X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f2f732921b6456c87ab8d180c5bd14456a5b35f..c602c59b6e623d7775c16ce6412b64b34dc5dd94:/interface/wx/app.h diff --git a/interface/wx/app.h b/interface/wx/app.h index 9037103381..4053532457 100644 --- a/interface/wx/app.h +++ b/interface/wx/app.h @@ -91,6 +91,14 @@ public: */ virtual int FilterEvent(wxEvent& event); + /** + Returns the main event loop instance, i.e. the event loop which is started + by OnRun() and which dispatches all events sent from the native toolkit + to the application (except when new event loops are temporarily set-up). + The returned value maybe @NULL. Put initialization code which needs a + non-@NULL main event loop into OnEventLoopEnter(). + */ + wxEventLoopBase* GetMainLoop() const; /** This function simply invokes the given method @a func of the specified @@ -106,6 +114,65 @@ public: //@} + /** + @name Pending events + + Pending events are handled by wxAppConsole rather than wxEventLoopBase + to allow queuing of events even when there's no event loop + (e.g. in wxAppConsole::OnInit). + */ + //@{ + + /** + Process all pending events; it is necessary to call this function to + process events posted with wxEvtHandler::QueueEvent or wxEvtHandler::AddPendingEvent. + + This happens during each event loop iteration (see wxEventLoopBase) in GUI mode but + it may be also called directly. + + Note that this function does not only process the pending events for the wxApp object + itself (which derives from wxEvtHandler) but also the pending events for @e any + event handler of this application. + + This function will immediately return and do nothing if SuspendProcessingOfPendingEvents() + was called. + */ + virtual void ProcessPendingEvents(); + + /** + Deletes the pending events of all wxEvtHandlers of this application. + + See wxEvtHandler::DeletePendingEvents() for warnings about deleting the pending + events. + */ + void DeletePendingEvents(); + + /** + Returns @true if there are pending events on the internal pending event list. + + Whenever wxEvtHandler::QueueEvent or wxEvtHandler::AddPendingEvent() are + called (not only for wxApp itself, but for any event handler of the application!), + the internal wxApp's list of handlers with pending events is updated and this + function will return true. + */ + bool HasPendingEvents() const; + + /** + Temporary suspends processing of the pending events. + + @see ResumeProcessingOfPendingEvents() + */ + void SuspendProcessingOfPendingEvents(); + + /** + Resume processing of the pending events previously stopped because of a + call to SuspendProcessingOfPendingEvents(). + */ + void ResumeProcessingOfPendingEvents(); + + //@} + + /** Allows external code to modify global ::wxTheApp, but you should really know what you're doing if you call it. @@ -145,7 +212,7 @@ public: Called in response of an "open-application" Apple event. Override this to create a new document in your app. - @onlyfor{wxmac} + @onlyfor{wxosx} */ virtual void MacNewFile(); @@ -156,28 +223,28 @@ public: user double clicked on it or if the document file was dropped on either the running application or the application icon in Finder. - @onlyfor{wxmac} + @onlyfor{wxosx} */ virtual void MacOpenFile(const wxString& fileName); /** Called in response of a "get-url" Apple event. - @onlyfor{wxmac} + @onlyfor{wxosx} */ virtual void MacOpenURL(const wxString& url); /** Called in response of a "print-document" Apple event. - @onlyfor{wxmac} + @onlyfor{wxosx} */ virtual void MacPrintFile(const wxString& fileName); /** Called in response of a "reopen-application" Apple event. - @onlyfor{wxmac} + @onlyfor{wxosx} */ virtual void MacReopenApp(); @@ -254,6 +321,26 @@ public: */ virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + /** + Called by wxEventLoopBase::SetActive(): you can override this function + and put here the code which needs an active event loop. + + Note that this function is called whenever an event loop is activated; + you may want to use wxEventLoopBase::IsMain() to perform initialization + specific for the app's main event loop. + + @see OnEventLoopExit() + */ + virtual void OnEventLoopEnter(wxEventLoopBase* loop); + + /** + Called by wxEventLoopBase::OnExit() for each event loop which + is exited. + + @see OnEventLoopEnter() + */ + virtual void OnEventLoopExit(wxEventLoopBase* loop); + /** This function is called if an unhandled exception occurs inside the main application event loop. It can return @true to ignore the exception and to