More style.
This commit is contained in:
@@ -144,51 +144,51 @@ GLProfilerDisplay::GLProfilerDisplay(xe::ui::Window* window)
|
||||
assert_always();
|
||||
}
|
||||
|
||||
window_->on_painted.AddListener([this](UIEvent& e) { Profiler::Present(); });
|
||||
window_->on_painted.AddListener([this](UIEvent* e) { Profiler::Present(); });
|
||||
|
||||
// Pass through mouse events.
|
||||
window_->on_mouse_down.AddListener([this](xe::ui::MouseEvent& e) {
|
||||
window_->on_mouse_down.AddListener([this](MouseEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnMouseDown(e.button() == xe::ui::MouseEvent::Button::kLeft,
|
||||
e.button() == xe::ui::MouseEvent::Button::kRight);
|
||||
e.set_handled(true);
|
||||
Profiler::OnMouseDown(e->button() == MouseEvent::Button::kLeft,
|
||||
e->button() == MouseEvent::Button::kRight);
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
window_->on_mouse_up.AddListener([this](xe::ui::MouseEvent& e) {
|
||||
window_->on_mouse_up.AddListener([this](MouseEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnMouseUp();
|
||||
e.set_handled(true);
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
window_->on_mouse_move.AddListener([this](xe::ui::MouseEvent& e) {
|
||||
window_->on_mouse_move.AddListener([this](MouseEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnMouseMove(e.x(), e.y());
|
||||
e.set_handled(true);
|
||||
Profiler::OnMouseMove(e->x(), e->y());
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
window_->on_mouse_wheel.AddListener([this](xe::ui::MouseEvent& e) {
|
||||
window_->on_mouse_wheel.AddListener([this](MouseEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnMouseWheel(e.x(), e.y(), -e.dy());
|
||||
e.set_handled(true);
|
||||
Profiler::OnMouseWheel(e->x(), e->y(), -e->dy());
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
|
||||
// Watch for toggle/mode keys and such.
|
||||
window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) {
|
||||
window_->on_key_down.AddListener([this](KeyEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnKeyDown(e.key_code());
|
||||
e.set_handled(true);
|
||||
Profiler::OnKeyDown(e->key_code());
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
window_->on_key_up.AddListener([this](xe::ui::KeyEvent& e) {
|
||||
window_->on_key_up.AddListener([this](KeyEvent* e) {
|
||||
if (Profiler::is_visible()) {
|
||||
Profiler::OnKeyUp(e.key_code());
|
||||
e.set_handled(true);
|
||||
Profiler::OnKeyUp(e->key_code());
|
||||
e->set_handled(true);
|
||||
window_->Invalidate();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ class Loop {
|
||||
virtual void Quit() = 0;
|
||||
virtual void AwaitQuit() = 0;
|
||||
|
||||
Delegate<UIEvent> on_quit;
|
||||
Delegate<UIEvent*> on_quit;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
@@ -84,7 +84,7 @@ void Win32Loop::ThreadMain() {
|
||||
}
|
||||
|
||||
UIEvent e(nullptr);
|
||||
on_quit(e);
|
||||
on_quit(&e);
|
||||
}
|
||||
|
||||
void Win32Loop::Post(std::function<void()> fn) {
|
||||
|
||||
@@ -63,7 +63,7 @@ void MenuItem::RemoveChild(MenuItem* child_item) {
|
||||
|
||||
MenuItem* MenuItem::child(size_t index) { return children_[index].get(); }
|
||||
|
||||
void MenuItem::OnSelected(UIEvent& e) {
|
||||
void MenuItem::OnSelected(UIEvent* e) {
|
||||
if (callback_) {
|
||||
callback_();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class MenuItem {
|
||||
virtual void OnChildAdded(MenuItem* child_item) {}
|
||||
virtual void OnChildRemoved(MenuItem* child_item) {}
|
||||
|
||||
virtual void OnSelected(UIEvent& e);
|
||||
virtual void OnSelected(UIEvent* e);
|
||||
|
||||
Type type_;
|
||||
MenuItem* parent_item_;
|
||||
|
||||
@@ -150,9 +150,9 @@ bool Window::MakeReady() {
|
||||
void Window::OnMainMenuChange() {}
|
||||
|
||||
void Window::OnClose() {
|
||||
auto e = UIEvent(this);
|
||||
on_closing(e);
|
||||
on_closed(e);
|
||||
UIEvent e(this);
|
||||
on_closing(&e);
|
||||
on_closed(&e);
|
||||
}
|
||||
|
||||
void Window::OnDestroy() {
|
||||
@@ -173,15 +173,15 @@ bool Window::LoadSkin(std::string filename) {
|
||||
}
|
||||
|
||||
void Window::Layout() {
|
||||
auto e = UIEvent(this);
|
||||
OnLayout(e);
|
||||
UIEvent e(this);
|
||||
OnLayout(&e);
|
||||
}
|
||||
|
||||
void Window::Invalidate() {}
|
||||
|
||||
void Window::OnResize(UIEvent& e) { on_resize(e); }
|
||||
void Window::OnResize(UIEvent* e) { on_resize(e); }
|
||||
|
||||
void Window::OnLayout(UIEvent& e) {
|
||||
void Window::OnLayout(UIEvent* e) {
|
||||
on_layout(e);
|
||||
if (!root_element()) {
|
||||
return;
|
||||
@@ -190,7 +190,7 @@ void Window::OnLayout(UIEvent& e) {
|
||||
root_element()->set_rect({0, 0, width(), height()});
|
||||
}
|
||||
|
||||
void Window::OnPaint(UIEvent& e) {
|
||||
void Window::OnPaint(UIEvent* e) {
|
||||
if (!renderer()) {
|
||||
return;
|
||||
}
|
||||
@@ -260,13 +260,13 @@ void Window::OnPaint(UIEvent& e) {
|
||||
}
|
||||
}
|
||||
|
||||
void Window::OnVisible(UIEvent& e) { on_visible(e); }
|
||||
void Window::OnVisible(UIEvent* e) { on_visible(e); }
|
||||
|
||||
void Window::OnHidden(UIEvent& e) { on_hidden(e); }
|
||||
void Window::OnHidden(UIEvent* e) { on_hidden(e); }
|
||||
|
||||
void Window::OnGotFocus(UIEvent& e) { on_got_focus(e); }
|
||||
void Window::OnGotFocus(UIEvent* e) { on_got_focus(e); }
|
||||
|
||||
void Window::OnLostFocus(UIEvent& e) {
|
||||
void Window::OnLostFocus(UIEvent* e) {
|
||||
modifier_shift_pressed_ = false;
|
||||
modifier_cntrl_pressed_ = false;
|
||||
modifier_alt_pressed_ = false;
|
||||
@@ -292,13 +292,13 @@ el::ModifierKeys Window::GetModifierKeys() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
void Window::OnKeyPress(KeyEvent& e, bool is_down, bool is_char) {
|
||||
void Window::OnKeyPress(KeyEvent* e, bool is_down, bool is_char) {
|
||||
if (!root_element()) {
|
||||
return;
|
||||
}
|
||||
auto special_key = el::SpecialKey::kUndefined;
|
||||
if (!is_char) {
|
||||
switch (e.key_code()) {
|
||||
switch (e->key_code()) {
|
||||
case 38:
|
||||
special_key = el::SpecialKey::kUp;
|
||||
break;
|
||||
@@ -382,7 +382,7 @@ void Window::OnKeyPress(KeyEvent& e, bool is_down, bool is_char) {
|
||||
el::Event ev(el::EventType::kContextMenu);
|
||||
ev.modifierkeys = GetModifierKeys();
|
||||
el::Element::focused_element->InvokeEvent(ev);
|
||||
e.set_handled(true);
|
||||
e->set_handled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -405,24 +405,24 @@ void Window::OnKeyPress(KeyEvent& e, bool is_down, bool is_char) {
|
||||
if (!CheckShortcutKey(e, special_key, is_down)) {
|
||||
int key_code = 0;
|
||||
if (is_char) {
|
||||
key_code = e.key_code();
|
||||
key_code = e->key_code();
|
||||
if (key_code < 32 || (key_code > 126 && key_code < 160)) {
|
||||
key_code = 0;
|
||||
}
|
||||
}
|
||||
e.set_handled(root_element()->InvokeKey(key_code, special_key,
|
||||
GetModifierKeys(), is_down));
|
||||
e->set_handled(root_element()->InvokeKey(key_code, special_key,
|
||||
GetModifierKeys(), is_down));
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::CheckShortcutKey(KeyEvent& e, el::SpecialKey special_key,
|
||||
bool Window::CheckShortcutKey(KeyEvent* e, el::SpecialKey special_key,
|
||||
bool is_down) {
|
||||
bool shortcut_key = modifier_cntrl_pressed_;
|
||||
if (!el::Element::focused_element || !is_down || !shortcut_key) {
|
||||
return false;
|
||||
}
|
||||
bool reverse_key = modifier_shift_pressed_;
|
||||
int upper_key = e.key_code();
|
||||
int upper_key = e->key_code();
|
||||
if (upper_key >= 'a' && upper_key <= 'z') {
|
||||
upper_key += 'A' - 'a';
|
||||
}
|
||||
@@ -464,47 +464,47 @@ bool Window::CheckShortcutKey(KeyEvent& e, el::SpecialKey special_key,
|
||||
if (!el::Element::focused_element->InvokeEvent(ev)) {
|
||||
return false;
|
||||
}
|
||||
e.set_handled(true);
|
||||
e->set_handled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Window::OnKeyDown(KeyEvent& e) {
|
||||
void Window::OnKeyDown(KeyEvent* e) {
|
||||
on_key_down(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
OnKeyPress(e, true, false);
|
||||
}
|
||||
|
||||
void Window::OnKeyUp(KeyEvent& e) {
|
||||
void Window::OnKeyUp(KeyEvent* e) {
|
||||
on_key_up(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
OnKeyPress(e, false, false);
|
||||
}
|
||||
|
||||
void Window::OnKeyChar(KeyEvent& e) {
|
||||
void Window::OnKeyChar(KeyEvent* e) {
|
||||
OnKeyPress(e, true, true);
|
||||
OnKeyPress(e, false, true);
|
||||
}
|
||||
|
||||
void Window::OnMouseDown(MouseEvent& e) {
|
||||
void Window::OnMouseDown(MouseEvent* e) {
|
||||
on_mouse_down(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
if (!root_element()) {
|
||||
return;
|
||||
}
|
||||
// TODO(benvanik): more button types.
|
||||
if (e.button() == MouseEvent::Button::kLeft) {
|
||||
if (e->button() == MouseEvent::Button::kLeft) {
|
||||
// Simulated click count support.
|
||||
// TODO(benvanik): move into Control?
|
||||
uint64_t now = xe::Clock::QueryHostUptimeMillis();
|
||||
if (now < last_click_time_ + kDoubleClickDelayMillis) {
|
||||
double distance_moved = std::sqrt(std::pow(e.x() - last_click_x_, 2.0) +
|
||||
std::pow(e.y() - last_click_y_, 2.0));
|
||||
double distance_moved = std::sqrt(std::pow(e->x() - last_click_x_, 2.0) +
|
||||
std::pow(e->y() - last_click_y_, 2.0));
|
||||
if (distance_moved < kDoubleClickDistance) {
|
||||
++last_click_counter_;
|
||||
} else {
|
||||
@@ -513,62 +513,64 @@ void Window::OnMouseDown(MouseEvent& e) {
|
||||
} else {
|
||||
last_click_counter_ = 1;
|
||||
}
|
||||
last_click_x_ = e.x();
|
||||
last_click_y_ = e.y();
|
||||
last_click_x_ = e->x();
|
||||
last_click_y_ = e->y();
|
||||
last_click_time_ = now;
|
||||
|
||||
e.set_handled(root_element()->InvokePointerDown(
|
||||
e.x(), e.y(), last_click_counter_, GetModifierKeys(), kTouch));
|
||||
e->set_handled(root_element()->InvokePointerDown(
|
||||
e->x(), e->y(), last_click_counter_, GetModifierKeys(), kTouch));
|
||||
}
|
||||
}
|
||||
|
||||
void Window::OnMouseMove(MouseEvent& e) {
|
||||
void Window::OnMouseMove(MouseEvent* e) {
|
||||
on_mouse_move(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
if (!root_element()) {
|
||||
return;
|
||||
}
|
||||
root_element()->InvokePointerMove(e.x(), e.y(), GetModifierKeys(), kTouch);
|
||||
e.set_handled(true);
|
||||
root_element()->InvokePointerMove(e->x(), e->y(), GetModifierKeys(), kTouch);
|
||||
e->set_handled(true);
|
||||
}
|
||||
|
||||
void Window::OnMouseUp(MouseEvent& e) {
|
||||
void Window::OnMouseUp(MouseEvent* e) {
|
||||
on_mouse_up(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
if (!root_element()) {
|
||||
return;
|
||||
}
|
||||
if (e.button() == MouseEvent::Button::kLeft) {
|
||||
e.set_handled(root_element()->InvokePointerUp(e.x(), e.y(),
|
||||
GetModifierKeys(), kTouch));
|
||||
} else if (e.button() == MouseEvent::Button::kRight) {
|
||||
root_element()->InvokePointerMove(e.x(), e.y(), GetModifierKeys(), kTouch);
|
||||
if (e->button() == MouseEvent::Button::kLeft) {
|
||||
e->set_handled(root_element()->InvokePointerUp(e->x(), e->y(),
|
||||
GetModifierKeys(), kTouch));
|
||||
} else if (e->button() == MouseEvent::Button::kRight) {
|
||||
root_element()->InvokePointerMove(e->x(), e->y(), GetModifierKeys(),
|
||||
kTouch);
|
||||
if (el::Element::hovered_element) {
|
||||
int x = e.x();
|
||||
int y = e.y();
|
||||
int x = e->x();
|
||||
int y = e->y();
|
||||
el::Element::hovered_element->ConvertFromRoot(x, y);
|
||||
el::Event ev(el::EventType::kContextMenu, x, y, kTouch,
|
||||
GetModifierKeys());
|
||||
el::Element::hovered_element->InvokeEvent(ev);
|
||||
}
|
||||
e.set_handled(true);
|
||||
e->set_handled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::OnMouseWheel(MouseEvent& e) {
|
||||
void Window::OnMouseWheel(MouseEvent* e) {
|
||||
on_mouse_wheel(e);
|
||||
if (e.is_handled()) {
|
||||
if (e->is_handled()) {
|
||||
return;
|
||||
}
|
||||
if (!root_element()) {
|
||||
return;
|
||||
}
|
||||
e.set_handled(root_element()->InvokeWheel(
|
||||
e.x(), e.y(), e.dx(), -e.dy() / kMouseWheelDetent, GetModifierKeys()));
|
||||
e->set_handled(root_element()->InvokeWheel(e->x(), e->y(), e->dx(),
|
||||
-e->dy() / kMouseWheelDetent,
|
||||
GetModifierKeys()));
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
||||
@@ -87,31 +87,31 @@ class Window {
|
||||
virtual void Close() = 0;
|
||||
|
||||
public:
|
||||
Delegate<UIEvent> on_closing;
|
||||
Delegate<UIEvent> on_closed;
|
||||
Delegate<UIEvent*> on_closing;
|
||||
Delegate<UIEvent*> on_closed;
|
||||
|
||||
Delegate<int> on_command;
|
||||
|
||||
Delegate<UIEvent> on_resize;
|
||||
Delegate<UIEvent> on_layout;
|
||||
Delegate<UIEvent> on_painting;
|
||||
Delegate<UIEvent> on_paint;
|
||||
Delegate<UIEvent> on_painted;
|
||||
Delegate<UIEvent*> on_resize;
|
||||
Delegate<UIEvent*> on_layout;
|
||||
Delegate<UIEvent*> on_painting;
|
||||
Delegate<UIEvent*> on_paint;
|
||||
Delegate<UIEvent*> on_painted;
|
||||
|
||||
Delegate<UIEvent> on_visible;
|
||||
Delegate<UIEvent> on_hidden;
|
||||
Delegate<UIEvent*> on_visible;
|
||||
Delegate<UIEvent*> on_hidden;
|
||||
|
||||
Delegate<UIEvent> on_got_focus;
|
||||
Delegate<UIEvent> on_lost_focus;
|
||||
Delegate<UIEvent*> on_got_focus;
|
||||
Delegate<UIEvent*> on_lost_focus;
|
||||
|
||||
Delegate<KeyEvent> on_key_down;
|
||||
Delegate<KeyEvent> on_key_up;
|
||||
Delegate<KeyEvent> on_key_char;
|
||||
Delegate<KeyEvent*> on_key_down;
|
||||
Delegate<KeyEvent*> on_key_up;
|
||||
Delegate<KeyEvent*> on_key_char;
|
||||
|
||||
Delegate<MouseEvent> on_mouse_down;
|
||||
Delegate<MouseEvent> on_mouse_move;
|
||||
Delegate<MouseEvent> on_mouse_up;
|
||||
Delegate<MouseEvent> on_mouse_wheel;
|
||||
Delegate<MouseEvent*> on_mouse_down;
|
||||
Delegate<MouseEvent*> on_mouse_move;
|
||||
Delegate<MouseEvent*> on_mouse_up;
|
||||
Delegate<MouseEvent*> on_mouse_wheel;
|
||||
|
||||
protected:
|
||||
Window(Loop* loop, const std::wstring& title);
|
||||
@@ -123,28 +123,28 @@ class Window {
|
||||
virtual void OnClose();
|
||||
virtual void OnDestroy();
|
||||
|
||||
virtual void OnResize(UIEvent& e);
|
||||
virtual void OnLayout(UIEvent& e);
|
||||
virtual void OnPaint(UIEvent& e);
|
||||
virtual void OnResize(UIEvent* e);
|
||||
virtual void OnLayout(UIEvent* e);
|
||||
virtual void OnPaint(UIEvent* e);
|
||||
|
||||
virtual void OnVisible(UIEvent& e);
|
||||
virtual void OnHidden(UIEvent& e);
|
||||
virtual void OnVisible(UIEvent* e);
|
||||
virtual void OnHidden(UIEvent* e);
|
||||
|
||||
virtual void OnGotFocus(UIEvent& e);
|
||||
virtual void OnLostFocus(UIEvent& e);
|
||||
virtual void OnGotFocus(UIEvent* e);
|
||||
virtual void OnLostFocus(UIEvent* e);
|
||||
|
||||
virtual void OnKeyDown(KeyEvent& e);
|
||||
virtual void OnKeyUp(KeyEvent& e);
|
||||
virtual void OnKeyChar(KeyEvent& e);
|
||||
virtual void OnKeyDown(KeyEvent* e);
|
||||
virtual void OnKeyUp(KeyEvent* e);
|
||||
virtual void OnKeyChar(KeyEvent* e);
|
||||
|
||||
virtual void OnMouseDown(MouseEvent& e);
|
||||
virtual void OnMouseMove(MouseEvent& e);
|
||||
virtual void OnMouseUp(MouseEvent& e);
|
||||
virtual void OnMouseWheel(MouseEvent& e);
|
||||
virtual void OnMouseDown(MouseEvent* e);
|
||||
virtual void OnMouseMove(MouseEvent* e);
|
||||
virtual void OnMouseUp(MouseEvent* e);
|
||||
virtual void OnMouseWheel(MouseEvent* e);
|
||||
|
||||
el::ModifierKeys GetModifierKeys();
|
||||
void OnKeyPress(KeyEvent& e, bool is_down, bool is_char);
|
||||
bool CheckShortcutKey(KeyEvent& e, el::SpecialKey special_key, bool is_down);
|
||||
void OnKeyPress(KeyEvent* e, bool is_down, bool is_char);
|
||||
bool CheckShortcutKey(KeyEvent* e, el::SpecialKey special_key, bool is_down);
|
||||
|
||||
Loop* loop_ = nullptr;
|
||||
std::unique_ptr<MenuItem> main_menu_;
|
||||
|
||||
@@ -260,7 +260,7 @@ void Win32Window::Resize(int32_t left, int32_t top, int32_t right,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
void Win32Window::OnResize(UIEvent& e) {
|
||||
void Win32Window::OnResize(UIEvent* e) {
|
||||
RECT client_rect;
|
||||
GetClientRect(hwnd_, &client_rect);
|
||||
int32_t width = client_rect.right - client_rect.left;
|
||||
@@ -354,14 +354,14 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
break;
|
||||
case WM_SIZE: {
|
||||
auto e = UIEvent(this);
|
||||
OnResize(e);
|
||||
OnResize(&e);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT: {
|
||||
ValidateRect(hwnd_, nullptr);
|
||||
auto e = UIEvent(this);
|
||||
OnPaint(e);
|
||||
OnPaint(&e);
|
||||
return 0; // Ignored because of custom paint.
|
||||
break;
|
||||
}
|
||||
@@ -374,10 +374,10 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
case WM_SHOWWINDOW: {
|
||||
if (wParam == TRUE) {
|
||||
auto e = UIEvent(this);
|
||||
OnVisible(e);
|
||||
OnVisible(&e);
|
||||
} else {
|
||||
auto e = UIEvent(this);
|
||||
OnHidden(e);
|
||||
OnHidden(&e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -385,13 +385,13 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
case WM_KILLFOCUS: {
|
||||
has_focus_ = false;
|
||||
auto e = UIEvent(this);
|
||||
OnLostFocus(e);
|
||||
OnLostFocus(&e);
|
||||
break;
|
||||
}
|
||||
case WM_SETFOCUS: {
|
||||
has_focus_ = true;
|
||||
auto e = UIEvent(this);
|
||||
OnGotFocus(e);
|
||||
OnGotFocus(&e);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
reinterpret_cast<Win32MenuItem*>(parent_item->child(wParam));
|
||||
assert_not_null(child_item);
|
||||
UIEvent e(this);
|
||||
child_item->OnSelected(e);
|
||||
child_item->OnSelected(&e);
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -484,19 +484,19 @@ bool Win32Window::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_XBUTTONDOWN:
|
||||
OnMouseDown(e);
|
||||
OnMouseDown(&e);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONUP:
|
||||
OnMouseUp(e);
|
||||
OnMouseUp(&e);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
OnMouseMove(e);
|
||||
OnMouseMove(&e);
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
OnMouseWheel(e);
|
||||
OnMouseWheel(&e);
|
||||
break;
|
||||
}
|
||||
return e.is_handled();
|
||||
@@ -506,13 +506,13 @@ bool Win32Window::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
auto e = KeyEvent(this, static_cast<int>(wParam));
|
||||
switch (message) {
|
||||
case WM_KEYDOWN:
|
||||
OnKeyDown(e);
|
||||
OnKeyDown(&e);
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
OnKeyUp(e);
|
||||
OnKeyUp(&e);
|
||||
break;
|
||||
case WM_CHAR:
|
||||
OnKeyChar(e);
|
||||
OnKeyChar(&e);
|
||||
break;
|
||||
}
|
||||
return e.is_handled();
|
||||
|
||||
@@ -54,7 +54,7 @@ class Win32Window : public Window {
|
||||
void OnDestroy() override;
|
||||
void OnClose() override;
|
||||
|
||||
void OnResize(UIEvent& e) override;
|
||||
void OnResize(UIEvent* e) override;
|
||||
|
||||
static LRESULT CALLBACK WndProcThunk(HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
Reference in New Issue
Block a user