summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/GToolBar.h
blob: bc7145ed91bfe26801e365092bde9b3f01c9e38a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#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, int button_size, 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;
    int m_button_size { 16 };
    bool m_has_frame { true };
};