Keep track of active widgets inside the Window
This commit is contained in:
parent
9c267cc87b
commit
24c139b917
2 changed files with 7 additions and 0 deletions
|
@ -119,6 +119,9 @@ void Widget::handle_mouse_button_event(MouseButtonEvent &event) {
|
|||
|
||||
on_mouse_button(event);
|
||||
|
||||
if (m_is_active && m_window)
|
||||
m_window->set_active_widget(this);
|
||||
|
||||
if (m_consumes_hits)
|
||||
event.accept();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Raven {
|
|||
class Window {
|
||||
private:
|
||||
Widget *m_focused_widget { nullptr };
|
||||
Widget *m_active_widget { nullptr };
|
||||
Widget *m_main_widget { nullptr };
|
||||
Box m_current_geometry { 0, 0, 800, 600 };
|
||||
Painter m_painter {};
|
||||
|
@ -26,6 +27,9 @@ public:
|
|||
Widget *get_focused_widget() { return m_focused_widget; }
|
||||
void set_focused_widget(Widget *focused_widget) { m_focused_widget = focused_widget; }
|
||||
|
||||
Widget *get_active_widget() { return m_active_widget; }
|
||||
void set_active_widget(Widget *active_widget) { m_active_widget = active_widget; }
|
||||
|
||||
Widget *get_main_widget() { return m_main_widget; }
|
||||
void set_main_widget(Widget *main_widget);
|
||||
|
||||
|
|
Loading…
Reference in a new issue