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


C++ AEInstallEventHandler函數代碼示例

本文整理匯總了C++中AEInstallEventHandler函數的典型用法代碼示例。如果您正苦於以下問題:C++ AEInstallEventHandler函數的具體用法?C++ AEInstallEventHandler怎麽用?C++ AEInstallEventHandler使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AEInstallEventHandler函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: installAEHandlers

bool installAEHandlers()
{
    OSErr iErr = noErr;
    
    g_lpfnAEProc = NewAEEventHandlerUPP(aplEventHdlr);

    if (noErr != (iErr = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, g_lpfnAEProc, FOUR_CHAR_CODE('QUIT'), FALSE)))
    {
        DisposeAEEventHandlerUPP(g_lpfnAEProc);
        fprintf(stderr, "installAEHandlers() - AEInstallEventHandler(kAEQuitApplication) failed, returning %lu!\n", (unsigned long) iErr);
        return false;
    }

    if (noErr != (iErr = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, g_lpfnAEProc, FOUR_CHAR_CODE('OPEN'), FALSE)))
    {
        AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, g_lpfnAEProc, FALSE);
        DisposeAEEventHandlerUPP(g_lpfnAEProc);
        fprintf(stderr, "installAEHandlers() - AEInstallEventHandler(kAEOpenDocuments) failed, returning %lu!\n", (unsigned long) iErr);
        return false;
    }
    
    if (noErr != (iErr = AEInstallEventHandler(kCoreEventClass, kAEShowPreferences, g_lpfnAEProc, FOUR_CHAR_CODE('PREF'), FALSE)))
    {
        AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, g_lpfnAEProc, FALSE);
        AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, g_lpfnAEProc, FALSE);
        DisposeAEEventHandlerUPP(g_lpfnAEProc);
        fprintf(stderr, "installAEHandlers() - AEInstallEventHandler(kAEShowPreferences) failed, returning %lu!\n", (unsigned long) iErr);
        return false;
    }

    return true;
}
開發者ID:ullerrm,項目名稱:frogg,代碼行數:32,代碼來源:AEvents.cpp

示例2: setupEventHandler_mac

void
setupEventHandler_mac(SRefCon handlerRef)
{
    appleEventProcessorUPP = AEEventHandlerUPP(appleEventProcessor);
    AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, appleEventProcessorUPP, handlerRef, true);
    macCallbackUrlHandlerUPP = AEEventHandlerUPP(macCallbackUrlHandler);
    AEInstallEventHandler(kInternetEventClass, kAEGetURL, macCallbackUrlHandlerUPP, handlerRef, false);
}
開發者ID:cancamilo,項目名稱:amarok,代碼行數:8,代碼來源:app_mac.cpp

示例3: Install

static void Install(void)
{
  short err=0;
  err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(OpenApplicationStuff), 0, 0);
  err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(OpenFinderDoc), 0, 0);
  err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerUPP(DoNothing), 0, 0);
  err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(SetUpQuitMessage), 0, 0);
  err = AEInstallEventHandler('PLT ', 'cmdl', NewAEEventHandlerUPP(CmdLineMessage), 0, 0);
}
開發者ID:akavel,項目名稱:pltscheme-cvs-cvs2git-1,代碼行數:9,代碼來源:simpledrop.cpp

示例4: installhandlers

static void installhandlers (void) {

	AEInstallEventHandler ('TEST', 'smsg', NewAEEventHandlerProc (setmessageverb), 0, false);

	AEInstallEventHandler (kCoreEventClass, kAEOpenApplication, NewAEEventHandlerProc (handleopenapp), 0, false);
	
	AEInstallEventHandler (kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerProc (handleopen), 0, false);
	
	AEInstallEventHandler (kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerProc (handleprint), 0, false);
	
	AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, NewAEEventHandlerProc (handlequit), 0, false);
	} /*installhandlers*/
開發者ID:dvincent,項目名稱:frontier,代碼行數:12,代碼來源:main.c

示例5: addLibraryPath

void
unicorn::Application::init()
{
#ifdef Q_OS_MAC
    addLibraryPath( applicationDirPath() + "/../plugins" );
#elif defined Q_OS_WIN
    addLibraryPath( applicationDirPath() + "/plugins" );
#endif

#ifdef Q_WS_MAC
    qt_mac_set_menubar_icons( false );
#endif

    CoreApplication::init();

    setupHotKeys();

#ifdef __APPLE__
    setGetURLEventHandler();
    AEEventHandlerUPP urlHandler = NewAEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( kInternetEventClass, kAEGetURL, urlHandler, 0, false );

    setOpenApplicationEventHandler();
    AEEventHandlerUPP openHandler = NewAEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, openHandler, 0, false );
