static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; wxWindow* focus = wxWindow::FindFocus() ; char charCode ; UInt32 keyCode ; UInt32 modifiers ; Point point ; EventRef rawEvent ; GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ; GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode ); GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof( Point ), NULL, &point ); switch ( GetEventKind( event ) ) { case kEventTextInputUnicodeForKeyEvent : // this is only called when no default handler has jumped in, eg a wxControl on a floater window does not // get its own kEventTextInputUnicodeForKeyEvent, so we route back the wxControl* control = wxDynamicCast( focus , wxControl ) ; if ( control ) { ControlHandle macControl = (ControlHandle) control->GetMacControl() ; if ( macControl ) { ::HandleControlKey( macControl , keyCode , charCode , modifiers ) ; result = noErr ; } } /* // this may lead to double events sent to a window in case all handlers have skipped the key down event UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; UInt32 message = (keyCode << 8) + charCode; if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( focus , message , modifiers , when , point.h , point.v ) ) { result = noErr ; } */ break ; } return result ; }
static pascal OSStatus wxMacAppMenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { wxMacCarbonEvent cEvent( event ) ; MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ; wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ; if ( menu ) { wxEventType type=0; MenuCommand cmd=0; switch (GetEventKind(event)) { case kEventMenuOpening: type = wxEVT_MENU_OPEN; break; case kEventMenuClosed: type = wxEVT_MENU_CLOSE; break; case kEventMenuTargetItem: cmd = cEvent.GetParameter<MenuCommand>(kEventParamMenuCommand,typeMenuCommand) ; if (cmd != 0) type = wxEVT_MENU_HIGHLIGHT; break; default: wxFAIL_MSG(wxT("Unexpected menu event kind")); break; } if ( type ) { wxMenuEvent wxevent(type, cmd, menu); wxevent.SetEventObject(menu); wxEvtHandler* handler = menu->GetEventHandler(); if (handler && handler->ProcessEvent(wxevent)) { // handled } else { wxWindow *win = menu->GetInvokingWindow(); if (win) win->GetEventHandler()->ProcessEvent(wxevent); } } } return eventNotHandledErr; }
static OSStatus CarbonEventHandlerProc( EventHandlerCallRef callRef, EventRef event, void *userData) { OSStatus err = eventNotHandledErr; TkMacOSXEvent macEvent; MacEventStatus eventStatus; macEvent.eventRef = event; macEvent.eClass = GetEventClass(event); macEvent.eKind = GetEventKind(event); macEvent.interp = (Tcl_Interp *) userData; macEvent.callRef = callRef; bzero(&eventStatus, sizeof(eventStatus)); #ifdef TK_MAC_DEBUG_CARBON_EVENTS if (!(macEvent.eClass == kEventClassMouse && ( macEvent.eKind == kEventMouseMoved || macEvent.eKind == kEventMouseDragged))) { TkMacOSXDbgMsg("Started handling %s", TkMacOSXCarbonEventToAscii(event)); TkMacOSXInitNamedDebugSymbol(HIToolbox, void, _DebugPrintEvent, EventRef inEvent); if (_DebugPrintEvent) { /* * Carbon-internal event debugging (c.f. Technote 2124) */ _DebugPrintEvent(event); } } #endif /* TK_MAC_DEBUG_CARBON_EVENTS */ TkMacOSXProcessEvent(&macEvent,&eventStatus); if (eventStatus.stopProcessing) { err = noErr; } #ifdef TK_MAC_DEBUG_CARBON_EVENTS if (macEvent.eKind != kEventMouseMoved && macEvent.eKind != kEventMouseDragged) { TkMacOSXDbgMsg("Finished handling %s: %s handled", TkMacOSXCarbonEventToAscii(event), eventStatus.stopProcessing ? " " : "not"); } #endif /* TK_MAC_DEBUG_CARBON_EVENTS */ return err; }
OSStatus HIOpenGLViewEventControl (EventHandlerCallRef inCall, EventRef inEvent, HIOpenGLViewData* inData) { fprintf(stderr, "HIOpenGLViewEventControl\n"); switch (GetEventKind(inEvent)) { case kEventControlInitialize: return HIOpenGLViewEventControlInitialize(inCall, inEvent, inData); break; case kEventControlDraw: return HIOpenGLViewEventControlDraw(inCall, inEvent, inData); break; case kEventControlHitTest: return HIOpenGLViewEventControlHitTest(inCall, inEvent, inData); break; case kEventControlHiliteChanged: return HIOpenGLViewEventControlHiliteChanged(inCall, inEvent, inData); break; case kEventControlBoundsChanged: return HIOpenGLViewEventControlBoundsChanged(inCall, inEvent, inData); break; case kEventControlOwningWindowChanged: return HIOpenGLViewEventControlOwningWindowChanged(inCall, inEvent, inData); break; default: return eventNotHandledErr; break; } }
static pascal OSStatus EventHandler(EventHandlerCallRef handler, EventRef event, void *data) { OSStatus result = eventNotHandledErr; VSTEffectDialog *dlg = (VSTEffectDialog *)data; if (GetEventClass(event) == kEventClassWindow && GetEventKind(event) == kEventWindowClose) { dlg->RemoveHandler(); dlg->Close(); result = noErr; } return result; }
OSStatus qxt_mac_handle_hot_key(EventHandlerCallRef nextHandler, EventRef event, void *data) { Q_UNUSED(nextHandler); Q_UNUSED(data); if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed) { EventHotKeyID keyID; GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(keyID), NULL, &keyID); Identifier id = keyIDs.key(keyID.id); QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first); } return noErr; }
OSStatus keyHandler(EventHandlerCallRef hcr, EventRef theEvent, void* inUserData) { UInt32 eventKind; UInt32 eventClass; OSErr err = noErr; eventKind = GetEventKind (theEvent); eventClass = GetEventClass (theEvent); err = GetEventParameter(theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(lastKey), NULL, &lastKey); if (err != noErr) lastKey = NO_KEY; return noErr; }
static OSStatus handleEvents( EventHandlerCallRef ref, EventRef e, void *data ) { switch( GetEventKind(e) ) { case eCall: { value *r; value f; GetEventParameter(e,pFunc,typeVoidPtr,0,sizeof(void*),0,&r); f = *r; free_root(r); val_call0(f); break; } } return 0; }
// -------------------------------------------------------------------------------------- static pascal OSStatus listBoxControlEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *prefsDialog) { OSStatus result = eventNotHandledErr; UInt32 eventClass, eventKind; DialogRef dialog; WindowRef dialogWindow; eventClass = GetEventClass(event); eventKind = GetEventKind(event); switch (eventClass) { case kEventClassTextInput: switch (eventKind) { case kEventTextInputUnicodeForKeyEvent: /* The strategy here is to first let the default handler handle the event (i.e. change the selected cell in the category list box control), then react to that change by showing the correct category panel. However the key pressed could potentially cause the default or cancel button to get hit. In this case, our window handler will be called which will dispose of the dialog. If this is the case, we need to not postprocess the event. We will test for this by getting the dialog's window, retaining it, calling the default handler, then getting the window's retain count. If the retain count is back to 1, then we know the dialog is already disposed. */ dialog = (DialogRef)prefsDialog; dialogWindow = GetDialogWindow(dialog); RetainWindow(dialogWindow); // hold onto the dialog's window result = CallNextEventHandler(nextHandler, event); if (result == noErr) // we don't need to postprocess if nothing happened { ItemCount retainCount; retainCount = GetWindowRetainCount(dialogWindow); if (retainCount > 1) // if we're the last one holding the window handleDialogItemHit(dialog, iIconList); // then there's no } // need to postprocess anything because it's about to go away ReleaseWindow(dialogWindow); break; } break; } return result; }
static OSStatus FilterFieldEventHandler(EventHandlerCallRef handlerCallRef, EventRef event, void *userData) { Q_UNUSED(handlerCallRef); FilterWidget *filter = (FilterWidget *) userData; OSType eventClass = GetEventClass(event); UInt32 eventKind = GetEventKind(event); if (eventClass == kEventClassSearchField && eventKind == kEventSearchFieldCancelClicked) filter->clear(); else if (eventClass == kEventClassTextField && eventKind == kEventTextDidChange) filter->emitTextChanged(); return (eventNotHandledErr); }
// --------------------------------------------------------------------------- // // ----------- bool bToolPrintArea::event(EventRef evt){ UInt32 clss=GetEventClass(evt); if(clss==kEventClassWindow){ UInt32 kind=GetEventKind(evt); switch(kind){ case kEventWindowDrawContent: case kEventWindowUpdate: update(false); return(true); break; } } return(bStdToolPres::event(evt)); }
pascal OSStatus DefaultEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { case kEventCommandUpdateStatus: HICommand tHICommand; err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } } break; } return (result); }
bool AUPropertyControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event) { UInt32 eclass = GetEventClass(event); UInt32 ekind = GetEventKind(event); switch (eclass) { case kEventClassControl: switch (ekind) { case kEventControlValueFieldChanged: HandleControlChange(); return true; // handled } } return false; }
/* EVENT HANDLER */ static OSStatus StatusWindowEventHandler ( EventHandlerCallRef nextHandler, EventRef event, void *userData) { OSStatus err = noErr; CARBON_GUI *me = (CARBON_GUI *)userData; switch (GetEventKind (event)) { case kEventWindowClose: me->showStatus(false); break; default: break; } return err; }
// --------------------------------------------------------------------------- // // ----------- bool bXMapTopoCheck::event(EventRef evt){ UInt32 clss=GetEventClass(evt); if(clss==kEventClassMacMap){ UInt32 kind=GetEventKind(evt); switch(kind){ case kEventMacMapDataBase: check_events(); break; default: break; } } return(false); }
static pascal OSStatus wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *WXUNUSED(data) ) { wxMacCarbonEvent cEvent( event ) ; MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ; #ifndef __WXUNIVERSAL__ wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ; if ( menu ) { switch (GetEventKind(event)) { case kEventMenuOpening: menu->HandleMenuOpened(); break; case kEventMenuClosed: menu->HandleMenuClosed(); break; case kEventMenuTargetItem: { HICommand command ; command.menu.menuRef = menuRef; command.menu.menuItemIndex = cEvent.GetParameter<MenuItemIndex>(kEventParamMenuItemIndex,typeMenuItemIndex) ; command.commandID = cEvent.GetParameter<MenuCommand>(kEventParamMenuCommand,typeMenuCommand) ; if (command.commandID != 0) { wxMenuItem* item = NULL ; wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ; if ( itemMenu && item ) itemMenu->HandleMenuItemHighlighted( item ); } } break; default: wxFAIL_MSG(wxT("Unexpected menu event kind")); break; } } #endif return eventNotHandledErr; }
OSStatus QuartzEventHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData ) { OSStatus err = eventNotHandledErr; UInt32 eventKind = GetEventKind( inEvent ), RWinCode, devsize; int devnum; WindowRef EventWindow; EventRef REvent; NewDevDesc *dd; if( GetEventClass(inEvent) != kEventClassWindow) return(err); GetEventParameter(inEvent, kEventParamDirectObject, typeWindowRef, NULL, sizeof(EventWindow), NULL, &EventWindow); if(GetWindowProperty(EventWindow, kRAppSignature, 'QRTZ', sizeof(int), NULL, &devnum) != noErr) return eventNotHandledErr; switch(eventKind){ case kEventWindowClose: { KillDevice(GetDevice(devnum)); err= noErr; } break; case kEventWindowBoundsChanged: if( (dd = ((GEDevDesc*) GetDevice(devnum))->dev) ){ QuartzDesc *xd = (QuartzDesc *) dd-> deviceSpecific; Rect portRect; GetWindowPortBounds ( xd->window, & portRect ) ; if( (xd->windowWidth != portRect.right) || (xd->windowHeight != portRect.bottom) ){ xd->resize = true; dd->size(&(dd->left), &(dd->right), &(dd->bottom), &(dd->top), dd); xd->resize = false; GEplayDisplayList((GEDevDesc*) GetDevice(devnum)); } err = noErr; } break; default: break; } return err; }
static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; wxMacCarbonEvent cEvent( event ) ; ControlRef controlRef ; cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; switch( GetEventKind( event ) ) { case kEventControlHit : { wxToolBarTool* tbartool = (wxToolBarTool*)data ; if ( tbartool->CanBeToggled() ) { #ifdef __WXMAC_OSX__ ((wxToolBar*)tbartool->GetToolBar())->ToggleTool(tbartool->GetId(), !tbartool->IsToggled() ); #else ((wxToolBar*)tbartool->GetToolBar())->ToggleTool(tbartool->GetId(), GetControl32BitValue((ControlRef)tbartool->GetControlHandle())); #endif } ((wxToolBar*)tbartool->GetToolBar())->OnLeftClick( tbartool->GetId() , tbartool -> IsToggled() ) ; result = noErr; } break ; #ifdef __WXMAC_OSX__ case kEventControlHitTest : { HIPoint pt = cEvent.GetParameter<HIPoint>(kEventParamMouseLocation) ; HIRect rect ; HIViewGetBounds( controlRef , &rect ) ; ControlPartCode pc = kControlNoPart ; if ( CGRectContainsPoint( rect , pt ) ) pc = kControlIconPart ; cEvent.SetParameter( kEventParamControlPart , typeControlPartCode, pc ) ; result = noErr ; } break ; #endif default : break ; } return result ; }
pascal OSStatus gelatineRendererEventHandler(EventHandlerCallRef handler, EventRef event, void* userData) { OSStatus result = eventNotHandledErr; GelatinePaneView* view = reinterpret_cast <GelatinePaneView*> (userData); UInt32 eventKind = GetEventKind(event); switch (eventKind) { case kEventControlInitialize: view->init(); break; case kEventControlDispose: view->dispose(); break; case kEventControlActivate: view->swapPortsAndDisplay(); break; case kEventControlDeactivate: break; case kEventControlDraw: view->swapPortsAndDisplay(); break; case kEventControlBoundsChanged: Rect* controlRect = view->getModel()._bounds; Rect portRect; GetWindowPortBounds(view->getModel().getWindowRef(), &portRect); InvalWindowRect(view->getModel().getWindowRef(), &portRect); view->resize(controlRect->left, controlRect->top, controlRect->right, controlRect->bottom); view->swapPortsAndDisplay(); break; } return result; }
OSStatus TabbedWindow::WindowHandleControlEvent( EventHandlerCallRef handler, EventRef event ) { OSStatus status = eventNotHandledErr; // grab the controlRef out of the event ControlRef controlHitRef; status = GetEventParameter( event, kEventParamDirectObject, typeControlRef, NULL, sizeof( ControlRef ), NULL, (void *) &controlHitRef ); require_noerr( status, HandleControlEvent_err ); // grab the id out of the event ControlID controlHitID; status = GetControlID( controlHitRef, &controlHitID ); require_noerr( status, HandleControlEvent_err ); status = eventNotHandledErr; switch( GetEventKind( event ) ) { // we only handle the kEventControlHit control event case kEventControlHit: { // check to see if the control hit was our happy tab thingy switch( controlHitID.signature ) { case kMasterTabControlSignature: status = this->SwitchTabPane( controlHitRef ); //check_noerr( status ); break; default: std::cout << "Some other unidentified control was hit" << std::endl; status = eventNotHandledErr; break; } } break; default: status = eventNotHandledErr; break; } HandleControlEvent_err: return status; }
static OSStatus VumeterWindowEventHandler ( EventHandlerCallRef nextHandler, EventRef event, void *userData) { OSStatus err = noErr; CARBON_GUI *me = (CARBON_GUI *)userData; switch (GetEventKind (event)) { case kEventWindowClose: SetControlValue(mainControls[VOL_BUT],0); me->showVumeters(false); break; default: err = eventNotHandledErr; break; } return err; }
static pascal OSStatus NPClientSheetEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { if (!npclient.dialogsheet) return (eventNotHandledErr); OSStatus err, result = eventNotHandledErr; switch (GetEventClass(inEvent)) { case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'ok ': npclient.dialogprocess = kNPCDialogDone; result = noErr; break; } } break; } break; } return (result); }
static pascal OSStatus WinEventHandler( EventHandlerCallRef handler, EventRef event, void *data ) { GenericWindow *pWin = (GenericWindow*)data; intf_thread_t *pIntf = pWin->getIntf(); //fprintf(stderr, "event\n" ); UInt32 evclass = GetEventClass( event ); UInt32 evkind = GetEventKind( event ); switch( evclass ) { case kEventClassWindow: EvtRefresh evt( pIntf, 0, 0, -1, -1); pWin->processEvent( evt ); break; } }
/***************************************************** * * UserPaneHandler(inHandlerCallRef, inEvent, inUserData) * * Purpose: called to handle the UserPane used as an embedder in the HIScrollView * * 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 UserPaneHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData) { OSStatus status = eventNotHandledErr; HIViewRef userPane = (HIViewRef)inUserData; HIRect bounds; HIViewGetBounds(userPane, &bounds); // the following is a very straightforward simple yet complete implementation of the // kEventClassScrollable protocol which is enough to make the User Pane scrolls along its embedded content switch (GetEventKind(inEvent)) { #pragma mark * kEventScrollableGetInfo case kEventScrollableGetInfo: { // we're being asked to return information about the scrolled view that we set as Event Parameters HISize lineSize = { 1, 1 }, imageSize = {3000, 2000}; SetEventParameter(inEvent, kEventParamViewSize, typeHISize, sizeof(bounds.size), &bounds.size); SetEventParameter(inEvent, kEventParamImageSize, typeHISize, sizeof(imageSize), &imageSize); SetEventParameter(inEvent, kEventParamLineSize, typeHISize, sizeof(lineSize), &lineSize); SetEventParameter(inEvent, kEventParamOrigin, typeHIPoint, sizeof(bounds.origin), &bounds.origin); status = noErr; break; } #pragma mark * kEventScrollableScrollTo case kEventScrollableScrollTo: { // we're being asked to scroll, we just do a sanity check and ask for a redraw if the location is different HIPoint where; GetEventParameter(inEvent, kEventParamOrigin, typeHIPoint, NULL, sizeof(where), NULL, &where); if ((bounds.origin.y != where.y) || (bounds.origin.x != where.x)) { HIViewSetBoundsOrigin(userPane, where.x, where.y); HIViewSetNeedsDisplay(userPane, true); } status = noErr; break; } } } // UserPaneHandler
static OSStatus EventHandler(EventHandlerCallRef next_handler, EventRef event, void* p) { switch (GetEventClass(event)) { case kEventClassWindow: { switch (GetEventKind(event)) { case kEventWindowClose: Shell::RequestExit(); break; } } break; } // InputMacOSX::ProcessCarbonEvent(event); return CallNextEventHandler(next_handler, event); }
static int ReceiveAndProcessEvent() { TkMacOSXEvent macEvent; MacEventStatus eventStatus; int err; char buf [ 256 ]; /* * This is a poll, since we have already counted the events coming * into this routine, and are guaranteed to have one waiting. */ err = ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &macEvent.eventRef); if (err != noErr) { return err; } else { macEvent.eClass = GetEventClass(macEvent.eventRef); macEvent.eKind = GetEventKind(macEvent.eventRef); bzero(&eventStatus, sizeof(eventStatus)); TkMacOSXProcessEvent(&macEvent,&eventStatus); if (!eventStatus.stopProcessing) { if (!targetRef) { targetRef = GetEventDispatcherTarget(); } err = SendEventToEventTarget(macEvent.eventRef,targetRef); if (err != noErr #if !TK_MAC_DEBUG && err != eventNotHandledErr #endif ) { fprintf(stderr, "RCNE SendEventToEventTarget (%s) failed, %d\n", CarbonEventToAscii(macEvent.eventRef, buf),err); } } ReleaseEvent(macEvent.eventRef); return 0; } }
static pascal OSStatus OverlayWindowEventHandlerProc( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData ) { #pragma unused( inCallRef ) Rect windowRect; CGRect box; CGContextRef cgContext; UInt32 eventKind = GetEventKind( inEvent ); UInt32 eventClass = GetEventClass( inEvent ); OSStatus err = eventNotHandledErr; WindowStorage *windowStorage = (WindowStorage*) inUserData; switch ( eventClass ) { case kEventClassWindow: if ( eventKind == kEventWindowClose ) { windowStorage->overlayWindow = NULL; // Let the default handler DisposeWindow() for us, just set our WindowRef to NULL } else if ( (eventKind == kEventWindowBoundsChanged) || (eventKind == kEventWindowShown) ) // Draw the overlay window { GetWindowPortBounds( windowStorage->overlayWindow, &windowRect ); //box.origin.x = box.origin.y = 0; //box.size.width = windowRect.right - windowRect.left; //box.size.height = windowRect.bottom - windowRect.top; box = CGRectMake( 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top ); QDBeginCGContext( GetWindowPort(windowStorage->overlayWindow), &cgContext ); CGContextClearRect( cgContext, box ); // Paint a semi-transparent box in the middle of our window box.origin.x = (windowRect.right - windowRect.left) / 4; box.size.width = (windowRect.right - windowRect.left) / 2; CGContextSetRGBFillColor( cgContext, 0.5, 0.75, 0.75, 0.2 ); CGContextFillRect( cgContext, box ); CGContextFlush( cgContext ); QDEndCGContext( GetWindowPort(windowStorage->overlayWindow), &cgContext ); } break; } return( err ); }
static pascal OSStatus joyWinproc(EventHandlerCallRef myHandler, EventRef event, void* userData) { OSStatus err = eventNotHandledErr; HICommand cmd; if (GetEventClass(event)==kEventClassCommand && GetEventKind(event)==kEventCommandProcess ) { GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd); switch (cmd.commandID) { case 'notJ': HideSheetWindow(joyWin); DisposeWindow(joyWin); err = noErr; break; default: break; } } return err; }
pascal OSStatus COSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void* inUserData) { COSXScreen* screen = (COSXScreen*)inUserData; UInt32 kind = GetEventKind(theEvent); if (kind == kEventSystemUserSessionDeactivated) { LOG((CLOG_DEBUG "user session deactivated")); EVENTQUEUE->addEvent(CEvent(IScreen::getSuspendEvent(), screen->getEventTarget())); } else if (kind == kEventSystemUserSessionActivated) { LOG((CLOG_DEBUG "user session activated")); EVENTQUEUE->addEvent(CEvent(IScreen::getResumeEvent(), screen->getEventTarget())); } return (CallNextEventHandler(nextHandler, theEvent)); }
pascal OSStatus DefaultEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { #pragma unused (inHandlerRef) OSStatus result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; } } return result; }