-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from StoneOrbits/daniel/editor/new_windows
Daniel/editor/new windows
- Loading branch information
Showing
38 changed files
with
3,998 additions
and
1,593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,91 @@ | ||
#include "VButton.h" | ||
|
||
// Windows includes | ||
#include <CommCtrl.h> | ||
|
||
// Vortex Engine includes | ||
#include "EditorConfig.h" | ||
|
||
// Editor includes | ||
#include "VortexEditor.h" | ||
|
||
using namespace std; | ||
|
||
VButton::VButton() : | ||
VWindow(), | ||
m_callback(nullptr) | ||
{ | ||
} | ||
|
||
VButton::VButton(HINSTANCE hInstance, VWindow &parent, const string &title, | ||
COLORREF backcol, uint32_t width, uint32_t height, uint32_t x, uint32_t y, | ||
uintptr_t menuID, VWindowCallback callback) : | ||
VButton() | ||
{ | ||
init(hInstance, parent, title, backcol, width, height, x, y, menuID, callback); | ||
} | ||
|
||
VButton::~VButton() | ||
{ | ||
cleanup(); | ||
} | ||
|
||
void VButton::init(HINSTANCE hInstance, VWindow &parent, const string &title, | ||
COLORREF backcol, uint32_t width, uint32_t height, uint32_t x, uint32_t y, | ||
uintptr_t menuID, VWindowCallback callback) | ||
{ | ||
// store callback and menu id | ||
m_callback = callback; | ||
m_backColor = backcol; | ||
m_foreColor = RGB(0xD0, 0xD0, 0xD0); | ||
|
||
if (!menuID) { | ||
menuID = nextMenuID++; | ||
} | ||
|
||
if (!parent.addChild(menuID, this)) { | ||
return; | ||
} | ||
|
||
// create the window | ||
m_hwnd = CreateWindow(WC_BUTTON, title.c_str(), | ||
WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | WS_TABSTOP, | ||
x, y, width, height, parent.hwnd(), (HMENU)menuID, nullptr, nullptr); | ||
if (!m_hwnd) { | ||
MessageBox(nullptr, "Failed to open window", "Error", 0); | ||
throw exception("idk"); | ||
} | ||
|
||
// set 'this' in the user data area of the class so that the static callback | ||
// routine can access the object | ||
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); | ||
} | ||
|
||
void VButton::cleanup() | ||
{ | ||
} | ||
|
||
void VButton::create() | ||
{ | ||
} | ||
|
||
void VButton::paint() | ||
{ | ||
} | ||
|
||
void VButton::command(WPARAM wParam, LPARAM lParam) | ||
{ | ||
if (!m_callback) { | ||
return; | ||
} | ||
m_callback(m_callbackArg, this); | ||
} | ||
|
||
void VButton::pressButton(WPARAM wParam, LPARAM lParam) | ||
{ | ||
} | ||
|
||
void VButton::releaseButton(WPARAM wParam, LPARAM lParam) | ||
{ | ||
} | ||
|
||
|
||
#include "VButton.h" | ||
|
||
// Windows includes | ||
#include <CommCtrl.h> | ||
#include <gdiplus.h> | ||
|
||
// Vortex Engine includes | ||
#include "EditorConfig.h" | ||
|
||
// Editor includes | ||
#include "VortexEditor.h" | ||
|
||
using namespace std; | ||
|
||
VButton::VButton() : | ||
VWindow(), | ||
m_callback(nullptr) | ||
{ | ||
} | ||
|
||
VButton::VButton(HINSTANCE hInstance, VWindow &parent, const string &title, | ||
COLORREF backcol, uint32_t width, uint32_t height, uint32_t x, uint32_t y, | ||
uintptr_t menuID, VWindowCallback callback) : | ||
VButton() | ||
{ | ||
init(hInstance, parent, title, backcol, width, height, x, y, menuID, callback); | ||
} | ||
|
||
VButton::~VButton() | ||
{ | ||
cleanup(); | ||
} | ||
|
||
void VButton::init(HINSTANCE hInstance, VWindow &parent, const string &title, | ||
COLORREF backcol, uint32_t width, uint32_t height, uint32_t x, uint32_t y, | ||
uintptr_t menuID, VWindowCallback callback) | ||
{ | ||
// store callback and menu id | ||
m_callback = callback; | ||
m_backColor = backcol; | ||
m_foreColor = RGB(0xD0, 0xD0, 0xD0); | ||
|
||
if (!menuID) { | ||
menuID = nextMenuID++; | ||
} | ||
|
||
if (!parent.addChild(menuID, this)) { | ||
return; | ||
} | ||
|
||
// create the window | ||
m_hwnd = CreateWindow(WC_BUTTON, title.c_str(), | ||
WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | WS_TABSTOP, | ||
x, y, width, height, parent.hwnd(), (HMENU)menuID, nullptr, nullptr); | ||
if (!m_hwnd) { | ||
MessageBox(nullptr, "Failed to open window", "Error", 0); | ||
throw exception("idk"); | ||
} | ||
|
||
// set 'this' in the user data area of the class so that the static callback | ||
// routine can access the object | ||
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); | ||
} | ||
|
||
void VButton::cleanup() | ||
{ | ||
} | ||
|
||
void VButton::create() | ||
{ | ||
} | ||
|
||
void VButton::paint() | ||
{ | ||
} | ||
|
||
void VButton::command(WPARAM wParam, LPARAM lParam) | ||
{ | ||
if (!m_callback) { | ||
return; | ||
} | ||
m_callback(m_callbackArg, this); | ||
} | ||
|
||
void VButton::pressButton(WPARAM wParam, LPARAM lParam) | ||
{ | ||
} | ||
|
||
void VButton::releaseButton(WPARAM wParam, LPARAM lParam) | ||
{ | ||
} |
Oops, something went wrong.