mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
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. :^)
25 lines
562 B
C++
25 lines
562 B
C++
#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;
|
|
};
|