diff options
author | Jesse Buhagiar <jesse.buhagiar@student.rmit.edu.au> | 2019-09-08 00:13:26 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-07 16:51:15 +0200 |
commit | 3f05799e412cc115f86e99964bb76ad0b1453cd5 (patch) | |
tree | df678ff5bb55e696bbf2da4b09780d509bbcf3c6 /Libraries/LibGUI/GTabWidget.cpp | |
parent | ecbc0322c11644ff186fe89fcd058c07a383a884 (diff) | |
download | serenity-3f05799e412cc115f86e99964bb76ad0b1453cd5.zip |
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.
Diffstat (limited to 'Libraries/LibGUI/GTabWidget.cpp')
-rw-r--r-- | Libraries/LibGUI/GTabWidget.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibGUI/GTabWidget.cpp b/Libraries/LibGUI/GTabWidget.cpp index 180ddb5138..530fb7f0f8 100644 --- a/Libraries/LibGUI/GTabWidget.cpp +++ b/Libraries/LibGUI/GTabWidget.cpp @@ -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; +} |