/* destructor for the CARBON_GUI class * here we destroy all other used objects and */ CARBON_GUI::~CARBON_GUI() { /* Destroy used objects */ delete streamHandler; delete playlistManager; delete aboutWindow; pthread_mutex_destroy(&_statusLock); if(msgList) { while(msgList->len()) { Entry *e = msgList->begin(); void *val = e->get_value(); if(val) free(val); delete e; } delete msgList; } /* delete all input channels */ for (int i=0;i<MAX_CHANNELS;i++) if(channel[i]) delete channel[i]; DisposeWindow(statusWindow); DisposeWindow(vumeterWindow); DisposeMenu(mainMenu); // We don't need the nib reference anymore. DisposeNibReference(nibRef); }
void tool_wind_fill_group_combo(void) { int n,group_idx; char str[256]; CFStringRef cf_str; HMHelpContentRec tag; // old settings group_idx=GetControl32BitValue(group_combo); // delete old control and menu DisposeControl(group_combo); DeleteMenu(160); DisposeMenu(group_menu); // recreate the menu CreateNewMenu(group_combo_menu_id,0,&group_menu); cf_str=CFStringCreateWithCString(kCFAllocatorDefault,"No Group",kCFStringEncodingMacRoman); AppendMenuItemTextWithCFString(group_menu,cf_str,0,FOUR_CHAR_CODE('gp01'),NULL); CFRelease(cf_str); AppendMenuItemTextWithCFString(group_menu,NULL,kMenuItemAttrSeparator,0,NULL); for (n=0;n<map.ngroup;n++) { sprintf(str,"%s (%d)",map.groups[n].name,group_count(n)); cf_str=CFStringCreateWithCString(kCFAllocatorDefault,str,kCFStringEncodingMacRoman); AppendMenuItemTextWithCFString(group_menu,cf_str,0,FOUR_CHAR_CODE('gp03'),NULL); CFRelease(cf_str); } InsertMenu(group_menu,kInsertHierarchicalMenu); // recreate the contorl CreatePopupButtonControl(toolwind,&group_box,NULL,group_combo_menu_id,FALSE,0,0,0,&group_combo); Draw1Control(group_combo); // build the help tag.version=kMacHelpVersion; tag.tagSide=kHMDefaultSide; SetRect(&tag.absHotRect,0,0,0,0); tag.content[kHMMinimumContentIndex].contentType=kHMCFStringContent; tag.content[kHMMinimumContentIndex].u.tagCFString=CFStringCreateWithCString(NULL,"Segment Groups",kCFStringEncodingMacRoman); tag.content[kHMMaximumContentIndex].contentType=kHMNoContent; HMSetControlHelpContent(group_combo,&tag); // reset the control SetControl32BitValue(group_combo,group_idx); }
void windowDestroy(GLWindow *glw) { MenuHandle hMenu; aglSetDrawable(glw->glCtx, NULL); aglSetCurrentContext(NULL); aglDestroyContext(glw->glCtx); DisposeWindow((WindowPtr)glw->pWin); glw->pWin = NULL; if(glw->supportWindow) DisposeWindow((WindowPtr)glw->supportWindow); hMenu = GetMenuHandle (kMenuFile); DeleteMenu (kMenuFile); DisposeMenu (hMenu); hMenu = GetMenuHandle (kMenuApple); DeleteMenu (kMenuApple); DisposeMenu (hMenu); }
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 ) ; }
void TkpDestroyMenuButton( TkMenuButton *mbPtr) { MacMenuButton * macMbPtr = (MacMenuButton *)mbPtr; if (macMbPtr->userPane) { DisposeControl(macMbPtr->userPane); macMbPtr->userPane = NULL; } if (macMbPtr->menuRef) { short menuID; menuID = GetMenuID(macMbPtr->menuRef); TkMacOSXFreeMenuID(menuID); DisposeMenu(macMbPtr->menuRef); macMbPtr->menuRef = NULL; } }
XGPopControl::~XGPopControl() { if (fPop) delete fPop; DeleteAll(); fFont->Detach(); #if OPT_MACOS if (fControl) { MenuHandle menu = GetMenuHandle(); SetMenuHandle(NULL); DeleteMenu(0x4000 + GetViewID()); DisposeMenu(menu); } #endif #if OPT_WINOS if (fControl) { ::DestroyWindow(fControl); } #endif }
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 ) ; }
void tool_wind_close(void) { int t; for ((t=0);(t!=maxtool);t++) { DisposeControl(tool_ctrl[t]); } DisposeControl(magnify_icon); DisposeControl(magnify_slider); DisposeControlActionUPP(magnify_proc); DisposeControl(group_combo); DisposeMenu(group_menu); RemoveEventHandler(tool_wind_event); DisposeEventHandlerUPP(tool_wind_upp); DisposeWindow(toolwind); }
EXPORT(sqInt) primitiveDisposeMenu(void) { MenuHandle menuHandle; sqInt menuHandleOop; sqInt _return_value; menuHandleOop = interpreterProxy->stackValue(0); if (interpreterProxy->failed()) { return null; } menuHandle = ((MenuHandle) (interpreterProxy->positive64BitValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { _return_value = interpreterProxy->success(0); if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(2, _return_value); return null; } DisposeMenu(menuHandle); return null; }
/* CreatePopMenu(theDialog, popupItemNumber, titleItemNumber, itemList, initialItem) Creates a popup menu in the specified dialog. popupItemNumber is the dialog item number for the popup menu. On Macintosh, this must be a CNTL item representing a popup button control. See notes above under "About Carbon Popup Menus". titleItemNumber is the dialog item number for the static text title for the popup menu. Prior to XOP Toolkit 5, on Macintosh, this item was highlighted when the user clicked on the popup menu. As of XOP Toolkit 5, it is no longer used by must be present for backward compatibility. itemList is a semicolon-separated list of items to insert into the menu. For example, "Red;Green;Blue". initialItem is the 1-based number of the item in the popup menu that should be initially selected. The menu handle allocated here will be disposed when you call KillPopMenus at the end of the dialog. In contrast to Macintosh menu manager routines, this routine does not treat any characters as meta-characters. Thread Safety: CreatePopMenu is not thread-safe. */ int CreatePopMenu(DialogPtr theDialog, int popupItemNumber, int titleItemNumber, const char* itemList, int initialItem) { MenuHandle mH; ControlHandle controlH; int menuID; int i; int err; if (gPopMenuInfoP == NULL) { // gPopMenuInfoP is used by KillPopMenusAfterDialogIsKilled to keep track of which menu IDs are free for use with popup menus. gPopMenuInfoP = (XOPPopMenuInfo*)NewPtrClear(MAX_POPUP_MENUS*(sizeof(XOPPopMenuInfo))); // Assume never more than MAX_POPUP_MENUS popups. if (gPopMenuInfoP == NULL) return NOMEM; } if (err = XOPGetDialogItemAsControl(theDialog, popupItemNumber, &controlH)) return err; /* Find a free menu ID. Menus IDs from 1100-1199 are reserved for XOPs. This routine uses the range 1150 to 1199 for dialog popup menus. */ mH = NULL; menuID = FIRST_POPUP_MENU_ID; for(i=0; i<MAX_POPUP_MENUS; i++) { if (gPopMenuInfoP[i].menuID == 0) { char menuName[64]; sprintf(menuName, "Menu %d", menuID); { unsigned char temp[256]; CopyCStringToPascal(menuName, temp); mH = NewMenu(menuID, temp); } if (mH == NULL) return NOMEM; break; } menuID += 1; } if (mH == NULL) // Ran out of menu IDs. return -1; // Very unlikely. XOPFillMenuNoMeta(mH, 0, itemList); /* Tell the control what menu handle it should use. According to Eric Schlegel from Apple, the menu does not need to be in the menu list. If this succeeds, the control now owns the menu handle and will dispose it. */ err = SetControlData(controlH, kControlMenuPart, kControlPopupButtonOwnedMenuRefTag, sizeof(mH), &mH); if (err!=0 || mH!=GetControlPopupMenuHandle(controlH)) { /* If here, you are probably need to double-check your popupItemNumber or your CNTL resource or your DITL resource. */ DisposeMenu(mH); return err ? err:-1; // Should never happen. } SetPopMenuMax(theDialog, popupItemNumber); // Store the menu ID so we can tell what menu ID is free the next time we create a popup menu. gPopMenuInfoP[menuID-FIRST_POPUP_MENU_ID].theDialog = theDialog; gPopMenuInfoP[menuID-FIRST_POPUP_MENU_ID].menuID = menuID; // Set the initially-selected item. SetPopItem(theDialog, popupItemNumber, initialItem); return 0; }