ladybird/Libraries/LibGUI/GToolBar.h
Andreas Kling a599317624 LibCore: Introduce a C_OBJECT macro.
This macro goes at the top of every CObject-derived class like so:

class SomeClass : public CObject {
    C_OBJECT(SomeClass)
public:
    ...

At the moment, all it does is create an override for the class_name() getter
but in the future this will be used to automatically insert member functions
into these classes.
2019-07-25 19:49:28 +02:00

34 lines
731 B
C++

#pragma once
#include <AK/NonnullOwnPtrVector.h>
#include <LibGUI/GWidget.h>
class GAction;
class GToolBar : public GWidget {
C_OBJECT(GToolBar)
public:
explicit GToolBar(GWidget* parent);
virtual ~GToolBar() override;
void add_action(GAction&);
void add_separator();
bool has_frame() const { return m_has_frame; }
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
private:
virtual void paint_event(GPaintEvent&) override;
struct Item {
enum Type {
Invalid,
Separator,
Action
};
Type type { Invalid };
RefPtr<GAction> action;
};
NonnullOwnPtrVector<Item> m_items;
bool m_has_frame { true };
};