mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibGUI: GTabWidget can now return active tab index
`GTabWidget` now allows the user/caller to get the currently active tab widget, meaning that actions that are applied globally (such as an 'Apply' or 'OK' button) can now react to specific tabs etc.
This commit is contained in:
parent
ecbc0322c1
commit
3f05799e41
Notes:
sideshowbarker
2024-07-19 12:14:38 +09:00
Author: https://github.com/Quaker762
Commit: 3f05799e41
Pull-request: https://github.com/SerenityOS/serenity/pull/525
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
2 changed files with 12 additions and 0 deletions
|
@ -208,3 +208,14 @@ void GTabWidget::set_tab_position(TabPosition tab_position)
|
|||
m_active_widget->set_relative_rect(child_rect_for_size(size()));
|
||||
update();
|
||||
}
|
||||
|
||||
int GTabWidget::get_active_tab() const
|
||||
{
|
||||
for(int i = 0; i < m_tabs.size(); i++)
|
||||
{
|
||||
if(m_tabs.at(i).widget == m_active_widget)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue