home *** CD-ROM | disk | FTP | other *** search
- #ifndef __APPLEEVENTMANAGER__
- #define __APPLEEVENTMANAGER__
- #pragma once
-
- #include "Module.h"
- #include "EventFilter.h"
-
- #include <AppleEvents.h>
-
- enum
- {
- kAEFutureReply = 0
- };
-
- //--------------------------------------------------------------------------------
-
- class AppleEventManager : public TModule, public EventFilter
- {
- DeclareClass2Base(AppleEventManager, TModule, EventFilter);
-
- protected:
- static AppleEventManager* gAppleEventManager;
-
- public:
- static AppleEventManager& GetAppleEventManager();
-
- // TModule overrides
- AppleEventManager();
- virtual ~AppleEventManager();
- virtual bool Validate();
- virtual void Initialize(void);
- virtual void Finalize(void);
-
- // EventFilter overrides
- virtual bool FilterEvent(ToolboxEvent& evt);
-
- static void SendAppleEvent(
- const AppleEvent& theAppleEvent,
- AppleEvent* reply,
- long timeOutInTicks = kAEDefaultTimeout,
- long maxWaitTime = kNoTimeOut,
- AESendMode sendMode = kAEFutureReply,
- AESendPriority sendPriority = kAENormalPriority);
- };
-
- //--------------------------------------------------------------------------------
-
- #if !qDebug
-
- AppleEventManager::AppleEventManager()
- {
- gAppleEventManager = this;
- }
-
- inline AppleEventManager& AppleEventManager::GetAppleEventManager()
- {
- return *gAppleEventManager;
- }
-
- #endif
-
- //--------------------------------------------------------------------------------
-
- #endif __APPLEEVENTMANAGER__