From 691745ab412824d74d036930ad69accbe37d97b4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 May 2013 13:15:41 +0000 Subject: [PATCH] Add a public wxModalDialogHook class for intercepting modal dialogs. Extract wxModalDialogHook from wx/testing.h into its own wx/modalhook.h, extend it to allow to be notified not only about showing modal dialogs but also about dismissing them and document it and show its use in the dialogs sample. Also replace all the WX_TESTING_SHOW_MODAL_HOOK macros occurrences with WX_HOOK_MODAL_DIALOG. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 21 +++++ build/bakefiles/files.bkl | 2 + build/msw/makefile.bcc | 28 +++++++ build/msw/makefile.gcc | 28 +++++++ build/msw/makefile.vc | 28 +++++++ build/msw/makefile.wat | 28 +++++++ build/msw/wx_core.dsp | 29 ++++--- build/msw/wx_vc7_core.vcproj | 6 ++ build/msw/wx_vc8_core.vcproj | 8 ++ build/msw/wx_vc9_core.vcproj | 8 ++ docs/changes.txt | 1 + include/wx/modalhook.h | 105 ++++++++++++++++++++++++ include/wx/testing.h | 114 ++++++++------------------ interface/wx/modalhook.h | 149 ++++++++++++++++++++++++++++++++++ samples/dialogs/dialogs.cpp | 29 +++++++ samples/dialogs/dialogs.h | 4 +- src/cocoa/dialog.mm | 4 +- src/cocoa/dirdlg.mm | 4 +- src/cocoa/filedlg.mm | 4 +- src/cocoa/msgdlg.mm | 4 +- src/common/dlgcmn.cpp | 4 +- src/common/modalhook.cpp | 120 +++++++++++++++++++++++++++ src/generic/filedlgg.cpp | 4 +- src/generic/msgdlgg.cpp | 4 +- src/gtk/colordlg.cpp | 4 +- src/gtk/dialog.cpp | 4 +- src/gtk/filedlg.cpp | 4 +- src/gtk/gnome/gprint.cpp | 6 +- src/gtk/msgdlg.cpp | 4 +- src/gtk/print.cpp | 6 +- src/gtk1/dialog.cpp | 4 +- src/gtk1/filedlg.cpp | 4 +- src/motif/dialog.cpp | 4 +- src/motif/filedlg.cpp | 4 +- src/motif/msgdlg.cpp | 4 +- src/msw/colordlg.cpp | 4 +- src/msw/dialog.cpp | 4 +- src/msw/dirdlg.cpp | 4 +- src/msw/filedlg.cpp | 4 +- src/msw/fontdlg.cpp | 4 +- src/msw/msgdlg.cpp | 4 +- src/msw/printdlg.cpp | 6 +- src/msw/richmsgdlg.cpp | 4 +- src/msw/wince/filedlgwce.cpp | 4 +- src/os2/dialog.cpp | 4 +- src/os2/dirdlg.cpp | 4 +- src/os2/filedlg.cpp | 4 +- src/os2/fontdlg.cpp | 4 +- src/os2/msgdlg.cpp | 4 +- src/osx/carbon/colordlg.cpp | 4 +- src/osx/carbon/colordlgosx.mm | 4 +- src/osx/carbon/dirdlg.cpp | 4 +- src/osx/carbon/filedlg.cpp | 4 +- src/osx/carbon/fontdlg.cpp | 4 +- src/osx/carbon/fontdlgosx.mm | 4 +- src/osx/carbon/msgdlg.cpp | 4 +- src/osx/carbon/printdlg.cpp | 6 +- src/osx/cocoa/dirdlg.mm | 4 +- src/osx/cocoa/filedlg.mm | 4 +- src/osx/cocoa/msgdlg.mm | 4 +- src/osx/cocoa/printdlg.mm | 6 +- src/osx/dialog_osx.cpp | 4 +- src/osx/iphone/msgdlg.mm | 4 +- src/univ/dialog.cpp | 4 +- 64 files changed, 712 insertions(+), 194 deletions(-) create mode 100644 include/wx/modalhook.h create mode 100644 interface/wx/modalhook.h create mode 100644 src/common/modalhook.cpp diff --git a/Makefile.in b/Makefile.in index b8b4700992..0e81d7b435 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4111,6 +4111,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/listbox.h \ wx/mdi.h \ wx/menu.h \ + wx/modalhook.h \ wx/mousemanager.h \ wx/msgdlg.h \ wx/nativewin.h \ @@ -4807,6 +4808,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_markupparser.o \ monodll_matrix.o \ monodll_menucmn.o \ + monodll_modalhook.o \ monodll_mousemanager.o \ monodll_nbkbase.o \ monodll_overlaycmn.o \ @@ -5028,6 +5030,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_markupparser.o \ monodll_matrix.o \ monodll_menucmn.o \ + monodll_modalhook.o \ monodll_mousemanager.o \ monodll_nbkbase.o \ monodll_overlaycmn.o \ @@ -7051,6 +7054,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_markupparser.o \ monolib_matrix.o \ monolib_menucmn.o \ + monolib_modalhook.o \ monolib_mousemanager.o \ monolib_nbkbase.o \ monolib_overlaycmn.o \ @@ -7272,6 +7276,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_markupparser.o \ monolib_matrix.o \ monolib_menucmn.o \ + monolib_modalhook.o \ monolib_mousemanager.o \ monolib_nbkbase.o \ monolib_overlaycmn.o \ @@ -9467,6 +9472,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_markupparser.o \ coredll_matrix.o \ coredll_menucmn.o \ + coredll_modalhook.o \ coredll_mousemanager.o \ coredll_nbkbase.o \ coredll_overlaycmn.o \ @@ -9688,6 +9694,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_markupparser.o \ coredll_matrix.o \ coredll_menucmn.o \ + coredll_modalhook.o \ coredll_mousemanager.o \ coredll_nbkbase.o \ coredll_overlaycmn.o \ @@ -11143,6 +11150,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_markupparser.o \ corelib_matrix.o \ corelib_menucmn.o \ + corelib_modalhook.o \ corelib_mousemanager.o \ corelib_nbkbase.o \ corelib_overlaycmn.o \ @@ -11364,6 +11372,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_markupparser.o \ corelib_matrix.o \ corelib_menucmn.o \ + corelib_modalhook.o \ corelib_mousemanager.o \ corelib_nbkbase.o \ corelib_overlaycmn.o \ @@ -21946,6 +21955,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_menucmn.o: $(srcdir)/src/common/menucmn.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/menucmn.cpp +@COND_USE_GUI_1@monodll_modalhook.o: $(srcdir)/src/common/modalhook.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/modalhook.cpp + @COND_USE_GUI_1@monodll_mousemanager.o: $(srcdir)/src/common/mousemanager.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/mousemanager.cpp @@ -27802,6 +27814,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_menucmn.o: $(srcdir)/src/common/menucmn.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/menucmn.cpp +@COND_USE_GUI_1@monolib_modalhook.o: $(srcdir)/src/common/modalhook.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/modalhook.cpp + @COND_USE_GUI_1@monolib_mousemanager.o: $(srcdir)/src/common/mousemanager.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/mousemanager.cpp @@ -33814,6 +33829,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_menucmn.o: $(srcdir)/src/common/menucmn.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/menucmn.cpp +@COND_USE_GUI_1@coredll_modalhook.o: $(srcdir)/src/common/modalhook.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/modalhook.cpp + @COND_USE_GUI_1@coredll_mousemanager.o: $(srcdir)/src/common/mousemanager.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/mousemanager.cpp @@ -38191,6 +38209,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_menucmn.o: $(srcdir)/src/common/menucmn.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/menucmn.cpp +@COND_USE_GUI_1@corelib_modalhook.o: $(srcdir)/src/common/modalhook.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/modalhook.cpp + @COND_USE_GUI_1@corelib_mousemanager.o: $(srcdir)/src/common/mousemanager.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/mousemanager.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 9a9f452a88..befd8fe351 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -709,6 +709,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/markupparser.cpp src/common/matrix.cpp src/common/menucmn.cpp + src/common/modalhook.cpp src/common/mousemanager.cpp src/common/nbkbase.cpp src/common/overlaycmn.cpp @@ -867,6 +868,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/listbox.h wx/mdi.h wx/menu.h + wx/modalhook.h wx/mousemanager.h wx/msgdlg.h wx/nativewin.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index b635a8f90f..ebc9778991 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1920,6 +1920,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.obj \ $(OBJS)\monodll_matrix.obj \ $(OBJS)\monodll_menucmn.obj \ + $(OBJS)\monodll_modalhook.obj \ $(OBJS)\monodll_mousemanager.obj \ $(OBJS)\monodll_nbkbase.obj \ $(OBJS)\monodll_overlaycmn.obj \ @@ -2141,6 +2142,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.obj \ $(OBJS)\monodll_matrix.obj \ $(OBJS)\monodll_menucmn.obj \ + $(OBJS)\monodll_modalhook.obj \ $(OBJS)\monodll_mousemanager.obj \ $(OBJS)\monodll_nbkbase.obj \ $(OBJS)\monodll_overlaycmn.obj \ @@ -3310,6 +3312,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.obj \ $(OBJS)\monolib_matrix.obj \ $(OBJS)\monolib_menucmn.obj \ + $(OBJS)\monolib_modalhook.obj \ $(OBJS)\monolib_mousemanager.obj \ $(OBJS)\monolib_nbkbase.obj \ $(OBJS)\monolib_overlaycmn.obj \ @@ -3531,6 +3534,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.obj \ $(OBJS)\monolib_matrix.obj \ $(OBJS)\monolib_menucmn.obj \ + $(OBJS)\monolib_modalhook.obj \ $(OBJS)\monolib_mousemanager.obj \ $(OBJS)\monolib_nbkbase.obj \ $(OBJS)\monolib_overlaycmn.obj \ @@ -4605,6 +4609,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.obj \ $(OBJS)\coredll_matrix.obj \ $(OBJS)\coredll_menucmn.obj \ + $(OBJS)\coredll_modalhook.obj \ $(OBJS)\coredll_mousemanager.obj \ $(OBJS)\coredll_nbkbase.obj \ $(OBJS)\coredll_overlaycmn.obj \ @@ -4826,6 +4831,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.obj \ $(OBJS)\coredll_matrix.obj \ $(OBJS)\coredll_menucmn.obj \ + $(OBJS)\coredll_modalhook.obj \ $(OBJS)\coredll_mousemanager.obj \ $(OBJS)\coredll_nbkbase.obj \ $(OBJS)\coredll_overlaycmn.obj \ @@ -5650,6 +5656,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.obj \ $(OBJS)\corelib_matrix.obj \ $(OBJS)\corelib_menucmn.obj \ + $(OBJS)\corelib_modalhook.obj \ $(OBJS)\corelib_mousemanager.obj \ $(OBJS)\corelib_nbkbase.obj \ $(OBJS)\corelib_overlaycmn.obj \ @@ -5871,6 +5878,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.obj \ $(OBJS)\corelib_matrix.obj \ $(OBJS)\corelib_menucmn.obj \ + $(OBJS)\corelib_modalhook.obj \ $(OBJS)\corelib_mousemanager.obj \ $(OBJS)\corelib_nbkbase.obj \ $(OBJS)\corelib_overlaycmn.obj \ @@ -15107,6 +15115,11 @@ $(OBJS)\monodll_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\monodll_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\monodll_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -20632,6 +20645,11 @@ $(OBJS)\monolib_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\monolib_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\monolib_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -26154,6 +26172,11 @@ $(OBJS)\coredll_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\coredll_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\coredll_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -30243,6 +30266,11 @@ $(OBJS)\corelib_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\corelib_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\corelib_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index b8678b7f03..d59d6f49d7 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1944,6 +1944,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.o \ $(OBJS)\monodll_matrix.o \ $(OBJS)\monodll_menucmn.o \ + $(OBJS)\monodll_modalhook.o \ $(OBJS)\monodll_mousemanager.o \ $(OBJS)\monodll_nbkbase.o \ $(OBJS)\monodll_overlaycmn.o \ @@ -2167,6 +2168,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.o \ $(OBJS)\monodll_matrix.o \ $(OBJS)\monodll_menucmn.o \ + $(OBJS)\monodll_modalhook.o \ $(OBJS)\monodll_mousemanager.o \ $(OBJS)\monodll_nbkbase.o \ $(OBJS)\monodll_overlaycmn.o \ @@ -3354,6 +3356,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.o \ $(OBJS)\monolib_matrix.o \ $(OBJS)\monolib_menucmn.o \ + $(OBJS)\monolib_modalhook.o \ $(OBJS)\monolib_mousemanager.o \ $(OBJS)\monolib_nbkbase.o \ $(OBJS)\monolib_overlaycmn.o \ @@ -3577,6 +3580,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.o \ $(OBJS)\monolib_matrix.o \ $(OBJS)\monolib_menucmn.o \ + $(OBJS)\monolib_modalhook.o \ $(OBJS)\monolib_mousemanager.o \ $(OBJS)\monolib_nbkbase.o \ $(OBJS)\monolib_overlaycmn.o \ @@ -4679,6 +4683,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.o \ $(OBJS)\coredll_matrix.o \ $(OBJS)\coredll_menucmn.o \ + $(OBJS)\coredll_modalhook.o \ $(OBJS)\coredll_mousemanager.o \ $(OBJS)\coredll_nbkbase.o \ $(OBJS)\coredll_overlaycmn.o \ @@ -4902,6 +4907,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.o \ $(OBJS)\coredll_matrix.o \ $(OBJS)\coredll_menucmn.o \ + $(OBJS)\coredll_modalhook.o \ $(OBJS)\coredll_mousemanager.o \ $(OBJS)\coredll_nbkbase.o \ $(OBJS)\coredll_overlaycmn.o \ @@ -5738,6 +5744,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.o \ $(OBJS)\corelib_matrix.o \ $(OBJS)\corelib_menucmn.o \ + $(OBJS)\corelib_modalhook.o \ $(OBJS)\corelib_mousemanager.o \ $(OBJS)\corelib_nbkbase.o \ $(OBJS)\corelib_overlaycmn.o \ @@ -5961,6 +5968,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.o \ $(OBJS)\corelib_matrix.o \ $(OBJS)\corelib_menucmn.o \ + $(OBJS)\corelib_modalhook.o \ $(OBJS)\corelib_mousemanager.o \ $(OBJS)\corelib_nbkbase.o \ $(OBJS)\corelib_overlaycmn.o \ @@ -16617,6 +16625,11 @@ $(OBJS)\monodll_menucmn.o: ../../src/common/menucmn.cpp endif ifeq ($(USE_GUI),1) +$(OBJS)\monodll_modalhook.o: ../../src/common/modalhook.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) $(OBJS)\monodll_mousemanager.o: ../../src/common/mousemanager.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif @@ -23586,6 +23599,11 @@ $(OBJS)\monolib_menucmn.o: ../../src/common/menucmn.cpp endif ifeq ($(USE_GUI),1) +$(OBJS)\monolib_modalhook.o: ../../src/common/modalhook.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) $(OBJS)\monolib_mousemanager.o: ../../src/common/mousemanager.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif @@ -30552,6 +30570,11 @@ $(OBJS)\coredll_menucmn.o: ../../src/common/menucmn.cpp endif ifeq ($(USE_GUI),1) +$(OBJS)\coredll_modalhook.o: ../../src/common/modalhook.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) $(OBJS)\coredll_mousemanager.o: ../../src/common/mousemanager.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif @@ -35859,6 +35882,11 @@ $(OBJS)\corelib_menucmn.o: ../../src/common/menucmn.cpp endif ifeq ($(USE_GUI),1) +$(OBJS)\corelib_modalhook.o: ../../src/common/modalhook.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) $(OBJS)\corelib_mousemanager.o: ../../src/common/mousemanager.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 10a0982f74..9208afb5ce 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2248,6 +2248,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.obj \ $(OBJS)\monodll_matrix.obj \ $(OBJS)\monodll_menucmn.obj \ + $(OBJS)\monodll_modalhook.obj \ $(OBJS)\monodll_mousemanager.obj \ $(OBJS)\monodll_nbkbase.obj \ $(OBJS)\monodll_overlaycmn.obj \ @@ -2469,6 +2470,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markupparser.obj \ $(OBJS)\monodll_matrix.obj \ $(OBJS)\monodll_menucmn.obj \ + $(OBJS)\monodll_modalhook.obj \ $(OBJS)\monodll_mousemanager.obj \ $(OBJS)\monodll_nbkbase.obj \ $(OBJS)\monodll_overlaycmn.obj \ @@ -3644,6 +3646,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.obj \ $(OBJS)\monolib_matrix.obj \ $(OBJS)\monolib_menucmn.obj \ + $(OBJS)\monolib_modalhook.obj \ $(OBJS)\monolib_mousemanager.obj \ $(OBJS)\monolib_nbkbase.obj \ $(OBJS)\monolib_overlaycmn.obj \ @@ -3865,6 +3868,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markupparser.obj \ $(OBJS)\monolib_matrix.obj \ $(OBJS)\monolib_menucmn.obj \ + $(OBJS)\monolib_modalhook.obj \ $(OBJS)\monolib_mousemanager.obj \ $(OBJS)\monolib_nbkbase.obj \ $(OBJS)\monolib_overlaycmn.obj \ @@ -5005,6 +5009,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.obj \ $(OBJS)\coredll_matrix.obj \ $(OBJS)\coredll_menucmn.obj \ + $(OBJS)\coredll_modalhook.obj \ $(OBJS)\coredll_mousemanager.obj \ $(OBJS)\coredll_nbkbase.obj \ $(OBJS)\coredll_overlaycmn.obj \ @@ -5226,6 +5231,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markupparser.obj \ $(OBJS)\coredll_matrix.obj \ $(OBJS)\coredll_menucmn.obj \ + $(OBJS)\coredll_modalhook.obj \ $(OBJS)\coredll_mousemanager.obj \ $(OBJS)\coredll_nbkbase.obj \ $(OBJS)\coredll_overlaycmn.obj \ @@ -6056,6 +6062,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.obj \ $(OBJS)\corelib_matrix.obj \ $(OBJS)\corelib_menucmn.obj \ + $(OBJS)\corelib_modalhook.obj \ $(OBJS)\corelib_mousemanager.obj \ $(OBJS)\corelib_nbkbase.obj \ $(OBJS)\corelib_overlaycmn.obj \ @@ -6277,6 +6284,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markupparser.obj \ $(OBJS)\corelib_matrix.obj \ $(OBJS)\corelib_menucmn.obj \ + $(OBJS)\corelib_modalhook.obj \ $(OBJS)\corelib_mousemanager.obj \ $(OBJS)\corelib_nbkbase.obj \ $(OBJS)\corelib_overlaycmn.obj \ @@ -15827,6 +15835,11 @@ $(OBJS)\monodll_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\monodll_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\monodll_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -21352,6 +21365,11 @@ $(OBJS)\monolib_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\monolib_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\monolib_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -26874,6 +26892,11 @@ $(OBJS)\coredll_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\coredll_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\coredll_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif @@ -30963,6 +30986,11 @@ $(OBJS)\corelib_menucmn.obj: ..\..\src\common\menucmn.cpp !endif !if "$(USE_GUI)" == "1" +$(OBJS)\corelib_modalhook.obj: ..\..\src\common\modalhook.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\modalhook.cpp +!endif + +!if "$(USE_GUI)" == "1" $(OBJS)\corelib_mousemanager.obj: ..\..\src\common\mousemanager.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\mousemanager.cpp !endif diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 9646c50062..c43f2ac8e4 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -382,6 +382,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_markupparser.obj & $(OBJS)\monodll_matrix.obj & $(OBJS)\monodll_menucmn.obj & + $(OBJS)\monodll_modalhook.obj & $(OBJS)\monodll_mousemanager.obj & $(OBJS)\monodll_nbkbase.obj & $(OBJS)\monodll_overlaycmn.obj & @@ -605,6 +606,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_markupparser.obj & $(OBJS)\monodll_matrix.obj & $(OBJS)\monodll_menucmn.obj & + $(OBJS)\monodll_modalhook.obj & $(OBJS)\monodll_mousemanager.obj & $(OBJS)\monodll_nbkbase.obj & $(OBJS)\monodll_overlaycmn.obj & @@ -1808,6 +1810,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_markupparser.obj & $(OBJS)\monolib_matrix.obj & $(OBJS)\monolib_menucmn.obj & + $(OBJS)\monolib_modalhook.obj & $(OBJS)\monolib_mousemanager.obj & $(OBJS)\monolib_nbkbase.obj & $(OBJS)\monolib_overlaycmn.obj & @@ -2031,6 +2034,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_markupparser.obj & $(OBJS)\monolib_matrix.obj & $(OBJS)\monolib_menucmn.obj & + $(OBJS)\monolib_modalhook.obj & $(OBJS)\monolib_mousemanager.obj & $(OBJS)\monolib_nbkbase.obj & $(OBJS)\monolib_overlaycmn.obj & @@ -3159,6 +3163,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_markupparser.obj & $(OBJS)\coredll_matrix.obj & $(OBJS)\coredll_menucmn.obj & + $(OBJS)\coredll_modalhook.obj & $(OBJS)\coredll_mousemanager.obj & $(OBJS)\coredll_nbkbase.obj & $(OBJS)\coredll_overlaycmn.obj & @@ -3382,6 +3387,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_markupparser.obj & $(OBJS)\coredll_matrix.obj & $(OBJS)\coredll_menucmn.obj & + $(OBJS)\coredll_modalhook.obj & $(OBJS)\coredll_mousemanager.obj & $(OBJS)\coredll_nbkbase.obj & $(OBJS)\coredll_overlaycmn.obj & @@ -4223,6 +4229,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_markupparser.obj & $(OBJS)\corelib_matrix.obj & $(OBJS)\corelib_menucmn.obj & + $(OBJS)\corelib_modalhook.obj & $(OBJS)\corelib_mousemanager.obj & $(OBJS)\corelib_nbkbase.obj & $(OBJS)\corelib_overlaycmn.obj & @@ -4446,6 +4453,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_markupparser.obj & $(OBJS)\corelib_matrix.obj & $(OBJS)\corelib_menucmn.obj & + $(OBJS)\corelib_modalhook.obj & $(OBJS)\corelib_mousemanager.obj & $(OBJS)\corelib_nbkbase.obj & $(OBJS)\corelib_overlaycmn.obj & @@ -16966,6 +16974,11 @@ $(OBJS)\monodll_menucmn.obj : .AUTODEPEND ..\..\src\common\menucmn.cpp !endif !ifeq USE_GUI 1 +$(OBJS)\monodll_modalhook.obj : .AUTODEPEND ..\..\src\common\modalhook.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + +!ifeq USE_GUI 1 $(OBJS)\monodll_mousemanager.obj : .AUTODEPEND ..\..\src\common\mousemanager.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif @@ -23935,6 +23948,11 @@ $(OBJS)\monolib_menucmn.obj : .AUTODEPEND ..\..\src\common\menucmn.cpp !endif !ifeq USE_GUI 1 +$(OBJS)\monolib_modalhook.obj : .AUTODEPEND ..\..\src\common\modalhook.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + +!ifeq USE_GUI 1 $(OBJS)\monolib_mousemanager.obj : .AUTODEPEND ..\..\src\common\mousemanager.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif @@ -30901,6 +30919,11 @@ $(OBJS)\coredll_menucmn.obj : .AUTODEPEND ..\..\src\common\menucmn.cpp !endif !ifeq USE_GUI 1 +$(OBJS)\coredll_modalhook.obj : .AUTODEPEND ..\..\src\common\modalhook.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + +!ifeq USE_GUI 1 $(OBJS)\coredll_mousemanager.obj : .AUTODEPEND ..\..\src\common\mousemanager.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif @@ -36208,6 +36231,11 @@ $(OBJS)\corelib_menucmn.obj : .AUTODEPEND ..\..\src\common\menucmn.cpp !endif !ifeq USE_GUI 1 +$(OBJS)\corelib_modalhook.obj : .AUTODEPEND ..\..\src\common\modalhook.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + +!ifeq USE_GUI 1 $(OBJS)\corelib_mousemanager.obj : .AUTODEPEND ..\..\src\common\mousemanager.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 32220f5cf9..4b89803d8f 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -8,21 +8,21 @@ CFG=core - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "wx_core.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "wx_core.mak" CFG="core - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "core - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "core - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "core - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "core - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -478,6 +478,10 @@ SOURCE=..\..\src\common\menucmn.cpp # End Source File # Begin Source File +SOURCE=..\..\src\common\modalhook.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\common\mousemanager.cpp # End Source File # Begin Source File @@ -1362,25 +1366,25 @@ SOURCE=..\..\include\wx\univ\setup.h !IF "$(CFG)" == "core - Win32 DLL Release" -# Begin Custom Build - +# Begin Custom Build - # End Custom Build !ELSEIF "$(CFG)" == "core - Win32 DLL Debug" -# Begin Custom Build - +# Begin Custom Build - # End Custom Build !ELSEIF "$(CFG)" == "core - Win32 Release" -# Begin Custom Build - +# Begin Custom Build - # End Custom Build !ELSEIF "$(CFG)" == "core - Win32 Debug" -# Begin Custom Build - +# Begin Custom Build - # End Custom Build @@ -2800,6 +2804,10 @@ SOURCE=..\..\include\wx\minifram.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\modalhook.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\mousemanager.h # End Source File # Begin Source File @@ -3605,4 +3613,3 @@ SOURCE=..\..\src\xrc\xmlreshandler.cpp # End Group # End Target # End Project - diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 7d826c8034..b8c6091d38 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -552,6 +552,9 @@ + + @@ -2285,6 +2288,9 @@ + + diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj index b81afc8128..3ec17d668a 100644 --- a/build/msw/wx_vc8_core.vcproj +++ b/build/msw/wx_vc8_core.vcproj @@ -752,6 +752,10 @@ RelativePath="..\..\src\common\menucmn.cpp" > + + @@ -3055,6 +3059,10 @@ RelativePath="..\..\include\wx\minifram.h" > + + diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index 13aebbf490..128f72bc8d 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -750,6 +750,10 @@ RelativePath="..\..\src\common\menucmn.cpp" > + + @@ -3053,6 +3057,10 @@ RelativePath="..\..\include\wx\minifram.h" > + + diff --git a/docs/changes.txt b/docs/changes.txt index 8b4fcddbaa..adc9b79eb5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -601,6 +601,7 @@ All (GUI): - Add support for wxRibbonBar and related controls to XRC (Armel Asselin). - Add wxBITMAP_PNG() macro similar to wxBITMAP() but for PNG files. - Add new wxSimplebook class. +- Implement possibility to hook all modal dialog calls. - Support hexadecimal numbers in wxSpinCtrl. - Respect window max size in wxBoxSizer (Nathan Ridge). - Add support for searching in wxWebView for MSW and GTK (Allonii). diff --git a/include/wx/modalhook.h b/include/wx/modalhook.h new file mode 100644 index 0000000000..bb7b37b66b --- /dev/null +++ b/include/wx/modalhook.h @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/modalhook.h +// Purpose: Allows to hook into showing modal dialogs. +// Author: Vadim Zeitlin +// Created: 2013-05-19 +// RCS-ID: $Id$ +// Copyright: (c) 2013 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MODALHOOK_H_ +#define _WX_MODALHOOK_H_ + +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxDialog; + +// ---------------------------------------------------------------------------- +// Class allowing to be notified about any modal dialog calls. +// ---------------------------------------------------------------------------- + +// To be notified about entering and exiting modal dialogs and possibly to +// replace them with something else (e.g. just return a predefined value for +// testing), define an object of this class, override its Enter() and +// possibly Exit() methods and call Register() on it. +class WXDLLIMPEXP_CORE wxModalDialogHook +{ +public: + // Default ctor doesn't do anything, call Register() to activate the hook. + wxModalDialogHook() { } + + // Dtor unregisters the hook if it had been registered. + virtual ~wxModalDialogHook() { DoUnregister(); } + + // Register this hook as being active, i.e. its Enter() and Exit() methods + // will be called. + // + // Notice that the order of registration matters: the last hook registered + // is called first, and if its Enter() returns something != wxID_NONE, the + // subsequent hooks are skipped. + void Register(); + + // Unregister this hook. Notice that is done automatically from the dtor. + void Unregister(); + + // Called from wxWidgets code before showing any modal dialogs and calls + // Enter() for every registered hook. + static int CallEnter(wxDialog* dialog); + + // Called from wxWidgets code after dismissing the dialog and calls Exit() + // for every registered hook. + static void CallExit(wxDialog* dialog); + +protected: + // Called by wxWidgets before showing any modal dialogs, override this to + // be notified about this and return anything but wxID_NONE to skip showing + // the modal dialog entirely and just return the specified result. + virtual int Enter(wxDialog* dialog) = 0; + + // Called by wxWidgets after dismissing the modal dialog. Notice that it + // won't be called if Enter() hadn't been. + virtual void Exit(wxDialog* WXUNUSED(dialog)) { } + +private: + // Unregister the given hook, return true if it was done or false if the + // hook wasn't found. + bool DoUnregister(); + + // All the hooks in reverse registration order (i.e. in call order). + typedef wxVector Hooks; + static Hooks ms_hooks; + + wxDECLARE_NO_COPY_CLASS(wxModalDialogHook); +}; + +// Helper object used by WX_MODAL_DIALOG_HOOK below to ensure that CallExit() +// is called on scope exit. +class wxModalDialogHookExitGuard +{ +public: + wxEXPLICIT wxModalDialogHookExitGuard(wxDialog* dialog) + : m_dialog(dialog) + { + } + + ~wxModalDialogHookExitGuard() + { + wxModalDialogHook::CallExit(m_dialog); + } + +private: + wxDialog* const m_dialog; + + wxDECLARE_NO_COPY_CLASS(wxModalDialogHookExitGuard); +}; + +// This macro needs to be used at the top of every implementation of +// ShowModal() in order for wxModalDialogHook to work. +#define WX_HOOK_MODAL_DIALOG() \ + const int modalDialogHookRC = wxModalDialogHook::CallEnter(this); \ + if ( modalDialogHookRC != wxID_NONE ) \ + return modalDialogHookRC; \ + wxModalDialogHookExitGuard modalDialogHookExit(this) + +#endif // _WX_MODALHOOK_H_ diff --git a/include/wx/testing.h b/include/wx/testing.h index fce2c508ba..dc1bd5ec33 100644 --- a/include/wx/testing.h +++ b/include/wx/testing.h @@ -13,56 +13,11 @@ #include "wx/debug.h" #include "wx/string.h" +#include "wx/modalhook.h" -class WXDLLIMPEXP_FWD_CORE wxDialog; class WXDLLIMPEXP_FWD_CORE wxMessageDialogBase; class WXDLLIMPEXP_FWD_CORE wxFileDialogBase; -// ---------------------------------------------------------------------------- -// 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 */ - - // ---------------------------------------------------------------------------- // testing API // ---------------------------------------------------------------------------- @@ -233,15 +188,42 @@ class wxTestingModalHook : public wxModalDialogHook public: wxTestingModalHook() { - m_prevHook = wxModalDialogHook::Set(this); + Register(); } - virtual ~wxTestingModalHook() + // Called to verify that all expectations were met. This cannot be done in + // the destructor, because ReportFailure() may throw (either because it's + // overriden or because wx's assertions handling is, globally). And + // throwing from the destructor would introduce all sort of problems, + // including messing up the order of errors in some cases. + void CheckUnmetExpectations() { - wxModalDialogHook::Set(m_prevHook); + while ( !m_expectations.empty() ) + { + const wxModalExpectation *expect = m_expectations.front(); + m_expectations.pop(); + if ( expect->IsOptional() ) + continue; + + ReportFailure + ( + wxString::Format + ( + "Expected %s dialog was not shown.", + expect->GetDescription() + ) + ); + break; + } + } + + void AddExpectation(const wxModalExpectation& e) + { + m_expectations.push(&e); } - virtual int Invoke(wxDialog *dlg) +protected: + virtual int Enter(wxDialog *dlg) { while ( !m_expectations.empty() ) { @@ -281,37 +263,6 @@ public: return wxID_NONE; } - // Called to verify that all expectations were met. This cannot be done in - // the destructor, because ReportFailure() may throw (either because it's - // overriden or because wx's assertions handling is, globally). And - // throwing from the destructor would introduce all sort of problems, - // including messing up the order of errors in some cases. - void CheckUnmetExpectations() - { - while ( !m_expectations.empty() ) - { - const wxModalExpectation *expect = m_expectations.front(); - m_expectations.pop(); - if ( expect->IsOptional() ) - continue; - - ReportFailure - ( - wxString::Format - ( - "Expected %s dialog was not shown.", - expect->GetDescription() - ) - ); - break; - } - } - - void AddExpectation(const wxModalExpectation& e) - { - m_expectations.push(&e); - } - protected: virtual void ReportFailure(const wxString& msg) { @@ -319,7 +270,6 @@ protected: } private: - wxModalDialogHook *m_prevHook; std::queue m_expectations; wxDECLARE_NO_COPY_CLASS(wxTestingModalHook); diff --git a/interface/wx/modalhook.h b/interface/wx/modalhook.h new file mode 100644 index 0000000000..16df4bc18b --- /dev/null +++ b/interface/wx/modalhook.h @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/modalhook.h +// Purpose: Public interface of wxModalDialogHook class. +// Author: Vadim Zeitlin +// Copyright: (c) 2013 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/** + Allows to intercept all modal dialog calls. + + This class can be used to hook into normal modal dialog handling for some + special needs. One of the most common use cases is for testing: as + automatic tests can't continue if a modal dialog is shown while they run, + this class can be used to avoid showing the modal dialogs during unattended + execution. wxModalDialogHook can also be used for disabling some background + operation while a modal dialog is shown. + + To install a modal dialog hook, you need to derive your own class from this + one and implement its pure virtual Enter() method. Then simply create an + object of your class and call Register() on it to start receiving calls to + your overridden Enter() (and possibly Exit()) methods: + @code + class MyModalDialogHook : public wxModalDialogHook + { + protected: + virtual int Enter(wxDialog* dialog) + { + // Just for demonstration purposes, intercept all uses of + // wxFileDialog. Notice that this doesn't provide any real + // sandboxing, of course, the program can still read and write + // files by not using wxFileDialog to ask the user for their + // names. + if ( wxDynamicCast(dialog, wxFileDialog) ) + { + wxLogError("Access to file system disallowed."); + + // Skip showing the file dialog entirely. + return wxID_CANCEL; + } + + m_lastEnter = wxDateTime::Now(); + + // Allow the dialog to be shown as usual. + return wxID_NONE; + } + + virtual void Exit(wxDialog* dialog) + { + // Again, just for demonstration purposes, show how long did + // the user take to dismiss the dialog. Notice that we + // shouldn't use wxLogMessage() here as this would result in + // another modal dialog call and hence infinite recursion. In + // general, the hooks should be as unintrusive as possible. + wxLogDebug("%s dialog took %s to be dismissed", + dialog->GetClassInfo()->GetClassName(), + (wxDateTime::Now() - m_lastEnter).Format()); + } + }; + + class MyApp : public wxApp + { + public: + virtual bool OnInit() + { + ... + m_myHook.Register(); + ... + } + + private: + MyModalDialogHook m_myHook; + }; + @endcode + + @since 2.9.5 + */ +class wxModalDialogHook +{ +public: + /** + Default and trivial constructor. + + The constructor doesn't do anything, call Register() to make this hook + active. + */ + wxModalDialogHook(); + + /** + Destructor unregisters the hook if it's currently active. + */ + virtual ~wxModalDialogHook(); + + /** + Register this hook as being active. + + After registering the hook, its Enter() and Exit() methods will be + called whenever a modal dialog is shown. + + Notice that the order of registration matters: the last hook registered + is called first, and if its Enter() returns a value different from + ::wxID_NONE, the subsequent hooks are skipped. + + It is an error to register the same hook twice. + */ + void Register(); + + /** + Unregister this hook. + + Notice that is done automatically from the destructor, so usually + calling this method explicitly is unnecessary. + + The hook must be currently registered. + */ + void Unregister(); + +protected: + /** + Called by wxWidgets before showing any modal dialogs. + + Override this to be notified whenever a modal dialog is about to be + shown. + + If the return value of this method is ::wxID_NONE, the dialog is shown + as usual and Exit() will be called when it is dismissed. If the return + value is anything else, the dialog is not shown at all and its + wxDialog::ShowModal() simply returns with the given result. In this + case, Exit() won't be called neither. + + @param dialog The dialog about to be shown, never @NULL. + @return wxID_NONE to continue with showing the dialog or anything else + to skip showing the dialog and just return this value from its + ShowModal(). + */ + virtual int Enter(wxDialog* dialog) = 0; + + /** + Called by wxWidgets after dismissing the modal dialog. + + Notice that it won't be called if Enter() hadn't been called because + another modal hook, registered after this one, intercepted the dialog + or if our Enter() was called but returned a value different from + ::wxID_NONE. + + @param dialog The dialog that was shown and dismissed, never @NULL. + */ + virtual void Exit(wxDialog* dialog); +}; diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 679838a4dd..11a4bc4388 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -32,6 +32,7 @@ #include "wx/minifram.h" #include "wx/sysopt.h" #include "wx/notifmsg.h" +#include "wx/modalhook.h" #if wxUSE_RICHMSGDLG #include "wx/richmsgdlg.h" @@ -249,6 +250,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, MyFrame::OnStandardButtonsSizerDialog) EVT_MENU(DIALOGS_TEST_DEFAULT_ACTION, MyFrame::OnTestDefaultActionDialog) + EVT_MENU(DIALOGS_MODAL_HOOK, MyFrame::OnModalHook) EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention) #if wxUSE_NOTIFICATION_MESSAGE @@ -538,6 +540,7 @@ bool MyApp::OnInit() menuDlg->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, wxT("&Standard Buttons Sizer Dialog")); menuDlg->Append(DIALOGS_TEST_DEFAULT_ACTION, wxT("&Test dialog default action")); + menuDlg->AppendCheckItem(DIALOGS_MODAL_HOOK, "Enable modal dialog hook"); menuDlg->AppendSeparator(); menuDlg->Append(wxID_EXIT, wxT("E&xit\tAlt-X")); @@ -2105,6 +2108,32 @@ void MyFrame::OnTestDefaultActionDialog(wxCommandEvent& WXUNUSED(event)) dialog.ShowModal(); } +void MyFrame::OnModalHook(wxCommandEvent& event) +{ + class TestModalHook : public wxModalDialogHook + { + protected: + virtual int Enter(wxDialog* dialog) + { + wxLogStatus("Showing %s modal dialog", + dialog->GetClassInfo()->GetClassName()); + return wxID_NONE; + } + + virtual void Exit(wxDialog* dialog) + { + wxLogStatus("Leaving %s modal dialog", + dialog->GetClassInfo()->GetClassName()); + } + }; + + static TestModalHook s_hook; + if ( event.IsChecked() ) + s_hook.Register(); + else + s_hook.Unregister(); +} + void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) ) { Close(true); diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index f92379f33f..3d866d9a40 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -475,6 +475,7 @@ public: void OnStandardButtonsSizerDialog(wxCommandEvent& event); void OnTestDefaultActionDialog(wxCommandEvent& event); + void OnModalHook(wxCommandEvent& event); void OnExit(wxCommandEvent& event); @@ -588,7 +589,8 @@ enum DIALOGS_PROPERTY_SHEET_TOOLBOOK, DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, - DIALOGS_TEST_DEFAULT_ACTION + DIALOGS_TEST_DEFAULT_ACTION, + DIALOGS_MODAL_HOOK }; #endif diff --git a/src/cocoa/dialog.mm b/src/cocoa/dialog.mm index fbc8bbe18d..72a380243c 100644 --- a/src/cocoa/dialog.mm +++ b/src/cocoa/dialog.mm @@ -19,7 +19,7 @@ #include "wx/settings.h" #endif //WX_PRECOMP -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" @@ -128,7 +128,7 @@ bool wxDialog::Show(bool show) // is stopped (via EndModal()) it returns the exit code. int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxCHECK_MSG(!IsModal(),GetReturnCode(),wxT("wxDialog::ShowModal called within its own modal loop")); diff --git a/src/cocoa/dirdlg.mm b/src/cocoa/dirdlg.mm index bc4613aa22..2f2ce30012 100644 --- a/src/cocoa/dirdlg.mm +++ b/src/cocoa/dirdlg.mm @@ -31,7 +31,7 @@ #endif #include "wx/filename.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" @@ -105,7 +105,7 @@ wxDirDialog::~wxDirDialog() int wxDirDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxAutoNSAutoreleasePool thePool; diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm index 613f75bfea..e953896a7b 100644 --- a/src/cocoa/filedlg.mm +++ b/src/cocoa/filedlg.mm @@ -33,7 +33,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #import #import @@ -197,7 +197,7 @@ void wxFileDialog::SetPath(const wxString& path) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxAutoNSAutoreleasePool thePool; diff --git a/src/cocoa/msgdlg.mm b/src/cocoa/msgdlg.mm index 0d6072a226..b14a70ba61 100644 --- a/src/cocoa/msgdlg.mm +++ b/src/cocoa/msgdlg.mm @@ -31,7 +31,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #import // ============================================================================ @@ -73,7 +73,7 @@ void wxCocoaMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& va int wxCocoaMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxAutoNSAutoreleasePool thePool; diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 1bc4d72667..4c52be1cee 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -43,7 +43,7 @@ #include "wx/bookctrl.h" #include "wx/scrolwin.h" #include "wx/textwrapper.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if wxUSE_DISPLAY #include "wx/display.h" @@ -51,8 +51,6 @@ extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog"; -wxModalDialogHook *wxModalDialogHook::ms_instance = NULL; - // ---------------------------------------------------------------------------- // XTI // ---------------------------------------------------------------------------- diff --git a/src/common/modalhook.cpp b/src/common/modalhook.cpp new file mode 100644 index 0000000000..0bba44934e --- /dev/null +++ b/src/common/modalhook.cpp @@ -0,0 +1,120 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/modalhook.cpp +// Purpose: wxModalDialogHook implementation +// Author: Vadim Zeitlin +// Created: 2013-05-19 +// RCS-ID: $Id$ +// Copyright: (c) 2013 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/modalhook.h" + +#ifndef WX_PRECOMP +#endif // WX_PRECOMP + +wxModalDialogHook::Hooks wxModalDialogHook::ms_hooks; + +// ============================================================================ +// wxModalDialogHook implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Hooks management +// ---------------------------------------------------------------------------- + +void wxModalDialogHook::Register() +{ +#if wxDEBUG_LEVEL + for ( Hooks::const_iterator it = ms_hooks.begin(); + it != ms_hooks.end(); + ++it) + { + if ( *it == this ) + { + wxFAIL_MSG( wxS("Registering already registered hook?") ); + return; + } + } +#endif // wxDEBUG_LEVEL + + ms_hooks.insert(ms_hooks.begin(), this); +} + +void wxModalDialogHook::Unregister() +{ + if ( !DoUnregister() ) + { + wxFAIL_MSG( wxS("Unregistering not registered hook?") ); + } +} + +bool wxModalDialogHook::DoUnregister() +{ + for ( Hooks::iterator it = ms_hooks.begin(); + it != ms_hooks.end(); + ++it ) + { + if ( *it == this ) + { + ms_hooks.erase(it); + return true; + } + } + + return false; +} + +// ---------------------------------------------------------------------------- +// Invoking hooks methods +// ---------------------------------------------------------------------------- + +/* static */ +int wxModalDialogHook::CallEnter(wxDialog* dialog) +{ + // Make a copy of the hooks list to avoid problems if it's modified while + // we're iterating over it: this is unlikely to happen in our case, but + // quite possible in CallExit() as the hooks may remove themselves after + // the call to their Exit(), so do it here for symmetry as well. + const Hooks hooks = ms_hooks; + + for ( Hooks::const_iterator it = hooks.begin(); it != hooks.end(); ++it ) + { + const int rc = (*it)->Enter(dialog); + if ( rc != wxID_NONE ) + { + // Skip calling all the rest of the hooks if one of them preempts + // showing the dialog completely. + return rc; + } + } + + return wxID_NONE; +} + +/* static */ +void wxModalDialogHook::CallExit(wxDialog* dialog) +{ + // See comment in CallEnter() for the reasons for making a copy here. + const Hooks hooks = ms_hooks; + + for ( Hooks::const_iterator it = hooks.begin(); it != hooks.end(); ++it ) + { + (*it)->Exit(dialog); + } +} diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index cd2e4da73f..96ad05137f 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -49,7 +49,7 @@ #include "wx/filectrl.h" #include "wx/generic/filedlgg.h" #include "wx/debug.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if wxUSE_TOOLTIPS #include "wx/tooltip.h" @@ -309,7 +309,7 @@ wxBitmapButton* wxGenericFileDialog::AddBitmapButton( wxWindowID winId, int wxGenericFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); if (CreateExtraControl()) { diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 8a16ab3d9c..4050fcaee8 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -39,7 +39,7 @@ #include "wx/msgdlg.h" #include "wx/artprov.h" #include "wx/textwrapper.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if wxUSE_STATLINE #include "wx/statline.h" @@ -267,7 +267,7 @@ void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) int wxGenericMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); if ( !m_created ) { diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index b3a806d5b2..ff47456e79 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -19,7 +19,7 @@ #if wxUSE_COLOURDLG #include "wx/colordlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -84,7 +84,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); ColourDataToDialog(); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index a79ee902e2..5d397cfe2f 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -19,7 +19,7 @@ #include "wx/evtloop.h" #include "wx/scopedptr.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include #include "wx/gtk/private/gtk2-compat.h" @@ -133,7 +133,7 @@ realize_hook(GSignalInvocationHint*, unsigned, const GValue* param_values, void* int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" ); diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index aa00e8c421..ce8c9db6cf 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -29,7 +29,7 @@ #include "wx/filename.h" // wxFilename #include "wx/tokenzr.h" // wxStringTokenizer #include "wx/filefn.h" // ::wxGetCwd -#include "wx/testing.h" +#include "wx/modalhook.h" extern "C" { @@ -320,7 +320,7 @@ void wxFileDialog::GTKOnCancel() int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); CreateExtraControl(); diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index 767c3c2f48..e4fe6daf81 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -34,7 +34,7 @@ #include "wx/dynlib.h" #include "wx/paper.h" #include "wx/dcprint.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include #include @@ -592,7 +592,7 @@ wxGnomePrintDialog::~wxGnomePrintDialog() int wxGnomePrintDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); int response = gtk_dialog_run (GTK_DIALOG (m_widget)); @@ -739,7 +739,7 @@ wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData() int wxGnomePageSetupDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxGnomePrintNativeData *native = (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData(); diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 2c561dfca3..6d1104ae62 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -24,7 +24,7 @@ #include "wx/intl.h" #endif -#include "wx/testing.h" +#include "wx/modalhook.h" #include #include "wx/gtk/private.h" @@ -276,7 +276,7 @@ void wxMessageDialog::GTKCreateMsgDialog() int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // break the mouse capture as it would interfere with modal dialog (see // wxDialog::ShowModal) diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 6076ef552f..9b7e7a2ca0 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -34,7 +34,7 @@ #include "wx/dynlib.h" #include "wx/paper.h" #include "wx/scopeguard.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include @@ -624,7 +624,7 @@ wxGtkPrintDialog::~wxGtkPrintDialog() // This is called even if we actually don't want the dialog to appear. int wxGtkPrintDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // We need to restore the settings given in the constructor. wxPrintData data = m_printDialogData.GetPrintData(); @@ -750,7 +750,7 @@ wxGtkPageSetupDialog::~wxGtkPageSetupDialog() int wxGtkPageSetupDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // Get the config. m_pageDialogData.GetPrintData().ConvertToNative(); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 041d74275b..c760fe0de2 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -19,7 +19,7 @@ #endif // WX_PRECOMP #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include #include @@ -183,7 +183,7 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); if (IsModal()) { diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 59f8824386..efebaebf2a 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -13,7 +13,7 @@ #if wxUSE_FILEDLG #include "wx/filedlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" //----------------------------------------------------------------------------- @@ -50,7 +50,7 @@ void wxFileDialog::OnFakeOk( wxCommandEvent &event ) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); return wxGenericFileDialog::ShowModal(); } diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index a63aca7d3f..25515e450a 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -21,7 +21,7 @@ #endif #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -289,7 +289,7 @@ bool wxDialog::Show( bool show ) // Shows a dialog modally, returning a return code int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); Show(true); diff --git a/src/motif/filedlg.cpp b/src/motif/filedlg.cpp index f1f2970e52..5cee8fdb59 100644 --- a/src/motif/filedlg.cpp +++ b/src/motif/filedlg.cpp @@ -23,7 +23,7 @@ #include "wx/tokenzr.h" #include "wx/stockitem.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -152,7 +152,7 @@ static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxBeginBusyCursor(); diff --git a/src/motif/msgdlg.cpp b/src/motif/msgdlg.cpp index 091d430d9d..c4b5576dd8 100644 --- a/src/motif/msgdlg.cpp +++ b/src/motif/msgdlg.cpp @@ -40,7 +40,7 @@ #include "wx/settings.h" #endif -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/motif/private.h" // ---------------------------------------------------------------------------- @@ -106,7 +106,7 @@ extern "C" int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); const long style = GetMessageDialogStyle(); diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index 688ca17380..8be79f3bc8 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -27,7 +27,7 @@ #if wxUSE_COLOURDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) #include "wx/colordlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -115,7 +115,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // initialize the struct used by Windows CHOOSECOLOR chooseColorStruct; diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index ccab43d45e..b8b73d2525 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -25,7 +25,7 @@ #endif #include "wx/dialog.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -198,7 +198,7 @@ bool wxDialog::Show(bool show) // show dialog modally int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxASSERT_MSG( !IsModal(), wxT("ShowModal() can't be called twice") ); diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 1760eb8d91..314299db91 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -30,7 +30,7 @@ (defined(__HANDHELDPC__) && (_WIN32_WCE >= 500))) #include "wx/dirdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/utils.h" @@ -221,7 +221,7 @@ void wxDirDialog::SetPath(const wxString& path) int wxDirDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParent(); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 27dfd888e5..e1f5287021 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -47,7 +47,7 @@ #include "wx/filename.h" #include "wx/scopeguard.h" #include "wx/tokenzr.h" -#include "wx/testing.h" +#include "wx/modalhook.h" // ---------------------------------------------------------------------------- // constants @@ -450,7 +450,7 @@ void wxFileDialog::MSWOnInitDialogHook(WXHWND hwnd) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); HWND hWnd = 0; if (m_parent) hWnd = (HWND) m_parent->GetHWND(); diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp index 848dd4f514..f800b51c11 100644 --- a/src/msw/fontdlg.cpp +++ b/src/msw/fontdlg.cpp @@ -27,7 +27,7 @@ #if wxUSE_FONTDLG #include "wx/fontdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -56,7 +56,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) int wxFontDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // It should be OK to always use GDI simulations DWORD flags = CF_SCREENFONTS /* | CF_NOSIMULATIONS */ ; diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index e9b25735a9..56c2885867 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -42,7 +42,7 @@ #include "wx/msw/private/button.h" #include "wx/msw/private/metrics.h" #include "wx/msw/private/msgdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if wxUSE_MSGBOX_HOOK #include "wx/fontutil.h" @@ -592,7 +592,7 @@ int wxMessageDialog::ShowMessageBox() int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); #ifdef wxHAS_MSW_TASKDIALOG if ( HasNativeTaskDialog() ) diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index a3da80615a..e91ddf2e31 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -39,7 +39,7 @@ #include "wx/msw/printdlg.h" #include "wx/msw/dcprint.h" #include "wx/paper.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include @@ -739,7 +739,7 @@ wxWindowsPrintDialog::~wxWindowsPrintDialog() int wxWindowsPrintDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); ConvertToNative( m_printDialogData ); @@ -960,7 +960,7 @@ wxWindowsPageSetupDialog::~wxWindowsPageSetupDialog() int wxWindowsPageSetupDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); ConvertToNative( m_pageSetupData ); diff --git a/src/msw/richmsgdlg.cpp b/src/msw/richmsgdlg.cpp index 67a827e21b..58bb7cf68d 100644 --- a/src/msw/richmsgdlg.cpp +++ b/src/msw/richmsgdlg.cpp @@ -18,7 +18,7 @@ #if wxUSE_RICHMSGDLG #include "wx/richmsgdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/msw/private.h" @@ -34,7 +34,7 @@ int wxRichMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); #ifdef wxHAS_MSW_TASKDIALOG using namespace wxMSWMessageDialog; diff --git a/src/msw/wince/filedlgwce.cpp b/src/msw/wince/filedlgwce.cpp index 5a7ff8a7a9..66abfd1629 100644 --- a/src/msw/wince/filedlgwce.cpp +++ b/src/msw/wince/filedlgwce.cpp @@ -47,7 +47,7 @@ #include #include "wx/filename.h" -#include "wx/testing.h" +#include "wx/modalhook.h" // ============================================================================ // implementation @@ -113,7 +113,7 @@ void wxFileDialog::SetPath(const wxString& path) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxWindow* parentWindow = GetParent(); if (!parentWindow) diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp index 7b1b0d0ce1..c6520d9698 100644 --- a/src/os2/dialog.cpp +++ b/src/os2/dialog.cpp @@ -26,7 +26,7 @@ #include "wx/os2/private.h" #include "wx/evtloop.h" #include "wx/scopedptr.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #define wxDIALOG_DEFAULT_X 300 #define wxDIALOG_DEFAULT_Y 300 @@ -220,7 +220,7 @@ bool wxDialog::Show( bool bShow ) // int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxASSERT_MSG( !IsModal(), wxT("wxDialog::ShowModal() reentered?") ); diff --git a/src/os2/dirdlg.cpp b/src/os2/dirdlg.cpp index 5ae4e61dd6..eef18aa525 100644 --- a/src/os2/dirdlg.cpp +++ b/src/os2/dirdlg.cpp @@ -13,7 +13,7 @@ #include "wx/wxprec.h" #include "wx/dirdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include @@ -43,7 +43,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, int wxDirDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); // TODO return wxID_CANCEL; diff --git a/src/os2/filedlg.cpp b/src/os2/filedlg.cpp index 65c8c59df4..d6d93809f3 100644 --- a/src/os2/filedlg.cpp +++ b/src/os2/filedlg.cpp @@ -39,7 +39,7 @@ #include #include "wx/tokenzr.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #define wxMAXPATH 1024 #define wxMAXFILE 1024 @@ -105,7 +105,7 @@ void wxFileDialog::GetPaths ( int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxString sTheFilter; wxString sFilterBuffer; diff --git a/src/os2/fontdlg.cpp b/src/os2/fontdlg.cpp index fe9cc27b15..a94cc91247 100644 --- a/src/os2/fontdlg.cpp +++ b/src/os2/fontdlg.cpp @@ -23,7 +23,7 @@ #endif #include "wx/fontutil.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #define INCL_PM #include @@ -37,7 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) int wxFontDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); FONTDLG vFontDlg; char zCurrentFont[FACESIZE]; diff --git a/src/os2/msgdlg.cpp b/src/os2/msgdlg.cpp index 81dc82639f..0fb64437af 100644 --- a/src/os2/msgdlg.cpp +++ b/src/os2/msgdlg.cpp @@ -22,7 +22,7 @@ #include "wx/math.h" #endif -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/os2/private.h" #include @@ -35,7 +35,7 @@ IMPLEMENT_CLASS(wxMessageDialog, wxDialog) int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); HWND hWnd = 0; ULONG ulStyle = MB_OK; diff --git a/src/osx/carbon/colordlg.cpp b/src/osx/carbon/colordlg.cpp index 18c4af745a..c5a7b1c47f 100644 --- a/src/osx/carbon/colordlg.cpp +++ b/src/osx/carbon/colordlg.cpp @@ -14,7 +14,7 @@ #include "wx/colordlg.h" #include "wx/fontdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX @@ -48,7 +48,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); RGBColor currentColor ; diff --git a/src/osx/carbon/colordlgosx.mm b/src/osx/carbon/colordlgosx.mm index 4f12861d3d..278f9ec9cd 100644 --- a/src/osx/carbon/colordlgosx.mm +++ b/src/osx/carbon/colordlgosx.mm @@ -22,7 +22,7 @@ #include "wx/colordlg.h" #include "wx/fontdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" // ============================================================================ // implementation @@ -124,7 +124,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) } int wxColourDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); //Start the pool. Required for carbon interaction //(For those curious, the only thing that happens diff --git a/src/osx/carbon/dirdlg.cpp b/src/osx/carbon/dirdlg.cpp index 4f98aa02da..9ff1c075e7 100644 --- a/src/osx/carbon/dirdlg.cpp +++ b/src/osx/carbon/dirdlg.cpp @@ -21,7 +21,7 @@ #endif // WX_PRECOMP #include "wx/filename.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/osx/private.h" @@ -73,7 +73,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, int wxDirDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); NavDialogRef dialog = NULL; NavDialogCreationOptions options; diff --git a/src/osx/carbon/filedlg.cpp b/src/osx/carbon/filedlg.cpp index d04dfb1923..b0a4e7b51b 100644 --- a/src/osx/carbon/filedlg.cpp +++ b/src/osx/carbon/filedlg.cpp @@ -26,7 +26,7 @@ #include "wx/filename.h" #include "wx/osx/private.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef __DARWIN__ #include @@ -477,7 +477,7 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_paths.Empty(); m_fileNames.Empty(); diff --git a/src/osx/carbon/fontdlg.cpp b/src/osx/carbon/fontdlg.cpp index 2aa22e63ec..b1ae442c78 100644 --- a/src/osx/carbon/fontdlg.cpp +++ b/src/osx/carbon/fontdlg.cpp @@ -42,7 +42,7 @@ #include "wx/fontdlg.h" #include "wx/fontutil.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG @@ -230,7 +230,7 @@ bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data) int wxFontDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); #if wxOSX_USE_CARBON diff --git a/src/osx/carbon/fontdlgosx.mm b/src/osx/carbon/fontdlgosx.mm index b1389b39bc..0ac8bd7d55 100644 --- a/src/osx/carbon/fontdlgosx.mm +++ b/src/osx/carbon/fontdlgosx.mm @@ -28,7 +28,7 @@ #endif #include "wx/fontutil.h" -#include "wx/testing.h" +#include "wx/modalhook.h" // ============================================================================ // implementation @@ -435,7 +435,7 @@ bool wxFontDialog::Create(wxWindow *parent) int wxFontDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); //Start the pool. Required for carbon interaction //(For those curious, the only thing that happens diff --git a/src/osx/carbon/msgdlg.cpp b/src/osx/carbon/msgdlg.cpp index 808fbcc385..6ce68371d1 100644 --- a/src/osx/carbon/msgdlg.cpp +++ b/src/osx/carbon/msgdlg.cpp @@ -19,7 +19,7 @@ #endif #include "wx/thread.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/osx/uma.h" @@ -37,7 +37,7 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); int resultbutton = wxID_CANCEL; diff --git a/src/osx/carbon/printdlg.cpp b/src/osx/carbon/printdlg.cpp index 2a9c234ec7..0729a4770a 100644 --- a/src/osx/carbon/printdlg.cpp +++ b/src/osx/carbon/printdlg.cpp @@ -28,11 +28,11 @@ #include "wx/osx/private/print.h" #include "wx/osx/private.h" #include "wx/statline.h" -#include "wx/testing.h" +#include "wx/modalhook.h" int wxMacPrintDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_printDialogData.GetPrintData().ConvertToNative(); ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData ); @@ -77,7 +77,7 @@ int wxMacPrintDialog::ShowModal() int wxMacPageSetupDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_pageSetupData.GetPrintData().ConvertToNative(); wxOSXPrintData* nativeData = (wxOSXPrintData*)m_pageSetupData.GetPrintData().GetNativeData(); diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index ad757e2adc..02f92f94f8 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -32,7 +32,7 @@ #include "wx/filename.h" #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/osx/private.h" @@ -95,7 +95,7 @@ void wxDirDialog::ShowWindowModal() int wxDirDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxCFEventLoopPauseIdleEvents pause; diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 1d162848ea..49e8680f06 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -38,7 +38,7 @@ #include "wx/osx/private.h" #include "wx/sysopt.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include @@ -501,7 +501,7 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) int wxFileDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxCFEventLoopPauseIdleEvents pause; diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 8218fc7e87..40ed938450 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -21,7 +21,7 @@ #include "wx/control.h" #include "wx/thread.h" #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #include "wx/osx/private.h" @@ -63,7 +63,7 @@ wxMessageDialog::~wxMessageDialog() int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); wxCFEventLoopPauseIdleEvents pause; diff --git a/src/osx/cocoa/printdlg.mm b/src/osx/cocoa/printdlg.mm index ef9268b377..f453778334 100644 --- a/src/osx/cocoa/printdlg.mm +++ b/src/osx/cocoa/printdlg.mm @@ -14,7 +14,7 @@ #if wxUSE_PRINTING_ARCHITECTURE #include "wx/printdlg.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/object.h" @@ -60,7 +60,7 @@ void wxOSXCocoaPrintData::UpdateToPMState() int wxMacPrintDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_printDialogData.GetPrintData().ConvertToNative(); @@ -85,7 +85,7 @@ int wxMacPrintDialog::ShowModal() int wxMacPageSetupDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_pageSetupData.GetPrintData().ConvertToNative(); ((wxOSXCocoaPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData ); diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index 8bb543ff75..cb127f323b 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -13,7 +13,7 @@ #include "wx/dialog.h" #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/app.h" @@ -138,7 +138,7 @@ bool wxDialog::Show(bool show) // Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); m_modality = wxDIALOG_MODALITY_APP_MODAL; diff --git a/src/osx/iphone/msgdlg.mm b/src/osx/iphone/msgdlg.mm index 9d11768149..c6b4021a88 100644 --- a/src/osx/iphone/msgdlg.mm +++ b/src/osx/iphone/msgdlg.mm @@ -20,7 +20,7 @@ #include "wx/thread.h" #include "wx/osx/private.h" -#include "wx/testing.h" +#include "wx/modalhook.h" IMPLEMENT_CLASS(wxMessageDialog, wxDialog) @@ -37,7 +37,7 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); int resultbutton = wxID_CANCEL; diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index bb1c941125..4c9609f097 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -29,7 +29,7 @@ #endif #include "wx/evtloop.h" -#include "wx/testing.h" +#include "wx/modalhook.h" //----------------------------------------------------------------------------- // wxDialog @@ -166,7 +166,7 @@ bool wxDialog::IsModal() const int wxDialog::ShowModal() { - WX_TESTING_SHOW_MODAL_HOOK(); + WX_HOOK_MODAL_DIALOG(); if ( IsModal() ) { -- 2.45.2