MCPcopy Create free account
hub / github.com/TASEmulators/fceux / UpdateLuaRMenu

Function UpdateLuaRMenu

src/drivers/win/window.cpp:785–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785void UpdateLuaRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid)
786{
787 MENUITEMINFO moo;
788 int x;
789
790 moo.cbSize = sizeof(moo);
791 moo.fMask = MIIM_SUBMENU | MIIM_STATE;
792
793 GetMenuItemInfo(GetSubMenu(fceumenu, 0), mitem, FALSE, &moo);
794 moo.hSubMenu = menu;
795 moo.fState = strs[0] ? MFS_ENABLED : MFS_GRAYED;
796
797 SetMenuItemInfo(GetSubMenu(fceumenu, 0), mitem, FALSE, &moo);
798
799 // Remove all recent files submenus
800 for(x = 0; x < MAX_NUMBER_OF_LUA_RECENT_FILES; x++)
801 {
802 RemoveMenu(menu, baseid + x, MF_BYCOMMAND);
803 }
804
805 // Recreate the menus
806 for(x = MAX_NUMBER_OF_LUA_RECENT_FILES - 1; x >= 0; x--)
807 {
808 // Skip empty strings
809 if(!strs[x])
810 continue;
811
812 string tmp = strs[x];
813
814 //clamp this string to 128 chars
815 if(tmp.size()>128)
816 tmp = tmp.substr(0,128);
817
818 moo.cbSize = sizeof(moo);
819 moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;
820
821 // Insert the menu item
822 moo.cch = tmp.size();
823 moo.fType = 0;
824 moo.wID = baseid + x;
825 moo.dwTypeData = (LPSTR)tmp.c_str();
826 InsertMenuItem(menu, 0, 1, &moo);
827 }
828
829 DrawMenuBar(hAppWnd);
830}
831
832void UpdateRecentLuaArray(const char* addString, char** bufferArray, unsigned int arrayLen, HMENU menu, unsigned int menuItem, unsigned int baseId)
833{

Callers 2

UpdateRecentLuaArrayFunction · 0.85
CreateMainWindowFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected