本文整理汇总了C++中CallNextEventHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ CallNextEventHandler函数的具体用法?C++ CallNextEventHandler怎么用?C++ CallNextEventHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CallNextEventHandler函数的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: 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;
}
示例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);
}
示例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);
}
示例5: EventHandler
static 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;
}
示例6: CallNextEventHandler
pascal OSStatus pxWindowNative::doWindowClosed(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
pxWindowNative* w = (pxWindowNative*)userData;
w->onClose();
return CallNextEventHandler (nextHandler, theEvent);
}
示例7: GetEventParameter
pascal OSStatus
COSXScreenSaver::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));
}
示例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;
}
示例9: DoWindowClose
//------------------------------------------------------------------------
pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
userData;
QuitApplicationEventLoop ();
return CallNextEventHandler (nextHandler, theEvent);
}
示例10: quit_event_handler
pascal 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;
}
示例11: infoEvtHandler
static 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;
}
示例12: put_event
OSStatus 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
}
示例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;
}
示例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);
}
示例15: EventHandler
static 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);
}