#endif

#ifdef Q_WS_MAC
#define CSS_PATH "/../Resources/"
#else
#define CSS_PATH "/"
#endif

    refreshStyleSheet();

    translate();

    m_icm = new lastfm::InternetConnectionMonitor( this );

    connect( m_icm, SIGNAL( up( QString ) ), this, SIGNAL( internetConnectionUp() ) );
    connect( m_icm, SIGNAL( down( QString ) ), this, SIGNAL( internetConnectionDown() ) );

    connect( &m_bus, SIGNAL( wizardRunningQuery( QString )), SLOT( onWizardRunningQuery( QString )));
    connect( &m_bus, SIGNAL( sessionQuery( QString )), SLOT( onBusSessionQuery( QString )));
    connect( &m_bus, SIGNAL( sessionChanged( const QMap<QString, QString>& )), SLOT( onBusSessionChanged( const QMap<QString, QString>& )));
    connect( &m_bus, SIGNAL( lovedStateChanged(bool)), SIGNAL( busLovedStateChanged(bool)));

    m_bus.board();

#ifdef __APPLE__
    setQuitOnLastWindowClosed( false );
#endif
}
開發者ID:dschmidt,項目名稱:lastfm-desktop,代碼行數:53,代碼來源:UnicornApplication.cpp

示例6: init_ae

void
init_ae()
{
	AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
					NewAEEventHandlerProc(DoOpenApp), 0L, false);
	AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
					NewAEEventHandlerProc(DoOpenDocument), 0L, false);
	AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
					NewAEEventHandlerProc(DoQuitApp), 0L, false);
	AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
					NewAEEventHandlerProc(DoQuitApp), 0L, false);

}
開發者ID:Feneric,項目名稱:xconq,代碼行數:13,代碼來源:iappmac.c

示例7: LauncherSetup_md

/*
 * If we got no arguments install the apple event handlers and our event loop.
 */
void LauncherSetup_md(int argc) {
    OSErr err;
    AEEventHandlerUPP openDocEventHandler;
    AEEventHandlerUPP openAppEventHandler;
    char **argv = NULL;
    int no = 0;

    // If we got more than one argument we were launched from the commandline,
    // so don't install any handlers.
    if (argc > 1)
        return;

    if (gInitialized)
        return;

    gInitialized = true;

    // We need to handle open events for the functionality we're looking for.
    openDocEventHandler = NewAEEventHandlerUPP((AEEventHandlerProcPtr)OpenDocEventHandler);
    openAppEventHandler = NewAEEventHandlerUPP((AEEventHandlerProcPtr)OpenAppEventHandler);

    err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, openDocEventHandler, 0, TRUE);
    if(err) {
        fprintf(stderr, "Error installing open event handler\n");
        exit(-1);
    }

    err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, openAppEventHandler, 0, TRUE);
    if(err) {
        fprintf(stderr, "Error installing open app handler\n");
        exit(-1);
    }

    // Enter the event loop and handle appleevents.  If we were given files to open
    // they will appear here.
    RunApplicationEventLoop();

    if (gRunAppManager) {
        // Three arguments -- app name, no file, and null.
        argv = (char**)malloc(sizeof(char*) * 3);
        no = 0;
        argv[no++] = GetWebStartAppName();
        argv[no] = NULL;

        // Call into our main app.
        main(no, argv);
    } else {
        exit(0);
    }

}
開發者ID:Spronovost,項目名稱:documentation,代碼行數:54,代碼來源:launcher_md.c

示例8: openApplicationAEHandler

// --------------------------------------------------------------------------------------
static pascal OSErr openApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, 
												long refcon)
{
#pragma unused (reply, refcon)
	OSErr error;
	DescType returnedType;
	Size actualSize;
	
	error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType,
								NULL, 0, &actualSize);
	if (error == noErr)
		error = errAEParamMissed;
	else if (error == errAEDescNotFound)
	{
		EventTypeSpec applicationEvents[] = {
												{kEventClassCommand, kEventCommandProcess}
		                                    };
		
			/* For our program running in Carbon, a Quit Application Apple Event handler 
			   is unnecessary because RunApplicationEventLoop installs one for us that 
			   calls QuitApplicationEventLoop.  However we will leave ours here in case 
			   we ever need it to do something different so that we know where it 
			   belongs. */
		gQuitAppAEHandler = NewAEEventHandlerUPP(quitApplicationAEHandler);
		error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, gQuitAppAEHandler, 
										0, false);
		if (error != noErr)		// if we can't allow the user a mechanism to quit
		{						// we'd better just quit right now
			DisposeAEEventHandlerUPP(gOpenAppAEHandler);
			DisposeAEEventHandlerUPP(gQuitAppAEHandler);
			
			ExitToShell();
		}
		gViewsFontChangedAEHandler = NewAEEventHandlerUPP(viewsFontChangedAEHandler);
		error = AEInstallEventHandler(kAppearanceEventClass, kAEViewsFontChanged, 
										gViewsFontChangedAEHandler, 0, false);
		
		gAppEventHandler = NewEventHandlerUPP(appEventHandler);
		InstallApplicationEventHandler(gAppEventHandler, GetEventTypeCount(applicationEvents), 
										applicationEvents, NULL, NULL);
		
		Gestalt(gestaltSystemVersion, &gMacOSVersion);	// get the version of Mac OS we're 
														// running on
		InitIconDataBrowser();
		
		error = noErr;
	}
	
	return error;
}
開發者ID:fruitsamples,項目名稱:CarbonPorting,代碼行數:51,代碼來源:ExamplePrefs.c

示例9: main

int
main( int argc, char *argv[] )
{
#ifdef Q_WS_MAC
    // Do Mac specific startup to get media keys working.
    // This must go before QApplication initialisation.
    Tomahawk::macMain();

    // used for url handler
    AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
#endif

    TomahawkApp a( argc, argv );
    KDSingleApplicationGuard guard( &a, KDSingleApplicationGuard::AutoKillOtherInstances );
    QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance )  ) );

    if ( guard.isPrimaryInstance() )
        a.init();

    QString locale = QLocale::system().name();

    QTranslator translator;
    translator.load( QString( ":/lang/tomahawk_" ) + locale );
    a.installTranslator( &translator );

    if ( argc > 1 )
    {
        QString arg = a.arguments()[ 1 ];
        a.loadUrl( arg );
    }

    return a.exec();
}
開發者ID:pauloppenheim,項目名稱:tomahawk,代碼行數:34,代碼來源:main.cpp

示例10: initialize

// --------------------------------------------------------------------------------------
static void initialize(void)
{
	OSStatus status;
	IBNibRef nib;
	OSErr error;
	
	RegisterAppearanceClient();

	status = CreateNibReference(CFSTR("ExamplePrefs"), &nib);
	if (status != noErr)
		ExitToShell();
	
	status = SetMenuBarFromNib(nib, CFSTR("MenuBar"));
	if (status != noErr)
		ExitToShell();
	
	DisposeNibReference(nib);
	
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that we 
		   do in the open application handler */
}
開發者ID:fruitsamples,項目名稱:CarbonPorting,代碼行數:32,代碼來源:ExamplePrefs.c

示例11: setUp

void setUp()
{
	Handle	menuBar;
	OSErr 	anErr = noErr;
	long	aLong;
	long	response;
	
	anErr = Gestalt(gestaltSystemVersion, &response);
	
	// Carbon Porting guidelines say provide alternate menu bar/menu scheme for OS X
	// This is just one way of doing this, which is pretty static
	if (response >= 0x01000) 
		menuBar = GetNewMBar(MENU_BAR_IDX);
	else
		menuBar = GetNewMBar(MENU_BAR_ID);
	
	if ( menuBar == nil || anErr != noErr )
		 ExitToShell();	

	SetMenuBar(menuBar);
	DisposeHandle(menuBar);

	DrawMenuBar();
	
    // Install 'quit' event handler
	if ((Gestalt(gestaltAppleEventsAttr, &aLong) == noErr)) {
		    anErr = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
			         NewAEEventHandlerUPP(AEQuitHandler), 0, false);
		    if (anErr != noErr)  
		    	ExitToShell();
	}
}
開發者ID:fruitsamples,項目名稱:Snapshot,代碼行數:32,代碼來源:Snapshot.c

示例12: PyMac_PRECHECK

static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AEEventClass theAEEventClass;
	AEEventID theAEEventID;
	AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
	PyObject *handler;
#ifndef AEInstallEventHandler
	PyMac_PRECHECK(AEInstallEventHandler);
#endif
	if (!PyArg_ParseTuple(_args, "O&O&O",
	                      PyMac_GetOSType, &theAEEventClass,
	                      PyMac_GetOSType, &theAEEventID,
	                      &handler))
		return NULL;
	_err = AEInstallEventHandler(theAEEventClass,
	                             theAEEventID,
	                             handler__proc__, (long)handler,
	                             0);
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	Py_INCREF(handler); /* XXX leak, but needed */
	return _res;
}
開發者ID:AdminCNP,項目名稱:appscript,代碼行數:26,代碼來源:_AEmodule.c

