MCPcopy Create free account
hub / github.com/NetHack/NetHack / InitMenuRes

Function InitMenuRes

outdated/sys/mac/macmenu.c:836–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

834}
835
836void
837InitMenuRes()
838{
839 static Boolean was_inited = 0;
840 short i, j;
841 menuListHandle mlHnd;
842 MenuHandle menu;
843
844 if (was_inited)
845 return;
846 was_inited = 1;
847
848 mustGetMenuAlerts();
849
850 for (i = listMenubar; i <= listSubmenu; i++) {
851 if (!(mlHnd =
852 (menuListHandle) GetResource('MNU#', (menuBarListID + i))))
853 menuError(errGetMenuList);
854
855 pMenuList[i] = (menuListPtr) NewPtr(GetHandleSize((Handle) mlHnd));
856 *pMenuList[i] = **mlHnd;
857
858 for (j = 0; j < pMenuList[i]->numMenus; j++) {
859 if (!(menu = (MenuHandle) GetMenu((**mlHnd).mref[j].mresID))) {
860 Str31 d;
861 NumToString((**mlHnd).mref[j].mresID, d);
862 menuError(errGetMenu);
863 }
864
865 pMenuList[i]->mref[j].mhnd = menu;
866 SetMenuID(menu, j + (**mlHnd).firstMenuID); /* consecutive IDs */
867
868 /* expand apple menu */
869 if ((i == listMenubar) && (j == menuApple)) {
870 AppendResMenu(menu, 'DRVR');
871 }
872
873 InsertMenu(menu, ((i == listSubmenu) ? hierMenu : 0));
874 }
875 }
876 DrawMenuBar();
877 return;
878}
879
880void
881AdjustMenus(short dimMenubar)

Callers 2

_mt_init_stuffFunction · 0.85
mac_init_nhwindowsFunction · 0.85

Calls 2

mustGetMenuAlertsFunction · 0.85
menuErrorFunction · 0.85

Tested by

no test coverage detected