当前位置: 首页>>代码示例>>C++>>正文


C++ GetEventParameter函数代码示例

本文整理汇总了C++中GetEventParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEventParameter函数的具体用法?C++ GetEventParameter怎么用?C++ GetEventParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetEventParameter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CustomEventHandler

pascal OSStatus CustomEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	DWORD id=0;
	GetEventParameter(inEvent,'evid',0,NULL,sizeof(id),NULL,&id);
	switch (id) {
		case 'open':
			SetStaticText(31,"connecting...");
			SetStaticText(30,"");
			SetStaticText(32,"");
			break;
		case 'end ':
			SetStaticText(31,"not playing");
			SetStaticText(30,"");
			SetStaticText(32,"");
			break;
		case 'stat':
			{
				char *status;
				GetEventParameter(inEvent,'data',0,NULL,sizeof(status),NULL,&status);
				SetStaticText(32,status); // display connection status
				free(status);
			}
			break;
		case 'meta':
			DoMeta();
			break;
	}
	return noErr;
}
开发者ID:bagnz0r,项目名称:ichigo-audio,代码行数:29,代码来源:netradio.c

示例2: 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,代码来源:agg_platform_support.cpp

示例3: NPServerDialogEventHandler

static pascal OSStatus NPServerDialogEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	OSStatus	err, result = eventNotHandledErr;
	WindowRef	tWindowRef = (WindowRef) inUserData;

	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 'OKAY':
								HIViewRef	ctl, root;
								HIViewID	cid;

								root = HIViewGetRoot(tWindowRef);
								cid.id = 0;
								cid.signature = 'OKAY';
								HIViewFindByID(root, cid, &ctl);
								DeactivateControl(ctl);
								cid.signature = 'CNSL';
								HIViewFindByID(root, cid, &ctl);
								DeactivateControl(ctl);

								npserver.dialogprocess = kNPSDialogProcess;
								result = noErr;
								break;

							case 'CNSL':
								npserver.dialogprocess = kNPSDialogCancel;
								result = noErr;
								break;
						}
					}

					break;
			}

			break;
	}

	return (result);
}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:60,代码来源:mac-server.cpp

示例4: GetEventParameter

pascal OSStatus pxWindowNative::doMouseUp(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	pxWindowNative* w = (pxWindowNative*)userData;
	
	Point loc;
	UInt16 button;
	UInt32 modifier;
	
	GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc);
	SetPort(GetWindowPort(w->mWindowRef));
	GlobalToLocal(&loc);
	GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
	GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier);	
	
	unsigned long flags = 0;

	if (button == kEventMouseButtonPrimary) flags |= PX_LEFTBUTTON;
	else if (button == kEventMouseButtonSecondary) flags |= PX_RIGHTBUTTON;
	else if (button == kEventMouseButtonTertiary) flags |= PX_MIDDLEBUTTON;
	
	if (modifier & shiftKey) flags |= PX_MOD_SHIFT;
	if (modifier & optionKey) flags |= PX_MOD_ALT;
	if (modifier & controlKey) flags |= PX_MOD_CONTROL;

	w->onMouseUp(loc.h, loc.v, flags);

	return CallNextEventHandler (nextHandler, theEvent);
}	
开发者ID:dtbinh,项目名称:pxcore,代码行数:28,代码来源:pxWindowNative.cpp

示例5: handle_unicode

static OSStatus
handle_unicode(EventRef event)
{
	UInt32 actual_size, i;
	UniChar *text;
	UniCharCount num_chars;
	OSStatus result = noErr;

	// hack to keep sequences like Cmd+f from writing to buffer
	if(! cmdPressed) {
		result = GetEventParameter (event, kEventParamTextInputSendText,
								typeUnicodeText, NULL, 0, &actual_size, NULL);
		if(result == noErr) {
			text = (UniChar*) NewPtr(actual_size);
			result = GetEventParameter (event, kEventParamTextInputSendText,
		   							typeUnicodeText, NULL, actual_size, NULL, text);
			if(result == noErr) {
				num_chars = actual_size / sizeof(UniChar);
				for(i=0; i < num_chars; i++) {
					int key = convert_unichar(text[i]);
					gkbdputc(gkbdq, key);
				}
			}
		}
	}

	return result;
}
开发者ID:Vykook,项目名称:acme-sac,代码行数:28,代码来源:win.c

示例6: GetEventParameter

void  wxControl::OnKeyDown( wxKeyEvent &event ) 
{
    if ( (ControlHandle) m_macControl == NULL )
        return ;
    
#if TARGET_CARBON

    char charCode ;
    UInt32 keyCode ;    
    UInt32 modifiers ;

    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);

    ::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
    
#else
    EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
    short keycode ;
    short keychar ;
    keychar = short(ev->message & charCodeMask);
    keycode = short(ev->message & keyCodeMask) >> 8 ;

    ::HandleControlKey( (ControlHandle) m_macControl , keycode , keychar , ev->modifiers ) ;
#endif
}
开发者ID:Duion,项目名称:Torsion,代码行数:27,代码来源:control.cpp

示例7: handleWindowEvent

static OSStatus handleWindowEvent(EventHandlerCallRef nextHandler, EventRef event, void *userData)
{
    OSStatus err;

    // Get the window
    WindowRef window;
    err = GetEventParameter(event, kEventParamDirectObject, typeWindowRef, 0, sizeof(window), 0, &window);
    if (err != noErr)
        return err;

    // Handle the different kinds of events
    ::UInt32 eventKind = GetEventKind(event);
    switch (eventKind)
    {
    // Quit the application when the user closes the window
    case kEventWindowClose:
        QuitApplicationEventLoop();
        return noErr;

    // Draw the contents of the window
    case kEventWindowDrawContent:
        redraw();
        return noErr;

    case kEventWindowBoundsChanged:
        {
            // Update the GL context
            aglUpdateContext(win->getContext());

            // Find out if we have a move or a resize situation
            ::UInt32 attributes;
            GetEventParameter(event, kEventParamAttributes, typeUInt32, 0, sizeof(attributes), 0, &attributes);

            if ((attributes & kWindowBoundsChangeSizeChanged) != 0)
            {
                // Get the new bounds of the window
                Rect bounds;
                GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, 0, sizeof(Rect), 0, &bounds);

                // Resize the OpenSG Window
                GLsizei width = bounds.right - bounds.left;
                GLsizei height = bounds.bottom - bounds.top;
                win->resize(width, height);

                // Redraw the whole window
                Rect portRect;
                GetWindowPortBounds(window, &portRect);
                InvalWindowRect(window, &portRect);
            }

            return noErr;
        }

    default:
        return eventNotHandledErr;
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:57,代码来源:testWindowCarbon.cpp

示例8: TkMacOSXProcessCommandEvent

int
TkMacOSXProcessCommandEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
{
    HICommand	    command;
    int 	    menuContext;
    OSStatus	    status;

    switch (eventPtr->eKind) {
	case kEventCommandProcess:
	case kEventCommandUpdateStatus:
	    break;
	default:
	    return 0;
	    break;
    }
    status = GetEventParameter(eventPtr->eventRef, 
	    kEventParamDirectObject,
	    typeHICommand, NULL, 
	    sizeof(command), NULL,
	    &command);
    if (status == noErr && (command.attributes & kHICommandFromMenu)) {
	if (eventPtr->eKind == kEventCommandProcess) {
	    status = GetEventParameter(eventPtr->eventRef, 
		    kEventParamMenuContext,
		    typeUInt32, NULL, 
		    sizeof(menuContext), NULL,
		    &menuContext);
	    if (status == noErr && (menuContext & kMenuContextMenuBar) &&
		    (menuContext & kMenuContextMenuBarTracking)) {
		TkMacOSXHandleMenuSelect(GetMenuID(command.menu.menuRef),
			command.menu.menuItemIndex,
			GetCurrentEventKeyModifiers() & optionKey);
		return 1;
	    }
	} else {
	    Tcl_CmdInfo dummy;
	    if (command.commandID == kHICommandPreferences && eventPtr->interp) {
		if (Tcl_GetCommandInfo(eventPtr->interp, 
			"::tk::mac::ShowPreferences", &dummy)) {
		    if (!IsMenuItemEnabled(command.menu.menuRef, 
			    command.menu.menuItemIndex)) {
			EnableMenuItem(command.menu.menuRef,
				command.menu.menuItemIndex);
		    }
		} else {
		    if (IsMenuItemEnabled(command.menu.menuRef, 
			    command.menu.menuItemIndex)) {
			DisableMenuItem(command.menu.menuRef,
				command.menu.menuItemIndex);
		    }
		}
		return 1;
	    }
	}
    }
    return 0;
}
开发者ID:SASfit,项目名称:SASfit,代码行数:57,代码来源:tkMacOSXEvent.c

示例9: dialogHandler

OSStatus dialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata)
{
	OSStatus result = eventNotHandledErr;
	OSStatus err;
	UInt32 evtClass = GetEventClass(event);
	UInt32 evtKind = GetEventKind(event);
	
	if((evtClass == kEventClassCommand) && (evtKind == kEventCommandProcess))
	{
		HICommand cmd;
		err = GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(cmd), NULL, &cmd);
		
		if(err == noErr)
		{
			switch(cmd.commandID)
			{				
				case kHICommandCancel:
					gCancelled = true;
//					QuitAppModalLoopForWindow(gWindow);
					result = noErr;
				break;
			}
		}
	}
	else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomProgress))
	{
		// Request to update the progress dialog
		long cur = 0;
		long max = 0;
		CFStringRef text = NULL;
		(void) GetEventParameter(event, kEventParamCustomCurValue, typeLongInteger, NULL, sizeof(cur), NULL, &cur);
		(void) GetEventParameter(event, kEventParamCustomMaxValue, typeLongInteger, NULL, sizeof(max), NULL, &max);
		(void) GetEventParameter(event, kEventParamCustomText, typeCFStringRef, NULL, sizeof(text), NULL, &text);
		
		err = setProgress(cur, max);
		if(err == noErr)
		{
			if(text != NULL)
			{
				setProgressText(text);
			}
		}
		
		result = noErr;
	}
	else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomDone))
	{
		// We're done.  Exit the modal loop.
		QuitAppModalLoopForWindow(gWindow);
		result = noErr;
	}
	
	return(result);
}
开发者ID:Xara,项目名称:Astra-Viewer-2,代码行数:54,代码来源:mac_updater.cpp

示例10: handleKeyEvent

static OSStatus handleKeyEvent(EventHandlerCallRef nextHandler, EventRef event, void *userData)
{
    OSStatus err;

    // Try to determine the size of the text input
    ::UInt32 actualSize; 					
    err = GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, 0, 0, &actualSize, 0);
    if (err != noErr)
        return err;

    // The input can actually consist of more than one character.
    // We are only interested in single character input
    if (actualSize == sizeof(UniChar))
    {
        // Get the character unicode
        UniChar c;
        err = GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, 0, sizeof(UniChar), 0, &c);
        if (err != noErr)
            return err;

        // Handle different keyboard commands
        CGLSetCurrentContext(win->getContext());
        switch (c)
        {
        case kEscapeCharCode:
            QuitApplicationEventLoop();
            break;
        case 'a':
            glDisable( GL_LIGHTING );
            redraw();
            break;
        case 's':
            glEnable( GL_LIGHTING );
            redraw();
            break;
        case 'z':
            glPolygonMode( GL_FRONT_AND_BACK, GL_POINT);
            redraw();
            break;
        case 'x':
            glPolygonMode( GL_FRONT_AND_BACK, GL_LINE);
            redraw();
            break;
        case 'c':
            glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
            redraw();
            break;
        }
    }

    return noErr;
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:52,代码来源:testWindowCoreGL.cpp

示例11: 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

示例12: AppEventHandler

static OSStatus AppEventHandler(EventHandlerCallRef inCaller, EventRef inEvent, void* inRefcon)
{
    OSStatus    result = eventNotHandledErr;
    
    switch ( GetEventClass( inEvent ) )
    {
        case kEventClassCommand:
        {
            HICommandExtended cmd;
            verify_noerr( GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof( cmd ), NULL, &cmd ) );
            
            switch ( GetEventKind( inEvent ) )
            {
                case kEventCommandProcess:
					CContextOSX* pContext = (CContextOSX*)inRefcon;
					pContext->OnMenuEventHandler(cmd.source.menu.menuItemIndex, (tint32)cmd.source.menu.menuRef);
							
            }
            break;

        }
		case kCoreEventClass:
		{
			HICommandExtended cmd;
            verify_noerr( GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof( cmd ), NULL, &cmd ) );
            
            switch ( GetEventKind( inEvent ) )
            {
                case kAEOpenDocuments:{
					
					tuint32 ui = 0;
					ui++;
					break;	
				}
				case kAEOpenApplication:{
					
					tuint32 ui = 0;
					ui++;
					break;	
				}
			}
		}
		
		  
        default:  break;
    }
    
    return result;
}
开发者ID:grimtraveller,项目名称:koblo_software,代码行数:49,代码来源:CContextOSX.cpp

示例13: GetEventParameter

OSStatus CSMNativeWindow::handleKeyEvent(EventHandlerCallRef  nextHandler, 
                                         EventRef             event      )
{
    OSStatus err;

    // Try to determine the size of the text input
    ::UInt32 actualSize; 					
    
    err = GetEventParameter(event, 
                            kEventParamTextInputSendText, 
                            typeUnicodeText, 0, 0, &actualSize, 0);

    if (err != noErr)
        return err;

    // The input can actually consist of more than one character.
    // We are only interested in single character input
    if (actualSize == sizeof(UniChar))
    {
        // Get the character unicode
        UniChar c;

        err = GetEventParameter(event, 
                                kEventParamTextInputSendText, 
                                typeUnicodeText, 0, 
                                sizeof(UniChar), 0, &c);

        if (err != noErr)
            return err;

        switch (c)
        {
            case kEscapeCharCode:
                //QuitApplicationEventLoop();
                _bRun = false;
                break;

            default:
                ComplexSceneManager::the()->key(
                    0,
                    0,
                    CSMKeyData::ButtonDown,
                    c);
                break;
        }
    }

    return noErr;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:49,代码来源:OSGCSMNativeWindow.cpp

示例14: GetEventParameter

void  wxControl::OnKeyDown( wxKeyEvent &event ) 
{
    if ( m_peer == NULL || !m_peer->Ok() )
        return ;
    
    char charCode ;
    UInt32 keyCode ;    
    UInt32 modifiers ;

    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);

    m_peer->HandleKey( keyCode , charCode , modifiers ) ;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:15,代码来源:control.cpp

示例15: HITestViewSetData

// -----------------------------------------------------------------------------
//	HITestViewSetData
// -----------------------------------------------------------------------------
//
OSStatus HITestViewSetData(
	EventRef				inEvent,
	HITestViewData*			inData )
{
#pragma unused( inData )
	OSStatus				err;
	ControlPartCode			part;
	OSType					tag;
	Ptr						ptr;
	Size					size;
	
	// Extract the part -- we don't use it here, but it might be important
	// in a non-trivial view
	err = GetEventParameter( inEvent, kEventParamControlPart, typeControlPartCode,
			NULL, sizeof( ControlPartCode ), NULL, &part );
	require_noerr( err, ParameterMissing );

	// Extract the rest of the info needs for data handling
	err = GetEventParameter( inEvent, kEventParamControlDataTag, typeEnumeration,
			NULL, sizeof( OSType ), NULL, &tag );
	require_noerr( err, ParameterMissing );

	err = GetEventParameter( inEvent, kEventParamControlDataBuffer, typePtr,
			NULL, sizeof( Ptr ), NULL, &ptr );
	require_noerr( err, ParameterMissing );

	err = GetEventParameter( inEvent, kEventParamControlDataBufferSize, typeLongInteger,
			NULL, sizeof( Size ), NULL, &size );
	require_noerr( err, ParameterMissing );

	switch ( tag )
	{
/*
		case kControlHITest_YourTagHere_Tag:
			if ( size == sizeof( HITest_YourTypeHere ) )
				inData->HITest_YourDataMemberHere = *( (HITest_YourTypeHere*) ptr );
			else
				err = errDataSizeMismatch;
			break;
*/
		default:
			err = errDataNotSupported;
			break;
	}

ParameterMissing:
	return err;
}
开发者ID:arnelh,项目名称:Examples,代码行数:52,代码来源:HITestView.c


注:本文中的GetEventParameter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。