mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
LibGUI: Add TabWidget::on_tab_count_change hook
This commit is contained in:
parent
2aaf12e9cd
commit
c8ff507534
2 changed files with 6 additions and 0 deletions
|
@ -68,15 +68,20 @@ void TabWidget::add_widget(const StringView& title, Widget& widget)
|
|||
m_tabs.append({ title, nullptr, &widget });
|
||||
add_child(widget);
|
||||
update_focus_policy();
|
||||
if (on_tab_count_change)
|
||||
on_tab_count_change(m_tabs.size());
|
||||
}
|
||||
|
||||
void TabWidget::remove_widget(Widget& widget)
|
||||
{
|
||||
VERIFY(widget.parent() == this);
|
||||
if (active_widget() == &widget)
|
||||
activate_next_tab();
|
||||
m_tabs.remove_first_matching([&widget](auto& entry) { return &widget == entry.widget; });
|
||||
remove_child(widget);
|
||||
update_focus_policy();
|
||||
if (on_tab_count_change)
|
||||
on_tab_count_change(m_tabs.size());
|
||||
}
|
||||
|
||||
void TabWidget::update_focus_policy()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue