这篇教程C++ CallNextEventHandler函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CallNextEventHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ CallNextEventHandler函数的具体用法?C++ CallNextEventHandler怎么用?C++ CallNextEventHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CallNextEventHandler函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: playerEvtHandlerstatic OSStatus playerEvtHandler(EventHandlerCallRef nextHdlr, EventRef thisEvt, void *pvUserData){ ControlRef cRef; ControlID cID; OSStatus iErr; UInt32 iSize, iPos; HIPoint pMouse; Rect rDims; int iPct; if ( (kEventClassWindow == GetEventClass(thisEvt)) && (kEventWindowClose == GetEventKind(thisEvt)) ) { HideWindow(g_refPlayerWin); g_bVisible = false; return noErr; } else if ( (kEventClassControl == GetEventClass(thisEvt)) && (kEventControlClick == GetEventKind(thisEvt)) ) { if (noErr != (iErr = GetEventParameter(thisEvt, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(Point), NULL, &pMouse))) { fprintf(stderr, "playerEvtHandler() - GetEventParameter(HitTest) failed, returning %lu!/n", (unsigned long) iErr); } cID.signature = FOUR_CHAR_CODE('fpos'); cID.id = 7; if (noErr == (iErr = GetControlByID(g_refPlayerWin, &cID, &cRef))) { GetControlBounds(cRef, &rDims); iSize = rDims.right - rDims.left; iPos = (UInt32) pMouse.x - rDims.left; iPct = (int) (100.0 * ((double) iPos) / ((double) iSize)); } else { fprintf(stderr, "playerEvtHandler() - GetControlByID() failed, returning %lu!/n", (unsigned long) iErr); } attemptSeekTo(iPct); return CallNextEventHandler(nextHdlr, thisEvt); } else { return CallNextEventHandler(nextHdlr, thisEvt); }}
开发者ID:ullerrm,项目名称:frogg,代码行数:49,
示例2: HITestViewInitialize// -----------------------------------------------------------------------------// HITestViewInitialize// -----------------------------------------------------------------------------// The view is constructed. Do anything necessary to initialize it.//OSStatus HITestViewInitialize( EventHandlerCallRef inCallRef, EventRef inEvent, HITestViewData* inData ){ OSStatus err; // Let any parent classes have a chance at initialization err = CallNextEventHandler( inCallRef, inEvent ); require_noerr( err, TroubleInSuperClass ); // Extract the bounds from the initialization event err = GetEventParameter( inEvent, 'redx', typeFloat, NULL, sizeof( float ), NULL, &inData->red ); require_noerr( err, ParameterMissing ); err = GetEventParameter( inEvent, 'gren', typeFloat, NULL, sizeof( float ), NULL, &inData->green ); require_noerr( err, ParameterMissing ); err = GetEventParameter( inEvent, 'blue', typeFloat, NULL, sizeof( float ), NULL, &inData->blue ); require_noerr( err, ParameterMissing ); ParameterMissing:TroubleInSuperClass: return err;}
开发者ID:arnelh,项目名称:Examples,代码行数:31,
示例3: GetEventParameter//------------------------------------------------------------------------pascal OSStatus pxWindowNative::doKeyUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ char key_code; char char_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); UInt32 kc; GetEventParameter (theEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &kc);// printf("VK UP: %lx/n", kc); pxWindowNative* w = (pxWindowNative*)userData; if (kc == 0x24) kc = 0x4c; unsigned long flags = 0; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; w->onKeyUp(kc, flags); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:dtbinh,项目名称:pxcore,代码行数:28,
示例4: DoMouseUp//------------------------------------------------------------------------pascal OSStatus DoMouseUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ Point wheresMyMouse; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse); GlobalToLocal (&wheresMyMouse); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast<platform_support*>(userData); app->m_specific->m_cur_x = wheresMyMouse.h; if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v; } else { app->m_specific->m_cur_y = wheresMyMouse.v; } app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier); if(app->m_ctrls.on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } app->on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:35,
示例5: EventHandlerstatic pascal OSStatus EventHandler( EventHandlerCallRef nextHandler, /* I - Next handler to call */ EventRef event, /* I - Event reference */ void *userData) /* I - User data (not used) */{ UInt32 kind; /* Kind of event */ Rect rect; /* New window size */ EventMouseButton button; /* Mouse button */ Point point; /* Mouse position */ kind = GetEventKind(event); switch (kind) { case kEventWindowBoundsChanged: GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &rect); if (aglContext) aglUpdateContext(aglContext); altEngine.resize(rect.right - rect.left, rect.bottom - rect.top); break; case kEventWindowShown: WindowVisible = 1; break; case kEventWindowHidden: WindowVisible = 0; break; case kEventMouseDown: GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button); GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); //MouseFunc(button, 0, point.h, point.v); break; case kEventMouseUp: GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button); GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); //MouseFunc(button, 1, point.h, point.v); break; case kEventMouseDragged: GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); //MotionFunc(point.h, point.v); break; case kEventWindowClose: altEngine.destroy(); ExitToShell(); break; default: return CallNextEventHandler(nextHandler, event); } return noErr;}
开发者ID:akw0088,项目名称:rigid,代码行数:60,
示例6: CallNextEventHandlerpascal OSStatus pxWindowNative::doWindowClosed(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ pxWindowNative* w = (pxWindowNative*)userData; w->onClose(); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:dtbinh,项目名称:pxcore,代码行数:7,
示例7: GetEventParameterpascal OSStatusCOSXScreenSaver::launchTerminationCallback( EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ OSStatus result; ProcessSerialNumber psn; EventParamType actualType; UInt32 actualSize; result = GetEventParameter(theEvent, kEventParamProcessID, typeProcessSerialNumber, &actualType, sizeof(psn), &actualSize, &psn); if ((result == noErr) && (actualSize > 0) && (actualType == typeProcessSerialNumber)) { COSXScreenSaver* screenSaver = (COSXScreenSaver*)userData; UInt32 eventKind = GetEventKind(theEvent); if (eventKind == kEventAppLaunched) { screenSaver->processLaunched(psn); } else if (eventKind == kEventAppTerminated) { screenSaver->processTerminated(psn); } } return (CallNextEventHandler(nextHandler, theEvent));}
开发者ID:ali1234,项目名称:synergy-old,代码行数:28,
示例8: OvalsDrawEventHandler/*OvalsDrawEventHandler : Handles the draw events for the "Ovals" window.Parameter DescriptionsinHandler : A reference to the current handler call chain. This is passed to your handler so that you can call CallNextEventHandler if you need to.inEvent : The event that triggered this call.inUserData : The application-specific data you passed in to InstallEventHandler.*/OSStatus OvalsDrawEventHandler (EventHandlerCallRef inHandler, EventRef inEvent, void* inUserData) { OSStatus status = eventNotHandledErr; CGContextRef context; CGRect r; //CallNextEventHandler in order to make sure the default handling of the inEvent // (drawing the white background) happens status = CallNextEventHandler( inHandler, inEvent ); require_noerr(status, CantCallNextEventHandler); // Get the CGContextRef status = GetEventParameter (inEvent, kEventParamCGContextRef, typeCGContextRef, NULL, sizeof (CGContextRef), NULL, &context); require_noerr(status, CantGetEventParameter); // Draw the outer oval in the left portion of the window r.size.height = 210; r.origin.x = 20; r.origin.y = 20; r.size.width = 210; frameOval(context, r); // Draw the inner oval in the left portion of the window r.size.height = 145; r.origin.x = 75; r.origin.y = 55; r.size.width = 100; frameOval(context, r); /* Set the fill color to green. */ CGContextSetRGBFillColor(context, 0, 1, 0, 1); // Draw and fill the outter oval in the right portion of the window r.size.height = 210; r.origin.x = 270; r.origin.y = 20; r.size.width = 210; paintOval(context, r); /* Set the fill color to yellow. */ CGContextSetRGBFillColor(context, 1, 1, 0, 1); // Draw and fill the inner oval in the right portion of the window r.size.height = 145; r.origin.x = 325; r.origin.y = 55; r.size.width = 100; paintOval(context, r);CantCallNextEventHandler:CantGetEventParameter: return status;}
开发者ID:DannyDeng2014,项目名称:CocoaSampleCode,代码行数:66,
示例9: DoWindowClose//------------------------------------------------------------------------pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ userData; QuitApplicationEventLoop (); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:9,
示例10: quit_event_handlerpascal OSStatus quit_event_handler(EventHandlerCallRef call_ref, EventRef event, void *ignore) { OSStatus err; err = CallNextEventHandler(call_ref, event); if(err == noErr) { g_quit_seen = 1; } return err;}
开发者ID:digarok,项目名称:gsplus,代码行数:9,
示例11: infoEvtHandlerstatic OSStatus infoEvtHandler(EventHandlerCallRef nextHdlr, EventRef thisEvt, void *pvUserData){ if ( (kEventClassWindow != GetEventClass(thisEvt)) || (kEventWindowClose != GetEventKind(thisEvt)) ) { return CallNextEventHandler(nextHdlr, thisEvt); } HideWindow(g_refInfoWin); g_bVisible = false; return noErr;}
开发者ID:ullerrm,项目名称:frogg,代码行数:12,
示例12: put_eventOSStatus QuartzWindow::handle_event(EventHandlerCallRef handler_call_chain, EventRef e) { put_event(e); // Hack: if this is a user-level window (not SPY) and if it is window-close, // must leave it for Self, otherwise let standard handler do it if ( myContext == NULL && GetEventClass && GetEventClass(e) == kEventClassWindow && GetEventKind(e) == kEventWindowClose ) return noErr; return CallNextEventHandler(handler_call_chain, e); // In future, could return either eventNotHandledErr or noErr}
开发者ID:ardeujho,项目名称:self,代码行数:13,
示例13: listBoxControlEventHandler// --------------------------------------------------------------------------------------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;}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:51,
示例14: DoWindowDrawContent//------------------------------------------------------------------------pascal OSStatus DoWindowDrawContent (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ platform_support * app = reinterpret_cast<platform_support*>(userData); if(app) { if(app->m_specific->m_redraw_flag) { app->on_draw(); app->m_specific->m_redraw_flag = false; } app->m_specific->display_pmap(app->m_specific->m_window, &app->rbuf_window()); } return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:17,
示例15: EventHandlerstatic 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);}
开发者ID:czbming,项目名称:libRocket,代码行数:19,
示例16: KeyEventHandler//default keyboard event handlerstatic OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData){ OSStatus result = noErr; UInt32 class = GetEventClass (event); UInt32 kind = GetEventKind (event); result = CallNextEventHandler(nextHandler, event); if(class == kEventClassKeyboard) { char macCharCodes; UInt32 macKeyCode; UInt32 macKeyModifiers; GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(macCharCodes), NULL, &macCharCodes); GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(macKeyCode), NULL, &macKeyCode); GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(macKeyModifiers), NULL, &macKeyModifiers); if(macKeyModifiers != 256) { if (kind == kEventRawKeyRepeat || kind == kEventRawKeyDown) { int key = convert_key(macKeyCode, macCharCodes); if(key != -1) mplayer_put_key(key); } } else if(macKeyModifiers == 256) { switch(macCharCodes) { case '[': SetWindowAlpha(theWindow, winAlpha-=0.05); break; case ']': SetWindowAlpha(theWindow, winAlpha+=0.05); break; } } else result = eventNotHandledErr; } return result;}
开发者ID:OpenSageTV,项目名称:mplayer-sage9orig,代码行数:42,
示例17: GetEventKindpascal OSStatusCOSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void* inUserData){ COSXScreen* screen = (COSXScreen*)inUserData; UInt32 kind = GetEventKind(theEvent); IEventQueue* events = screen->getEvents(); if (kind == kEventSystemUserSessionDeactivated) { LOG((CLOG_DEBUG "user session deactivated")); events->addEvent(CEvent(events->forIScreen().suspend(), screen->getEventTarget())); } else if (kind == kEventSystemUserSessionActivated) { LOG((CLOG_DEBUG "user session activated")); events->addEvent(CEvent(events->forIScreen().resume(), screen->getEventTarget())); } return (CallNextEventHandler(nextHandler, theEvent));}
开发者ID:rakete,项目名称:synergy-foss,代码行数:21,
示例18: HandleStarFrameObjectEvents/* Handle the messages necessary for creating the custom StarMenuFame class.*/OSStatus HandleStarFrameObjectEvents( EventHandlerCallRef inCallRef, EventRef inEvent, StarFrameData* frameData){ OSStatus err = eventNotHandledErr; switch ( GetEventKind( inEvent ) ) { case kEventHIObjectConstruct: frameData = (StarFrameData *) calloc(1, sizeof(StarFrameData)); frameData->menu = NULL; GetEventParameter(inEvent, kEventParamHIObjectInstance, typeHIObjectRef, NULL, sizeof( frameData->hiSelf ), NULL, &frameData->hiSelf ); // This important step actually associates our frameData with the view being initialized SetEventParameter(inEvent, kEventParamHIObjectInstance, typeVoidPtr, sizeof( frameData ), &frameData ); err = noErr; break; case kEventHIObjectInitialize: err = CallNextEventHandler( inCallRef, inEvent ); if ( err == noErr ) { GetEventParameter(inEvent, kEventParamMenuRef, typeMenuRef, NULL, sizeof(frameData->menu), NULL, &frameData->menu); GetEventParameter(inEvent, kEventParamMenuType, typeThemeMenuType, NULL, sizeof( frameData->menuType ), NULL, &frameData->menuType ); } err = noErr; break; case kEventHIObjectDestruct: free( (void*) frameData ); err = noErr; break; default: break; } return err;}
开发者ID:fruitsamples,项目名称:StarMenu,代码行数:44,
示例19: DoKeyUp//------------------------------------------------------------------------pascal OSStatus DoKeyUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ char key_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast<platform_support*>(userData); app->m_specific->m_last_translated_key = 0; switch(modifier) { case controlKey: app->m_specific->m_input_flags &= ~kbd_ctrl; break; case shiftKey: app->m_specific->m_input_flags &= ~kbd_shift; break; } return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:25,
示例20: DoKeyDown//------------------------------------------------------------------------pascal OSStatus DoKeyDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ char key_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast<platform_support*>(userData); app->m_specific->m_last_translated_key = 0; switch(modifier) { case controlKey: app->m_specific->m_input_flags |= kbd_ctrl; break; case shiftKey: app->m_specific->m_input_flags |= kbd_shift; break; default: app->m_specific->translate(key_code); break; } if(app->m_specific->m_last_translated_key) { bool left = false; bool up = false; bool right = false; bool down = false; switch(app->m_specific->m_last_translated_key) { case key_left: left = true; break; case key_up: up = true; break; case key_right: right = true; break; case key_down: down = true; break; //On a Mac, screenshots are handled by the system. case key_f2: app->copy_window_to_img(agg::platform_support::max_images - 1); app->save_img(agg::platform_support::max_images - 1, "screenshot"); break; } if(app->m_ctrls.on_arrow_keys(left, right, down, up)) { app->on_ctrl_change(); app->force_redraw(); } else { app->on_key(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_last_translated_key, app->m_specific->m_input_flags); } } return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:76,
示例21: CallNextEventHandlerOSStatus CL_DisplayWindow_OpenGL::on_window_event(EventHandlerCallRef call_ref, EventRef event_ref, void *user_data){ CL_DisplayWindow_OpenGL *self = (CL_DisplayWindow_OpenGL *) user_data; OSStatus result = CallNextEventHandler(call_ref, event_ref); UInt32 event_class = GetEventClass(event_ref); UInt32 event_kind = GetEventKind(event_ref); if (event_class == kEventClassKeyboard) { Point mouse_pos; UInt32 key_modifiers = 0; UInt32 click_count = 0; UInt32 key_code = 0; // Todo: // KeyboardLayoutRef layout; // KLGetCurrentKeyboardLayout(&layout); // KLGetKeyboardLayoutProperty(layout, kKLuchrData, &data); // call UCKeyTranslate to get unicode string for keys being pressed. GetMouse(&mouse_pos); GetEventParameter(event_ref, kEventParamKeyModifiers, typeUInt32, 0, sizeof(UInt32), 0, &key_modifiers); GetEventParameter(event_ref, kEventParamKeyCode, typeUInt32, 0, sizeof(UInt32), 0, &key_code); GetEventParameter(event_ref, kEventParamClickCount, typeUInt32, 0, sizeof(UInt32), 0, &click_count); if (!self->fullscreen) { Rect wbounds; GetWindowBounds(self->window_ref, kWindowContentRgn, &wbounds); mouse_pos.h -= wbounds.left; mouse_pos.v -= wbounds.top; } static unsigned long state = 0; static Ptr keymap = nil; Ptr new_keymap; // Get the current keyboard map resource new_keymap = (Ptr)GetScriptManagerVariable(smKCHRCache); if (new_keymap != keymap) { keymap = new_keymap; state = 0; } CL_InputEvent event; event.str = KeyTranslate(keymap, key_code|key_modifiers, &state) & 0xffff; event.device = self->keyboard; event.mouse_pos = CL_Point(mouse_pos.h, mouse_pos.v); event.repeat_count = click_count; self->mouse_pos = event.mouse_pos; // if kEventParamMouseLocation is not valid here, reverse this. switch (event_kind) { case kEventRawKeyModifiersChanged: { std::set<int> current_keys = modifiercode_to_clkeys(key_modifiers); for (std::set<int>::iterator i=current_keys.begin(); i!=current_keys.end(); i++) { if (!self->prev_modifier_keys.count(*i)) { event.id = *i; event.type = CL_InputEvent::pressed; self->keyboard.sig_key_down().call(event); } } for (std::set<int>::iterator i=self->prev_modifier_keys.begin(); i!=self->prev_modifier_keys.end(); i++) { if (!current_keys.count(*i)) { event.id = *i; event.type = CL_InputEvent::released; self->keyboard.sig_key_up().call(event); } } self->prev_modifier_keys = current_keys; return noErr; } case kEventRawKeyDown: // first tests for cmd-q(12) or cmd-w(13) to close the window if needed if ((key_modifiers & cmdKey) && (key_code==12 || key_code==13)) { EventRef close_event; CreateEvent(NULL, kEventClassWindow, kEventWindowClose, 0, kEventAttributeNone, &close_event); EventTargetRef target = GetWindowEventTarget(self->window_ref); SendEventToEventTarget(close_event, target); return noErr; } else { event.id = keycode_to_clkey(key_code); event.type = CL_InputEvent::pressed; self->keyboard.sig_key_down().call(event); return noErr; } case kEventRawKeyRepeat://.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:101,
示例22: windowEventHandlerstatic pascal OSStatus windowEventHandler(EventHandlerCallRef nextHandler, EventRef theEvent, void *inUserData){ CvWindow* window = NULL; UInt32 eventKind, eventClass; OSErr err = noErr; int event = 0; UInt32 count = 0; HIPoint point = {0,0}; EventMouseButton eventMouseButton = 0;//FD UInt32 modifiers;//FD WindowRef theWindow = (WindowRef)inUserData; if (theWindow == NULL) return eventNotHandledErr; window = icvWindowByHandle(theWindow); if ( window == NULL) return eventNotHandledErr; eventKind = GetEventKind(theEvent); eventClass = GetEventClass(theEvent); switch (eventClass) { case kEventClassMouse : { switch (eventKind){ case kEventMouseUp : case kEventMouseDown : case kEventMouseMoved : { err = CallNextEventHandler(nextHandler, theEvent); if (err != eventNotHandledErr) return err; err = GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(eventMouseButton), NULL, &eventMouseButton); err = GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); err = GetEventParameter(theEvent,kEventParamClickCount,typeUInt32,NULL,sizeof(UInt32),NULL,&count); if (err == noErr){ if (count >1) event += 6; } else { event = CV_EVENT_MOUSEMOVE; } if (eventKind == kEventMouseUp) event +=4; if (eventKind == kEventMouseDown) event +=1; err = GetEventParameter(theEvent, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(point), NULL, &point); if (eventKind != kEventMouseMoved){ switch(eventMouseButton){ case kEventMouseButtonPrimary: if (modifiers & controlKey) /* ctrl-click for right button */ event += 1; break; case kEventMouseButtonSecondary: event += 1; break; case kEventMouseButtonTertiary: event += 2; break; } } int c = icvCountTrackbarInWindow(window); if (window->on_mouse != NULL){ int lx,ly; Rect structure, content; GetWindowBounds(theWindow, kWindowStructureRgn, &structure); GetWindowBounds(theWindow, kWindowContentRgn, &content); lx = point.x - content.left + structure.left; ly = point.y - window->trackbarheight - content.top + structure.top; /* minus la taille des trackbars */ if (window->flags & CV_WINDOW_AUTOSIZE) {//FD //printf("was %d,%d/n", lx, ly); /* scale the mouse coordinates */ lx = lx * window->imageWidth / (content.right - content.left); ly = ly * window->imageHeight / (content.bottom - content.top - window->trackbarheight); //printf("now %d,%d/n", lx, ly); } //fprintf(stdout,"final OpenCV event is %d/n",event); //fprintf(stdout,"event @ %d %d which is localy %d %d offset of %d/n",point.h, point.v ,lx,ly,yOffset); if (lx>0 && ly >0){ /* a remettre dans les coordonn C++ CallProtoService函数代码示例 C++ CallMethod函数代码示例
|