project64/Source/Project64/UserInterface/MenuItem.h

108 lines
2.4 KiB
C
Raw Normal View History

2016-01-27 09:11:59 +00:00
#pragma once
#include <list>
2022-09-26 02:31:54 +00:00
enum Menu_ID
2016-01-27 09:11:59 +00:00
{
2022-09-26 02:31:54 +00:00
// ControlID
SPLITER,
SUB_MENU,
NO_ID,
ID_PLUGIN_MENU,
2016-01-27 09:11:59 +00:00
};
const std::wstring EMPTY_STDSTR = L"";
2022-09-26 02:31:54 +00:00
class MENU_ITEM
2016-01-27 09:11:59 +00:00
{
public:
2022-09-26 02:31:54 +00:00
MENU_ITEM(void)
2016-01-27 09:11:59 +00:00
{
2022-09-26 02:31:54 +00:00
Reset(NO_ID);
}
MENU_ITEM(int ID, LanguageStringID Title = EMPTY_STRING, const std::wstring & ShortCut = EMPTY_STDSTR,
void * SubMenu = nullptr, const std::wstring & ManualString = EMPTY_STDSTR)
{
Reset(ID, Title, ShortCut, SubMenu, ManualString);
}
void Reset(int ID, LanguageStringID Title = EMPTY_STRING, const std::wstring & ShortCut2 = EMPTY_STDSTR,
void * SubMenu = nullptr, const std::wstring & ManualString = EMPTY_STDSTR)
{
this->m_ID = ID;
this->m_Title = Title;
this->m_ShortCut = ShortCut2;
this->m_SubMenu = SubMenu;
this->m_ManualString = ManualString;
this->m_ItemTicked = false;
this->m_ItemEnabled = true;
}
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
int ID() const
{
return m_ID;
}
LanguageStringID Title() const
{
return m_Title;
}
const std::wstring & ShortCut() const
{
return m_ShortCut;
}
void * SubMenu() const
{
return m_SubMenu;
}
const std::wstring & ManualString() const
{
return m_ManualString;
}
bool ItemTicked() const
{
return m_ItemTicked;
}
bool ItemEnabled() const
{
return m_ItemEnabled;
}
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
void SetItemTicked(bool ItemTicked)
{
m_ItemTicked = ItemTicked;
}
void SetItemEnabled(bool ItemEnabled)
{
m_ItemEnabled = ItemEnabled;
}
2016-01-27 09:11:59 +00:00
private:
2022-09-26 02:31:54 +00:00
int m_ID;
LanguageStringID m_Title;
std::wstring m_ShortCut;
void * m_SubMenu;
std::wstring m_ManualString;
bool m_ItemTicked;
bool m_ItemEnabled;
2016-01-27 09:11:59 +00:00
};
2022-09-26 02:31:54 +00:00
typedef std::list<MENU_ITEM> MenuItemList;
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
class CBaseMenu
{
2016-01-27 09:11:59 +00:00
protected:
2022-09-26 02:31:54 +00:00
HMENU m_MenuHandle;
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
bool AddMenu(HMENU hMenu, MenuItemList Items);
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
public:
CBaseMenu();
2016-01-27 09:11:59 +00:00
2022-09-26 02:31:54 +00:00
virtual int ProcessAccelerator(HWND hWnd, void * lpMsg) = 0; // Pure virtual draw() function
virtual bool ProcessMessage(HWND hWnd, DWORD wNotifyCode, DWORD wID) = 0; // Pure virtual draw() function
2022-09-26 02:31:54 +00:00
virtual void ResetMenu(void) = 0; // Pure virtual draw() function
HMENU GetHandle(void)
{
return m_MenuHandle;
}
2016-01-27 09:11:59 +00:00
};