PlayerMenuServiceProtocol.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __PLAYER_MENU_SERVICE_PROTOCOL_H
  2. #define __PLAYER_MENU_SERVICE_PROTOCOL_H
  3. #include <string>
  4. #include "cocos2d.h"
  5. #include "PlayerMacros.h"
  6. #include "PlayerServiceProtocol.h"
  7. #include "SimulatorExport.h"
  8. PLAYER_NS_BEGIN
  9. #define kPlayerSuperModifyKey "super"
  10. #define kPlayerShiftModifyKey "shift"
  11. #define kPlayerCtrlModifyKey "ctrl"
  12. #define kPlayerAltModifyKey "alt"
  13. class CC_LIBSIM_DLL PlayerMenuItem : public cocos2d::Ref
  14. {
  15. public:
  16. virtual ~PlayerMenuItem();
  17. std::string getMenuId() const;
  18. std::string getTitle() const;
  19. int getOrder() const;
  20. bool isGroup() const;
  21. bool isEnabled() const;
  22. bool isChecked() const;
  23. std::string getShortcut() const;
  24. virtual void setTitle(const std::string &title) = 0;
  25. virtual void setEnabled(bool enabled) = 0;
  26. virtual void setChecked(bool checked) = 0;
  27. virtual void setShortcut(const std::string &shortcut) = 0;
  28. protected:
  29. PlayerMenuItem();
  30. std::string _menuId;
  31. std::string _title;
  32. int _order;
  33. bool _isGroup;
  34. bool _isEnabled;
  35. bool _isChecked; // ignored when isGroup = true
  36. std::string _shortcut; // ignored when isGroup = true
  37. };
  38. class PlayerMenuServiceProtocol : public PlayerServiceProtocol
  39. {
  40. public:
  41. static const int MAX_ORDER = 9999;
  42. virtual PlayerMenuItem *addItem(const std::string &menuId,
  43. const std::string &title,
  44. const std::string &parentId,
  45. int order = MAX_ORDER) = 0;
  46. virtual PlayerMenuItem *addItem(const std::string &menuId,
  47. const std::string &title) = 0;
  48. virtual PlayerMenuItem *getItem(const std::string &menuId) = 0;
  49. virtual bool removeItem(const std::string &menuId) = 0;
  50. virtual void setMenuBarEnabled(bool enabled) = 0;
  51. };
  52. PLAYER_NS_END
  53. #endif // __PLAYER_MENU_SERVICE_PROTOCOL_H