/*** INITALISE MENUBAR ***/ OSStatus InitMenubar( void ) { // set menu bar Handle menuBar; #if TARGET_API_MAC_CARBON long result; if ((Gestalt(gestaltMenuMgrAttr, &result) == noErr) && (result & gestaltMenuMgrAquaLayoutMask)) menuBar = GetNewMBar( kMenuXBaseID); else #endif menuBar = GetNewMBar( kMenuBaseID ); SetMenuBar( menuBar ); // get menu references appleMenu = GetMenuRef( kAppleMenu ); fileMenu = GetMenuRef( kFileMenu ); editMenu = GetMenuRef( kEditMenu ); findMenu = GetMenuRef( kFindMenu ); optionsMenu = GetMenuRef( kOptionsMenu ); colorMenu = GetMenuRef( kColorMenu ); windowMenu = GetMenuRef( kWindowMenu ); #if !TARGET_API_MAC_CARBON AppendResMenu( appleMenu, 'DRVR' ); #endif AppendResMenu( colorMenu, 'HEct' ); // LR: add color scheme menu DrawMenuBar(); return noErr; }
void MakeMenus(void) { Handle mbarHdl; MenuHandle menuHdl; OSErr err; if ( !(mbarHdl = GetNewMBar( rMBar)) ) { ErrorHandler(eMem, nil); return; } SetMenuBar(mbarHdl); if ( (menuHdl = GetMenuHandle(mApple)) != nil) { AppendResMenu(menuHdl, 'DRVR'); } else ErrorHandler(eMenuHdl, nil); ERR_CHECK(HMGetHelpMenuHandle(&menuHdl)); DisableItem(menuHdl, 1); DrawMenuBar(); }
/* ============= InitMacStuff ============= */ void InitMacStuff( void ) { Handle menuBar; char dir[MAX_OSPATH]; // init toolbox MaxApplZone(); MoreMasters(); InitGraf(&qd.thePort); InitFonts(); FlushEvents(everyEvent, 0); SetEventMask( -1 ); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); // init menu menuBar = GetNewMBar(rMenuBar); if(!menuBar) { Com_Error( ERR_FATAL, "MenuBar not found."); } SetMenuBar(menuBar); DisposeHandle(menuBar); AppendResMenu(GetMenuHandle(mApple),'DRVR'); DrawMenuBar(); Sys_InitConsole(); SetEventMask( -1 ); }
void TkMacInitMenus( Tcl_Interp *interp) { gInterp = interp; /* * At this point, InitMenus() should have already been called. */ if (TkMacUseMenuID(256) != TCL_OK) { panic("Menu ID 256 is already in use!"); } tkAppleMenu = NewMenu(256, "\p\024"); if (tkAppleMenu == NULL) { panic("memory - menus"); } InsertMenu(tkAppleMenu, 0); AppendMenu(tkAppleMenu, "\pAbout Tcl & TkŠ"); AppendMenu(tkAppleMenu, "\p(-"); AppendResMenu(tkAppleMenu, 'DRVR'); if (TkMacUseMenuID(kFileMenu) != TCL_OK) { panic("Menu ID %d is already in use!", kFileMenu); } tkFileMenu = NewMenu(kFileMenu, "\pFile"); if (tkFileMenu == NULL) { panic("memory - menus"); } InsertMenu(tkFileMenu, 0); AppendMenu(tkFileMenu, "\pSourceŠ"); AppendMenu(tkFileMenu, "\pClose/W"); AppendMenu(tkFileMenu, "\p(-"); AppendMenu(tkFileMenu, "\pQuit/Q"); if (TkMacUseMenuID(kEditMenu) != TCL_OK) { panic("Menu ID %d is already in use!", kEditMenu); } tkEditMenu = NewMenu(kEditMenu, "\pEdit"); if (tkEditMenu == NULL) { panic("memory - menus"); } InsertMenu(tkEditMenu, 0); AppendMenu(tkEditMenu, "\pCut/X"); AppendMenu(tkEditMenu, "\pCopy/C"); AppendMenu(tkEditMenu, "\pPaste/V"); AppendMenu(tkEditMenu, "\pClear"); if (TkMacUseMenuID(kHMHelpMenuID) != TCL_OK) { panic("Help menu ID %s is already in use!", kHMHelpMenuID); } DrawMenuBar(); TkMacSetHelpMenuItemCount(); return; }
static void SetUpMenus () { int i; for (i=0; i<menuCount; i++) myMenus[i] = GetMenu(i+appleID); AppendResMenu(myMenus[0],'DRVR'); for (i=0; i<menuCount; i++) InsertMenu(myMenus[i],0); /* Add menus to menu bar */ DrawMenuBar(); }
/* ----------- private code */ static void initialize_application( void) { Handle menubar; StringHandle userName; #ifndef OP_PLATFORM_MAC_CARBON_FLAG MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(NULL); #else MoreMasterPointers(192); #endif // ! OP_PLATFORM_MAC_CARBON_FLAG InitCursor(); FlushEvents(everyEvent, 0); menubar= GetNewMBar(rMENU_BAR_ID); op_assert(menubar); SetMenuBar(menubar); DisposeHandle(menubar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); DrawMenuBar(); // Get the user name from the systemÉ userName = GetString (-16096); if (userName == NULL) strcpy(gNameString, "OpenPlay Test"); else { doCopyP2CStr(*userName,gNameString); ReleaseResource ((Handle) userName); } // ecf - we wanna enable enumeration by default... check_menu_item(mSpecial, iActiveEnumeration, active_enumeration); //install apple event handler for quitting AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,NewAEEventHandlerUPP((AEEventHandlerProcPtr)do_quit_apple_event),0L,false); return; }
void wxFontEnumeratorHelper::DoEnumerate() { MenuHandle menu ; short lines ; menu = NewMenu( 32000 , "\pFont" ) ; AppendResMenu( menu , 'FONT' ) ; lines = CountMenuItems( menu ) ; for ( int i = 1 ; i < lines+1 ; i ++ ) { wxString c_name ; #if TARGET_API_MAC_CARBON CFStringRef menutext ; c_name = wxEmptyString ; if ( CopyMenuItemTextAsCFString (menu, i, &menutext) == noErr ) { c_name = wxMacCFStringHolder(menutext).AsString(wxLocale::GetSystemEncoding()); } #else Str255 p_name; GetMenuItemText( menu , i , p_name ) ; c_name = wxMacMakeStringFromPascal( p_name ); #endif /* if ( m_fixedOnly ) { // check that it's a fixed pitch font (there is *no* error here, the // flag name is misleading!) if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH ) { // not a fixed pitch font return TRUE; } } if ( m_charset != -1 ) { // check that we have the right encoding if ( lf->lfCharSet != m_charset ) { return TRUE; } } */ m_fontEnum->OnFacename( c_name ) ; } DisposeMenu( menu ) ; }
int init_macintosh( void) { static int initdone = 0; Handle menuBar; long attributes; /* semaphore required for preemptive threads */ if( initdone) return initdone == 1; initdone = -1; /* should I check for MLNK resource too as launch-filtering is done based on it? */ /* too late--since I'm running there likely wasn't a problem (this time anyway). */ menuBar = GetNewMBar(rMenuBar); if( menuBar){ SetMenuBar(menuBar); DisposeHandle(menuBar); }else{ MenuHandle am, fm, em; am = NewMenu( mApple, (unsigned char*)"\001\024"); fm = NewMenu( mFile, (unsigned char*)"\004File"); em = NewMenu( mEdit, (unsigned char*)"\004Edit"); if( !am || !fm || !em) return 0; AppendMenu( am, (unsigned char*)"\022About MathLink\252\311;-"); DisableMenuItem(am, 0); InsertMenu( am, 0); AppendMenu( fm, (unsigned char*)"\006Quit/Q"); InsertMenu( fm, 0); AppendMenu( em, (unsigned char*)"\043Undo/Z;-;Cut/X;Copy/C;Paste/V;Clear"); DisableMenuItem(em, 0); InsertMenu( em, 0); } AppendResMenu( GetMenuHandle(mApple), 'DRVR'); set_about_item(); DrawMenuBar(); about_filter_upp = NewModalFilterUPP( about_filter); outline_hook_upp = NewUserItemUPP( outline_hook); if( Gestalt( gestaltAppleEventsAttr, &attributes) == noErr && ((1 << gestaltAppleEventsPresent) & attributes)){ handle_core_ae_upp = NewAEEventHandlerUPP( handle_core_ae); (void) AEInstallEventHandler( kCoreEventClass, typeWildCard, handle_core_ae_upp, 0, false); }else{ return 0; /* this may be too strong since I am, after all, running. */ } initdone = 1; return initdone == 1; }
nsresult nsNativeBrowserWindow::CreateMenuBar(PRInt32 aWidth) { for (int i = menu_First; i <= menu_Last; i++) { MenuHandle menu = GetMenu(i); NS_ASSERTION(menu, "menu failed to load"); if (menu) InsertMenu(menu, 0); } InsertMenu(GetMenu(submenu_Print), -1); InsertMenu(GetMenu(submenu_CompatibilityMode), -1); AppendResMenu(GetMenuHandle(menu_Apple), 'DRVR'); DrawMenuBar(); return NS_OK; }
void wxFontEnumeratorHelper::DoEnumerate() { MenuHandle menu ; Str255 p_name ; short lines ; menu = NewMenu( 32000 , "\pFont" ) ; AppendResMenu( menu , 'FONT' ) ; lines = CountMenuItems( menu ) ; for ( int i = 1 ; i < lines+1 ; i ++ ) { GetMenuItemText( menu , i , p_name ) ; wxString c_name = wxMacMakeStringFromPascal(p_name) ; /* if ( m_fixedOnly ) { // check that it's a fixed pitch font (there is *no* error here, the // flag name is misleading!) if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH ) { // not a fixed pitch font return TRUE; } } if ( m_charset != -1 ) { // check that we have the right encoding if ( lf->lfCharSet != m_charset ) { return TRUE; } } */ m_fontEnum->OnFacename( c_name ) ; } DisposeMenu( menu ) ; }
static void mac_startup(void) { Handle menuBar; TECInfoHandle ti; #if !TARGET_API_MAC_CARBON /* Init Memory Manager */ MaxApplZone(); /* Init QuickDraw */ InitGraf(&qd.thePort); /* Init Font Manager */ InitFonts(); /* Init Window Manager */ InitWindows(); /* Init Menu Manager */ InitMenus(); /* Init TextEdit */ TEInit(); /* Init Dialog Manager */ InitDialogs(NULL); #endif /* Get base system version (only used if there's no better selector) */ if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr || (mac_gestalts.sysvers &= 0xffff) < 0x700) fatalbox("PuTTYgen requires System 7 or newer"); /* Find out if we've got Color Quickdraw */ if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr) mac_gestalts.qdvers = gestaltOriginalQD; /* ... and the Appearance Manager? */ if (Gestalt(gestaltAppearanceVersion, &mac_gestalts.apprvers) != noErr) if (Gestalt(gestaltAppearanceAttr, NULL) == noErr) mac_gestalts.apprvers = 0x0100; else mac_gestalts.apprvers = 0; #if TARGET_RT_MAC_CFM /* Paranoia: Did we manage to pull in AppearanceLib? */ if (&RegisterAppearanceClient == kUnresolvedCFragSymbolAddress) mac_gestalts.apprvers = 0; #endif #if TARGET_CPU_68K mac_gestalts.cntlattr = 0; mac_gestalts.windattr = 0; #else /* Mac OS 8.5 Control Manager (proportional scrollbars)? */ if (Gestalt(gestaltControlMgrAttr, &mac_gestalts.cntlattr) != noErr || &SetControlViewSize == kUnresolvedCFragSymbolAddress) mac_gestalts.cntlattr = 0; /* Mac OS 8.5 Window Manager? */ if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr || &SetWindowContentColor == kUnresolvedCFragSymbolAddress) mac_gestalts.windattr = 0; #endif /* Text Encoding Conversion Manager? */ if ( #if TARGET_RT_MAC_CFM &TECGetInfo == kUnresolvedCFragSymbolAddress || #else InitializeUnicodeConverter(NULL) != noErr || #endif TECGetInfo(&ti) != noErr) mac_gestalts.encvvers = 0; else { mac_gestalts.encvvers = (*ti)->tecVersion; mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures; DisposeHandle((Handle)ti); } /* Navigation Services? */ if (NavServicesAvailable()) mac_gestalts.navsvers = NavLibraryVersion(); else mac_gestalts.navsvers = 0; /* We've been tested with the Appearance Manager */ if (mac_gestalts.apprvers != 0) RegisterAppearanceClient(); menuBar = GetNewMBar(128); if (menuBar == NULL) fatalbox("Unable to create menu bar."); SetMenuBar(menuBar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); mac_adjustmenus(); DrawMenuBar(); InitCursor(); windows.about = NULL; windows.licence = NULL; flags = FLAG_INTERACTIVE; /* Install Apple Event handlers. */ #if 0 AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(&mac_aevt_oapp), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(&mac_aevt_odoc), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerUPP(&mac_aevt_pdoc), 0, FALSE); #endif AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(&mac_aevt_quit), 0, FALSE); }
static void MenuBarInit(void) { Handle hdl; MenuHandle hmenu; hdl = GetNewMBar(IDM_MAINMENU); if (hdl == NULL) { ExitToShell(); } SetMenuBar(hdl); hmenu = GetMenuHandle(IDM_APPLE); if (hmenu) { AppendResMenu(hmenu, 'DRVR'); } #if !defined(SUPPORT_SCSI) hmenu = GetMenuHandle(IDM_HARDDISK); if (hmenu) { DeleteMenuItem(hmenu, 7); DeleteMenuItem(hmenu, 6); DeleteMenuItem(hmenu, 5); DeleteMenuItem(hmenu, 4); DeleteMenuItem(hmenu, 3); } #endif if (!np2oscfg.I286SAVE) { hmenu = GetMenuHandle(IDM_OTHER); if (hmenu) { DeleteMenuItem(hmenu, 9); } } InsertMenu(GetMenu(IDM_SASI1), -1); InsertMenu(GetMenu(IDM_SASI2), -1); #if defined(SUPPORT_SCSI) InsertMenu(GetMenu(IDM_SCSI0), -1); InsertMenu(GetMenu(IDM_SCSI1), -1); InsertMenu(GetMenu(IDM_SCSI2), -1); InsertMenu(GetMenu(IDM_SCSI3), -1); #endif InsertMenu(GetMenu(IDM_KEYBOARD), -1); InsertMenu(GetMenu(IDM_SOUND), -1); InsertMenu(GetMenu(IDM_MEMORY), -1); #if TARGET_API_MAC_CARBON hmenu = GetMenuHandle(IDM_FDD2); SetItemCmd(hmenu, LoWord(IDM_FDD2OPEN), 'D'); SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2OPEN), kMenuShiftModifier); SetItemCmd(hmenu, LoWord(IDM_FDD2EJECT), 'E'); SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2EJECT), kMenuShiftModifier); hmenu = GetMenuHandle(IDM_SASI2); SetItemCmd(hmenu, LoWord(IDM_SASI2OPEN), 'O'); SetMenuItemModifiers(hmenu, LoWord(IDM_SASI2OPEN), kMenuShiftModifier); #else EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); #endif if (!(np2cfg.fddequip & 1)) { DeleteMenu(IDM_FDD1); } if (!(np2cfg.fddequip & 2)) { DeleteMenu(IDM_FDD2); } if (!(np2cfg.fddequip & 4)) { DeleteMenu(IDM_FDD3); } if (!(np2cfg.fddequip & 8)) { DeleteMenu(IDM_FDD4); } #if defined(SUPPORT_STATSAVE) if (!np2oscfg.statsave) { #endif DeleteMenu(IDM_STATSAVE); #if defined(SUPPORT_STATSAVE) } #endif DrawMenuBar(); }