• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetEventClass函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: playerEvtHandler

static 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,代码来源:PlayerWin.cpp


示例2: AppEventHandlerProc

//-----------------------------------------------------------------------------------------------------------------------
static	pascal	OSStatus AppEventHandlerProc( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData )
{
    #pragma unused(inCallRef, inUserData)
    OSStatus    err         = eventNotHandledErr;
    UInt32      eventClass  = GetEventClass(inEvent);
    UInt32      eventKind   = GetEventKind(inEvent);
    
    if ( (eventClass == kEventClassCommand) && (eventKind == kEventCommandProcess) )
    {
        HICommand command;

        GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &command );
        
        switch ( command.commandID)
        {
            case kHICommandNew:
                NewCSkWindow(gOurNibRef, CSkToolPalette(gOurNibRef));
				err = noErr;
			break;
				
			case kHICommandOpen:
				err = OpenAFile();
			break;
        }
    }
    return err;
}   // AppEventHandlerProc
开发者ID:fruitsamples,项目名称:CarbonSketch,代码行数:28,代码来源:main.c


示例3: simpleDialogHandler

OSStatus simpleDialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata)
{
	OSStatus result = eventNotHandledErr;
	OSStatus err;
	UInt32 evtClass = GetEventClass(event);
	UInt32 evtKind = GetEventKind(event);
	WindowRef window = (WindowRef)userdata;
	
	if((evtClass == kEventClassCommand) && (evtKind == kEventCommandProcess))
	{
		HICommand cmd;
		err = GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(cmd), NULL, &cmd);
		
		if(err == noErr)
		{
			switch(cmd.commandID)
			{
				case kHICommandOK:
					QuitAppModalLoopForWindow(window);
					result = noErr;
				break;
				
				case kHICommandCancel:
					QuitAppModalLoopForWindow(window);
					result = userCanceledErr;
				break;
			}
		}
	}
	
	return(result);
}
开发者ID:Boy,项目名称:netbook,代码行数:32,代码来源:llappviewermacosx.cpp


示例4: GetEventClass

bool	AUCarbonViewBase::HandleEvent(EventRef event)
{
    UInt32 eclass = GetEventClass(event);
    UInt32 ekind = GetEventKind(event);
    ControlRef control;

    switch (eclass) {
    case kEventClassControl:
        switch (ekind) {
        case kEventControlClick:
            GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
            if (control == mCarbonPane) {
                ClearKeyboardFocus(mCarbonWindow);
                return true;
            }
        }
        break;
    case kEventClassWindow:
        switch (ekind) {
        case kEventWindowClosed:
            printf("caught window-closed\n");
            break;
        }
        break;
    }

    return false;
}
开发者ID:fruitsamples,项目名称:AudioUnits,代码行数:28,代码来源:AUCarbonViewBase.cpp


示例5: NPClientSheetEventHandler

static pascal OSStatus NPClientSheetEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	#pragma unused (inHandlerRef, inUserData)

	if (!npclient.dialogsheet)
		return (eventNotHandledErr);

	OSStatus	err, result = eventNotHandledErr;

	switch (GetEventClass(inEvent))
	{
		case kEventClassCommand:
			switch (GetEventKind(inEvent))
			{
				case kEventCommandProcess:
					HICommand	tHICommand;

					err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, nil, sizeof(HICommand), nil, &tHICommand);
					if (err == noErr)
					{
						switch (tHICommand.commandID)
						{
							case 'ok  ':
								npclient.dialogprocess = kNPCDialogDone;
								result = noErr;
						}
					}
			}
	}

	return (result);
}
开发者ID:alesegdia,项目名称:snes-sdk,代码行数:32,代码来源:mac-client.cpp


示例6: switch

OSStatus
TabbedWindow::WindowHandleEvent( EventHandlerCallRef handler, EventRef event )
{
    OSStatus status = eventNotHandledErr;
    
    // process the event based on what type it is
    switch ( GetEventClass( event ) )
    {
        case kEventClassControl:
            status = this->WindowHandleControlEvent( handler, event );
            break;
        case kEventClassCommand:
            status = this->WindowHandleCommandEvent( handler, event );
            break;
        case kEventClassMenu:
            status = this->WindowHandleMenuEvent( handler, event );
            break;
        case kEventClassWindow:
            status = this->WindowHandleWindowEvent( handler, event );
            break;
        default:
            status = eventNotHandledErr;
            break;
    }
    return status;
}
开发者ID:fruitsamples,项目名称:InkSample,代码行数:26,代码来源:TabbedWindow.cpp


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


示例8: ViewClassHandler

static pascal OSStatus ViewClassHandler(EventHandlerCallRef inCaller, EventRef inEvent, void* inRefcon)
{
    OSStatus result = eventNotHandledErr;
    int* pain = (int*)inRefcon;

    if (GetEventClass(inEvent) == kEventClassHIObject) {
        switch (GetEventKind(inEvent)) {
        case kEventHIObjectConstruct: {
            int* pa = new int;
            GetEventParameter(inEvent,kEventParamHIObjectInstance, typeHIObjectRef, NULL, sizeof(int), NULL, &pa);
            result = SetEventParameter(inEvent, kEventParamHIObjectInstance, typeVoidPtr, sizeof(int), &pa);
            break;
        }

        case kEventHIObjectDestruct: {
            if (pain != NULL) {
                delete pain;
            }
            result = noErr;
            break;
        }
        }
    }

    return result;
}
开发者ID:hirano,项目名称:koblo_software,代码行数:26,代码来源:CKSPlugInEffectPane.cpp


示例9: wd_event

// ---------------------------------------------------------------------------
// 
// ------------
bool bvDefScaleRef::wd_event(EventRef evt, WindowRef wd){
bool			b=true;
UInt32			clss=GetEventClass(evt);	
HICommand		cmd;
ControlRef		c;
bGenericUnit*	u;

	if(clss==kEventClassCommand){
		GetEventParameter(evt,kEventParamDirectObject,typeHICommand,NULL,sizeof(HICommand),NULL,&cmd);
		switch(cmd.commandID){
			case kHICommandOK:
				write();
				break;
			case kHICommandCancel:
				break;
			case kvDefScaleRefPopupCmd:
				c=get_control(kvDefScaleRefViewSignature,kvDefScaleRefPopupID);
				_idx=GetControl32BitValue(c);
				if(_idx>2){
					u=_gapp->scaleMgr()->get(_idx-2);
					_scale=u->coef();
				}
				else{
					_scale=0;
				}
				break;
			default:
				b=false;
				break;
		}
	}
	return(b);
}
开发者ID:CarteBlancheConseil,项目名称:MacMap,代码行数:36,代码来源:bvDefScaleRef.cpp


示例10: AutofireWindowEventHandler

pascal OSStatus AutofireWindowEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	#pragma unused (inHandlerRef)
	
	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 kEventCommandProcess:
					HICommand	tHICommand;
					HIViewRef	root;
					int			player = -1;

					root = HIViewGetRoot(tWindowRef);

					err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, nil, sizeof(HICommand), nil, &tHICommand);
					if (err == noErr)
					{
						switch (tHICommand.commandID)
						{
							case 'DEF1':
								player = 0;
								break;
							
							case 'DEF2':
								player = 1;
								break;
						}
						
						if (player != -1)
						{
							autofireRec[player].buttonMask = 0x0000;
							autofireRec[player].toggleMask = 0xFFF0;
							autofireRec[player].tcMask     = 0x0000;
							autofireRec[player].invertMask = 0x0000;
							autofireRec[player].frequency  = 10;
							AutofireReadAllSettings(player + 1, root);
							
							result = noErr;
						}
					}
			}
	}
	
	return result;
}
开发者ID:alesegdia,项目名称:snes-sdk,代码行数:60,代码来源:mac-dialog.cpp


示例11: windowHandler

//-------------------------------------------------------------------------------------------------------
pascal OSStatus windowHandler (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)
{
	OSStatus result = eventNotHandledErr;
	WindowRef window = (WindowRef) inUserData;
	UInt32 eventClass = GetEventClass (inEvent);
	UInt32 eventKind = GetEventKind (inEvent);

	switch (eventClass)
	{
		case kEventClassWindow:
		{
			switch (eventKind)
			{
				case kEventWindowClose:
				{
					QuitAppModalLoopForWindow (window);
					break;
				}
			}
			break;
		}
	}

	return result;
}
开发者ID:ekenberg,项目名称:vstminihost,代码行数:26,代码来源:minieditor.cpp


示例12: eventHandler

static pascal OSStatus eventHandler(EventHandlerCallRef  nextHandler, 
                                    EventRef             event, 
                                    void                *userData   )
{
    ::UInt32 eventClass = GetEventClass(event);

    CSMNativeWindow *pWin = reinterpret_cast<CSMNativeWindow *>(userData);

    OSG_ASSERT(pWin != NULL);

    switch (eventClass)
    {
        // Mouse events
        case kEventClassMouse:
            return pWin->handleMouseEvent(nextHandler, event);
            
            // Key press events
        case kEventClassTextInput:
            return pWin->handleKeyEvent(nextHandler, event);
            
            // Window events
        case kEventClassWindow:
            return pWin->handleWindowEvent(nextHandler, event);
            
        default:
            return eventNotHandledErr;
    }
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:28,代码来源:OSGCSMNativeWindow.cpp


示例13: dialogEventHandler

// --------------------------------------------------------------------------------------
static pascal OSStatus dialogEventHandler(EventHandlerCallRef nextHandler, EventRef event, 
											void *prefsDialog)
{
#pragma unused (nextHandler)

	OSStatus result = eventNotHandledErr;
	UInt32 eventClass, eventKind;
	ControlRef controlHit;
	ControlID controlID;
	
	eventClass = GetEventClass(event);
	eventKind = GetEventKind(event);
	
	switch (eventClass)
	{
		case kEventClassControl:
			switch (eventKind)
			{
				case kEventControlHit:
					GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, 
										sizeof(ControlRef), NULL, &controlHit);
					GetControlID(controlHit, &controlID);
					
					handleDialogItemHit((DialogRef)prefsDialog, (DialogItemIndex)controlID.id);
					result = noErr;
					break;
			}
			break;
	}
	
	return result;
}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:33,代码来源:PrefsDialog.c


示例14: AppEventEventHandlerProc

static	pascal	OSStatus AppEventEventHandlerProc( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData )
{
	#pragma unused ( inCallRef, inUserData )
	HICommand		command;
	OSStatus 		err			= eventNotHandledErr;
	UInt32			eventClass	= GetEventClass( inEvent );
	UInt32			eventKind	= GetEventKind(inEvent);
	
	switch ( eventClass )
	{
		case kEventClassCommand:
			GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &command );
			if ( eventKind == kEventCommandProcess )
			{
				if ( command.commandID == kHICommandNew )
				{
					DisplaySimpleWindow();
				}
				else if ( command.commandID == kHICommandOpen )		//	Open... menu choice
				{
					OpenFiles();
				}
			}
			break;
	}

	return( err );
}
开发者ID:fruitsamples,项目名称:WindowFun,代码行数:28,代码来源:WindowFun.c


示例15: GetEventClass

bool	XControl::HandleEvent(EventRef event)
{
    if (!mListener) return false;

    UInt32 eclass = GetEventClass(event);
    UInt32 ekind = GetEventKind(event);
    ControlRef control;

    switch (eclass) {
    case kEventClassControl:
        switch (ekind) {
        case kEventControlValueFieldChanged:
        {
            GetEventParameter(event,
                              kEventParamDirectObject,
                              kEventParamControlRef,
                              NULL,
                              sizeof(ControlRef),
                              NULL,
                              &control);
            mListener->ControlValueChanged (this);
            return true;
        }
        }
    }

    return false;
}
开发者ID:fruitsamples,项目名称:XFramework,代码行数:28,代码来源:XControl.cpp


示例16: IndicatorEventHandler

static pascal OSStatus IndicatorEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *userData)
{
    #pragma unused (inHandlerCallRef)

    OSStatus	err, result = eventNotHandledErr;
	HIViewRef	view = (HIViewRef) userData;

	switch (GetEventClass(inEvent))
	{
		case kEventClassControl:
			switch (GetEventKind(inEvent))
			{
				case kEventControlDraw:
					CGContextRef	ctx;

					err = GetEventParameter(inEvent, kEventParamCGContextRef, typeCGContextRef, nil, sizeof(CGContextRef), nil, &ctx);
					if (err == noErr)
					{
						HIRect	bounds;

						HIViewGetBounds(view, &bounds);
						CGContextTranslateCTM(ctx, 0, bounds.size.height);
						CGContextScaleCTM(ctx, 1.0, -1.0);
						MusicBoxDrawIndicator(view, ctx);

						result = noErr;
					}
			}
	}

	return result;
}
开发者ID:BruceJawn,项目名称:flashsnes,代码行数:32,代码来源:mac-musicbox.cpp


