mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibGUI: Add TabWidget::set_tab_title(Widget&, StringView)
This lets you change the title of a tab after creating it.
This commit is contained in:
parent
933cf365e8
commit
ee7e7e6d55
Notes:
sideshowbarker
2024-07-19 07:21:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ee7e7e6d55b
@ -259,4 +259,18 @@ int TabWidget::active_tab_index() const
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void TabWidget::set_tab_title(Widget& tab, const StringView& title)
|
||||
{
|
||||
for (auto& t : m_tabs) {
|
||||
if (t.widget == &tab) {
|
||||
if (t.title != title) {
|
||||
t.title = title;
|
||||
update();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,9 @@ public:
|
||||
|
||||
void remove_tab(Widget& tab) { remove_widget(tab); }
|
||||
|
||||
Function<void(const Widget&)> on_change;
|
||||
void set_tab_title(Widget& tab, const StringView& title);
|
||||
|
||||
Function<void(Widget&)> on_change;
|
||||
|
||||
protected:
|
||||
TabWidget();
|
||||
|
Loading…
Reference in New Issue
Block a user