ladybird/Libraries/LibGUI/GToolBar.h
Andreas Kling 0d2495e4e7 LibGUI: Allow construction of vertical GToolBars
There's currently a small paint glitch for vertical toolbars due to the
way StylePainter::paint_surface() draws a MidGray line at the bottom of
whatever a "surface" is supposed to be.
2019-11-09 00:41:00 +01:00

37 lines
796 B
C++

#pragma once
#include <AK/NonnullOwnPtrVector.h>
#include <LibGUI/GWidget.h>
class GAction;
class GToolBar : public GWidget {
C_OBJECT(GToolBar)
public:
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; }
protected:
explicit GToolBar(GWidget* parent);
explicit GToolBar(Orientation, GWidget* parent);
virtual void paint_event(GPaintEvent&) override;
private:
struct Item {
enum Type {
Invalid,
Separator,
Action
};
Type type { Invalid };
RefPtr<GAction> action;
};
NonnullOwnPtrVector<Item> m_items;
bool m_has_frame { true };
};