示例17: s86proc

static pascal OSStatus s86proc(EventHandlerCallRef myHandler, EventRef event, void* userData) {
    OSStatus	err = eventNotHandledErr;
	HIPoint		pos;
	Point		p;
	Rect		ctrlbounds, winbounds;
	PicHandle   pict;

    if (GetEventClass(event)==kEventClassControl && GetEventKind(event)==kEventControlClick ) {
		err = noErr;
        GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pos);
		GetControlBounds((ControlRef)userData, &ctrlbounds);
		GetWindowBounds(soundWin, kWindowContentRgn, &winbounds);
		p.h = (short)pos.x;
		p.h -= (ctrlbounds.left + winbounds.left);
		p.h /= 8;
		if ((p.h < 2) || (p.h >= 10)) {
			return(err);
		}
		p.h -= 2;
		snd86 ^= (1 << p.h);
		set86s();
		setbmp(dipswbmp_getsnd86(snd86), &pict);
		SetControlData((ControlRef)userData, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);
		Draw1Control((ControlRef)userData);
	}

	(void)myHandler;
	(void)userData;
    return err;
}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:30,代码来源:soundopt.cpp


示例18: appEventHandler

// --------------------------------------------------------------------------------------
static pascal OSStatus appEventHandler(EventHandlerCallRef nextHandler, EventRef event, 
										void *junk)
{
#pragma unused (nextHandler, junk)

	OSStatus result = eventNotHandledErr;
	UInt32 eventClass, eventKind;
	HICommand command;
	
	eventClass = GetEventClass(event);
	eventKind = GetEventKind(event);
	
	switch (eventClass)
	{
		case kEventClassCommand:
			switch (eventKind)
			{
				case kEventCommandProcess:
					GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, 
										sizeof(HICommand), NULL, &command);
					result = handleCommand(command);
					
					break;
			}
			break;
	}
	
	return result;
}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:30,代码来源:ExamplePrefs.c


示例19: edit_event

// ---------------------------------------------------------------------------
// 
// -----------
bool bToolShape::edit_event(EventRef evt, WindowRef wd){
bool		b=true;
HICommand	cmd;
ControlRef	c;
ControlID	cid={kShapeEditSign,kShapeCenterID};

	if(GetEventClass(evt)==kEventClassCommand){
		GetEventParameter(evt,kEventParamDirectObject,typeHICommand,NULL,sizeof(HICommand),NULL,&cmd);
		switch(cmd.commandID){
			case kHICommandOK:
				GetControlByID(wd,&cid,&c);
				_ctr=GetControl32BitValue(c);
				cid.id=kShapeOpenFicheID;
				GetControlByID(wd,&cid,&c);
				_opn=GetControl32BitValue(c);
				cid.id=kShapeCMMeasID;
				GetControlByID(wd,&cid,&c);
				_cm=GetControl32BitValue(c);
				break;
			case kHICommandCancel:
				break;
			default:
				b=false;
				break;
		}
	}
	return(b);
}
开发者ID:CarteBlancheConseil,项目名称:MacMap,代码行数:31,代码来源:bToolShape.cpp


示例20: ApplicationEventHandler

static pascal OSStatus ApplicationEventHandler(EventHandlerCallRef inHandlerCallRef, 
											   EventRef inEvent, void *inUserData)
	// Dispatches HICommands to their implementations.
{
	OSStatus 	err;
	HICommand 	command;
	#pragma unused(inHandlerCallRef)
	#pragma unused(inUserData)
	
	assert( GetEventClass(inEvent) == kEventClassCommand  );
	assert( GetEventKind(inEvent)  == kEventCommandProcess);
	
	err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(command), NULL, &command);
	if (err == noErr) {
		switch (command.commandID) {
			case kHICommandAbout:
				DoAbout();
				break;
			case 'DShw':
				DoRefresh();
				break;
			case 'DAdd':
				DoAddTest();
				break;
			case 'DRem':
				DoRemoveTest();
				break;
			default:
				err = eventNotHandledErr;
				break;
		}
	}
	
	return err;
}
开发者ID:xin3liang,项目名称:platform_external_login-items-ae,代码行数:35,代码来源:LoginItemsAETest.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetEventHandler函数代码示例发布时间:2022-05-30
下一篇:
C++ GetEvent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap