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


C++ CallNextEventHandler函數代碼示例

本文整理匯總了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);
    }
}
開發者ID:ullerrm,項目名稱:frogg,代碼行數:49,代碼來源:PlayerWin.cpp

示例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;
}
開發者ID:arnelh,項目名稱:Examples,代碼行數:31,代碼來源:HITestView.c

示例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);
}
開發者ID:dtbinh,項目名稱:pxcore,代碼行數:28,代碼來源:pxWindowNative.cpp

示例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);
}
開發者ID:asmboom,項目名稱:PixelFarm,代碼行數:35,代碼來源:agg_platform_support.cpp

示例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;
}
開發者ID:akw0088,項目名稱:rigid,代碼行數:60,代碼來源:osxmain.cpp

示例6: CallNextEventHandler

pascal OSStatus pxWindowNative::doWindowClosed(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	pxWindowNative* w = (pxWindowNative*)userData;
	w->onClose();

	return CallNextEventHandler (nextHandler, theEvent);
}	
開發者ID:dtbinh,項目名稱:pxcore,代碼行數:7,代碼來源:pxWindowNative.cpp

示例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));
}
開發者ID:ali1234,項目名稱:synergy-old,代碼行數:28,代碼來源:COSXScreenSaver.cpp

示例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;
}
開發者ID:DannyDeng2014,項目名稱:CocoaSampleCode,代碼行數:66,代碼來源:DrawProcs.c

示例9: DoWindowClose

//------------------------------------------------------------------------
pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	userData;
	
	QuitApplicationEventLoop ();

	return CallNextEventHandler (nextHandler, theEvent);
}
開發者ID:asmboom,項目名稱:PixelFarm,代碼行數:9,代碼來源:agg_platform_support.cpp

示例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;
}
開發者ID:digarok,項目名稱:gsplus,代碼行數:9,代碼來源:macdriver_console.c

示例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;
}
開發者ID:ullerrm,項目名稱:frogg,代碼行數:12,代碼來源:InfoWin.cpp

示例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
}
開發者ID:ardeujho,項目名稱:self,代碼行數:13,代碼來源:quartzWindow.cpp

示例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;
}
開發者ID:fruitsamples,項目名稱:CarbonPorting,代碼行數:51,代碼來源:PrefsDialog.c

示例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);
}
開發者ID:asmboom,項目名稱:PixelFarm,代碼行數:17,代碼來源:agg_platform_support.cpp

示例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);
}
開發者ID:czbming,項目名稱:libRocket,代碼行數:19,代碼來源:ShellMacOSX.cpp


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