keep track of focused widget on parent
This commit is contained in:
parent
d6dcff2b7c
commit
61b76df08b
3 changed files with 7 additions and 4 deletions
|
@ -97,6 +97,9 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
|
||||||
on_mouse_move(event);
|
on_mouse_move(event);
|
||||||
on_focus_update(focus_update_event);
|
on_focus_update(focus_update_event);
|
||||||
|
|
||||||
|
if (m_is_focused && m_window)
|
||||||
|
m_window->set_focused_widget(this);
|
||||||
|
|
||||||
if (m_consumes_hits)
|
if (m_consumes_hits)
|
||||||
event.accept();
|
event.accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Raven {
|
||||||
|
|
||||||
class Window {
|
class Window {
|
||||||
private:
|
private:
|
||||||
Widget *m_hovered_widget { nullptr };
|
Widget *m_focused_widget { nullptr };
|
||||||
Widget *m_main_widget { nullptr };
|
Widget *m_main_widget { nullptr };
|
||||||
Box m_current_geometry { 0, 0, 800, 600 };
|
Box m_current_geometry { 0, 0, 800, 600 };
|
||||||
Painter m_painter {};
|
Painter m_painter {};
|
||||||
|
@ -23,8 +23,8 @@ public:
|
||||||
|
|
||||||
Painter &get_painter() { return m_painter; }
|
Painter &get_painter() { return m_painter; }
|
||||||
|
|
||||||
Widget *get_hovered_widget() { return m_hovered_widget; }
|
Widget *get_focused_widget() { return m_focused_widget; }
|
||||||
void set_hovered_widget(Widget *hovered_widget) { m_hovered_widget = hovered_widget; }
|
void set_focused_widget(Widget *focused_widget) { m_focused_widget = focused_widget; }
|
||||||
|
|
||||||
Widget *get_main_widget() { return m_main_widget; }
|
Widget *get_main_widget() { return m_main_widget; }
|
||||||
void set_main_widget(Widget *main_widget);
|
void set_main_widget(Widget *main_widget);
|
||||||
|
|
Loading…
Reference in a new issue