當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetEventKind函數代碼示例

本文整理匯總了C++中GetEventKind函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetEventKind函數的具體用法?C++ GetEventKind怎麽用?C++ GetEventKind使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetEventKind函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: TextInputEventHandler

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 ;
}
開發者ID:Duion,項目名稱:Torsion,代碼行數:51,代碼來源:toplevel.cpp

示例2: wxMacAppMenuEventHandler

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;
}
開發者ID:gitrider,項目名稱:wxsj2,代碼行數:50,代碼來源:app.cpp

示例3: CarbonEventHandlerProc

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;
}
開發者ID:aosm,項目名稱:tcl,代碼行數:50,代碼來源:tkMacOSXCarbonEvents.c

示例4: HIOpenGLViewEventControl

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;
    }
}
開發者ID:toddlipcon,項目名稱:PScope,代碼行數:14,代碼來源:HIOpenGLView.cpp

示例5: EventHandler

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;
}
開發者ID:ruthmagnus,項目名稱:audacity,代碼行數:14,代碼來源:VSTEffect.cpp

示例6: qxt_mac_handle_hot_key

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;
}
開發者ID:CelineThiry,項目名稱:MellowPlayer,代碼行數:14,代碼來源:qxtglobalshortcut_mac.cpp

示例7: keyHandler

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;
}
開發者ID:DORARA29,項目名稱:AtomManipulator,代碼行數:14,代碼來源:window_carbon.cpp

示例8: handleEvents

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;
}
開發者ID:MattTuttle,項目名稱:neko,代碼行數:14,代碼來源:ui.c

示例9: 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,代碼來源:PrefsDialog.c

示例10: FilterFieldEventHandler

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);
}
開發者ID:partition,項目名稱:kadu,代碼行數:14,代碼來源:filter-widget.cpp

示例11: event

// ---------------------------------------------------------------------------
// 
// -----------
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));
}
開發者ID:CarteBlancheConseil,項目名稱:MacMap,代碼行數:17,代碼來源:bToolPrintArea.cpp

示例12: DefaultEventHandler

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);
}
開發者ID:OV2,項目名稱:snes9x-libsnes,代碼行數:36,代碼來源:mac-dialog.cpp

示例13: GetEventClass

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;
}
開發者ID:kdridi,項目名稱:acau,代碼行數:15,代碼來源:AUCarbonViewControl.cpp

示例14: StatusWindowEventHandler

/* 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;
}
開發者ID:dyne,項目名稱:MuSE,代碼行數:16,代碼來源:carbon_gui.cpp

示例15: event

// ---------------------------------------------------------------------------
//
// -----------
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);
}
開發者ID:CarteBlancheConseil,項目名稱:Instances,代碼行數:18,代碼來源:bXMapTopoCheck.cpp


注:本文中的GetEventKind函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。