add wxAppConsoleBase::OnEventLoopEnter/Exit callbacks; add wxEventLoopBase::IsMain() and wxAppConsoleBase::GetMainLoop() helpers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -87,10 +87,21 @@ public: | ||||
|     // be done here. When OnRun() returns, the programs starts shutting down. | ||||
|     virtual int OnRun(); | ||||
|  | ||||
|     // This is called by wxEventLoopBase::SetActive(): you should put the code | ||||
|     // which needs an active event loop here. | ||||
|     // 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. | ||||
|     virtual void OnEventLoopEnter(wxEventLoopBase* WXUNUSED(loop)) {} | ||||
|  | ||||
|     // This is only called if OnInit() returned true so it's a good place to do | ||||
|     // any cleanup matching the initializations done there. | ||||
|     virtual int OnExit(); | ||||
|  | ||||
|     // This is called by wxEventLoopBase::OnExit() for each event loop which | ||||
|     // is exited. | ||||
|     virtual void OnEventLoopExit(wxEventLoopBase* WXUNUSED(loop)) {} | ||||
|  | ||||
|     // This is the very last function called on wxApp object before it is | ||||
|     // destroyed. If you override it (instead of overriding OnExit() as usual) | ||||
|     // do not forget to call the base class version! | ||||
| @@ -206,6 +217,15 @@ public: | ||||
|     // for it | ||||
|     static wxAppTraits *GetTraitsIfExists(); | ||||
|  | ||||
|     // 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 | ||||
|         { return m_mainLoop; } | ||||
|  | ||||
|  | ||||
|     // event processing functions | ||||
|     // -------------------------- | ||||
|  | ||||
|   | ||||
| @@ -61,6 +61,9 @@ public: | ||||
|     // using it | ||||
|     virtual bool IsOk() const { return true; } | ||||
|  | ||||
|     // returns true if this is the main loop | ||||
|     bool IsMain() const; | ||||
|  | ||||
|  | ||||
|     // dispatch&processing | ||||
|     // ------------------- | ||||
| @@ -173,14 +176,14 @@ public: | ||||
|     static wxEventLoopBase *GetActive() { return ms_activeLoop; } | ||||
|  | ||||
|     // set currently active (running) event loop | ||||
|     static void SetActive(wxEventLoopBase* loop) { ms_activeLoop = loop; } | ||||
|     static void SetActive(wxEventLoopBase* loop); | ||||
|  | ||||
|  | ||||
| protected: | ||||
|     // this function should be called before the event loop terminates, whether | ||||
|     // this happens normally (because of Exit() call) or abnormally (because of | ||||
|     // an exception thrown from inside the loop) | ||||
|     virtual void OnExit() { } | ||||
|     virtual void OnExit(); | ||||
|  | ||||
|     // the pointer to currently active loop | ||||
|     static wxEventLoopBase *ms_activeLoop; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user