本文整理汇总了C++中GetEventClass函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEventClass函数的具体用法?C++ GetEventClass怎么用?C++ GetEventClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEventClass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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 );
}
示例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;
}