mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGUI: Add set_tab_index method
This method sets the current tab index to the value specified.
This commit is contained in:
parent
5f364f5dc1
commit
d0adaf4465
Notes:
sideshowbarker
2024-07-19 00:01:19 +09:00
Author: https://github.com/TheMorc Commit: https://github.com/SerenityOS/serenity/commit/d0adaf44658 Pull-request: https://github.com/SerenityOS/serenity/pull/4842 Reviewed-by: https://github.com/awesomekling
2 changed files with 10 additions and 0 deletions
|
@ -113,6 +113,15 @@ void TabWidget::set_active_widget(Widget* widget)
|
|||
update_bar();
|
||||
}
|
||||
|
||||
void TabWidget::set_tab_index(int index)
|
||||
{
|
||||
if (m_tabs.at(index).widget == m_active_widget)
|
||||
return;
|
||||
set_active_widget(m_tabs.at(index).widget);
|
||||
|
||||
update_bar();
|
||||
}
|
||||
|
||||
void TabWidget::resize_event(ResizeEvent& event)
|
||||
{
|
||||
if (!m_active_widget)
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
Widget* active_widget() { return m_active_widget.ptr(); }
|
||||
const Widget* active_widget() const { return m_active_widget.ptr(); }
|
||||
void set_active_widget(Widget*);
|
||||
void set_tab_index(int);
|
||||
|
||||
int bar_height() const { return m_bar_visible ? 21 : 0; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue