mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibGUI: Make GUI::Toolbar::add_action() return the toolbar button
Previously there was no easy way for clients to access the button.
This commit is contained in:
parent
a6ec024352
commit
5daf7bd2ef
2 changed files with 3 additions and 2 deletions
|
@ -88,7 +88,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void Toolbar::add_action(Action& action)
|
GUI::Button& Toolbar::add_action(Action& action)
|
||||||
{
|
{
|
||||||
auto item = make<Item>();
|
auto item = make<Item>();
|
||||||
item->type = Item::Type::Action;
|
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);
|
button.set_fixed_size(m_button_size + 8, m_button_size + 8);
|
||||||
|
|
||||||
m_items.append(move(item));
|
m_items.append(move(item));
|
||||||
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toolbar::add_separator()
|
void Toolbar::add_separator()
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Toolbar : public Widget {
|
||||||
public:
|
public:
|
||||||
virtual ~Toolbar() override;
|
virtual ~Toolbar() override;
|
||||||
|
|
||||||
void add_action(Action&);
|
GUI::Button& add_action(GUI::Action&);
|
||||||
void add_separator();
|
void add_separator();
|
||||||
|
|
||||||
bool has_frame() const { return m_has_frame; }
|
bool has_frame() const { return m_has_frame; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue