mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
LibGUI: Make ToolBarContainer better at reacting to child events
Now you can remove a ToolBar from a ToolBarContainer and it will update its own preferred size automatically.
This commit is contained in:
parent
9c772a64a1
commit
1887dc6de4
2 changed files with 28 additions and 7 deletions
|
@ -35,20 +35,16 @@ class ToolBarContainer : public Frame {
|
|||
C_OBJECT(ToolBarContainer);
|
||||
|
||||
public:
|
||||
template<class T, class... Args>
|
||||
inline T& add(Args&&... args)
|
||||
{
|
||||
auto& child = Frame::add<T>(forward<Args>(args)...);
|
||||
did_add_toolbar(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit ToolBarContainer(Gfx::Orientation = Gfx::Orientation::Horizontal);
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
virtual void child_event(Core::ChildEvent&) override;
|
||||
|
||||
void did_add_toolbar(Widget&);
|
||||
void did_remove_toolbar(Widget&);
|
||||
void recompute_preferred_size();
|
||||
|
||||
Gfx::Orientation m_orientation { Gfx::Orientation::Horizontal };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue