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

C++ NewEventHandlerUPP函数代码示例

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

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



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

示例1: dialog_create_grid_mesh_run

bool dialog_create_grid_mesh_run(int *xdiv,int *ydiv,int *zdiv)
{
	EventHandlerUPP					event_upp;
	EventTypeSpec					event_list[]={{kEventClassCommand,kEventProcessCommand}};
	
		// open the dialog
		
	dialog_open(&dialog_create_grid_mesh_wind,"GridMesh");
	
		// install event handler
		
	event_upp=NewEventHandlerUPP(create_grid_mesh_event_proc);
	InstallWindowEventHandler(dialog_create_grid_mesh_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL);
	
		// setup controls
		
	dialog_set_int(dialog_create_grid_mesh_wind,kGridMeshXDivision,0,10);
	dialog_set_int(dialog_create_grid_mesh_wind,kGridMeshYDivision,0,10);
	dialog_set_int(dialog_create_grid_mesh_wind,kGridMeshZDivision,0,10);
		
		// show window
	
	ShowWindow(dialog_create_grid_mesh_wind);
	
		// modal window
		
	dialog_create_grid_mesh_cancel=FALSE;
	
	RunAppModalLoopForWindow(dialog_create_grid_mesh_wind);
	
		// get object name
		
	if (!dialog_create_grid_mesh_cancel) {
		*xdiv=dialog_get_int(dialog_create_grid_mesh_wind,kGridMeshXDivision,0);
		*ydiv=dialog_get_int(dialog_create_grid_mesh_wind,kGridMeshYDivision,0);
		*zdiv=dialog_get_int(dialog_create_grid_mesh_wind,kGridMeshZDivision,0);
	}
	
		// close window
		
	DisposeWindow(dialog_create_grid_mesh_wind);
	
	return(!dialog_create_grid_mesh_cancel);
}
开发者ID:prophile,项目名称:dim3,代码行数:44,代码来源:dialog_grid_mesh.c


示例2: main

int main(int argc, char* argv[])
{
	IBNibRef 		nibRef;
	OSStatus		err;

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS was loaded");
		return 0;
	}

	// initialize default output device
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST,1); // enable playlist processing
	BASS_SetConfig(BASS_CONFIG_NET_PREBUF,0); // minimize automatic pre-buffering, so we can do it (and display it) instead
	BASS_SetConfigPtr(BASS_CONFIG_NET_PROXY,proxy); // setup proxy server location

	// Create Window and stuff
	err = CreateNibReference(CFSTR("netradio"), &nibRef);
	if (err) return err;
	err = CreateWindowFromNib(nibRef, CFSTR("Window"), &win);
	if (err) return err;
	DisposeNibReference(nibRef);

	int a;
	for (a=10;a<20;a++)
		SetupControlHandler(a,kEventControlHit,RadioEventHandler);
	SetupControlHandler(41,kEventControlHit,DirectEventHandler);
	{
		EventTypeSpec etype={'blah','blah'};
		InstallApplicationEventHandler(NewEventHandlerUPP(CustomEventHandler),1,&etype,NULL,NULL);
	}

	ShowWindow(win);
	RunApplicationEventLoop();

	BASS_Free();

    return 0; 
}
开发者ID:bagnz0r,项目名称:ichigo-audio,代码行数:44,代码来源:netradio.c


示例3: m_owner

KGlobalAccelImpl::KGlobalAccelImpl(GlobalShortcutsRegistry* owner)
	: m_owner(owner)
    , m_eventTarget(GetApplicationEventTarget())
    , m_eventHandler(NewEventHandlerUPP(hotKeyEventHandler))
{
    m_eventType[0].eventClass = kEventClassKeyboard;
    m_eventType[0].eventKind = kEventHotKeyPressed; 
    m_eventType[1].eventClass = kEventClassKeyboard; // only useful for testing, is not used because count passed in call to InstallEventHandler is 1
    m_eventType[1].eventKind = kEventRawKeyDown;
    refs = new QMap<int, QList<EventHotKeyRef> >();
    
    CFStringRef str = CFStringCreateWithCString(NULL, "AppleKeyboardPreferencesChangedNotification", kCFStringEncodingASCII);
    if (str) {
        CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), this, layoutChanged, str, NULL, CFNotificationSuspensionBehaviorHold);
        CFRelease(str);
    } else {
        kWarning(125) << "Couldn't create CFString to register for keyboard notifications";
    }
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:19,代码来源:kglobalaccel_mac.cpp


示例4: install_app_launch_cb

int
install_app_launch_cb(void *user_data)
{
    static int already_installed = 0;

    if(!already_installed){
	EventHandlerUPP cb_upp;
	EventTypeSpec event_types[2] = {
	    {kEventClassApplication, kEventAppTerminated},
	    {kEventClassApplication, kEventAppLaunchNotification}};

	if((cb_upp = NewEventHandlerUPP(osx_launch_app_callback)) == NULL)
	  return 1;
	InstallApplicationEventHandler(cb_upp, 2, event_types,
				       user_data, NULL);
	already_installed = 1;
    }
    return 0;
}
开发者ID:RsrchBoy,项目名称:dpkg-alpine,代码行数:19,代码来源:execview.c


示例5: palette_polygon_open

void palette_polygon_open(int x,int y)
{
	EventHandlerUPP			event_upp;
	EventTypeSpec			event_list[]={{kEventClassControl,kEventControlHit},
										  {kEventClassKeyboard,kEventRawKeyUp}};

		// open the window
		
	dialog_open(&palette_poly_wind,"PolyPalette");
	MoveWindow(palette_poly_wind,x,y,FALSE);

		// show palette
		
	ShowWindow(palette_poly_wind);
	
		// install event handler
		
	event_upp=NewEventHandlerUPP(palette_poly_event_proc);
	InstallWindowEventHandler(palette_poly_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL);
}
开发者ID:prophile,项目名称:dim3,代码行数:20,代码来源:palette_polygon.c


示例6: setupJoyConfig

static OSStatus setupJoyConfig (OSType type) {
    OSStatus	err = noErr;
    char elementName[256] = "----";

    err = CreateWindowFromNib(nibRef, CFSTR("InputWindow"), &joyWin);
    if (err == noErr) {
        EventTypeSpec	list[]={ { kEventClassCommand, kEventCommandProcess } };
        EventHandlerRef	ref;
        InstallWindowEventHandler (joyWin, NewEventHandlerUPP(joyWinproc), 1, list, (void *)joyWin, &ref);
        ShowSheetWindow(joyWin, soundWin);

        if (setJoypad(type, elementName)) {
            setTitle(type, elementName);
        }

        HideSheetWindow(joyWin);
        DisposeWindow(joyWin);
    }
    return(err);
}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:20,代码来源:soundopt.cpp


示例7: WindowImpl

// ---------------------------------------------------------------------------
OSXWindowImpl::OSXWindowImpl(Window* window)
  : WindowImpl(window)
{
  OSStatus s;
  WindowClass wc = kDocumentWindowClass;
  WindowAttributes wa = 0
    // |kWindowCompositingAttribute
    |kWindowStandardDocumentAttributes
    |kWindowStandardHandlerAttribute
    |kWindowLiveResizeAttribute
  ;
  mRect.left = 100;
  mRect.right = mRect.left + 256;
  mRect.top = 100;
  mRect.bottom = mRect.top + 256;
  s = CreateNewWindow(wc,wa,&mRect,&mWindowRef);
  check_noerr(s); 
  EventTypeSpec typeList[] = {
    { kEventClassWindow,    kEventWindowClosed },
    { kEventClassWindow,    kEventWindowDrawContent },
    { kEventClassWindow,    kEventWindowBoundsChanged },
    { kEventClassKeyboard,  kEventRawKeyDown },
    { kEventClassKeyboard,  kEventRawKeyUp },
    { kEventClassMouse,     kEventMouseDown },
    { kEventClassMouse,     kEventMouseUp },
    { kEventClassMouse,     kEventMouseMoved },
    { kEventClassMouse,     kEventMouseDragged },
    { kEventClassMouse,     kEventMouseWheelMoved }
  };
  int numTypes = sizeof(typeList)/sizeof(EventTypeSpec);
  EventHandlerUPP handlerUPP = NewEventHandlerUPP(OSXWindowImpl::memberDelegate);
  EventTargetRef theTarget; 
  theTarget = GetWindowEventTarget(mWindowRef);
  InstallEventHandler(
    theTarget, handlerUPP,
    numTypes, typeList,
    this, 
    NULL
  );  	
  on_init();	
}
开发者ID:jefferis,项目名称:rgl,代码行数:42,代码来源:osxgui.cpp


示例8: wxTaskBarIconImpl

//-----------------------------------------------------------------------------
// wxDockTaskBarIcon ctor
//
// Initializes the dock implementation of wxTaskBarIcon.
//
// Here we create some Mac-specific event handlers and UPPs.
//-----------------------------------------------------------------------------
wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent)
    :   wxTaskBarIconImpl(parent),
        m_eventHandlerRef(NULL), m_pMenu(NULL),
        m_theLastMenu(GetApplicationDockTileMenu()), m_iconAdded(false)
{
    // register the events that will return the dock menu
    EventTypeSpec tbEventList[] =
    {
        { kEventClassCommand, kEventProcessCommand },
        { kEventClassApplication, kEventAppGetDockTileMenu }
    };

    m_eventupp = NewEventHandlerUPP(wxDockEventHandler);
    wxASSERT(m_eventupp != NULL);

    OSStatus err = InstallApplicationEventHandler(
            m_eventupp,
            GetEventTypeCount(tbEventList), tbEventList,
            this, &m_eventHandlerRef);
    verify_noerr( err );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:28,代码来源:taskbar.cpp


示例9: loadAboutWin

bool loadAboutWin()
{
    IBNibRef nibFile;
    OSStatus iResult;
    EventTypeSpec pEvent;

    g_lpfnAboutProc = NewEventHandlerUPP(aboutEvtHandler);

    if (noErr != (iResult = CreateNibReference(CFSTR("AboutWin"), &nibFile)))
    {
        DisposeEventHandlerUPP(g_lpfnAboutProc);
        fprintf(stderr, "loadAboutWin() - CreateNibReference(AboutWin) failed, returning %lu!\n", (unsigned long) iResult);
        return false;
    }

    if (noErr != (iResult = CreateWindowFromNib(nibFile, CFSTR("FroggAboutWindow"), &g_refAboutWin)))
    {
        DisposeNibReference(nibFile);
        DisposeEventHandlerUPP(g_lpfnAboutProc);
        fprintf(stderr, "loadAboutWin() - CreateWindowFromNib(FroggAboutWindow) failed, returning %lu!\n", (unsigned long) iResult);
        return false;
    }

    DisposeNibReference(nibFile);

    pEvent.eventClass = kEventClassWindow;
    pEvent.eventKind = kEventWindowClose;

    if (noErr != (iResult = InstallWindowEventHandler(g_refAboutWin, g_lpfnAboutProc, 1, &pEvent, NULL, &g_refAboutHdlr)))
    {
        DisposeWindow(g_refAboutWin);
        DisposeEventHandlerUPP(g_lpfnAboutProc);
        fprintf(stderr, "loadAboutWin() - InstallWindowEventHandler() failed, returning %lu!\n", (unsigned long) iResult);
        return false;
    }

    g_bLoaded = true;

    return true;
}
开发者ID:ullerrm,项目名称:frogg,代码行数:40,代码来源:AboutWin.cpp


示例10: CreateDialogWindow

// Create, show and run modally our dialog window
OSStatus CreateDialogWindow()
{
    IBNibRef 		nibRef;
    EventTypeSpec 	dialogSpec = {kEventClassCommand, kEventCommandProcess };
    WindowRef 		dialogWindow;
    EventHandlerUPP	dialogUPP;
    OSStatus		err = noErr;

    // Find the dialog nib
    err = CreateNibReference(CFSTR("dialog"), &nibRef);
    require_noerr( err, CantFindDialogNib );

    // Load the window inside it
    err = CreateWindowFromNib(nibRef, CFSTR("dialog"), &dialogWindow);
    require_noerr( err, CantCreateDialogWindow );

    // We don't need the nib reference anymore.
    DisposeNibReference(nibRef);

    // Install our event handler
    dialogUPP =  NewEventHandlerUPP (DialogWindowEventHandler);
    err = InstallWindowEventHandler (dialogWindow, dialogUPP, 1, &dialogSpec, (void *) dialogWindow, NULL);
    require_noerr( err, CantInstallDialogHandler );

    // Show the window
    ShowWindow( dialogWindow );

    // Run modally
    RunAppModalLoopForWindow(dialogWindow);

    HideWindow(dialogWindow);
    DisposeWindow(dialogWindow);
    DisposeEventHandlerUPP(dialogUPP);

CantFindDialogNib:
CantCreateDialogWindow:
CantInstallDialogHandler:

    return err;
}
开发者ID:fruitsamples,项目名称:IBCarbonDialogExample,代码行数:41,代码来源:modalDialogHandler.c


示例11: dialog_group_settings_run

bool dialog_group_settings_run(group_type *group)
{
	EventHandlerUPP			event_upp;
	EventTypeSpec			event_list[]={{kEventClassCommand,kEventProcessCommand}};
	
		// open the dialog
		
	dialog_open(&dialog_group_settings_wind,"GroupSettings");

		// set controls
		
	dialog_set_text(dialog_group_settings_wind,kGroupName,0,group->name);
	
		// show window
	
	ShowWindow(dialog_group_settings_wind);
	
		// install event handler
		
	event_upp=NewEventHandlerUPP(group_setting_event_proc);
	InstallWindowEventHandler(dialog_group_settings_wind,event_upp,GetEventTypeCount(event_list),event_list,NULL,NULL);
	
		// modal window
		
	dialog_group_settings_cancel=FALSE;
	RunAppModalLoopForWindow(dialog_group_settings_wind);
	
		// dialog to data
		
	if (!dialog_group_settings_cancel) {
		dialog_get_text(dialog_group_settings_wind,kGroupName,0,group->name,name_str_len);
	}

		// close window
		
	DisposeWindow(dialog_group_settings_wind);
	
	return(!dialog_group_settings_cancel);
}
开发者ID:prophile,项目名称:dim3,代码行数:39,代码来源:dialog_group_settings.c


示例12: ui_main

void ui_main() {
	if( data.init_done )
		return;
	data.init_done = 1;
#	if defined(NEKO_WINDOWS)
	{
		WNDCLASSEX wcl;
		HINSTANCE hinst = GetModuleHandle(NULL);
		memset(&wcl,0,sizeof(wcl));
		wcl.cbSize			= sizeof(WNDCLASSEX);
		wcl.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
		wcl.lpfnWndProc		= WindowProc;
		wcl.cbClsExtra		= 0;
		wcl.cbWndExtra		= 0;
		wcl.hInstance		= hinst;
		wcl.hIcon			= NULL;
		wcl.hCursor			= LoadCursor(NULL, IDC_ARROW);
		wcl.hbrBackground	= (HBRUSH)(COLOR_BTNFACE+1);
		wcl.lpszMenuName	= "";
		wcl.lpszClassName	= CLASS_NAME;
		wcl.hIconSm			= 0;
		RegisterClassEx(&wcl);
	}
	data.tid = GetCurrentThreadId();
	data.wnd = CreateWindow(CLASS_NAME,"",0,0,0,0,0,NULL,NULL,NULL,NULL);
#	elif defined(NEKO_MAC)
	MPCreateTask(nothing,NULL,0,0,0,0,0,NULL); // creates a MPTask that will enable Carbon MT
	data.tid = pthread_self();
	EventTypeSpec ets = { UIEvent, eCall };
	InstallEventHandler(GetApplicationEventTarget(),NewEventHandlerUPP(handleEvents),1,&ets,0,0);
#	elif defined(NEKO_LINUX)
	g_thread_init(NULL);
	gdk_threads_init();
	gtk_init(NULL,NULL);
	setlocale(LC_NUMERIC,"POSIX"); // prevent broking atof()
	data.tid = pthread_self();
	pthread_mutex_init(&data.lock,NULL);
#	endif
}
开发者ID:fantoine,项目名称:haxe-templo2,代码行数:39,代码来源:ui.c


示例13: main

//---------------------------------------------------------------------------------------------
int main()
{
    static const EventTypeSpec  sApplicationEvents[] = {{ kEventClassCommand, kEventCommandProcess }};
    OSErr err;
    
    if (!SystemVersionRequired(0x1020))
    {
	DialogRef theAlert;
	CreateStandardAlert(kAlertStopAlert, CFSTR("Need 10.2 or later!"), NULL, NULL, &theAlert);
	RunStandardAlert(theAlert, NULL, NULL);
	return 0;
    }
    
    ProcessSerialNumber psn = {0, kCurrentProcess};
    err = GetProcessBundleLocation(&psn, &gApplicationBundleFSRef);

    err = CreateNibReference(CFSTR("CarbonSketch"), &gOurNibRef );
    require_noerr( err, CantGetNibRef );

    err = SetMenuBarFromNib( gOurNibRef, CFSTR("MenuBar") );
    require_noerr( err, SetMenuBarFromNib_FAILED );

    AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, DoOpenApp, 0, false);
    AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, DoOpenDocuments, 0, false);
//  AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, DoPrintDocuments, 0, false);

    InstallApplicationEventHandler( NewEventHandlerUPP(AppEventHandlerProc), 
                                    GetEventTypeCount(sApplicationEvents), 
                                    sApplicationEvents, 0, NULL );

    RunApplicationEventLoop();

SetMenuBarFromNib_FAILED:
    DisposeNibReference(gOurNibRef);

CantGetNibRef:
    return err;
}
开发者ID:fruitsamples,项目名称:CarbonSketch,代码行数:39,代码来源:main.c


示例14: main

int main(int argc, char* argv[])
{
    IBNibRef 	nibRef;
    OSStatus	err;

    // Create a Nib reference passing the name of the nib file (without the .nib extension)
    // CreateNibReference only searches into the application bundle.
    err = CreateNibReference(CFSTR("main"), &nibRef);
    require_noerr( err, CantGetNibRef );

    // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
    // object. This name is set in InterfaceBuilder when the nib is created.
    err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
    require_noerr( err, CantSetMenuBar );

    MakeWindow(nibRef);

    // don't need the nib reference anymore.
    DisposeNibReference(nibRef);

    const		EventTypeSpec   commandProcessEvents[]	= { { kEventClassCommand, kEventCommandProcess } };

    InstallAppleEventHandlers();
    InstallApplicationEventHandler( NewEventHandlerUPP(CommandProcessEventHandler), 
                                    GetEventTypeCount(commandProcessEvents), 
                                    commandProcessEvents, NULL, NULL );

    // Must initialize QuickTime first
    InitializeQuickTime ();

    // Call the event loop
    RunApplicationEventLoop();

CantCreateWindow:
CantSetMenuBar:
CantGetNibRef:
	return err;
}
开发者ID:fruitsamples,项目名称:SimpleAudioExtraction,代码行数:38,代码来源:main.c


示例15: main

int main(int argc, char* argv[])
{
    IBNibRef 		nibRef;
    WindowRef 		window;
    OSStatus		err;
    EventTypeSpec   cmdEvent	= {kEventClassCommand, kEventCommandProcess};

    // Create a Nib reference passing the name of the nib file (without the .nib extension)
    // CreateNibReference only searches into the application bundle.
    err = CreateNibReference(CFSTR("main"), &nibRef);
    require_noerr( err, CantGetNibRef );
    
    // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
    // object. This name is set in InterfaceBuilder when the nib is created.
    err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
    require_noerr( err, CantSetMenuBar );
    
    // Then create a window. "MainWindow" is the name of the window object. This name is set in 
    // InterfaceBuilder when the nib is created.
    err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &window);
    require_noerr( err, CantCreateWindow );

    // We don't need the nib reference anymore.
    DisposeNibReference(nibRef);
    
    // The window was created hidden so show it.
    ShowWindow( window );
    
    InstallApplicationEventHandler(NewEventHandlerUPP(appCommandHandler), GetEventTypeCount(cmdEvent), &cmdEvent, 0, NULL);

    // Call the event loop
    RunApplicationEventLoop();
    
CantCreateWindow:
CantSetMenuBar:
CantGetNibRef:
	return err;
}
开发者ID:eross,项目名称:misc,代码行数:38,代码来源:main.c


