GMenuItem.h 566 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <AK/AKString.h>
  3. class GAction;
  4. class GMenuItem {
  5. public:
  6. enum Type { Invalid, Action, Separator };
  7. explicit GMenuItem(Type);
  8. explicit GMenuItem(RetainPtr<GAction>&&);
  9. ~GMenuItem();
  10. Type type() const { return m_type; }
  11. String text() const;
  12. const GAction* action() const { return m_action.ptr(); }
  13. GAction* action() { return m_action.ptr(); }
  14. unsigned identifier() const { return m_identifier; }
  15. private:
  16. Type m_type { Invalid };
  17. unsigned m_identifier { 0 };
  18. RetainPtr<GAction> m_action;
  19. };