X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72ddb593f1a430b8aab993e43b4184bc16acb665..57fbe23f68f9ef92b8ef7e26bd06b399b53e33b2:/include/wx/mac/app.h diff --git a/include/wx/mac/app.h b/include/wx/mac/app.h index 5f269ffc05..498fe3e71c 100644 --- a/include/wx/mac/app.h +++ b/include/wx/mac/app.h @@ -12,7 +12,7 @@ #ifndef _WX_APP_H_ #define _WX_APP_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "app.h" #endif @@ -53,10 +53,15 @@ class WXDLLEXPORT wxApp: public wxAppBase virtual bool Pending() ; virtual void Dispatch() ; virtual bool Yield(bool onlyIfNeeded = FALSE); + virtual bool ProcessIdle(); virtual void SetPrintMode(int mode) { m_printMode = mode; } virtual int GetPrintMode() const { return m_printMode; } +#if wxUSE_GUI + // setting up all MacOS Specific Event-Handlers etc + virtual bool OnInitGui(); +#endif // wxUSE_GUI // implementation only void OnIdle(wxIdleEvent& event); void OnEndSession(wxCloseEvent& event); @@ -85,16 +90,18 @@ public: static bool Initialize(); static void CleanUp(); - virtual bool OnInit(); void DeletePendingObjects(); - bool ProcessIdle(); bool IsExiting() { return !m_keepGoing ; } - +#if TARGET_CARBON + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } +#endif + public: static long sm_lastMessageTime; static wxWindow* s_captureWindow ; static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right static WXHRGN s_macCursorRgn ; + static long s_lastModifiers ; WXEVENTREF m_macCurrentEvent ; int m_nCmdShow; @@ -105,9 +112,16 @@ protected: // mac specifics public: +#if TARGET_CARBON + // public to avoid change in initialization order of handlers + // could be moved into a override of OnInitGui eventually + WXEVENTHANDLERREF m_macEventHandler ; +#endif static bool s_macDefaultEncodingIsPC ; static bool s_macSupportPCMenuShortcuts ; static long s_macAboutMenuItemId ; + static long s_macPreferencesMenuItemId ; + static long s_macExitMenuItemId ; static wxString s_macHelpMenuTitleName ; static bool s_macHasAppearance ; @@ -127,28 +141,32 @@ public: virtual void MacSuspend( bool convertClipboard ) ; virtual void MacResume( bool convertClipboard ) ; - virtual void MacConvertPrivateToPublicScrap() ; virtual void MacConvertPublicToPrivateScrap() ; + +#if !TARGET_CARBON + virtual void MacHandleMenuSelect( int menuid , int menuitem ) ; + virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ; + virtual void MacHandleOSEvent( WXEVENTREF ev ) ; + virtual void MacHandleDiskEvent( WXEVENTREF ev ) ; + virtual void MacHandleActivateEvent( WXEVENTREF ev ) ; + virtual void MacHandleUpdateEvent( WXEVENTREF ev ) ; +#endif + virtual void MacHandleMouseDownEvent( WXEVENTREF ev ) ; + void MacHandleMenuCommand( wxUint32 command ) ; // event main methods void MacDoOneEvent() ; void MacHandleOneEvent( WXEVENTREF ev ) ; + void MacHandleModifierEvents( WXEVENTREF ev ) ; WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } // primary events - virtual void MacHandleMouseDownEvent( WXEVENTREF ev ) ; - virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ; - virtual void MacHandleActivateEvent( WXEVENTREF ev ) ; - virtual void MacHandleUpdateEvent( WXEVENTREF ev ) ; virtual void MacHandleKeyDownEvent( WXEVENTREF ev ) ; virtual void MacHandleKeyUpEvent( WXEVENTREF ev ) ; - virtual void MacHandleDiskEvent( WXEVENTREF ev ) ; - virtual void MacHandleOSEvent( WXEVENTREF ev ) ; virtual void MacHandleHighLevelEvent( WXEVENTREF ev ) ; - virtual void MacHandleMenuSelect( int menuid , int menuitem ) ; virtual bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; virtual bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; @@ -158,6 +176,13 @@ public: virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + // in response of an open-document apple event + virtual void MacOpenFile(const wxString &fileName) ; + // in response of a print-document apple event + virtual void MacPrintFile(const wxString &fileName) ; + // in response of a open-application apple event + virtual void MacNewFile() ; + DECLARE_EVENT_TABLE() }; @@ -176,7 +201,9 @@ private: } ; // TODO: add platform-specific arguments +#ifndef __DARWIN__ int WXDLLEXPORT wxEntry( int argc, char *argv[] , bool enterLoop = TRUE); +#endif void wxMacConvertFromPCForControls( char * p ) ;