diff options
Diffstat (limited to 'Userland/Libraries/LibGUI/Toolbar.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Toolbar.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index 5380af356a..daca0bd235 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -27,6 +27,7 @@ Toolbar::Toolbar(Orientation orientation, int button_size) , m_button_size(button_size) { REGISTER_BOOL_PROPERTY("collapsible", is_collapsible, set_collapsible); + REGISTER_BOOL_PROPERTY("grouped", is_grouped, set_grouped); if (m_orientation == Orientation::Horizontal) set_fixed_height(button_size); @@ -202,6 +203,16 @@ ErrorOr<void> Toolbar::update_overflow_menu() return {}; } + if (m_grouped) { + for (size_t i = marginal_index.value(); i > 0; --i) { + auto& item = m_items.at(i); + if (item.type == Item::Type::Separator) + break; + item.widget->set_visible(false); + marginal_index = i; + } + } + if (!m_overflow_action) TRY(create_overflow_objects()); m_overflow_action->set_enabled(true); |