GToolBar.h 731 B

12345678910111213141516171819202122232425262728293031323334
  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. explicit GToolBar(GWidget* parent);
  9. virtual ~GToolBar() override;
  10. void add_action(GAction&);
  11. void add_separator();
  12. bool has_frame() const { return m_has_frame; }
  13. void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
  14. private:
  15. virtual void paint_event(GPaintEvent&) override;
  16. struct Item {
  17. enum Type {
  18. Invalid,
  19. Separator,
  20. Action
  21. };
  22. Type type { Invalid };
  23. RefPtr<GAction> action;
  24. };
  25. NonnullOwnPtrVector<Item> m_items;
  26. bool m_has_frame { true };
  27. };