Microprofile integration.

This commit is contained in:
Ben Vanik
2014-05-28 13:59:43 -07:00
parent cd56c30334
commit beb9bd11f0
17 changed files with 864 additions and 13 deletions

View File

@@ -32,6 +32,18 @@ private:
Window* window_;
};
class KeyEvent : public UIEvent {
public:
KeyEvent(Window* window, int key_code) :
key_code_(key_code),
UIEvent(window) {}
virtual ~KeyEvent() {}
int key_code() const { return key_code_; }
private:
int key_code_;
};
class MouseEvent : public UIEvent {
public:

View File

@@ -281,12 +281,13 @@ bool Win32Window::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) {
}
bool Win32Window::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
auto e = KeyEvent(this, (int)wParam);
switch (message) {
case WM_KEYDOWN:
(byte)wParam;
key_down(e);
return true;
case WM_KEYUP:
(byte)wParam;
key_up(e);
return true;
default:
return false;

View File

@@ -48,6 +48,9 @@ public:
alloy::Delegate<UIEvent> closing;
alloy::Delegate<UIEvent> closed;
alloy::Delegate<KeyEvent> key_down;
alloy::Delegate<KeyEvent> key_up;
alloy::Delegate<MouseEvent> mouse_down;
alloy::Delegate<MouseEvent> mouse_move;
alloy::Delegate<MouseEvent> mouse_up;