GME  13
DynMenu.h
Go to the documentation of this file.
00001 #ifndef GME_DYNMENU_H
00002 #define GME_DYNMENU_H
00003 
00004 class CDynMenuItem {
00005         friend class CDynMenu;
00006 public:
00007         CDynMenuItem(int iden, CString&& lab, CString&& dName, CString&& hmsg) : id(iden), label(std::move(lab)), displayName(std::move(dName)), helpMsg(std::move(hmsg)) {}
00008 protected:
00009         int id;
00010         CString label;          // contains RoleNames actually
00011         CString helpMsg;
00012         CString displayName;
00013 public:
00014         CString& GetLabel()             { return label; }
00015         CString& GetHelpMsg()   { return helpMsg; }
00016 };
00017 
00018 class CDynMenu {
00019 public:
00020         CDynMenu(int iden, TCHAR *nm);
00021         ~CDynMenu();
00022 protected:
00023         int id;
00024         int minID, maxID;
00025         CString name;
00026         std::vector<std::unique_ptr<CDynMenuItem> > items;
00027         CMenu menu;
00028 public:
00029         void SetName(CString nm)        { name = nm; }
00030         void SetID(int i)                       { id = i; }
00031         CMenu& GetMenu()                        { return menu; }
00032         int GetMinID() const            { return minID; }
00033         int GetMaxID() const            { return maxID; }
00034         bool IsEmpty() const            { return items.size() == 0; }
00035         int GetCount() const            { return items.size(); }
00036 
00037         void AddItem(int id, CString&& roleName, CString&& displayName, CString&& helpMsg);
00038         CDynMenuItem* FindItem(int id);
00039         void Sort();
00040 };
00041 
00042 #endif // whole file
00043