示例16: DoNewWindow

static	OSStatus	DoNewWindow( WindowRef *outWindow )
{
	OSStatus					status;
	static	EventHandlerUPP		windowEventHandlerUPP;
	WindowRef					window				= NULL;
	const	EventTypeSpec		windowEvents[]		=	{ { kEventClassCommand, kEventCommandProcess } };
	
	//	Create a window. "MainWindow" is the name of the window object. This name is set in	InterfaceBuilder when the nib is created.
	status	= CreateWindowFromNib( gMainNibRef, CFSTR("MainWindow"), &window );
	require_noerr( status, CantCreateWindow );
	
	if ( windowEventHandlerUPP == NULL ) windowEventHandlerUPP	= NewEventHandlerUPP( MainWindowEventHandler );
	status	= InstallWindowEventHandler( window, windowEventHandlerUPP, GetEventTypeCount(windowEvents), windowEvents, window, NULL );
	require_noerr( status, CantInstallWindowEventHandler );
	
	//	The window was created hidden so show it if the window parameter is NULL, if it's not, it will be the responsibility of the caller to show it.
	if ( outWindow == NULL )	ShowWindow( window );
	
CantInstallWindowEventHandler:
CantCreateWindow:
		if ( outWindow != NULL )	*outWindow	= window;
	return( status );
}
开发者ID:fruitsamples,项目名称:CarbonQuartzComposer_TV,代码行数:23,代码来源:main.c


示例17: main

//--------------------------------------------------------------------------------------------
int	main( int argc, char *argv[] )
{
	OSStatus				status;
	const   EventTypeSpec   commandProcessEvents[]		= { { kEventClassCommand, kEventCommandProcess } };
	
	status	= CreateNibReference( CFSTR("main"), &gMainNibRef );
	require_noerr( status, CantGetNibRef );
	
	status	= SetMenuBarFromNib( gMainNibRef, CFSTR("MenuBar") );
	require_noerr( status, CantSetMenuBar );
	
	InstallApplicationEventHandler( NewEventHandlerUPP(CommandProcessEventHandler), GetEventTypeCount(commandProcessEvents), commandProcessEvents, NULL, NULL );
	
	NSApplicationLoad();												//	Needed for Carbon based applications which call into Cocoa
	
	DoNewWindow( NULL );
	
	RunApplicationEventLoop();											//	In 10.4, RunApplicationEventLoop also handles our AutoRelease pool used in Cocoa.
	
CantSetMenuBar:
CantGetNibRef:
		return( status );
}
开发者ID:fruitsamples,项目名称:CarbonQuartzComposer_TV,代码行数:24,代码来源:main.c


示例18: loadDialogWindow

//----------------------------------------------------------------------------//
bool MacCEGuiRendererSelector::invokeDialog()
{
    loadDialogWindow();
    int rendererCount = populateRendererMenu();

    // 'cancel' if there are no renderers available
    if (rendererCount == 0)
        d_cancelled = true;
    // only bother with the dialog if there is a choice ;)
    else if (rendererCount > 1)
    {
        // set the event handling
        EventTypeSpec cmdEvt;	
        cmdEvt.eventClass = kEventClassCommand;
        cmdEvt.eventKind = kEventCommandProcess;
        
        InstallEventHandler(
            GetWindowEventTarget(d_dialog),
            NewEventHandlerUPP(MacCEGuiRendererSelector::eventDispatcher), 1,
            &cmdEvt, this, 0); 

        ShowWindow(d_dialog);
        RunApplicationEventLoop();
    }

    SInt32 idx = HIViewGetValue(d_rendererPopup);
    DisposeWindow(d_dialog);

    // bail out if user cancelled dialog or if selected index is 0
    if (d_cancelled || (idx == 0))
        return false;

    // set the last selected renderer - i.e. the one we want to use.
    d_lastSelected = d_rendererTypes[idx - 1];

    return true;
}
开发者ID:CharlesSadler,项目名称:CharlesSadlerRTSGame,代码行数:38,代码来源:MacCEGuiRendererSelector.cpp


