当前位置: 首页>>代码示例>>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;未经允许,请勿转载。