mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:27:34 +00:00
LibGUI: Add a GToolBar class that can be populated with GActions.
The same action can be added to both a menu and a toolbar. Use this to put a toolbar into FileManager. This is pretty neat. :^)
This commit is contained in:
parent
4804609b7e
commit
b704d3d295
24 changed files with 196 additions and 44 deletions
25
LibGUI/GToolBar.h
Normal file
25
LibGUI/GToolBar.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GAction;
|
||||
|
||||
class GToolBar : public GWidget {
|
||||
public:
|
||||
explicit GToolBar(GWidget* parent);
|
||||
virtual ~GToolBar() override;
|
||||
|
||||
void add_action(RetainPtr<GAction>&&);
|
||||
void add_separator();
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "GToolBar"; }
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
struct Item {
|
||||
enum Type { Invalid, Separator, Action };
|
||||
Type type { Invalid };
|
||||
RetainPtr<GAction> action;
|
||||
};
|
||||
Vector<OwnPtr<Item>> m_items;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue