GToolBar.h 743 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <AK/NonnullOwnPtrVector.h>
  3. #include <LibGUI/GWidget.h>
  4. class GAction;
  5. class GToolBar : public GWidget {
  6. C_OBJECT(GToolBar)
  7. public:
  8. virtual ~GToolBar() override;
  9. void add_action(GAction&);
  10. void add_separator();
  11. bool has_frame() const { return m_has_frame; }
  12. void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
  13. protected:
  14. explicit GToolBar(GWidget* parent);
  15. virtual void paint_event(GPaintEvent&) override;
  16. private:
  17. struct Item {
  18. enum Type {
  19. Invalid,
  20. Separator,
  21. Action
  22. };
  23. Type type { Invalid };
  24. RefPtr<GAction> action;
  25. };
  26. NonnullOwnPtrVector<Item> m_items;
  27. bool m_has_frame { true };
  28. };