GStackWidget: Add a notification hook for when the active widget changes.
This commit is contained in:
parent
8b0953a795
commit
d47432487d
Notes:
sideshowbarker
2024-07-19 13:23:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d47432487d4
2 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,8 @@ void GStackWidget::set_active_widget(GWidget* widget)
|
|||
m_active_widget->set_relative_rect(rect());
|
||||
m_active_widget->set_visible(true);
|
||||
}
|
||||
if (on_active_widget_change)
|
||||
on_active_widget_change(m_active_widget);
|
||||
}
|
||||
|
||||
void GStackWidget::resize_event(GResizeEvent& event)
|
||||
|
|
|
@ -10,6 +10,8 @@ public:
|
|||
GWidget* active_widget() const { return m_active_widget; }
|
||||
void set_active_widget(GWidget*);
|
||||
|
||||
Function<void(GWidget*)> on_active_widget_change;
|
||||
|
||||
virtual const char* class_name() const override { return "GStackWidget"; }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Reference in a new issue