示例13: main

int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    a.setOrganizationName("sqlitebrowser");
    a.setApplicationName("SQLite Database Browser");

    // Set character encoding to UTF8
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

    // Enable translation
    QTranslator translator;
    translator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    a.installTranslator(&translator);
    QTranslator apptranslator;
    apptranslator.load("translations/tr_" + QLocale::system().name());
    a.installTranslator(&apptranslator);

    MainWindow w;
#if defined(Q_WS_MAC)
    AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
                          NewAEEventHandlerUPP(odocHandler),reinterpret_cast<long>(&w),false);
#endif // Q_WS_MAC
    w.show();
    if (argc>1) {
        //first and only argument we accept is the name of the database to open
        w.fileOpen(QString(argv[1]));
    }
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    return a.exec();
}
開發者ID:mmankarious,項目名稱:sqlitebrowser,代碼行數:32,代碼來源:main.cpp

示例14: os_initialize

bool os_initialize( adobe::application_t* theApp )
{
    //
    // On the Mac we need to install the application menus, respond
    // to AppleEvents and set the resource path. We set the resource
    // path first.
    //
    ProcessSerialNumber psn;
    ADOBE_REQUIRE_STATUS( GetCurrentProcess( &psn ) );

    FSRef location;
    ADOBE_REQUIRE_STATUS( GetProcessBundleLocation( &psn, &location ) );

    theApp->set_resource_directory( fsref_to_path( location ) / "Contents" / "Resources" );

    //
    // Now load our bundle, sign up for AppleEvents and show the menu.
    //
    CFBundleRef bundle = CFBundleGetMainBundle();
    IBNibRef    nibs = 0;

    if( !bundle ) return false;

    ADOBE_REQUIRE_STATUS( CreateNibReferenceWithCFBundle( bundle, kMainNibFileName, &nibs ) );

    if( !nibs )
    {
        ::CFRelease( bundle );

        return false;
    }

    //
    // Sign up to handle the "Open" AppleEvent.
    //
    static adobe::auto_resource<AEEventHandlerUPP> ae_handler( NewAEEventHandlerUPP( handle_open ) );

    AEInstallEventHandler( kCoreEventClass, kAEOpenDocuments, ae_handler.get(), 0, false );

    //
    // Install the menu, and it's event handler.
    //
    ADOBE_REQUIRE_STATUS( SetMenuBarFromNib( nibs, kMenuBarNibName ) );

    static EventTypeSpec                            hi_event = { kEventClassCommand, kHICommandFromMenu };
    static adobe::auto_resource<EventHandlerUPP>    hi_handler( NewEventHandlerUPP( menu_command ) );

    InstallApplicationEventHandler( hi_handler.get(), 1, &hi_event, theApp, 0 );

    //
    // Register this app as an Appearance Client
    //
    // Apple docs: "This function does nothing on Mac OS X. Do not call it."
    //
    // RegisterAppearanceClient();

    return true;
}
開發者ID:sehe,項目名稱:legacy,代碼行數:58,代碼來源:main.cpp

示例15: main

int main( int argc, char** argv )
{    
    QCoreApplication::setApplicationName( moose::applicationName() );
    QCoreApplication::setApplicationVersion( VERSION );
    QCoreApplication::setOrganizationName( CoreSettings::organizationName() );
    QCoreApplication::setOrganizationDomain( CoreSettings::organizationDomain() );

#ifdef NDEBUG
    UniqueApplication uapp( moose::id() );
    if (uapp.isAlreadyRunning())
		return uapp.forward( argc, argv ) ? 0 : 1;
    uapp.init1();
#endif	
    
    try
    {
        App app( argc, argv );
      #ifdef NDEBUG
		uapp.init2( &app );
        app.connect( &uapp, SIGNAL(arguments( QStringList )), SLOT(parseArguments( QStringList )) );
      #endif

      #ifdef Q_WS_MAC
        AEEventHandlerUPP h = NewAEEventHandlerUPP( appleEventHandler );
        AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
        //AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, h, 0, false ); //QCoreApplication handles this for us
        AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, h, 0, false );
      #endif

        Container container; gcon = &container;
        container.show();

        if (!app.arguments().contains( "--tray" ))
            container.show();

        app.parseArguments( app.arguments() );

        return app.exec();
    }
    catch (unicorn::Application::StubbornUserException&)
    {
        // user wouldn't log in
        return 0;
    }    
}
開發者ID:RJ,項目名稱:lastfm-desktop,代碼行數:45,代碼來源:main.cpp


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