-// ----------------------------------------------------------------------------
-// implementation helpers
-// ----------------------------------------------------------------------------
-
-// Helper hook class used to redirect ShowModal() to testing code.
-// Instead of showing a dialog modally, hook code is called to simulate what
-// the user would do and return appropriate ID from ShowModal().
-class WXDLLIMPEXP_CORE wxModalDialogHook
-{
-public:
- wxModalDialogHook() {}
- virtual ~wxModalDialogHook() {}
-
- /// Returns currently active hook object or NULL.
- static wxModalDialogHook *Get() { return ms_instance; }
-
- /// Set the hook and returns the previously set one.
- static wxModalDialogHook *Set(wxModalDialogHook *hook)
- {
- wxModalDialogHook *old = ms_instance;
- ms_instance = hook;
- return old;
- }
-
- /// Entry point that is called from ShowModal().
- virtual int Invoke(wxDialog *dlg) = 0;
-
-private:
- static wxModalDialogHook *ms_instance;
-
- wxDECLARE_NO_COPY_CLASS(wxModalDialogHook);
-};
-
-// This macro needs to be used at the top of every implementation of
-// ShowModal() in order for the above modal dialogs testing code to work.
-#define WX_TESTING_SHOW_MODAL_HOOK() \
- if ( wxModalDialogHook::Get() ) \
- { \
- int rc = wxModalDialogHook::Get()->Invoke(this); \
- if ( rc != wxID_NONE ) \
- return rc; \
- } \
- struct wxDummyTestingStruct /* just to force a semicolon */
-
-