2019-02-20 02:39:46 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibGUI/GWidget.h>
|
|
|
|
|
|
|
|
class GAction;
|
|
|
|
|
|
|
|
class GToolBar : public GWidget {
|
|
|
|
public:
|
|
|
|
explicit GToolBar(GWidget* parent);
|
|
|
|
virtual ~GToolBar() override;
|
|
|
|
|
2019-02-25 12:43:52 +01:00
|
|
|
void add_action(Retained<GAction>&&);
|
2019-02-20 02:39:46 +01:00
|
|
|
void add_separator();
|
|
|
|
|
2019-05-10 22:58:52 +02:00
|
|
|
bool has_frame() const { return m_has_frame; }
|
|
|
|
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
|
|
|
|
|
2019-02-20 02:39:46 +01:00
|
|
|
virtual const char* class_name() const override { return "GToolBar"; }
|
2019-03-16 12:57:04 +01:00
|
|
|
|
|
|
|
private:
|
2019-02-20 02:39:46 +01:00
|
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
|
|
|
|
|
|
struct Item {
|
|
|
|
enum Type { Invalid, Separator, Action };
|
|
|
|
Type type { Invalid };
|
|
|
|
RetainPtr<GAction> action;
|
|
|
|
};
|
|
|
|
Vector<OwnPtr<Item>> m_items;
|
2019-05-10 22:58:52 +02:00
|
|
|
bool m_has_frame { true };
|
2019-02-20 02:39:46 +01:00
|
|
|
};
|