diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-15 22:23:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-16 01:11:56 +0200 |
commit | 5daf7bd2eff141a3a01f3f1625b94484cd5c8523 (patch) | |
tree | 14fa40db004b8ca8e535272eb65d992368f10a9d | |
parent | a6ec02435293e9df7e9553f6f23220542e5c6c3c (diff) | |
download | serenity-5daf7bd2eff141a3a01f3f1625b94484cd5c8523.zip |
LibGUI: Make GUI::Toolbar::add_action() return the toolbar button
Previously there was no easy way for clients to access the button.
-rw-r--r-- | Userland/Libraries/LibGUI/Toolbar.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Toolbar.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index 12f9189306..64079bf6c9 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -88,7 +88,7 @@ private: } }; -void Toolbar::add_action(Action& action) +GUI::Button& Toolbar::add_action(Action& action) { auto item = make<Item>(); item->type = Item::Type::Action; @@ -98,6 +98,7 @@ void Toolbar::add_action(Action& action) button.set_fixed_size(m_button_size + 8, m_button_size + 8); m_items.append(move(item)); + return button; } void Toolbar::add_separator() diff --git a/Userland/Libraries/LibGUI/Toolbar.h b/Userland/Libraries/LibGUI/Toolbar.h index c51ab94513..c7f6e8c556 100644 --- a/Userland/Libraries/LibGUI/Toolbar.h +++ b/Userland/Libraries/LibGUI/Toolbar.h @@ -16,7 +16,7 @@ class Toolbar : public Widget { public: virtual ~Toolbar() override; - void add_action(Action&); + GUI::Button& add_action(GUI::Action&); void add_separator(); bool has_frame() const { return m_has_frame; } |