bool unloadAboutWin() { HideWindow(g_refAboutWin); RemoveEventHandler(g_refAboutHdlr); DisposeWindow(g_refAboutWin); DisposeEventHandlerUPP(g_lpfnAboutProc); return true; }
wxScreenDCImpl::~wxScreenDCImpl() { wxDELETE(m_graphicContext); #if wxOSX_USE_COCOA_OR_IPHONE #else DisposeWindow((WindowRef) m_overlayWindow ); #endif }
wxScreenDCImpl::~wxScreenDCImpl() { delete m_graphicContext; m_graphicContext = NULL; #if wxOSX_USE_COCOA_OR_IPHONE #else DisposeWindow((WindowRef) m_overlayWindow ); #endif }
TabbedWindow::~TabbedWindow( void ) { // remove the event handler RemoveEventHandler( fHandler ); // dispose of the window DisposeWindow( fWindowRef ); }
static void mac_closedlg(WindowPtr window) { Session *s = mac_windowsession(window); macctrl_close(window); DisposeWindow(window); if (s->window == NULL) sfree(s); }
void NCarbonWindowManager::CloseMacWindow(WindowRef aWind) { NWindow *nWind = NULL; NUInt32 wRef = GetWRefCon(aWind); if(NObject::CheckValidNObject(wRef)) nWind = (NWindow*)wRef; if(nWind) { if(nWind->GetImplementation()->CloseRequest()) { delete nWind; DisposeWindow(aWind); } } else DisposeWindow(aWind); }
pxError pxWindow::term() { if (mWindowRef) { DisposeWindow(mWindowRef); mWindowRef = NULL; } return PX_OK; }
void disposedirwindow (WindowPtr wp) { SendBehind (g_hotband, (WindowPtr) 0); if ((**g_selection)[0] != 0 && (*(**g_selection)[0])->contrlOwner == wp) (**g_selection)[0] = 0; DisposHandle ((*(opendirinfo **) ((WindowPeek) wp)->refCon)->path); DisposeWindow (wp); showviewmenu (FrontWindow () != g_hotband); }
void Sys_KillWindow(void) { deleteContext(g_Window.glctx); g_Window.glctx = 0; DisposeWindow((WindowPtr)g_Window.window); g_Window.window = 0; if (g_Player != NULL) { free(g_Player); } }
void palette_scenery_close(int *x,int *y) { Rect box; GetWindowBounds(palette_scenery_wind,kWindowGlobalPortRgn,&box); *x=box.left; *y=box.top; DisposeWindow(palette_scenery_wind); }
void mac_freeeventlog(Session *s) { if (s->eventlog != NULL) LDispose(s->eventlog); if (s->eventlog_window != NULL) { sfree((WinInfo *)GetWRefCon(s->eventlog_window)); DisposeWindow(s->eventlog_window); } }
void dialog_preference_run(void) { EventHandlerUPP event_upp; EventTypeSpec event_list[]={{kEventClassCommand,kEventProcessCommand}}; // open the dialog dialog_open(&dialog_preference_wind,"Preferences"); // set controls dialog_set_text(dialog_preference_wind,kPrefEngineName,0,setup.engine_name); dialog_set_combo(dialog_preference_wind,kPrefMipMapMode,0,setup.mipmap_mode); dialog_set_boolean(dialog_preference_wind,kPrefAutoTexture,0,setup.auto_texture); dialog_set_int(dialog_preference_wind,kPrefDuplicateOffset,0,setup.duplicate_offset); dialog_set_color(dialog_preference_wind,kPrefBackgroundColor,0,&setup.col.background); dialog_set_color(dialog_preference_wind,kPrefLineColor,0,&setup.col.mesh_line); dialog_set_color(dialog_preference_wind,kPrefMeshSelColor,0,&setup.col.mesh_sel); dialog_set_color(dialog_preference_wind,kPrefPolySelColor,0,&setup.col.poly_sel); // show window ShowWindow(dialog_preference_wind); // install event handler event_upp=NewEventHandlerUPP(preference_event_proc); InstallWindowEventHandler(dialog_preference_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL); // modal window dialog_preference_cancel=FALSE; RunAppModalLoopForWindow(dialog_preference_wind); // dialog to data if (!dialog_preference_cancel) { dialog_get_text(dialog_preference_wind,kPrefEngineName,0,setup.engine_name,256); setup.mipmap_mode=dialog_get_combo(dialog_preference_wind,kPrefMipMapMode,0); setup.auto_texture=dialog_get_boolean(dialog_preference_wind,kPrefAutoTexture,0); setup.duplicate_offset=dialog_get_int(dialog_preference_wind,kPrefDuplicateOffset,0); dialog_get_color(dialog_preference_wind,kPrefBackgroundColor,0,&setup.col.background); dialog_get_color(dialog_preference_wind,kPrefLineColor,0,&setup.col.mesh_line); dialog_get_color(dialog_preference_wind,kPrefMeshSelColor,0,&setup.col.mesh_sel); dialog_get_color(dialog_preference_wind,kPrefPolySelColor,0,&setup.col.poly_sel); setup_xml_write(); } // close window DisposeWindow(dialog_preference_wind); }
//-------------------------------------------------------------------------------------------------// void OSXCarbonWindow::destroy(void) { if(!mCreated) return; if(mIsFullScreen) { // Handle fullscreen destruction destroyCGLFullscreen(); } else { // Handle windowed destruction // Destroy the Ogre context if(mCGLContext) { OGRE_DELETE mCGLContext; mCGLContext = NULL; } if(mCarbonContext) { OGRE_DELETE mCarbonContext; mCarbonContext = NULL; } if(mContext) { // mContext is a reference to either the AGL or CGL context, already deleted. // Just clear the variable mContext = NULL; } if(!mIsExternal) { // Remove the window from the Window listener WindowEventUtilities::_removeRenderWindow( this ); // Remove our event handler if(mEventHandlerRef) RemoveEventHandler(mEventHandlerRef); } if(mAGLContext) aglDestroyContext(mAGLContext); if(mWindow) DisposeWindow(mWindow); } mActive = false; mClosed = true; mCreated = false; }
wxScreenDC::~wxScreenDC() { #if wxMAC_USE_CORE_GRAPHICS delete m_graphicContext; m_graphicContext = NULL; DisposeWindow((WindowRef) m_overlayWindow ); #else if ( m_macPort ) DisposePort( (CGrafPtr) m_macPort ) ; #endif }
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); }
/***************************************************** * * Do_CleanUp(void) * * Purpose: called when we get the quit event, closes all the windows. * * Inputs: none * * Returns: OSStatus - eventNotHandledErr indicates that the quit process can continue */ static OSStatus Do_CleanUp(void) { WindowRef windowToDispose, aWindowRef = GetFrontWindowOfClass(kDocumentWindowClass, true); for ( ; aWindowRef != NULL; ) { windowToDispose = aWindowRef; aWindowRef = GetNextWindowOfClass(aWindowRef, kDocumentWindowClass, true); DisposeWindow(windowToDispose); } return eventNotHandledErr; } // Do_CleanUp
OSErr QTDR_PlayMovieFromRAM (Movie theMovie) { WindowPtr myWindow = NULL; Rect myBounds = {50, 50, 100, 100}; Rect myRect; StringPtr myTitle = QTUtils_ConvertCToPascalString(kWindowTitle); OSErr myErr = memFullErr; myWindow = NewCWindow(NULL, &myBounds, myTitle, false, 0, (WindowPtr)-1, false, 0); if (myWindow == NULL) goto bail; myErr = noErr; MacSetPort((GrafPtr)GetWindowPort(myWindow)); GetMovieBox(theMovie, &myRect); MacOffsetRect(&myRect, -myRect.left, -myRect.top); SetMovieBox(theMovie, &myRect); if (!EmptyRect(&myRect)) SizeWindow(myWindow, myRect.right, myRect.bottom, false); else SizeWindow(myWindow, 200, 0, false); MacShowWindow(myWindow); SetMovieGWorld(theMovie, GetWindowPort(myWindow), NULL); GoToBeginningOfMovie(theMovie); MoviesTask(theMovie, 0); StartMovie(theMovie); myErr = GetMoviesError(); if (myErr != noErr) goto bail; while (!IsMovieDone(theMovie)) MoviesTask(theMovie, 0); bail: free(myTitle); if (theMovie != NULL) DisposeMovie(theMovie); if (myWindow != NULL) DisposeWindow(myWindow); return(myErr); }
void PoofItGood( Point centerPt ) { CGRect box; WindowRef window; Rect bounds; CGContextRef context; CGImageRef image; float windowWidth; float windowHeight; int i; image = GetThePoofImage(); if ( image == NULL ) goto Bail; windowWidth = CGImageGetWidth( image ) / NUMBER_OF_POOF_ANIM_FRAMES; windowHeight = CGImageGetHeight( image ); // Start our animation bounds at the first item in the animation strip box.origin.x = box.origin.y = 0; box.size.width = CGImageGetWidth( image ); box.size.height = CGImageGetHeight( image ); bounds.top = centerPt.v - (SInt16)(windowHeight / 2); bounds.left = centerPt.h - (SInt16)(windowWidth / 2); bounds.bottom = bounds.top + (SInt16)windowHeight; bounds.right = bounds.left + (SInt16)windowWidth; CreateNewWindow( kOverlayWindowClass, 0, &bounds, &window ); CreateCGContextForPort( GetWindowPort( window ), &context ); ShowWindow( window ); for ( i = 1; i <= NUMBER_OF_POOF_ANIM_FRAMES; i++ ) { CGContextClearRect( context, box ); CGContextDrawImage( context, box, image ); CGContextFlush( context ); Delay( EventTimeToTicks( POOF_ANIMATION_DELAY ), NULL ); box.origin.x -= windowWidth; } CGContextRelease( context ); CGImageRelease( image ); DisposeWindow( window ); Bail: return; }
//------------------------------------------------------------------------------------- // Prompt //------------------------------------------------------------------------------------- // Put up a modal panel and request some text. // CFStringRef Prompt( CFStringRef inPrompt, CFStringRef inDefaultText ) { IBNibRef nibRef; OSStatus err; WindowRef window; EventTypeSpec kEvents[] = { { kEventClassCommand, kEventCommandProcess } }; PanelInfo info; HIViewRef view; info.window = window; info.string = NULL; err = CreateNibReference( CFSTR( "main" ), &nibRef ); require_noerr( err, CantGetNibRef ); err = CreateWindowFromNib( nibRef, CFSTR( "Prompt" ), &window ); require_noerr( err, CantCreateWindow ); DisposeNibReference( nibRef ); if ( inPrompt ) { HIViewFindByID( HIViewGetRoot( window ), kPromptLabelID, &view ); SetControlData( view, 0, kControlStaticTextCFStringTag, sizeof( CFStringRef ), &inPrompt ); } HIViewFindByID( HIViewGetRoot( window ), kTextFieldID, &view ); if ( inDefaultText ) SetControlData( view, 0, kControlEditTextCFStringTag, sizeof( CFStringRef ), &inDefaultText ); SetKeyboardFocus( window, view, kControlFocusNextPart ); InstallWindowEventHandler( window, InputPanelHandler, GetEventTypeCount( kEvents ), kEvents, &info, NULL ); ShowWindow( window ); info.window = window; RunAppModalLoopForWindow( window ); DisposeWindow( window ); CantCreateWindow: CantGetNibRef: return info.string; }
void NCarbonWindowManager::Destroy(NWindow *wndToDestroy) { WindowRef macWindow = GetMacWindowFromNWindow(wndToDestroy); if(macWindow) { if(wndToDestroy->GetClass() == kWindowClassDialog) DisposeDialog(GetDialogFromWindow(macWindow)); else DisposeWindow(macWindow); delete wndToDestroy; } // else something went pretty much wrong here }
pascal OSStatus confirmadm_yes_clicked (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { TCONFIRM *confirm_t = (TCONFIRM *) inUserData; if (confirm_t) { DisposeWindow (confirm_t->mainwnd); confirm_t->mainwnd = NULL; confirm_t->yes_no = true; } return noErr; }
bool dialog_play_blend_animation_run(void) { EventHandlerUPP event_upp; EventTypeSpec event_list[]={{kEventClassCommand,kEventProcessCommand}}; // open the dialog dialog_open(&dialog_play_blend_animation_wind,"BlendAnimation"); // set controls dialog_set_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate1,0,play_animate_blend_idx[0],FALSE); dialog_set_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate2,0,play_animate_blend_idx[1],TRUE); dialog_set_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate3,0,play_animate_blend_idx[2],TRUE); dialog_set_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate4,0,play_animate_blend_idx[3],TRUE); // show window ShowWindow(dialog_play_blend_animation_wind); // install event handler event_upp=NewEventHandlerUPP(play_blend_animation_event_proc); InstallWindowEventHandler(dialog_play_blend_animation_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL); // modal window dialog_play_blend_animation_cancel=FALSE; RunAppModalLoopForWindow(dialog_play_blend_animation_wind); // dialog to data if (!dialog_play_blend_animation_cancel) { // get play animations play_animate_blend_idx[0]=dialog_get_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate1,0,FALSE); play_animate_blend_idx[1]=dialog_get_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate2,0,TRUE); play_animate_blend_idx[2]=dialog_get_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate3,0,TRUE); play_animate_blend_idx[3]=dialog_get_animate_combo(dialog_play_blend_animation_wind,kBlendAnimate4,0,TRUE); } // close window DisposeWindow(dialog_play_blend_animation_wind); return(!dialog_play_blend_animation_cancel); }
static void doMenu( long menuSelection ) { short whichMenu = HiWord(menuSelection); short whichMenuItem = LoWord(menuSelection); switch (whichMenu) { case kAppleMenuID: switch (whichMenuItem) { case kAppleMenuAbout: Alert(128, NULL); break; default: break; } break; case kFileMenuID: switch (whichMenuItem) { case kFileMenuQuit: gDone = true; break; } break; case kDemoMenuID: if (window) { DisposeWindow( window ); window = NULL; }; switch (whichMenuItem) { case kDemoMenuDraw: DrawImage(); break; case kDemoMenuScaleRotate: ScaleAndRotate(); break; case kDemoMenuAlpha: AlphaComposite(); break; case kDemoMenuMoreInfo: GetMoreInfo(); break; case kDemoMenuMultipleImage: MultipleImage(); break; case kDemoMenuURLImage: ImageFromURL(); break; case kDemoMenuFiltersExport: FilterExport(); break; case kDemoMenuMovieImage: MovieToImage(); break; case kDemoMenuDeepImages: DeepImages(); break; case kDemoMenuDrawCMYK: DrawCMYK(); break; case kDemoMenuDrawUsingCGImage: DrawUsingCGImage(); break; case kDemoMenuExportFromCGBitmapContext: ExportFromCGBitmapContext(); break; default: break; } // switch } HiliteMenu(0); }
pascal OSStatus keyval_ok_clicked (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { TKEYVAL *keyval_t = (TKEYVAL *) inUserData; char *cour; int i = 0, size = 1; char msg[1024], msg1[1024]; if (keyval_t) { /* What is the size of the block to malloc */ keyval_t->connstr = calloc(sizeof(char), 2); for (i = 0; i < KEYVAL_nrows; i++) { CFStringGetCString (KEYVAL_array[0][i], msg, sizeof (msg), kCFStringEncodingUTF8); CFStringGetCString (KEYVAL_array[1][i], msg1, sizeof (msg1), kCFStringEncodingUTF8); cour = (char *) keyval_t->connstr; keyval_t->connstr = (LPSTR) malloc (size + STRLEN (msg) + STRLEN (msg1) + 2); if (keyval_t->connstr) { memcpy (keyval_t->connstr, cour, size); sprintf (((char*)keyval_t->connstr) + size - 1, "%s=%s", msg, msg1); if (cour) free (cour); size += STRLEN (msg) + STRLEN (msg1) + 2; } else keyval_t->connstr = cour; } ((char*)keyval_t->connstr)[size - 1] = '\0'; keyval_t->verify_conn = GetControlValue (keyval_t->verify_conn_cb) != 0; DisposeWindow (keyval_t->mainwnd); keyval_t->mainwnd = NULL; keyval_t->verify_conn_cb = NULL; keyval_t->key_list = NULL; KEYVAL = NULL; } return noErr; }
static void Quartz_Close(NewDevDesc *dd) { QuartzDesc *xd = (QuartzDesc *) dd->deviceSpecific; if(xd->window) DisposeWindow(xd->window); if(xd->family) free(xd->family); if(xd->context) CGContextRelease(xd->context); if(xd->auxcontext) CGContextRelease(xd->auxcontext); free(xd); }
pascal OSStatus login_cancel_clicked (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { TLOGIN *log_t = (TLOGIN *) inUserData; if (log_t) { log_t->user = log_t->pwd = NULL; log_t->username = log_t->password = NULL; log_t->ok = FALSE; DisposeWindow (log_t->mainwnd); log_t->mainwnd = NULL; } return noErr; }
bool dialog_mesh_info_run(model_mesh_type *mesh) { EventHandlerUPP event_upp; EventTypeSpec event_list[]={{kEventClassCommand,kEventProcessCommand}}; // open the dialog dialog_open(&dialog_mesh_info_wind,"MeshInfo"); // setup the controls dialog_set_text(dialog_mesh_info_wind,kMeshInfoName,0,mesh->name); dialog_set_boolean(dialog_mesh_info_wind,kMeshNoLighting,0,mesh->no_lighting); dialog_set_boolean(dialog_mesh_info_wind,kMeshAdditive,0,mesh->blend_add); dialog_set_boolean(dialog_mesh_info_wind,kMeshTintable,0,mesh->tintable); // show window ShowWindow(dialog_mesh_info_wind); // install event handler event_upp=NewEventHandlerUPP(mesh_info_event_proc); InstallWindowEventHandler(dialog_mesh_info_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL); // modal window dialog_cancel=FALSE; dialog_set_focus(dialog_mesh_info_wind,'name',0); RunAppModalLoopForWindow(dialog_mesh_info_wind); if (!dialog_cancel) { dialog_get_text(dialog_mesh_info_wind,kMeshInfoName,0,mesh->name,name_str_len); mesh->no_lighting=dialog_get_boolean(dialog_mesh_info_wind,kMeshNoLighting,0); mesh->blend_add=dialog_get_boolean(dialog_mesh_info_wind,kMeshAdditive,0); mesh->tintable=dialog_get_boolean(dialog_mesh_info_wind,kMeshTintable,0); } // close window DisposeWindow(dialog_mesh_info_wind); return(!dialog_cancel); }
void wxOverlayImpl::Reset() { if ( m_overlayContext ) { #ifndef __LP64__ OSStatus err = QDEndCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext); wxASSERT_MSG( err == noErr , _("Couldn't end the context on the overlay window") ); #endif m_overlayContext = NULL ; } // todo : don't dispose, only hide and reposition on next run if (m_overlayWindow) { DisposeWindow(m_overlayWindow); m_overlayWindow = NULL ; } }
/***************************************************** * * Handle_WindowCommandProcess(inHandlerCallRef, inEvent, inUserData) * * Purpose: called to process commands from the window controls * * Inputs: inHandlerCallRef - reference to the current handler call chain * inEvent - the event * inUserData - app-specified data you passed in the call to InstallEventHandler * * Returns: OSStatus - noErr indicates the event was handled * eventNotHandledErr indicates the event was not handled and the Toolbox should take over */ static pascal OSStatus Handle_WindowCommandProcess(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus status = eventNotHandledErr; WindowRef aWindowRef = (WindowRef)inUserData; HICommand aCommand; GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &aCommand); switch (aCommand.commandID) { case kHICommandOK: DisposeWindow(aWindowRef); status = noErr; break; } return status; } // Handle_WindowCommandProcess
pascal OSStatus driverchooser_cancel_clicked (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { TDRIVERCHOOSER *choose_t = (TDRIVERCHOOSER *) inUserData; if (choose_t) { DisposeWindow (choose_t->mainwnd); choose_t->mainwnd = NULL; /* No driver choosen ... cancel pressed */ choose_t->driver = NULL; choose_t->driverlist = NULL; Drivers_nrows = 0; } return noErr; }