示例19: InitializeApplication

static	OSErr	InitializeApplication( void )
{
	OSErr						err;
	static const EventTypeSpec	sApplicationEvents[] =	{	{ kEventClassCommand, kEventCommandProcess }	};

	BlockZero( &g, sizeof(g) );
		
	g.mainBundle = CFBundleGetMainBundle();
	if ( g.mainBundle == NULL ) 		{ err = -1;	goto Bail;	}

	if ( MPLibraryIsLoaded() == false )	{ err = -1;	goto Bail;	}
	
	err	= CreateNibReferenceWithCFBundle( g.mainBundle, CFSTR("main"), &g.mainNib );
	if ( err != noErr )	goto Bail;
	if ( g.mainNib == NULL ) 		{ err = -1;	goto Bail;	}

	err	= SetMenuBarFromNib( g.mainNib, CFSTR("MenuBar") );
	if ( err != noErr )	goto Bail;

	InstallApplicationEventHandler( NewEventHandlerUPP(AppEventEventHandlerProc), GetEventTypeCount(sApplicationEvents), sApplicationEvents, 0, NULL );

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


示例20: PickMonitor

OSStatus PickMonitor (DisplayIDType *inOutDisplayID, WindowRef parentWindow)
{
	WindowRef theWindow;
	OSStatus status = noErr;
	static const ControlID	kUserPane 		= { 'MONI', 1 };
	
	// Fetch the dialog

	IBNibRef aslNib;
	CFBundleRef theBundle = CFBundleGetMainBundle();
	status = CreateNibReferenceWithCFBundle(theBundle, CFSTR("ASLCore"), &aslNib);
	status = ::CreateWindowFromNib(aslNib, CFSTR( "Pick Monitor" ), &theWindow );
	if (status != noErr)
	{
		assert(false);
		return userCanceledErr;
	}

#if 0
	// Put game name in window title. By default the title includes the token <<<kGameName>>>.

	Str255 windowTitle;
	GetWTitle(theWindow, windowTitle);
	FormatPStringWithGameName(windowTitle);
	SetWTitle(theWindow, windowTitle);
#endif
		
	// Set up the controls

	ControlRef monitorPane;
	GetControlByID( theWindow, &kUserPane, &monitorPane );
	assert(monitorPane);

	SetupPickMonitorPane(monitorPane, *inOutDisplayID);

	// Create our UPP and install the handler.

	EventTypeSpec cmdEvent = { kEventClassCommand, kEventCommandProcess };
	EventHandlerUPP handler = NewEventHandlerUPP( PickMonitorHandler );
	InstallWindowEventHandler( theWindow, handler, 1, &cmdEvent, theWindow, NULL );
	
	// Show the window

	if (parentWindow)
		ShowSheetWindow( theWindow, parentWindow );
	else
		ShowWindow( theWindow );

	// Now we run modally. We will remain here until the PrefHandler
	// calls QuitAppModalLoopForWindow if the user clicks OK or
	// Cancel.

	RunAppModalLoopForWindow( theWindow );

	// OK, we're done. Dispose of our window and our UPP.
	// We do the UPP last because DisposeWindow can send out
	// CarbonEvents, and we haven't explicitly removed our
	// handler. If we disposed the UPP, the Toolbox might try
	// to call it. That would be bad.

	TearDownPickMonitorPane(monitorPane);
	if (parentWindow)
		HideSheetWindow( theWindow );
	DisposeWindow( theWindow );
	DisposeEventHandlerUPP( handler );

	// Return settings to caller

	if (sSelectedDevice != 0)
	{
		// Read back the controls
		DMGetDisplayIDByGDevice (sSelectedDevice, &*inOutDisplayID, true);
		return noErr;
	}
	else
		return userCanceledErr;

}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:78,代码来源:PickMonitor.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NewGame函数代码示例发布时间:2022-05-30
下一篇:
C++ New函数代码示例发布时间: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