[Project64] Clean up Menu Class.cpp

This commit is contained in:
zilmar 2015-11-14 08:15:20 +11:00
parent 9e744ef180
commit 003bcc9096
1 changed files with 56 additions and 56 deletions

View File

@ -1,11 +1,12 @@
#include "stdafx.h" #include "stdafx.h"
CBaseMenu::CBaseMenu () : CBaseMenu::CBaseMenu() :
m_MenuHandle((HMENU)CreateMenu()) m_MenuHandle((HMENU)CreateMenu())
{ {
} }
bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) { bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items)
{
if (Items.begin() == Items.end()) { return false; } if (Items.begin() == Items.end()) { return false; }
UINT ItemID, uFlags; UINT ItemID, uFlags;
@ -43,7 +44,7 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) {
ItemID = (UINT)CreatePopupMenu(); ItemID = (UINT)CreatePopupMenu();
uFlags |= MF_POPUP; uFlags |= MF_POPUP;
AddMenu((HMENU)ItemID,*SubMenu); AddMenu((HMENU)ItemID, *SubMenu);
} }
if (ItemID == ID_PLUGIN_MENU) if (ItemID == ID_PLUGIN_MENU)
@ -55,7 +56,7 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) {
lpmii.cbSize = sizeof(MENUITEMINFO); lpmii.cbSize = sizeof(MENUITEMINFO);
lpmii.fMask = MIIM_STATE; lpmii.fMask = MIIM_STATE;
lpmii.fState = 0; lpmii.fState = 0;
SetMenuItemInfo((HMENU)ItemID, (DWORD)MenuItem->SubMenu(), FALSE,&lpmii); SetMenuItemInfo((HMENU)ItemID, (DWORD)MenuItem->SubMenu(), FALSE, &lpmii);
} }
if (MenuItem->ShortCut().empty() == false) if (MenuItem->ShortCut().empty() == false)
@ -65,8 +66,7 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) {
String += MenuItem->ShortCut(); String += MenuItem->ShortCut();
Text = String; Text = String;
} }
AppendMenuW(hMenu,uFlags,ItemID,Text.c_str()); AppendMenuW(hMenu, uFlags, ItemID, Text.c_str());
} }
return true; return true;
} }