Review/simplify/cleanup MDI classes for all platforms and introduce base
classes for wxMDI{Parent,Child}Frame and wxMDIClientWindow. Also use generic MDI implementation for wxMotif as it seems to be more functional and definitely is more maintained (we probably should use the generic version for wxGTK too). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
82
Makefile.in
82
Makefile.in
@@ -2680,6 +2680,7 @@ COND_TOOLKIT_MOTIF_GUI_HDR = \
|
||||
wx/generic/fontdlgg.h \
|
||||
wx/generic/fontpickerg.h \
|
||||
wx/generic/listctrl.h \
|
||||
wx/generic/mdig.h \
|
||||
wx/generic/notebook.h \
|
||||
wx/generic/prntdlgg.h \
|
||||
wx/generic/statline.h \
|
||||
@@ -2716,7 +2717,6 @@ COND_TOOLKIT_MOTIF_GUI_HDR = \
|
||||
wx/motif/gauge.h \
|
||||
wx/motif/icon.h \
|
||||
wx/motif/listbox.h \
|
||||
wx/motif/mdi.h \
|
||||
wx/motif/menu.h \
|
||||
wx/motif/menuitem.h \
|
||||
wx/motif/minifram.h \
|
||||
@@ -5040,7 +5040,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS = \
|
||||
monodll_motif_icon.o \
|
||||
monodll_motif_listbox.o \
|
||||
monodll_motif_main.o \
|
||||
monodll_motif_mdi.o \
|
||||
monodll_motif_menu.o \
|
||||
monodll_motif_menuitem.o \
|
||||
monodll_motif_minifram.o \
|
||||
@@ -5072,6 +5071,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS = \
|
||||
monodll_fontdlgg.o \
|
||||
monodll_fontpickerg.o \
|
||||
monodll_generic_listctrl.o \
|
||||
monodll_mdig.o \
|
||||
monodll_generic_notebook.o \
|
||||
monodll_prntdlgg.o \
|
||||
monodll_generic_statline.o \
|
||||
@@ -6853,7 +6853,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_motif_icon.o \
|
||||
monolib_motif_listbox.o \
|
||||
monolib_motif_main.o \
|
||||
monolib_motif_mdi.o \
|
||||
monolib_motif_menu.o \
|
||||
monolib_motif_menuitem.o \
|
||||
monolib_motif_minifram.o \
|
||||
@@ -6885,6 +6884,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_fontdlgg.o \
|
||||
monolib_fontpickerg.o \
|
||||
monolib_generic_listctrl.o \
|
||||
monolib_mdig.o \
|
||||
monolib_generic_notebook.o \
|
||||
monolib_prntdlgg.o \
|
||||
monolib_generic_statline.o \
|
||||
@@ -8817,7 +8817,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_motif_icon.o \
|
||||
coredll_motif_listbox.o \
|
||||
coredll_motif_main.o \
|
||||
coredll_motif_mdi.o \
|
||||
coredll_motif_menu.o \
|
||||
coredll_motif_menuitem.o \
|
||||
coredll_motif_minifram.o \
|
||||
@@ -8849,6 +8848,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_fontdlgg.o \
|
||||
coredll_fontpickerg.o \
|
||||
coredll_generic_listctrl.o \
|
||||
coredll_mdig.o \
|
||||
coredll_generic_notebook.o \
|
||||
coredll_prntdlgg.o \
|
||||
coredll_generic_statline.o \
|
||||
@@ -10321,7 +10321,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_motif_icon.o \
|
||||
corelib_motif_listbox.o \
|
||||
corelib_motif_main.o \
|
||||
corelib_motif_mdi.o \
|
||||
corelib_motif_menu.o \
|
||||
corelib_motif_menuitem.o \
|
||||
corelib_motif_minifram.o \
|
||||
@@ -10353,6 +10352,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_fontdlgg.o \
|
||||
corelib_fontpickerg.o \
|
||||
corelib_generic_listctrl.o \
|
||||
corelib_mdig.o \
|
||||
corelib_generic_notebook.o \
|
||||
corelib_prntdlgg.o \
|
||||
corelib_generic_statline.o \
|
||||
@@ -14872,9 +14872,6 @@ monodll_motif_listbox.o: $(srcdir)/src/motif/listbox.cpp $(MONODLL_ODEP)
|
||||
monodll_motif_main.o: $(srcdir)/src/motif/main.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
||||
|
||||
monodll_motif_mdi.o: $(srcdir)/src/motif/mdi.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/motif/mdi.cpp
|
||||
|
||||
monodll_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
||||
|
||||
@@ -17656,6 +17653,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@monodll_fontpickerg.o: $(srcdir)/src/generic/fontpickerg.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/fontpickerg.cpp
|
||||
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_msw_accel.o: $(srcdir)/src/msw/accel.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/accel.cpp
|
||||
|
||||
@@ -18112,12 +18118,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1@monodll_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
||||
|
||||
@@ -19552,9 +19552,6 @@ monolib_motif_listbox.o: $(srcdir)/src/motif/listbox.cpp $(MONOLIB_ODEP)
|
||||
monolib_motif_main.o: $(srcdir)/src/motif/main.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
||||
|
||||
monolib_motif_mdi.o: $(srcdir)/src/motif/mdi.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/motif/mdi.cpp
|
||||
|
||||
monolib_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
||||
|
||||
@@ -22336,6 +22333,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@monolib_fontpickerg.o: $(srcdir)/src/generic/fontpickerg.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/fontpickerg.cpp
|
||||
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_msw_accel.o: $(srcdir)/src/msw/accel.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/accel.cpp
|
||||
|
||||
@@ -22792,12 +22798,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1@monolib_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
||||
|
||||
@@ -24895,9 +24895,6 @@ coredll_motif_listbox.o: $(srcdir)/src/motif/listbox.cpp $(COREDLL_ODEP)
|
||||
coredll_motif_main.o: $(srcdir)/src/motif/main.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
||||
|
||||
coredll_motif_mdi.o: $(srcdir)/src/motif/mdi.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/motif/mdi.cpp
|
||||
|
||||
coredll_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
||||
|
||||
@@ -27205,6 +27202,15 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@coredll_fontpickerg.o: $(srcdir)/src/generic/fontpickerg.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/fontpickerg.cpp
|
||||
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@coredll_msw_accel.o: $(srcdir)/src/msw/accel.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/accel.cpp
|
||||
|
||||
@@ -27661,12 +27667,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1@coredll_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
||||
|
||||
@@ -28402,9 +28402,6 @@ corelib_motif_listbox.o: $(srcdir)/src/motif/listbox.cpp $(CORELIB_ODEP)
|
||||
corelib_motif_main.o: $(srcdir)/src/motif/main.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
||||
|
||||
corelib_motif_mdi.o: $(srcdir)/src/motif/mdi.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/motif/mdi.cpp
|
||||
|
||||
corelib_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
||||
|
||||
@@ -30712,6 +30709,15 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@corelib_fontpickerg.o: $(srcdir)/src/generic/fontpickerg.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/fontpickerg.cpp
|
||||
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@corelib_msw_accel.o: $(srcdir)/src/msw/accel.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/accel.cpp
|
||||
|
||||
@@ -31168,12 +31174,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
|
||||
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1_WXUNIV_1@corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
|
||||
|
||||
@COND_USE_GUI_1@corelib_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
||||
|
||||
|
@@ -1374,7 +1374,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/motif/icon.cpp
|
||||
src/motif/listbox.cpp
|
||||
src/motif/main.cpp
|
||||
src/motif/mdi.cpp
|
||||
src/motif/menu.cpp
|
||||
src/motif/menuitem.cpp
|
||||
src/motif/minifram.cpp
|
||||
@@ -1407,6 +1406,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/generic/fontdlgg.cpp
|
||||
src/generic/fontpickerg.cpp
|
||||
src/generic/listctrl.cpp
|
||||
src/generic/mdig.cpp
|
||||
src/generic/notebook.cpp
|
||||
src/generic/prntdlgg.cpp
|
||||
src/generic/statline.cpp
|
||||
@@ -1424,6 +1424,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/generic/fontdlgg.h
|
||||
wx/generic/fontpickerg.h
|
||||
wx/generic/listctrl.h
|
||||
wx/generic/mdig.h
|
||||
wx/generic/notebook.h
|
||||
wx/generic/prntdlgg.h
|
||||
wx/generic/statline.h
|
||||
@@ -1460,7 +1461,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/motif/gauge.h
|
||||
wx/motif/icon.h
|
||||
wx/motif/listbox.h
|
||||
wx/motif/mdi.h
|
||||
wx/motif/menu.h
|
||||
wx/motif/menuitem.h
|
||||
wx/motif/minifram.h
|
||||
|
@@ -134,6 +134,7 @@ library:
|
||||
@itemdef{wxUSE_GAUGE, Use wxGauge class.}
|
||||
@itemdef{wxUSE_GENERIC_DRAGIMAGE, Used in wxDragImage sample.}
|
||||
@itemdef{wxUSE_GENERIC_DRAWELLIPSE, See comment in wx/dc.h file.}
|
||||
@itemdef{wxUSE_GENERIC_MDI_AS_NATIVE, This is not a user-settable symbol, it is only used internally in wx/generic/mdig.h.}
|
||||
@itemdef{wxUSE_GEOMETRY, Use common geometry classes}
|
||||
@itemdef{wxUSE_GIF, Use GIF wxImageHandler}
|
||||
@itemdef{wxUSE_GLCANVAS, Enables OpenGL support.}
|
||||
|
@@ -2,10 +2,11 @@
|
||||
// Name: wx/cocoa/mdi.h
|
||||
// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 2003/09/08
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,7 +25,7 @@ WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList);
|
||||
// ========================================================================
|
||||
// wxMDIParentFrame
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
DECLARE_EVENT_TABLE()
|
||||
@@ -76,17 +77,16 @@ protected:
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxMDIChildFrame *GetActiveChild() const;
|
||||
void SetActiveChild(wxMDIChildFrame *child);
|
||||
|
||||
wxMDIClientWindow *GetClientWindow() const;
|
||||
virtual wxMDIClientWindow *OnCreateClient();
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
static bool IsTDI() { return false; }
|
||||
|
||||
virtual void ActivateNext() { /* TODO */ }
|
||||
virtual void ActivatePrevious() { /* TODO */ }
|
||||
|
||||
virtual void Cascade() {}
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
|
||||
virtual void ArrangeIcons() {}
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
protected:
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
@@ -150,14 +150,15 @@ protected:
|
||||
// ========================================================================
|
||||
// wxMDIClientWindow
|
||||
// ========================================================================
|
||||
class wxMDIClientWindow: public wxWindow
|
||||
class wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
public:
|
||||
wxMDIClientWindow();
|
||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
||||
virtual ~wxMDIClientWindow();
|
||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = 0 );
|
||||
wxMDIClientWindow() { }
|
||||
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxHSCROLL | wxVSCROLL);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_MDI_H__
|
||||
|
@@ -2,334 +2,260 @@
|
||||
// Name: wx/generic/mdig.h
|
||||
// Purpose: Generic MDI (Multiple Document Interface) classes
|
||||
// Author: Hans Van Leemputten
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 29/07/2002
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Hans Van Leemputten
|
||||
// Copyright: (c) 2002 Hans Van Leemputten
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDIG_H_
|
||||
#define _WX_MDIG_H_
|
||||
#ifndef _WX_GENERIC_MDIG_H_
|
||||
#define _WX_GENERIC_MDIG_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/frame.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/notebook.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIcon;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
|
||||
class WXDLLIMPEXP_FWD_CORE wxNotebook;
|
||||
|
||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
|
||||
#if wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
#define wxGenericMDIParentFrame wxMDIParentFrame
|
||||
#define wxGenericMDIChildFrame wxMDIChildFrame
|
||||
#define wxGenericMDIClientWindow wxMDIClientWindow
|
||||
#else // !wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow;
|
||||
#endif // wxUSE_GENERIC_MDI_AS_NATIVE/!wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericMDIParentFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
public:
|
||||
wxGenericMDIParentFrame();
|
||||
wxGenericMDIParentFrame() { Init(); }
|
||||
wxGenericMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxGenericMDIParentFrame();
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
// implement base class pure virtuals
|
||||
static bool IsTDI() { return true; }
|
||||
|
||||
virtual void ActivateNext() { AdvanceActive(true); }
|
||||
virtual void ActivatePrevious() { AdvanceActive(false); }
|
||||
|
||||
#if wxUSE_MENUS
|
||||
wxMenu* GetWindowMenu() const { return m_pWindowMenu; };
|
||||
void SetWindowMenu(wxMenu* pMenu);
|
||||
virtual void SetWindowMenu(wxMenu* pMenu);
|
||||
|
||||
virtual void SetMenuBar(wxMenuBar *pMenuBar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
void SetChildMenuBar(wxGenericMDIChildFrame *pChild);
|
||||
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
wxGenericMDIChildFrame *GetActiveChild() const;
|
||||
inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame);
|
||||
virtual wxGenericMDIClientWindow *OnCreateGenericClient();
|
||||
|
||||
wxGenericMDIClientWindow *GetClientWindow() const;
|
||||
virtual wxGenericMDIClientWindow *OnCreateClient();
|
||||
|
||||
virtual void Cascade() { /* Has no effect */ }
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
|
||||
virtual void ArrangeIcons() { /* Has no effect */ }
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
// implementation only from now on
|
||||
void WXSetChildMenuBar(wxGenericMDIChildFrame *child);
|
||||
void WXUpdateChildTitle(wxGenericMDIChildFrame *child);
|
||||
void WXActivateChild(wxGenericMDIChildFrame *child);
|
||||
void WXRemoveChild(wxGenericMDIChildFrame *child);
|
||||
bool WXIsActiveChild(wxGenericMDIChildFrame *child) const;
|
||||
bool WXIsInsideChildHandler(wxGenericMDIChildFrame *child) const;
|
||||
|
||||
// return the book control used by the client window to manage the pages
|
||||
wxBookCtrlBase *GetBookCtrl() const;
|
||||
|
||||
protected:
|
||||
wxGenericMDIClientWindow *m_pClientWindow;
|
||||
wxGenericMDIChildFrame *m_pActiveChild;
|
||||
#if wxUSE_MENUS
|
||||
wxMenu *m_pWindowMenu;
|
||||
wxMenuBar *m_pMyMenuBar;
|
||||
wxMenuBar *m_pMyMenuBar;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
protected:
|
||||
// advance the activation forward or backwards
|
||||
void AdvanceActive(bool forward);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
#if wxUSE_MENUS
|
||||
void RemoveWindowMenu(wxMenuBar *pMenuBar);
|
||||
void AddWindowMenu(wxMenuBar *pMenuBar);
|
||||
|
||||
void DoHandleMenu(wxCommandEvent &event);
|
||||
void OnWindowMenu(wxCommandEvent& event);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
// return the client window, may be NULL if we hadn't been created yet
|
||||
wxGenericMDIClientWindow *GetGenericClientWindow() const;
|
||||
|
||||
// close all children, return false if any of them vetoed it
|
||||
bool CloseAll();
|
||||
|
||||
|
||||
// this pointer is non-NULL if we're currently inside our ProcessEvent()
|
||||
// and we forwarded the event to this child (as we do with menu events)
|
||||
wxMDIChildFrameBase *m_childHandler;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericMDIChildFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIChildFrame: public wxPanel
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIChildFrame : public wxTDIChildFrame
|
||||
{
|
||||
public:
|
||||
wxGenericMDIChildFrame();
|
||||
wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
wxGenericMDIChildFrame() { Init(); }
|
||||
wxGenericMDIChildFrame(wxGenericMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxGenericMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxGenericMDIChildFrame();
|
||||
bool Create( wxGenericMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
// implement MDI operations
|
||||
virtual void Activate();
|
||||
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||
virtual wxMenuBar *GetMenuBar() const;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
virtual void SetTitle(const wxString& title);
|
||||
virtual wxString GetTitle() const;
|
||||
|
||||
virtual void Activate();
|
||||
virtual bool TryParent(wxEvent& event);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// no status bars
|
||||
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
|
||||
long WXUNUSED(style) = 1,
|
||||
wxWindowID WXUNUSED(winid) = 1,
|
||||
const wxString& WXUNUSED(name) = wxEmptyString)
|
||||
{ return (wxStatusBar*)NULL; }
|
||||
// implementation only from now on
|
||||
|
||||
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
||||
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
|
||||
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
|
||||
wxGenericMDIParentFrame* GetGenericMDIParent() const
|
||||
{
|
||||
#if wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
return GetMDIParent();
|
||||
#else // generic != native
|
||||
return m_mdiParentGeneric;
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// no toolbar bars
|
||||
virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
|
||||
wxWindowID WXUNUSED(winid),
|
||||
const wxString& WXUNUSED(name) )
|
||||
{ return (wxToolBar*)NULL; }
|
||||
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
|
||||
#endif
|
||||
|
||||
// no icon
|
||||
void SetIcon(const wxIcon& WXUNUSED(icon)) { }
|
||||
virtual void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
|
||||
|
||||
// no maximize etc
|
||||
virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ }
|
||||
virtual void Restore() { /* Has no effect */ }
|
||||
virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
|
||||
virtual bool IsMaximized() const { return true; }
|
||||
virtual bool IsIconized() const { return false; }
|
||||
virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
|
||||
virtual bool IsFullScreen() const { return false; }
|
||||
|
||||
virtual bool IsTopLevel() const { return false; }
|
||||
|
||||
void OnMenuHighlight(wxMenuEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// The next 2 are copied from top level...
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
void SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame);
|
||||
wxGenericMDIParentFrame* GetMDIParentFrame() const;
|
||||
}
|
||||
|
||||
protected:
|
||||
wxGenericMDIParentFrame *m_pMDIParentFrame;
|
||||
wxRect m_MDIRect;
|
||||
wxString m_Title;
|
||||
wxString m_title;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
wxMenuBar *m_pMenuBar;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if !wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
wxGenericMDIParentFrame *m_mdiParentGeneric;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// no size hints
|
||||
virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
|
||||
int WXUNUSED(maxW), int WXUNUSED(maxH),
|
||||
int WXUNUSED(incW), int WXUNUSED(incH)) {}
|
||||
|
||||
// This function needs to be called when a size change is confirmed,
|
||||
// we needed this function to prevent any body from the outside
|
||||
// changing the panel... it messes the UI layout when we would allow it.
|
||||
void ApplyMDIChildFrameRect();
|
||||
|
||||
private:
|
||||
void OnMenuHighlight(wxMenuEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
friend class wxGenericMDIClientWindow;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIClientWindow: public wxNotebook
|
||||
class WXDLLIMPEXP_CORE wxGenericMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
public:
|
||||
wxGenericMDIClientWindow();
|
||||
wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 );
|
||||
virtual ~wxGenericMDIClientWindow();
|
||||
virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
||||
wxGenericMDIClientWindow() { }
|
||||
|
||||
virtual int SetSelection(size_t nPage);
|
||||
// unfortunately we need to provide our own version of CreateClient()
|
||||
// because of the difference in the type of the first parameter and
|
||||
// implement the base class pure virtual method in terms of it
|
||||
// (CreateGenericClient() is virtual itself to allow customizing the client
|
||||
// window creation by overriding it in the derived classes)
|
||||
virtual bool CreateGenericClient(wxWindow *parent);
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long WXUNUSED(style) = wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
return CreateGenericClient(parent);
|
||||
}
|
||||
|
||||
protected:
|
||||
// implementation only
|
||||
wxBookCtrlBase *GetBookCtrl() const;
|
||||
wxGenericMDIChildFrame *GetChild(size_t pos) const;
|
||||
int FindChild(wxGenericMDIChildFrame *child) const;
|
||||
|
||||
private:
|
||||
void PageChanged(int OldSelection, int newSelection);
|
||||
|
||||
void OnPageChanged(wxBookCtrlEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
private:
|
||||
// the notebook containing all MDI children as its pages
|
||||
wxNotebook *m_notebook;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// inline functions implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Define normal wxMDI classes based on wxGenericMDI
|
||||
*/
|
||||
|
||||
#ifndef wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
#if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__)
|
||||
#define wxUSE_GENERIC_MDI_AS_NATIVE 1
|
||||
#else
|
||||
#define wxUSE_GENERIC_MDI_AS_NATIVE 0
|
||||
#endif
|
||||
#endif // wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
|
||||
#if wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
|
||||
class wxMDIChildFrame ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxGenericMDIParentFrame
|
||||
inline bool
|
||||
wxGenericMDIParentFrame::
|
||||
WXIsInsideChildHandler(wxGenericMDIChildFrame *child) const
|
||||
{
|
||||
public:
|
||||
wxMDIParentFrame() {}
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
:wxGenericMDIParentFrame(parent, winid, title, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
return child == m_childHandler;
|
||||
}
|
||||
|
||||
wxMDIChildFrame * GetActiveChild() const ;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIChildFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxGenericMDIChildFrame
|
||||
{
|
||||
public:
|
||||
wxMDIChildFrame() {}
|
||||
|
||||
wxMDIChildFrame( wxGenericMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr )
|
||||
:wxGenericMDIChildFrame(parent, winid, title, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxGenericMDIClientWindow
|
||||
{
|
||||
public:
|
||||
wxMDIClientWindow() {}
|
||||
|
||||
wxMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 )
|
||||
:wxGenericMDIClientWindow(parent, style)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_MDIG_H_
|
||||
#endif // _WX_GENERIC_MDIG_H_
|
||||
|
@@ -1,9 +1,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/mdi.h
|
||||
// Purpose:
|
||||
// Purpose: TDI-based MDI implementation for wxGTK
|
||||
// Author: Robert Roebling
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -15,11 +17,13 @@
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
|
||||
typedef struct _GtkNotebook GtkNotebook;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
public:
|
||||
wxMDIParentFrame() { Init(); }
|
||||
@@ -36,29 +40,28 @@ public:
|
||||
(void)Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxMDIParentFrame();
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
wxMDIChildFrame *GetActiveChild() const;
|
||||
// we don't store the active child in m_currentChild unlike the base class
|
||||
// version so override this method to find it dynamically
|
||||
virtual wxMDIChildFrame *GetActiveChild() const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow() const;
|
||||
virtual wxMDIClientWindow *OnCreateClient();
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void Cascade() {}
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
|
||||
virtual void ArrangeIcons() {}
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
static bool IsTDI() { return true; }
|
||||
|
||||
// implementation
|
||||
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
bool m_justInserted;
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
@@ -77,95 +80,54 @@ private:
|
||||
// wxMDIChildFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||
{
|
||||
public:
|
||||
wxMDIChildFrame();
|
||||
wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
wxMDIChildFrame() { Init(); }
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
bool Create( wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||
virtual wxMenuBar *GetMenuBar() const;
|
||||
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
|
||||
virtual void Activate();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// no status bars
|
||||
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
|
||||
long WXUNUSED(style) = 1,
|
||||
wxWindowID WXUNUSED(id) = 1,
|
||||
const wxString& WXUNUSED(name) = wxEmptyString)
|
||||
{ return (wxStatusBar*)NULL; }
|
||||
virtual void SetTitle(const wxString& title);
|
||||
|
||||
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
||||
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
|
||||
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// no toolbar
|
||||
virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& WXUNUSED(name) )
|
||||
{ return (wxToolBar*)NULL; }
|
||||
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
// no icon
|
||||
virtual void SetIcons(const wxIconBundle& icons )
|
||||
{ wxTopLevelWindowBase::SetIcons(icons); }
|
||||
|
||||
// no title
|
||||
virtual void SetTitle( const wxString &title );
|
||||
|
||||
// no maximize etc
|
||||
virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
|
||||
virtual bool IsMaximized() const { return true; }
|
||||
virtual void Iconize(bool WXUNUSED(iconize) = true) { }
|
||||
virtual bool IsIconized() const { return false; }
|
||||
virtual void Restore() {}
|
||||
|
||||
virtual bool IsTopLevel() const { return false; }
|
||||
|
||||
virtual bool Destroy();
|
||||
// implementation
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnMenuHighlight( wxMenuEvent& event );
|
||||
|
||||
// implementation
|
||||
|
||||
wxMenuBar *m_menuBar;
|
||||
GtkNotebookPage *m_page;
|
||||
bool m_justInserted;
|
||||
|
||||
protected:
|
||||
// override wxFrame methods to not do anything
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// no size hints
|
||||
virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
|
||||
int WXUNUSED(maxW), int WXUNUSED(maxH),
|
||||
int WXUNUSED(incW), int WXUNUSED(incH)) {}
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
GtkNotebook *GTKGetNotebook() const;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
};
|
||||
@@ -174,13 +136,13 @@ private:
|
||||
// wxMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
public:
|
||||
wxMDIClientWindow();
|
||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
||||
virtual ~wxMDIClientWindow();
|
||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
||||
wxMDIClientWindow() { }
|
||||
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
private:
|
||||
virtual void AddChildGTK(wxWindowGTK* child);
|
||||
|
@@ -1,42 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk1/mdi.h
|
||||
// Purpose:
|
||||
// Purpose: TDI-based MDI implementation for wxGTK1
|
||||
// Author: Robert Roebling
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __MDIH__
|
||||
#define __MDIH__
|
||||
#ifndef _WX_GTK1_MDI_H_
|
||||
#define _WX_GTK1_MDI_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/control.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
|
||||
typedef struct _GtkNotebook GtkNotebook;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
public:
|
||||
wxMDIParentFrame() { Init(); }
|
||||
@@ -53,41 +40,35 @@ public:
|
||||
(void)Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxMDIParentFrame();
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
wxMDIChildFrame *GetActiveChild() const;
|
||||
// we don't store the active child in m_currentChild unlike the base class
|
||||
// version so override this method to find it dynamically
|
||||
virtual wxMDIChildFrame *GetActiveChild() const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow() const;
|
||||
virtual wxMDIClientWindow *OnCreateClient();
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void Cascade() {}
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
|
||||
virtual void ArrangeIcons() {}
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
static bool IsTDI() { return true; }
|
||||
|
||||
// implementation
|
||||
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
bool m_justInserted;
|
||||
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
|
||||
private:
|
||||
friend class wxMDIChildFrame;
|
||||
void Init();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
};
|
||||
@@ -96,98 +77,54 @@ private:
|
||||
// wxMDIChildFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||
{
|
||||
public:
|
||||
wxMDIChildFrame();
|
||||
wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
wxMDIChildFrame() { Init(); }
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
bool Create( wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||
virtual wxMenuBar *GetMenuBar() const;
|
||||
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
|
||||
virtual void Activate();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// no status bars
|
||||
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
|
||||
long WXUNUSED(style) = 1,
|
||||
wxWindowID WXUNUSED(id) = 1,
|
||||
const wxString& WXUNUSED(name) = wxEmptyString)
|
||||
{ return (wxStatusBar*)NULL; }
|
||||
virtual void SetTitle(const wxString& title);
|
||||
|
||||
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
||||
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
|
||||
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
|
||||
#endif
|
||||
|
||||
// no size hints
|
||||
virtual void DoSetSizeHints( int WXUNUSED(minW),
|
||||
int WXUNUSED(minH),
|
||||
int WXUNUSED(maxW) = wxDefaultCoord,
|
||||
int WXUNUSED(maxH) = wxDefaultCoord,
|
||||
int WXUNUSED(incW) = wxDefaultCoord,
|
||||
int WXUNUSED(incH) = wxDefaultCoord) {}
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// no toolbar
|
||||
virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& WXUNUSED(name) )
|
||||
{ return (wxToolBar*)NULL; }
|
||||
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
// no icon
|
||||
virtual void SetIcons(const wxIconBundle& icons )
|
||||
{ wxTopLevelWindowBase::SetIcons(icons); }
|
||||
|
||||
// no title
|
||||
virtual void SetTitle( const wxString &title );
|
||||
|
||||
// no maximize etc
|
||||
virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
|
||||
virtual bool IsMaximized() const { return true; }
|
||||
virtual void Iconize(bool WXUNUSED(iconize) = true) { }
|
||||
virtual bool IsIconized() const { return false; }
|
||||
virtual void Restore() {}
|
||||
|
||||
virtual bool IsTopLevel() const { return false; }
|
||||
// implementation
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnMenuHighlight( wxMenuEvent& event );
|
||||
|
||||
// implementation
|
||||
|
||||
wxMenuBar *m_menuBar;
|
||||
GtkNotebookPage *m_page;
|
||||
bool m_justInserted;
|
||||
|
||||
protected:
|
||||
// override wxFrame methods to not do anything
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
GtkNotebook *GTKGetNotebook() const;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
};
|
||||
@@ -196,16 +133,16 @@ private:
|
||||
// wxMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
public:
|
||||
wxMDIClientWindow();
|
||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
||||
virtual ~wxMDIClientWindow();
|
||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
||||
wxMDIClientWindow() { }
|
||||
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif // __MDIH__
|
||||
#endif // _WX_GTK1_MDI_H_
|
||||
|
342
include/wx/mdi.h
342
include/wx/mdi.h
@@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/mdi.h
|
||||
// Purpose: wxMDI base header
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created:
|
||||
// Copyright: (c) Julian Smart
|
||||
// Author: Julian Smart (original)
|
||||
// Vadim Zeitlin (base MDI classes refactoring)
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -16,12 +16,330 @@
|
||||
|
||||
#if wxUSE_MDI
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/frame.h"
|
||||
|
||||
// forward declarations
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindowBase;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMDIParentFrameBase: base class for parent frame for MDI children
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrameBase : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxMDIParentFrameBase()
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
#if wxUSE_MENUS
|
||||
m_windowMenu = NULL;
|
||||
#endif // wxUSE_MENUS
|
||||
}
|
||||
|
||||
/*
|
||||
Derived classes should provide ctor and Create() with the following
|
||||
declaration:
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
*/
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual ~wxMDIParentFrameBase()
|
||||
{
|
||||
delete m_windowMenu;
|
||||
}
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// Get or change the active MDI child window
|
||||
virtual wxMDIChildFrame *GetActiveChild() const
|
||||
{ return m_currentChild; }
|
||||
virtual void SetActiveChild(wxMDIChildFrame *child)
|
||||
{ m_currentChild = child; }
|
||||
|
||||
|
||||
// Get the client window
|
||||
wxMDIClientWindowBase *GetClientWindow() const { return m_clientWindow; }
|
||||
|
||||
|
||||
// MDI windows menu functions
|
||||
// --------------------------
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// return the pointer to the current window menu or NULL if we don't have
|
||||
// because of wxFRAME_NO_WINDOW_MENU style
|
||||
wxMenu* GetWindowMenu() const { return m_windowMenu; };
|
||||
|
||||
// use the given menu instead of the default window menu
|
||||
//
|
||||
// menu can be NULL to disable the window menu completely
|
||||
virtual void SetWindowMenu(wxMenu *menu)
|
||||
{
|
||||
delete m_windowMenu;
|
||||
m_windowMenu = menu;
|
||||
}
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
|
||||
// standard MDI window management functions
|
||||
// ----------------------------------------
|
||||
|
||||
virtual void Cascade() { }
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
|
||||
virtual void ArrangeIcons() { }
|
||||
virtual void ActivateNext() = 0;
|
||||
virtual void ActivatePrevious() = 0;
|
||||
|
||||
/*
|
||||
Derived classes must provide the following function:
|
||||
|
||||
static bool IsTDI();
|
||||
*/
|
||||
|
||||
// Create the client window class (don't Create() the window here, just
|
||||
// return a new object of a wxMDIClientWindow-derived class)
|
||||
//
|
||||
// Notice that if you override this method you should use the default
|
||||
// constructor and Create() and not the constructor creating the window
|
||||
// when creating the frame or your overridden version is not going to be
|
||||
// called (as the call to a virtual function from ctor will be dispatched
|
||||
// to this class version)
|
||||
virtual wxMDIClientWindow *OnCreateClient();
|
||||
|
||||
protected:
|
||||
// This is wxMDIClientWindow for all the native implementations but not for
|
||||
// the generic MDI version which has its own wxGenericMDIClientWindow and
|
||||
// so we store it as just a base class pointer because we don't need its
|
||||
// exact type anyhow
|
||||
wxMDIClientWindowBase *m_clientWindow;
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// the current window menu or NULL if we are not using it
|
||||
wxMenu *m_windowMenu;
|
||||
#endif // wxUSE_MENUS
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMDIChildFrameBase: child frame managed by wxMDIParentFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrameBase : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxMDIChildFrameBase() { m_mdiParent = NULL; }
|
||||
|
||||
/*
|
||||
Derived classes should provide Create() with the following signature:
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
And setting m_mdiParent to parent parameter.
|
||||
*/
|
||||
|
||||
// MDI children specific methods
|
||||
virtual void Activate() = 0;
|
||||
|
||||
// Return the MDI parent frame: notice that it may not be the same as
|
||||
// GetParent() (our parent may be the client window or even its subwindow
|
||||
// in some implementations)
|
||||
wxMDIParentFrame *GetMDIParent() const { return m_mdiParent; }
|
||||
|
||||
// Synonym for GetMDIParent(), was used in some other ports
|
||||
wxMDIParentFrame *GetMDIParentFrame() const { return GetMDIParent(); }
|
||||
|
||||
|
||||
// in most ports MDI children frames are not really top-level, the only
|
||||
// exception are the Mac ports in which MDI children are just normal top
|
||||
// level windows too
|
||||
virtual bool IsTopLevel() const { return false; }
|
||||
|
||||
protected:
|
||||
wxMDIParentFrame *m_mdiParent;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTDIChildFrame: child frame used by TDI implementations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxTDIChildFrame : public wxMDIChildFrameBase
|
||||
{
|
||||
public:
|
||||
// override wxFrame methods for this non top-level window
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// no status bars
|
||||
//
|
||||
// TODO: MDI children should have their own status bars, why not?
|
||||
virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
|
||||
long WXUNUSED(style) = 1,
|
||||
wxWindowID WXUNUSED(id) = 1,
|
||||
const wxString& WXUNUSED(name)
|
||||
= wxEmptyString)
|
||||
{ return NULL; }
|
||||
|
||||
virtual wxStatusBar *GetStatusBar() const
|
||||
{ return NULL; }
|
||||
virtual void SetStatusText(const wxString &WXUNUSED(text),
|
||||
int WXUNUSED(number)=0)
|
||||
{ }
|
||||
virtual void SetStatusWidths(int WXUNUSED(n),
|
||||
const int WXUNUSED(widths)[])
|
||||
{ }
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// no toolbar
|
||||
//
|
||||
// TODO: again, it should be possible to have tool bars
|
||||
virtual wxToolBar *CreateToolBar(long WXUNUSED(style),
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& WXUNUSED(name))
|
||||
{ return NULL; }
|
||||
virtual wxToolBar *GetToolBar() const { return NULL; }
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
// no icon
|
||||
virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
|
||||
|
||||
// title is used as the tab label
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
virtual void SetTitle(const wxString& title) = 0;
|
||||
|
||||
// no maximize etc
|
||||
virtual void Maximize(bool WXUNUSED(maximize) = true) { }
|
||||
virtual bool IsMaximized() const { return true; }
|
||||
virtual bool IsAlwaysMaximized() const { return true; }
|
||||
virtual void Iconize(bool WXUNUSED(iconize) = true) { }
|
||||
virtual bool IsIconized() const { return false; }
|
||||
virtual void Restore() { }
|
||||
|
||||
virtual bool ShowFullScreen(bool WXUNUSED(show),
|
||||
long WXUNUSED(style)) { return false; }
|
||||
virtual bool IsFullScreen() const { return false; }
|
||||
|
||||
|
||||
// we need to override these functions to ensure that a child window is
|
||||
// created even though we derive from wxFrame -- basically we make it
|
||||
// behave as just a wxWindow by short-circuiting wxTLW changes to the base
|
||||
// class behaviour
|
||||
|
||||
virtual void AddChild(wxWindowBase *child) { wxWindow::AddChild(child); }
|
||||
|
||||
virtual bool Destroy() { return wxWindow::Destroy(); }
|
||||
|
||||
// extra platform-specific hacks
|
||||
#ifdef __WXMSW__
|
||||
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const
|
||||
{
|
||||
return wxWindow::MSWGetStyle(flags, exstyle);
|
||||
}
|
||||
|
||||
virtual WXHWND MSWGetParent() const
|
||||
{
|
||||
return wxWindow::MSWGetParent();
|
||||
}
|
||||
|
||||
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
return wxWindow::MSWWindowProc(message, wParam, lParam);
|
||||
}
|
||||
#endif // __WXMSW__
|
||||
|
||||
protected:
|
||||
virtual void DoGetSize(int *width, int *height) const
|
||||
{
|
||||
wxWindow::DoGetSize(width, height);
|
||||
}
|
||||
|
||||
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
virtual void DoGetClientSize(int *width, int *height) const
|
||||
{
|
||||
wxWindow::DoGetClientSize(width, height);
|
||||
}
|
||||
|
||||
virtual void DoSetClientSize(int width, int height)
|
||||
{
|
||||
wxWindow::DoSetClientSize(width, height);
|
||||
}
|
||||
|
||||
// no size hints
|
||||
virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
|
||||
int WXUNUSED(maxW), int WXUNUSED(maxH),
|
||||
int WXUNUSED(incW), int WXUNUSED(incH)) { }
|
||||
|
||||
wxString m_title;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMDIClientWindowBase: child of parent frame, parent of children frames
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindowBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
/*
|
||||
The derived class must provide the default ctor only (CreateClient()
|
||||
will be called later).
|
||||
*/
|
||||
|
||||
// Can be overridden in the derived classes but the base class version must
|
||||
// be usually called first to really create the client window.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Include the port-specific implementation of the base classes defined above
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// wxUSE_GENERIC_MDI_AS_NATIVE may be predefined to force the generic MDI
|
||||
// implementation use even on the platforms which usually don't use it
|
||||
//
|
||||
// notice that generic MDI can still be used without this, but you would need
|
||||
// to explicitly use wxGenericMDIXXX classes in your code (and currently also
|
||||
// add src/generic/mdig.cpp to your build as it's not compiled in if generic
|
||||
// MDI is not used by default -- but this may change later...)
|
||||
#ifndef wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
// wxUniv always uses the generic MDI implementation and so do the ports
|
||||
// without native version (although wxCocoa seems to have one -- but it's
|
||||
// probably not functional?)
|
||||
#if defined(__WXCOCOA__) || \
|
||||
defined(__WXMOTIF__) || \
|
||||
defined(__WXPM__) || \
|
||||
defined(__WXUNIVERSAL__)
|
||||
#define wxUSE_GENERIC_MDI_AS_NATIVE 1
|
||||
#else
|
||||
#define wxUSE_GENERIC_MDI_AS_NATIVE 0
|
||||
#endif
|
||||
#endif // wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
|
||||
#if wxUSE_GENERIC_MDI_AS_NATIVE
|
||||
#include "wx/generic/mdig.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/mdi.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/mdi.h"
|
||||
#elif defined(__WXGTK20__)
|
||||
#include "wx/gtk/mdi.h"
|
||||
#elif defined(__WXGTK__)
|
||||
@@ -30,11 +348,13 @@
|
||||
#include "wx/osx/mdi.h"
|
||||
#elif defined(__WXCOCOA__)
|
||||
#include "wx/cocoa/mdi.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/mdig.h"
|
||||
#endif
|
||||
|
||||
inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow;
|
||||
}
|
||||
|
||||
#endif // wxUSE_MDI
|
||||
|
||||
#endif
|
||||
// _WX_MDI_H_BASE_
|
||||
#endif // _WX_MDI_H_BASE_
|
||||
|
@@ -2,58 +2,62 @@
|
||||
// Name: wx/motif/mdi.h
|
||||
// Purpose: MDI (Multiple Document Interface) classes.
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 17/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDI_H_
|
||||
#define _WX_MDI_H_
|
||||
#ifndef _WX_MOTIF_MDI_H_
|
||||
#define _WX_MOTIF_MDI_H_
|
||||
|
||||
/*
|
||||
New MDI scheme using tabs. We can use a wxNotebook to implement the client
|
||||
window. wxMDIChildFrame can be implemented as an XmMainWindow widget
|
||||
as before, and is a child of the notebook _and_ of the parent frame...
|
||||
but wxMDIChildFrame::GetParent should return the parent frame.
|
||||
|
||||
*/
|
||||
|
||||
#include "wx/frame.h"
|
||||
#include "wx/notebook.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
public:
|
||||
|
||||
wxMDIParentFrame();
|
||||
inline wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
|
||||
const wxString& name = wxFrameNameStr)
|
||||
wxMDIParentFrame() { Init(); }
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIParentFrame();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
static bool IsTDI() { return true; }
|
||||
|
||||
virtual void ActivateNext() { /* TODO */ }
|
||||
virtual void ActivatePrevious() { /* TODO */ }
|
||||
|
||||
|
||||
// Implementation
|
||||
|
||||
// Set the child's menubar into the parent frame
|
||||
void SetChildMenuBar(wxMDIChildFrame* frame);
|
||||
|
||||
wxMenuBar* GetActiveMenuBar() const { return m_activeMenuBar; }
|
||||
|
||||
// Redirect events to active child first
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
@@ -62,82 +66,41 @@ public:
|
||||
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
|
||||
// Get the active MDI child window
|
||||
wxMDIChildFrame *GetActiveChild() const ;
|
||||
|
||||
// Get the client window
|
||||
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient() ;
|
||||
|
||||
// MDI operations
|
||||
virtual void Cascade();
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL);
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
// Implementation
|
||||
|
||||
// Set the active child
|
||||
inline void SetActiveChild(wxMDIChildFrame* child) { m_activeChild = child; }
|
||||
|
||||
// Set the child's menubar into the parent frame
|
||||
void SetChildMenuBar(wxMDIChildFrame* frame);
|
||||
|
||||
inline wxMenuBar* GetActiveMenuBar() const { return m_activeMenuBar; }
|
||||
|
||||
// Redirect events to active child first
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
protected:
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
wxMenuBar *m_activeMenuBar;
|
||||
|
||||
// Gets the size available for subwindows after menu size, toolbar size
|
||||
// and status bar size have been subtracted. If you want to manage your own
|
||||
// toolbar(s), don't call SetToolBar.
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
|
||||
protected:
|
||||
|
||||
wxMDIClientWindow* m_clientWindow;
|
||||
wxMDIChildFrame* m_activeChild;
|
||||
wxMenuBar* m_activeMenuBar;
|
||||
private:
|
||||
void Init();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
|
||||
public:
|
||||
wxMDIChildFrame();
|
||||
wxMDIChildFrame() { }
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
// Set menu bar
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
@@ -174,55 +137,18 @@ public:
|
||||
WXWidget GetTopWidget() const { return m_mainWidget; };
|
||||
WXWidget GetClientWidget() const { return m_mainWidget; };
|
||||
|
||||
/*
|
||||
virtual void OnRaise();
|
||||
virtual void OnLower();
|
||||
*/
|
||||
|
||||
void SetMDIParentFrame(wxMDIParentFrame* parentFrame) { m_mdiParentFrame = parentFrame; }
|
||||
wxMDIParentFrame* GetMDIParentFrame() const { return m_mdiParentFrame; }
|
||||
|
||||
protected:
|
||||
wxMDIParentFrame* m_mdiParentFrame;
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
void DoGetSize(int *width, int *height) const;
|
||||
void DoGetPosition(int *x, int *y) const ;
|
||||
void DoSetSizeHints(int minW, int minH,
|
||||
int maxW, int maxH,
|
||||
int incW, int incH);
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
};
|
||||
|
||||
/* The client window is a child of the parent MDI frame, and itself
|
||||
* contains the child MDI frames.
|
||||
* However, you create the MDI children as children of the MDI parent:
|
||||
* only in the implementation does the client window become the parent
|
||||
* of the children. Phew! So the children are sort of 'adopted'...
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxNotebook
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
|
||||
public:
|
||||
wxMDIClientWindow() ;
|
||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
|
||||
wxMDIClientWindow() { }
|
||||
virtual ~wxMDIClientWindow();
|
||||
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
// Implementation
|
||||
void OnPageChanged(wxBookCtrlEvent& event);
|
||||
@@ -231,17 +157,19 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
void DoGetSize(int *width, int *height) const ;
|
||||
void DoGetPosition(int *x, int *y) const ;
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoGetSize(int *width, int *height) const ;
|
||||
virtual void DoGetPosition(int *x, int *y) const ;
|
||||
|
||||
wxNotebook *m_notebook;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_MDI_H_
|
||||
#endif // _WX_MOTIF_MDI_H_
|
||||
|
@@ -2,28 +2,24 @@
|
||||
// Name: wx/msw/mdi.h
|
||||
// Purpose: MDI (Multiple Document Interface) classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDI_H_
|
||||
#define _WX_MDI_H_
|
||||
#ifndef _WX_MSW_MDI_H_
|
||||
#define _WX_MSW_MDI_H_
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
public:
|
||||
wxMDIParentFrame();
|
||||
@@ -48,41 +44,26 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
// override/implement base class [pure] virtual methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
// Get the active MDI child window
|
||||
wxMDIChildFrame *GetActiveChild() const;
|
||||
static bool IsTDI() { return false; }
|
||||
|
||||
// Get the client window
|
||||
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
||||
// we don't store the active child in m_currentChild so override this
|
||||
// function to find it dynamically
|
||||
virtual wxMDIChildFrame *GetActiveChild() const;
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient();
|
||||
|
||||
// MDI windows menu functions
|
||||
// --------------------------
|
||||
|
||||
// return the pointer to the current window menu or NULL if we don't have
|
||||
// because of wxFRAME_NO_WINDOW_MENU style
|
||||
wxMenu *GetWindowMenu() const { return m_windowMenu; }
|
||||
|
||||
// use the given menu instead of the default window menu
|
||||
//
|
||||
// menu can be NULL to disable the window menu completely
|
||||
void SetWindowMenu(wxMenu* menu) ;
|
||||
|
||||
virtual void DoMenuUpdates(wxMenu* menu = NULL);
|
||||
|
||||
// MDI operations
|
||||
// --------------
|
||||
virtual void Cascade();
|
||||
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual void SetWindowMenu(wxMenu* menu);
|
||||
|
||||
virtual void DoMenuUpdates(wxMenu* menu = NULL);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// implementation only from now on
|
||||
|
||||
@@ -127,12 +108,6 @@ protected:
|
||||
void UpdateClientSize();
|
||||
|
||||
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
|
||||
// the current window menu or NULL if we are not using it
|
||||
wxMenu *m_windowMenu;
|
||||
|
||||
// true if MDI Frame is intercepting commands, not child
|
||||
bool m_parentFrameActive;
|
||||
|
||||
@@ -155,7 +130,7 @@ private:
|
||||
// wxMDIChildFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
|
||||
{
|
||||
public:
|
||||
wxMDIChildFrame() { Init(); }
|
||||
@@ -172,8 +147,6 @@ public:
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
@@ -182,21 +155,20 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual bool IsTopLevel() const { return false; }
|
||||
virtual ~wxMDIChildFrame();
|
||||
|
||||
// MDI operations
|
||||
// implement MDI operations
|
||||
virtual void Activate();
|
||||
|
||||
// Override some frame operations too
|
||||
virtual void Maximize(bool maximize = true);
|
||||
virtual void Restore();
|
||||
virtual void Activate();
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
// Implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
wxMDIParentFrame* GetMDIParent() const
|
||||
{
|
||||
return wxStaticCast(wxFrame::GetParent(), wxMDIParentFrame);
|
||||
}
|
||||
|
||||
// Handlers
|
||||
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||
bool HandleWindowPosChanging(void *lpPos);
|
||||
@@ -213,8 +185,6 @@ public:
|
||||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
protected:
|
||||
virtual void DoGetScreenPosition(int *x, int *y) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
@@ -240,16 +210,10 @@ private:
|
||||
// wxMDIClientWindow
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxWindow
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
public:
|
||||
wxMDIClientWindow() { Init(); }
|
||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
Init();
|
||||
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
@@ -272,5 +236,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_MDI_H_
|
||||
#endif // _WX_MSW_MDI_H_
|
||||
|
@@ -1,88 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mdi.h
|
||||
// Name: wx/osx/carbon/mdi.h
|
||||
// Purpose: MDI (Multiple Document Interface) classes.
|
||||
// This doesn't have to be implemented just like Windows,
|
||||
// it could be a tabbed design as in wxGTK.
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 1998-01-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDI_H_
|
||||
#define _WX_MDI_H_
|
||||
#ifndef _WX_OSX_CARBON_MDI_H_
|
||||
#define _WX_OSX_CARBON_MDI_H_
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr[];
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
|
||||
public:
|
||||
wxMDIParentFrame() { Init(); }
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
wxMDIParentFrame() { Init(); }
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIParentFrame();
|
||||
virtual ~wxMDIParentFrame();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
// implement/override base class [pure] virtuals
|
||||
// ---------------------------------------------
|
||||
|
||||
// Mac OS activate event
|
||||
virtual void MacActivate(long timestamp, bool activating);
|
||||
static bool IsTDI() { return false; }
|
||||
|
||||
// wxWidgets activate event
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
virtual void AddChild(wxWindowBase *child);
|
||||
virtual void RemoveChild(wxWindowBase *child);
|
||||
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
virtual void ActivateNext() { /* TODO */ }
|
||||
virtual void ActivatePrevious() { /* TODO */ }
|
||||
|
||||
// Get the active MDI child window (Windows only)
|
||||
wxMDIChildFrame *GetActiveChild() const ;
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
// Get the client window
|
||||
inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
|
||||
// Get rect to be used to center top-level children
|
||||
virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient() ;
|
||||
// Mac-specific implementation from now on
|
||||
// ---------------------------------------
|
||||
|
||||
// MDI operations
|
||||
virtual void Cascade();
|
||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL);
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
// Mac OS activate event
|
||||
virtual void MacActivate(long timestamp, bool activating);
|
||||
|
||||
virtual bool Show( bool show = true );
|
||||
// wxWidgets activate event
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// overridden base clas virtuals
|
||||
virtual void AddChild(wxWindowBase *child);
|
||||
virtual void RemoveChild(wxWindowBase *child);
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
|
||||
// Get rect to be used to center top-level children
|
||||
virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
@@ -93,9 +77,6 @@ protected:
|
||||
bool ShouldBeVisible() const;
|
||||
|
||||
|
||||
// TODO maybe have this member
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
wxMenu *m_windowMenu;
|
||||
|
||||
// true if MDI Frame is intercepting commands, not child
|
||||
@@ -107,88 +88,67 @@ protected:
|
||||
|
||||
private:
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
public:
|
||||
wxMDIChildFrame() { Init(); }
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init() ;
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
wxMDIChildFrame();
|
||||
inline wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init() ;
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
virtual ~wxMDIChildFrame();
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
// un-override the base class override
|
||||
virtual bool IsTopLevel() const { return true; }
|
||||
|
||||
// Mac OS activate event
|
||||
virtual void MacActivate(long timestamp, bool activating);
|
||||
// implement MDI operations
|
||||
virtual void Activate();
|
||||
|
||||
// Set menu bar
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
|
||||
// MDI operations
|
||||
virtual void Maximize();
|
||||
virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
|
||||
virtual void Restore();
|
||||
virtual void Activate();
|
||||
// Mac OS activate event
|
||||
virtual void MacActivate(long timestamp, bool activating);
|
||||
|
||||
protected:
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
};
|
||||
|
||||
/* The client window is a child of the parent MDI frame, and itself
|
||||
* contains the child MDI frames.
|
||||
* However, you create the MDI children as children of the MDI parent:
|
||||
* only in the implementation does the client window become the parent
|
||||
* of the children. Phew! So the children are sort of 'adopted'...
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
|
||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
public:
|
||||
public:
|
||||
wxMDIClientWindow() { }
|
||||
virtual ~wxMDIClientWindow();
|
||||
|
||||
wxMDIClientWindow() ;
|
||||
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
|
||||
virtual ~wxMDIClientWindow();
|
||||
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
protected:
|
||||
// Gets the size available for subwindows after menu size, toolbar size
|
||||
// and status bar size have been subtracted. If you want to manage your own
|
||||
// toolbar(s), don't call SetToolBar.
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_MDI_H_
|
||||
#endif // _WX_OSX_CARBON_MDI_H_
|
||||
|
@@ -36,34 +36,28 @@
|
||||
class wxMDIClientWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
Default constructor.
|
||||
*/
|
||||
|
||||
Objects of this class are only created by wxMDIParentFrame which uses
|
||||
the default constructor and calls CreateClient() immediately
|
||||
afterwards.
|
||||
*/
|
||||
wxMDIClientWindow();
|
||||
|
||||
/**
|
||||
Constructor, creating the window.
|
||||
Called by wxMDIParentFrame immediately after creating the client
|
||||
window.
|
||||
|
||||
This function may be overridden in the derived class but the base class
|
||||
version must usually be called first to really create the window.
|
||||
|
||||
@param parent
|
||||
The window parent.
|
||||
@param style
|
||||
The window style. Currently unused.
|
||||
The window style. Only wxHSCROLL and wxVSCROLL bits are meaningful
|
||||
here.
|
||||
|
||||
@remarks This constructor is called within wxMDIParentFrame::OnCreateClient().
|
||||
|
||||
@see wxMDIParentFrame::wxMDIParentFrame(), wxMDIParentFrame::OnCreateClient()
|
||||
*/
|
||||
wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxMDIClientWindow();
|
||||
|
||||
/**
|
||||
Used in two-step frame construction. See wxMDIClientWindow()
|
||||
for further details.
|
||||
*/
|
||||
virtual bool CreateClient(wxMDIParentFrame* parent, long style = 0);
|
||||
};
|
||||
@@ -73,65 +67,45 @@ public:
|
||||
/**
|
||||
@class wxMDIParentFrame
|
||||
|
||||
An MDI (Multiple Document Interface) parent frame is a window which can contain
|
||||
MDI child frames in its own 'desktop'. It is a convenient way to avoid window
|
||||
clutter, and is used in many popular Windows applications, such as Microsoft Word(TM).
|
||||
An MDI (Multiple Document Interface) parent frame is a window which can
|
||||
contain MDI child frames in its client area which emulates the full
|
||||
desktop.
|
||||
|
||||
MDI is a user-interface model in which all the window reside inside the
|
||||
single parent window as opposed to being separate from each other. It
|
||||
remains popular despite dire warnings from Microsoft itself (which
|
||||
popularized this model in the first model) that MDI is obsolete.
|
||||
|
||||
An MDI parent frame always has a wxMDIClientWindow associated with it,
|
||||
which is the parent for MDI child frames. In the simplest case, the client
|
||||
window takes up the entire parent frame area but it is also possible to
|
||||
resize it to be smaller in order to have other windows in the frame, a
|
||||
typical example is using a sidebar along one of the window edges.
|
||||
|
||||
The appearance of MDI applications differs between different ports. The
|
||||
classic MDI model, with child windows which can be independently moved,
|
||||
resized etc, is only available under MSW, which provides native support for
|
||||
it. In Mac ports, multiple top level windows are used for the MDI children
|
||||
too and the MDI parent frame itself is invisible, to accommodate the native
|
||||
look and feel requirements. In all the other ports, a tab-based MDI
|
||||
implementation (sometimes called TDI) is used and so at most one MDI child
|
||||
is visible at any moment (child frames are always maximized).
|
||||
|
||||
@remarks
|
||||
|
||||
There may be multiple MDI parent frames in a single application, but this probably
|
||||
only makes sense within programming development environments.
|
||||
|
||||
Child frames may be of class wxMDIChildFrame (contained within the parent frame)
|
||||
or wxFrame (shown as a top-level frame).
|
||||
|
||||
An MDI parent frame always has a wxMDIClientWindow associated with it, which is the
|
||||
parent for MDI child frames. This client window may be resized to accommodate non-MDI
|
||||
windows, as seen in Microsoft Visual C++ (TM) and Microsoft Publisher (TM), where
|
||||
a documentation window is placed to one side of the workspace.
|
||||
|
||||
MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete
|
||||
user interface style.
|
||||
|
||||
The implementation is native in Windows, and simulated under Motif. Under Motif, the
|
||||
child window frames will often have a different appearance from other frames because
|
||||
the window decorations are simulated.
|
||||
Although it is possible to have multiple MDI parent frames, a typical MDI
|
||||
application has a single MDI parent frame window inside which multiple MDI
|
||||
child frames, i.e. objects of class wxMDIChildFrame, can be created.
|
||||
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxCAPTION}
|
||||
Puts a caption on the frame.
|
||||
@style{wxDEFAULT_FRAME_STYLE}
|
||||
Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
|
||||
@c wxSYSTEM_MENU | @c wxCAPTION.
|
||||
@style{wxHSCROLL}
|
||||
Displays a horizontal scrollbar in the client window, allowing the
|
||||
user to view child frames that are off the current view.
|
||||
@style{wxICONIZE}
|
||||
Display the frame iconized (minimized) (Windows only).
|
||||
@style{wxMAXIMIZE}
|
||||
Displays the frame maximized (Windows only).
|
||||
@style{wxMAXIMIZE_BOX}
|
||||
Displays a maximize box on the frame (Windows and Motif only).
|
||||
@style{wxMINIMIZE}
|
||||
Identical to @c wxICONIZE.
|
||||
@style{wxMINIMIZE_BOX}
|
||||
Displays a minimize box on the frame (Windows and Motif only).
|
||||
@style{wxRESIZE_BORDER}
|
||||
Displays a resizeable border around the window (Motif only; for
|
||||
Windows, it is implicit in @c wxTHICK_FRAME).
|
||||
@style{wxSTAY_ON_TOP}
|
||||
Stay on top of other windows (Windows only).
|
||||
@style{wxSYSTEM_MENU}
|
||||
Displays a system menu (Windows and Motif only).
|
||||
@style{wxTHICK_FRAME}
|
||||
Displays a thick frame around the window (Windows and Motif only).
|
||||
@style{wxVSCROLL}
|
||||
Displays a vertical scrollbar in the client window, allowing the
|
||||
user to view child frames that are off the current view.
|
||||
@style{wxFRAME_NO_WINDOW_MENU}
|
||||
Under Windows, removes the Window menu that is normally added
|
||||
automatically.
|
||||
|
||||
There are no special styles for this class, all wxFrame styles apply to it
|
||||
in the usual way. The only exception is that wxHSCROLL and wxVSCROLL styles
|
||||
apply not to the frame itself but to the client window, so that using them
|
||||
enables horizontal and vertical scrollbars for this window and not the
|
||||
frame.
|
||||
|
||||
@endStyleTable
|
||||
|
||||
@library{wxcore}
|
||||
@@ -145,38 +119,47 @@ public:
|
||||
|
||||
/**
|
||||
Default constructor.
|
||||
|
||||
Use Create() for the objects created using this constructor.
|
||||
*/
|
||||
wxMDIParentFrame();
|
||||
|
||||
/**
|
||||
Constructor, creating the window.
|
||||
|
||||
Notice that if you override virtual OnCreateClient() method you
|
||||
shouldn't be using this constructor but the default constructor and
|
||||
Create() as otherwise your overridden method is never going to be
|
||||
called because of the usual C++ virtual call resolution rules.
|
||||
|
||||
@param parent
|
||||
The window parent. This should be @NULL.
|
||||
The window parent. Usually is @NULL.
|
||||
@param id
|
||||
The window identifier. It may take a value of -1 to indicate a default
|
||||
value.
|
||||
The window identifier. It may take a value of @c wxID_ANY to
|
||||
indicate a default value.
|
||||
@param title
|
||||
The caption to be displayed on the frame's title bar.
|
||||
@param pos
|
||||
The window position. The value @c wxDefaultPosition indicates a default position,
|
||||
chosen by either the windowing system or wxWidgets, depending on platform.
|
||||
The window position. The value @c wxDefaultPosition indicates a
|
||||
default position, chosen by either the windowing system or
|
||||
wxWidgets, depending on platform.
|
||||
@param size
|
||||
The window size. The value @c wxDefaultSize indicates a default size, chosen by
|
||||
either the windowing system or wxWidgets, depending on platform.
|
||||
The window size. The value @c wxDefaultSize indicates a default
|
||||
size, chosen by either the windowing system or wxWidgets, depending
|
||||
on platform.
|
||||
@param style
|
||||
The window style. See wxMDIParentFrame.
|
||||
The window style. Default value includes wxHSCROLL and wxVSCROLL
|
||||
styles.
|
||||
@param name
|
||||
The name of the window. This parameter is used to associate a name
|
||||
with the item, allowing the application user to set Motif resource values
|
||||
for individual windows.
|
||||
with the item, allowing the application user to set Motif resource
|
||||
values for individual windows.
|
||||
|
||||
@remarks During the construction of the frame, the client window will be
|
||||
created. To use a different class from wxMDIClientWindow, override
|
||||
OnCreateClient().
|
||||
Under Windows 95, the client window will automatically have a
|
||||
sunken border style when the active child is not maximized,
|
||||
and no border style when a child is maximized.
|
||||
@remarks
|
||||
|
||||
Under Windows 95, the client window will automatically have a sunken
|
||||
border style when the active child is not maximized, and no border
|
||||
style when a child is maximized.
|
||||
|
||||
@see Create(), OnCreateClient()
|
||||
*/
|
||||
@@ -188,13 +171,19 @@ public:
|
||||
const wxString& name = "frame");
|
||||
|
||||
/**
|
||||
Destructor. Destroys all child windows and menu bar if present.
|
||||
Destructor.
|
||||
|
||||
Destroys all child windows and menu bar if present.
|
||||
*/
|
||||
virtual ~wxMDIParentFrame();
|
||||
|
||||
/**
|
||||
Activates the MDI child following the currently active one.
|
||||
|
||||
The MDI children are maintained in an ordered list and this function
|
||||
switches to the next element in this list, wrapping around the end of
|
||||
it if the currently active child is the last one.
|
||||
|
||||
@see ActivatePrevious()
|
||||
*/
|
||||
virtual void ActivateNext();
|
||||
@@ -209,6 +198,9 @@ public:
|
||||
/**
|
||||
Arranges any iconized (minimized) MDI child windows.
|
||||
|
||||
This method is only implemented in MSW MDI implementation and does
|
||||
nothing under the other platforms.
|
||||
|
||||
@see Cascade(), Tile()
|
||||
*/
|
||||
virtual void ArrangeIcons();
|
||||
@@ -216,92 +208,76 @@ public:
|
||||
/**
|
||||
Arranges the MDI child windows in a cascade.
|
||||
|
||||
This method is only implemented in MSW MDI implementation and does
|
||||
nothing under the other platforms.
|
||||
|
||||
@see Tile(), ArrangeIcons()
|
||||
*/
|
||||
virtual void Cascade();
|
||||
|
||||
/**
|
||||
Used in two-step frame construction.
|
||||
|
||||
See wxMDIParentFrame() for further details.
|
||||
*/
|
||||
bool Create(wxWindow* parent, wxWindowID id, const wxString& title,
|
||||
bool Create(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
/**
|
||||
Returns a pointer to the active MDI child, if there is one.
|
||||
|
||||
If there are any children at all this function returns a non-@NULL
|
||||
pointer.
|
||||
*/
|
||||
wxMDIChildFrame* GetActiveChild() const;
|
||||
|
||||
/**
|
||||
This gets the size of the frame 'client area' in pixels.
|
||||
|
||||
@param width
|
||||
Receives the client width in pixels.
|
||||
@param height
|
||||
Receives the client height in pixels.
|
||||
|
||||
@remarks
|
||||
|
||||
The client area is the area which may be drawn on by the programmer, excluding
|
||||
title bar, border, status bar, and toolbar if present.
|
||||
|
||||
If you wish to manage your own toolbar (or perhaps you have more than one),
|
||||
provide an @b OnSize event handler. Call GetClientSize() to find how much space
|
||||
there is for your windows and don't forget to set the size and position of
|
||||
the MDI client window as well as your toolbar and other windows (but not the
|
||||
status bar).
|
||||
|
||||
If you have set a toolbar with wxMDIParentFrame::SetToolbar(), the client size
|
||||
returned will have subtracted the toolbar height. However, the available positions
|
||||
for the client window and other windows of the frame do not start at zero - you
|
||||
must add the toolbar height.
|
||||
|
||||
The position and size of the status bar and toolbar (if known to the frame) are
|
||||
always managed by wxMDIParentFrame, regardless of what behaviour is defined in
|
||||
your @b OnSize event handler. However, the client window position and size are always
|
||||
set in @b OnSize, so if you override this event handler, make sure you deal with the
|
||||
client window.
|
||||
|
||||
You do not have to manage the size and position of MDI child windows, since they
|
||||
are managed automatically by the client window.
|
||||
|
||||
@see GetToolBar(), SetToolBar(), wxMDIClientWindow
|
||||
|
||||
@beginWxPythonOnly
|
||||
The wxPython version of this method takes no arguments and returns a tuple containing
|
||||
width and height.
|
||||
@endWxPythonOnly
|
||||
*/
|
||||
void GetClientSize(int* width, int* height) const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the client window.
|
||||
|
||||
@see OnCreateClient()
|
||||
*/
|
||||
wxMDIClientWindow* GetClientWindow() const;
|
||||
wxWindow *GetClientWindow() const;
|
||||
|
||||
/**
|
||||
Returns the window being used as the toolbar for this frame.
|
||||
Returns the current MDI Window menu.
|
||||
|
||||
@see SetToolBar()
|
||||
Unless wxFRAME_NO_WINDOW_MENU style was used, a default menu listing
|
||||
all the currently active children and providing the usual operations
|
||||
(tile, cascade, ...) on them is created automatically by the library
|
||||
and this function can be used to retrieve it. Notice that the default
|
||||
menu can be replaced by calling SetWindowMenu().
|
||||
|
||||
This function is currently not available under OS X.
|
||||
|
||||
@return The current Window menu or @NULL.
|
||||
*/
|
||||
virtual wxToolBar* GetToolBar() const;
|
||||
wxMenu *GetWindowMenu() const;
|
||||
|
||||
/**
|
||||
Returns the current Window menu (added by wxWidgets to the menubar). This
|
||||
function
|
||||
is available under Windows only.
|
||||
*/
|
||||
wxMenu* GetWindowMenu() const;
|
||||
Returns whether the MDI implementation is tab-based.
|
||||
|
||||
Currently only the MSW port uses the real MDI. In Mac ports the usual
|
||||
SDI is used, as common under this platforms, and all the other ports
|
||||
use TDI implementation.
|
||||
|
||||
TDI-based MDI applications have different appearance and functionality
|
||||
(e.g. child frames can't be minimized and only one of them is visible
|
||||
at any given time) so the application may need to adapt its interface
|
||||
somewhat depending on the return value of this function.
|
||||
*/
|
||||
static bool IsTDI();
|
||||
|
||||
/**
|
||||
Override this to return a different kind of client window. If you override this
|
||||
function, you must create your parent frame in two stages, or your function will
|
||||
never be called, due to the way C++ treats virtual functions called from constructors.
|
||||
For example:
|
||||
Override this to return a different kind of client window.
|
||||
|
||||
If you override this function, you must create your parent frame in two
|
||||
stages, or your function will never be called, due to the way C++
|
||||
treats virtual functions called from constructors. For example:
|
||||
|
||||
@code
|
||||
frame = new MyParentFrame;
|
||||
@@ -310,8 +286,9 @@ public:
|
||||
|
||||
@remarks
|
||||
|
||||
You might wish to derive from wxMDIClientWindow in order to implement different
|
||||
erase behaviour, for example, such as painting a bitmap on the background.
|
||||
You might wish to derive from wxMDIClientWindow in order to implement
|
||||
different erase behaviour, for example, such as painting a bitmap on
|
||||
the background.
|
||||
|
||||
Note that it is probably impossible to have a client window that scrolls
|
||||
as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar
|
||||
@@ -322,50 +299,31 @@ public:
|
||||
virtual wxMDIClientWindow* OnCreateClient();
|
||||
|
||||
/**
|
||||
Sets the window to be used as a toolbar for this
|
||||
MDI parent window. It saves the application having to manage the positioning
|
||||
of the toolbar MDI client window.
|
||||
Replace the current MDI Window menu.
|
||||
|
||||
@param toolbar
|
||||
Toolbar to manage.
|
||||
Ownership of the menu object passes to the frame when you call this
|
||||
function, i.e. the menu will be deleted by it when it's no longer
|
||||
needed (usually when the frame itself is deleted or when
|
||||
SetWindowMenu() is called again).
|
||||
|
||||
@remarks
|
||||
To remove the window completely, you can use the wxFRAME_NO_WINDOW_MENU
|
||||
window style but this function also allows to do it by passing @NULL
|
||||
pointer as @a menu.
|
||||
|
||||
When the frame is resized, the toolbar is resized to be the width of the frame
|
||||
client area, and the toolbar height is kept the same.
|
||||
This function is currently not available under OS X.
|
||||
|
||||
When the frame is resized, the toolbar is resized to be the width of the frame
|
||||
client area, and the toolbar height is kept the same.
|
||||
|
||||
The parent of the toolbar must be this frame.
|
||||
|
||||
If you wish to manage your own toolbar (or perhaps you have more than one),
|
||||
don't call this function, and instead manage your subwindows and the MDI client
|
||||
window by providing an @b OnSize event handler. Call wxMDIParentFrame::GetClientSize()
|
||||
to find how much space there is for your windows.
|
||||
|
||||
Note that SDI (normal) frames and MDI child windows must always have their toolbars
|
||||
managed by the application.
|
||||
|
||||
@see GetToolBar(), GetClientSize()
|
||||
@param menu
|
||||
The menu to be used instead of the standard MDI Window menu or @NULL.
|
||||
*/
|
||||
virtual void SetToolBar(wxToolBar* toolbar);
|
||||
void SetWindowMenu(wxMenu *menu);
|
||||
|
||||
/**
|
||||
Call this to change the current Window menu.
|
||||
Ownership of the menu object passes to the frame when you call this function.
|
||||
Tiles the MDI child windows either horizontally or vertically depending
|
||||
on whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
|
||||
|
||||
This call is available under Windows only.
|
||||
This method is only implemented in MSW MDI implementation and does
|
||||
nothing under the other platforms.
|
||||
|
||||
To remove the window completely, use the @c wxFRAME_NO_WINDOW_MENU window style.
|
||||
*/
|
||||
void SetWindowMenu(wxMenu* menu);
|
||||
|
||||
/**
|
||||
Tiles the MDI child windows either horizontally or vertically depending on
|
||||
whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
|
||||
|
||||
Currently only implemented for MSW, does nothing under the other platforms.
|
||||
*/
|
||||
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
||||
};
|
||||
@@ -375,48 +333,24 @@ public:
|
||||
/**
|
||||
@class wxMDIChildFrame
|
||||
|
||||
An MDI child frame is a frame that can only exist on a wxMDIClientWindow,
|
||||
which is itself a child of wxMDIParentFrame.
|
||||
An MDI child frame is a frame that can only exist inside a
|
||||
wxMDIClientWindow, which is itself a child of wxMDIParentFrame.
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxCAPTION}
|
||||
Puts a caption on the frame.
|
||||
@style{wxDEFAULT_FRAME_STYLE}
|
||||
Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
|
||||
@c wxSYSTEM_MENU | @c wxCAPTION.
|
||||
@style{wxICONIZE}
|
||||
Display the frame iconized (minimized) (Windows only).
|
||||
@style{wxMAXIMIZE}
|
||||
Displays the frame maximized (Windows only).
|
||||
@style{wxMAXIMIZE_BOX}
|
||||
Displays a maximize box on the frame (Windows and Motif only).
|
||||
@style{wxMINIMIZE}
|
||||
Identical to @c wxICONIZE.
|
||||
@style{wxMINIMIZE_BOX}
|
||||
Displays a minimize box on the frame (Windows and Motif only).
|
||||
@style{wxRESIZE_BORDER}
|
||||
Displays a resizeable border around the window (Motif only; for
|
||||
Windows, it is implicit in @c wxTHICK_FRAME).
|
||||
@style{wxSTAY_ON_TOP}
|
||||
Stay on top of other windows (Windows only).
|
||||
@style{wxSYSTEM_MENU}
|
||||
Displays a system menu (Windows and Motif only).
|
||||
@style{wxTHICK_FRAME}
|
||||
Displays a thick frame around the window (Windows and Motif only).
|
||||
All of the standard wxFrame styles can be used but most of them are ignored
|
||||
by TDI-based MDI implementations.
|
||||
@endStyleTable
|
||||
|
||||
@remarks
|
||||
Although internally an MDI child frame is a child of the MDI client window,
|
||||
in wxWidgets you create it as a child of wxMDIParentFrame.
|
||||
You can usually forget that the client window exists.
|
||||
MDI child frames are clipped to the area of the MDI client window, and may
|
||||
be iconized on the client window.
|
||||
You can associate a menubar with a child frame as usual, although an MDI
|
||||
child doesn't display its menubar under its own title bar.
|
||||
The MDI parent frame's menubar will be changed to reflect the currently
|
||||
active child frame.
|
||||
If there are currently no children, the parent frame's own menubar will
|
||||
be displayed.
|
||||
in wxWidgets you create it as a child of wxMDIParentFrame. In fact, you can
|
||||
usually forget that the client window exists. MDI child frames are clipped
|
||||
to the area of the MDI client window, and may be iconized on the client
|
||||
window. You can associate a menubar with a child frame as usual, although
|
||||
an MDI child doesn't display its menubar under its own title bar. The MDI
|
||||
parent frame's menubar will be changed to reflect the currently active
|
||||
child frame. If there are currently no children, the parent frame's own
|
||||
menubar will be displayed.
|
||||
|
||||
@library{wxcore}
|
||||
@category{managedwnd}
|
||||
@@ -426,7 +360,6 @@ public:
|
||||
class wxMDIChildFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
Default constructor.
|
||||
*/
|
||||
@@ -486,15 +419,41 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
/**
|
||||
Returns the MDI parent frame containing this child.
|
||||
|
||||
Notice that this may return a different object than GetParent() as the
|
||||
child frames may be created as children of the client window
|
||||
internally.
|
||||
*/
|
||||
wxMDIParentFrame *GetMDIParent() const;
|
||||
|
||||
/**
|
||||
Returns true for MDI children in TDI implementations.
|
||||
|
||||
TDI-based implementations represent MDI children as pages in a
|
||||
wxNotebook and so they are always maximized and can't be restored or
|
||||
iconized.
|
||||
|
||||
@see wxMDIParentFrame::IsTDI().
|
||||
*/
|
||||
virtual bool IsAlwaysMaximized() const;
|
||||
|
||||
/**
|
||||
Maximizes this MDI child frame.
|
||||
|
||||
This function doesn't do anything if IsAlwaysMaximized() returns @true.
|
||||
|
||||
@see Activate(), Restore()
|
||||
*/
|
||||
virtual void Maximize(bool maximize = true);
|
||||
|
||||
/**
|
||||
Restores this MDI child frame (unmaximizes).
|
||||
|
||||
This function doesn't do anything if IsAlwaysMaximized() returns @true.
|
||||
|
||||
@see Activate(), Maximize()
|
||||
*/
|
||||
virtual void Restore();
|
||||
};
|
||||
|
@@ -2,10 +2,11 @@
|
||||
// Name: mdi.cpp
|
||||
// Purpose: MDI sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: big clean up
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -45,42 +46,36 @@
|
||||
#include "bitmaps/print.xpm"
|
||||
#include "bitmaps/help.xpm"
|
||||
|
||||
// replace this 0 with 1 to build the sample using the generic MDI classes (you
|
||||
// may also need to add src/generic/mdig.cpp to the build)
|
||||
#if 0
|
||||
#include "wx/generic/mdig.h"
|
||||
#define wxMDIParentFrame wxGenericMDIParentFrame
|
||||
#define wxMDIChildFrame wxGenericMDIChildFrame
|
||||
#define wxMDIClientWindow wxGenericMDIClientWindow
|
||||
#endif
|
||||
|
||||
#include "mdi.h"
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
MyFrame *frame = (MyFrame *) NULL;
|
||||
wxList my_children;
|
||||
|
||||
// For drawing lines in a canvas
|
||||
static long xpos = -1;
|
||||
static long ypos = -1;
|
||||
|
||||
static int gs_nFrames = 0;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
|
||||
EVT_MENU(MDI_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(MDI_NEW_WINDOW, MyFrame::OnNewWindow)
|
||||
EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_NEW, MyFrame::OnNewWindow)
|
||||
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||
|
||||
EVT_CLOSE(MyFrame::OnClose)
|
||||
EVT_SIZE(MyFrame::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Note that MDI_NEW_WINDOW and MDI_ABOUT commands get passed
|
||||
// Note that wxID_NEW and wxID_ABOUT commands get passed
|
||||
// to the parent window for processing, so no need to
|
||||
// duplicate event handlers here.
|
||||
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
|
||||
EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
|
||||
EVT_MENU(wxID_CLOSE, MyChild::OnClose)
|
||||
EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
|
||||
EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
|
||||
EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
|
||||
@@ -94,7 +89,7 @@ BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
|
||||
EVT_SIZE(MyChild::OnSize)
|
||||
EVT_MOVE(MyChild::OnMove)
|
||||
|
||||
EVT_CLOSE(MyChild::OnClose)
|
||||
EVT_CLOSE(MyChild::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
@@ -117,44 +112,10 @@ bool MyApp::OnInit()
|
||||
|
||||
// Create the main frame window
|
||||
|
||||
frame = new MyFrame((wxFrame *)NULL, wxID_ANY, _T("MDI Demo"),
|
||||
wxDefaultPosition, wxSize(500, 400),
|
||||
wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
|
||||
#if 0
|
||||
// Experimental: change the window menu
|
||||
wxMenu* windowMenu = new wxMenu;
|
||||
windowMenu->Append(5000, _T("My menu item!"));
|
||||
frame->SetWindowMenu(windowMenu);
|
||||
#endif
|
||||
|
||||
// Give it an icon
|
||||
frame->SetIcon(wxICON(sample));
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(MDI_NEW_WINDOW, _T("&New window\tCtrl-N"), _T("Create a new child window"));
|
||||
file_menu->Append(MDI_QUIT, _T("&Exit\tAlt-X"), _T("Quit the program"));
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(MDI_ABOUT, _T("&About\tF1"));
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
MyFrame *frame = new MyFrame;
|
||||
|
||||
frame->Show(true);
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -163,17 +124,46 @@ bool MyApp::OnInit()
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxWindow *parent,
|
||||
const wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const long style)
|
||||
: wxMDIParentFrame(parent, id, title, pos, size, style)
|
||||
MyFrame::MyFrame()
|
||||
: wxMDIParentFrame(NULL, wxID_ANY, "wxWidgets MDI Sample",
|
||||
wxDefaultPosition, wxSize(500, 400))
|
||||
{
|
||||
textWindow = new wxTextCtrl(this, wxID_ANY, _T("A help window"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxSUNKEN_BORDER);
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
// Make a menubar
|
||||
#if wxUSE_MENUS
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(wxID_NEW, "&New window\tCtrl-N", "Create a new child window");
|
||||
file_menu->Append(wxID_EXIT, "&Exit\tAlt-X", "Quit the program");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(wxID_ABOUT, "&About\tF1");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
#if 0
|
||||
// Experimental: change the window menu
|
||||
wxMenu* windowMenu = new wxMenu;
|
||||
windowMenu->Append(5000, "My menu item!");
|
||||
frame->SetWindowMenu(windowMenu);
|
||||
#endif
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
|
||||
m_textWindow = new wxTextCtrl(this, wxID_ANY, "A help window",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxSUNKEN_BORDER);
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
|
||||
@@ -183,21 +173,32 @@ MyFrame::MyFrame(wxWindow *parent,
|
||||
#if wxUSE_ACCEL
|
||||
// Accelerators
|
||||
wxAcceleratorEntry entries[3];
|
||||
entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW);
|
||||
entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT);
|
||||
entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT);
|
||||
entries[0].Set(wxACCEL_CTRL, (int) 'N', wxID_NEW);
|
||||
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
|
||||
entries[2].Set(wxACCEL_CTRL, (int) 'A', wxID_ABOUT);
|
||||
wxAcceleratorTable accel(3, entries);
|
||||
SetAcceleratorTable(accel);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// connect it only now, after creating m_textWindow
|
||||
Connect(wxEVT_SIZE, wxSizeEventHandler(MyFrame::OnSize));
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
// and disconnect it to prevent accessing already deleted m_textWindow in
|
||||
// the size event handler if it's called during destruction
|
||||
Disconnect(wxEVT_SIZE, wxSizeEventHandler(MyFrame::OnSize));
|
||||
}
|
||||
|
||||
void MyFrame::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
if ( event.CanVeto() && (gs_nFrames > 0) )
|
||||
unsigned numChildren = MyChild::GetChildrenCount();
|
||||
if ( event.CanVeto() && (numChildren > 0) )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(_T("%d windows still open, close anyhow?"), gs_nFrames);
|
||||
if ( wxMessageBox(msg, _T("Please confirm"),
|
||||
msg.Printf("%d windows still open, close anyhow?", numChildren);
|
||||
if ( wxMessageBox(msg, "Please confirm",
|
||||
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
@@ -216,66 +217,15 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox(_T("wxWidgets 2.0 MDI Demo\n")
|
||||
_T("Author: Julian Smart (c) 1997\n")
|
||||
_T("Usage: mdi.exe"), _T("About MDI Demo"));
|
||||
(void)wxMessageBox("wxWidgets 2.0 MDI Demo\n"
|
||||
"Author: Julian Smart (c) 1997\n"
|
||||
"Usage: mdi.exe", "About MDI Demo");
|
||||
}
|
||||
|
||||
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
// Make another frame, containing a canvas
|
||||
MyChild *subframe = new MyChild(frame, _T("Canvas Frame"));
|
||||
|
||||
wxString title;
|
||||
title.Printf(_T("Canvas Frame %d"), ++gs_nFrames);
|
||||
|
||||
subframe->SetTitle(title);
|
||||
|
||||
// Give it an icon
|
||||
subframe->SetIcon(wxICON(chart));
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(MDI_NEW_WINDOW, _T("&New window"));
|
||||
file_menu->Append(MDI_CHILD_QUIT, _T("&Close child"), _T("Close this window"));
|
||||
file_menu->Append(MDI_QUIT, _T("&Exit"));
|
||||
|
||||
wxMenu *option_menu = new wxMenu;
|
||||
|
||||
option_menu->Append(MDI_REFRESH, _T("&Refresh picture"));
|
||||
option_menu->Append(MDI_CHANGE_TITLE, _T("Change &title...\tCtrl-T"));
|
||||
option_menu->AppendSeparator();
|
||||
option_menu->Append(MDI_CHANGE_POSITION, _T("Move frame\tCtrl-M"));
|
||||
option_menu->Append(MDI_CHANGE_SIZE, _T("Resize frame\tCtrl-S"));
|
||||
#if wxUSE_CLIPBOARD
|
||||
option_menu->AppendSeparator();
|
||||
option_menu->Append(wxID_PASTE, _T("Copy text from clipboard\tCtrl-V"));
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(MDI_ABOUT, _T("&About"));
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(option_menu, _T("&Child"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
subframe->SetMenuBar(menu_bar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
int width, height;
|
||||
subframe->GetClientSize(&width, &height);
|
||||
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
|
||||
canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
|
||||
subframe->canvas = canvas;
|
||||
|
||||
// Give it scrollbars
|
||||
canvas->SetScrollbars(20, 20, 50, 50);
|
||||
|
||||
// create and show another child frame
|
||||
MyChild *subframe = new MyChild(this);
|
||||
subframe->Show(true);
|
||||
}
|
||||
|
||||
@@ -290,7 +240,7 @@ void MyFrame::OnSize(wxSizeEvent&
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
|
||||
textWindow->SetSize(0, 0, 200, h);
|
||||
m_textWindow->SetSize(0, 0, 200, h);
|
||||
GetClientWindow()->SetSize(200, 0, w - 200, h);
|
||||
|
||||
// FIXME: On wxX11, we need the MDI frame to process this
|
||||
@@ -315,17 +265,17 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
|
||||
bitmaps[6] = wxBitmap( print_xpm );
|
||||
bitmaps[7] = wxBitmap( help_xpm );
|
||||
|
||||
toolBar->AddTool(MDI_NEW_WINDOW, _T("New"), bitmaps[0], _T("New file"));
|
||||
toolBar->AddTool(1, _T("Open"), bitmaps[1], _T("Open file"));
|
||||
toolBar->AddTool(2, _T("Save"), bitmaps[2], _T("Save file"));
|
||||
toolBar->AddTool(wxID_NEW, "New", bitmaps[0], "New file");
|
||||
toolBar->AddTool(1, "Open", bitmaps[1], "Open file");
|
||||
toolBar->AddTool(2, "Save", bitmaps[2], "Save file");
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(3, _T("Copy"), bitmaps[3], _T("Copy"));
|
||||
toolBar->AddTool(4, _T("Cut"), bitmaps[4], _T("Cut"));
|
||||
toolBar->AddTool(5, _T("Paste"), bitmaps[5], _T("Paste"));
|
||||
toolBar->AddTool(3, "Copy", bitmaps[3], "Copy");
|
||||
toolBar->AddTool(4, "Cut", bitmaps[4], "Cut");
|
||||
toolBar->AddTool(5, "Paste", bitmaps[5], "Paste");
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(6, _T("Print"), bitmaps[6], _T("Print"));
|
||||
toolBar->AddTool(6, "Print", bitmaps[6], "Print");
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(MDI_ABOUT, _T("About"), bitmaps[7], _T("Help"));
|
||||
toolBar->AddTool(wxID_ABOUT, "About", bitmaps[7], "Help");
|
||||
|
||||
toolBar->Realize();
|
||||
}
|
||||
@@ -342,7 +292,10 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||
wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
SetBackgroundColour(wxColour(_T("WHITE")));
|
||||
SetBackgroundColour(wxColour("WHITE"));
|
||||
SetCursor(wxCursor(wxCURSOR_PENCIL));
|
||||
|
||||
SetScrollbars(20, 20, 50, 50);
|
||||
|
||||
m_dirty = false;
|
||||
}
|
||||
@@ -368,7 +321,7 @@ void MyCanvas::OnDraw(wxDC& dc)
|
||||
dc.DrawSpline(50, 200, 50, 100, 200, 10);
|
||||
#endif // wxUSE_SPLINES
|
||||
dc.DrawLine(50, 230, 200, 230);
|
||||
dc.DrawText(_T("This is a test string"), 50, 230);
|
||||
dc.DrawText("This is a test string", 50, 230);
|
||||
|
||||
wxPoint points[3];
|
||||
points[0].x = 200; points[0].y = 300;
|
||||
@@ -387,6 +340,9 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
|
||||
|
||||
wxPoint pt(event.GetLogicalPosition(dc));
|
||||
|
||||
static long xpos = -1;
|
||||
static long ypos = -1;
|
||||
|
||||
if (xpos > -1 && ypos > -1 && event.Dragging())
|
||||
{
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
@@ -403,31 +359,80 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
|
||||
// MyChild
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title)
|
||||
: wxMDIChildFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
canvas = (MyCanvas *) NULL;
|
||||
my_children.Append(this);
|
||||
unsigned MyChild::ms_numChildren = 0;
|
||||
|
||||
// this should work for MDI frames as well as for normal ones
|
||||
SetSizeHints(100, 100);
|
||||
MyChild::MyChild(wxMDIParentFrame *parent)
|
||||
: wxMDIChildFrame
|
||||
(
|
||||
parent,
|
||||
wxID_ANY,
|
||||
wxString::Format("Child %u", ++ms_numChildren)
|
||||
)
|
||||
{
|
||||
m_canvas = new MyCanvas(this, wxPoint(0, 0), GetClientSize());
|
||||
|
||||
SetIcon(wxICON(chart));
|
||||
|
||||
const bool canBeResized = !IsAlwaysMaximized();
|
||||
|
||||
// create our menubar: it will be shown instead of the main frame one when
|
||||
// we're active
|
||||
#if wxUSE_MENUS
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(wxID_NEW, "&New window\tCtrl-N");
|
||||
file_menu->Append(wxID_CLOSE, "&Close child\tCtrl-W", "Close this window");
|
||||
file_menu->Append(wxID_EXIT, "&Exit\tAlt-X", "Quit the program");
|
||||
|
||||
wxMenu *option_menu = new wxMenu;
|
||||
|
||||
option_menu->Append(MDI_REFRESH, "&Refresh picture");
|
||||
option_menu->Append(MDI_CHANGE_TITLE, "Change &title...\tCtrl-T");
|
||||
if ( canBeResized )
|
||||
{
|
||||
option_menu->AppendSeparator();
|
||||
option_menu->Append(MDI_CHANGE_POSITION, "Move frame\tCtrl-M");
|
||||
option_menu->Append(MDI_CHANGE_SIZE, "Resize frame\tCtrl-S");
|
||||
}
|
||||
#if wxUSE_CLIPBOARD
|
||||
option_menu->AppendSeparator();
|
||||
option_menu->Append(wxID_PASTE, "Copy text from clipboard\tCtrl-V");
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(wxID_ABOUT, "&About");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(option_menu, "&Child");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// this should work for MDI frames as well as for normal ones, provided
|
||||
// they can be resized at all
|
||||
if ( canBeResized )
|
||||
SetSizeHints(100, 100);
|
||||
}
|
||||
|
||||
MyChild::~MyChild()
|
||||
{
|
||||
my_children.DeleteObject(this);
|
||||
ms_numChildren--;
|
||||
}
|
||||
|
||||
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyChild::OnClose(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
void MyChild::OnRefresh(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( canvas )
|
||||
canvas->Refresh();
|
||||
if ( m_canvas )
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
void MyChild::OnChangePosition(wxCommandEvent& WXUNUSED(event))
|
||||
@@ -443,10 +448,10 @@ void MyChild::OnChangeSize(wxCommandEvent& WXUNUSED(event))
|
||||
void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_TEXTDLG
|
||||
static wxString s_title = _T("Canvas Frame");
|
||||
static wxString s_title = "Canvas Frame";
|
||||
|
||||
wxString title = wxGetTextFromUser(_T("Enter the new title for MDI child"),
|
||||
_T("MDI sample question"),
|
||||
wxString title = wxGetTextFromUser("Enter the new title for MDI child",
|
||||
"MDI sample question",
|
||||
s_title,
|
||||
GetParent()->GetParent());
|
||||
if ( !title )
|
||||
@@ -459,8 +464,8 @@ void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyChild::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
if ( event.GetActive() && canvas )
|
||||
canvas->SetFocus();
|
||||
if ( event.GetActive() && m_canvas )
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
|
||||
void MyChild::OnMove(wxMoveEvent& event)
|
||||
@@ -470,7 +475,7 @@ void MyChild::OnMove(wxMoveEvent& event)
|
||||
// to be the width of the MDI canvas border)
|
||||
wxPoint pos1 = event.GetPosition(),
|
||||
pos2 = GetPosition();
|
||||
wxLogStatus(wxT("position from event: (%d, %d), from frame (%d, %d)"),
|
||||
wxLogStatus("position from event: (%d, %d), from frame (%d, %d)",
|
||||
pos1.x, pos1.y, pos2.x, pos2.y);
|
||||
|
||||
event.Skip();
|
||||
@@ -484,17 +489,17 @@ void MyChild::OnSize(wxSizeEvent& event)
|
||||
wxSize size1 = event.GetSize(),
|
||||
size2 = GetSize(),
|
||||
size3 = GetClientSize();
|
||||
wxLogStatus(wxT("size from event: %dx%d, from frame %dx%d, client %dx%d"),
|
||||
wxLogStatus("size from event: %dx%d, from frame %dx%d, client %dx%d",
|
||||
size1.x, size1.y, size2.x, size2.y, size3.x, size3.y);
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MyChild::OnClose(wxCloseEvent& event)
|
||||
void MyChild::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
if ( canvas && canvas->IsDirty() )
|
||||
if ( m_canvas && m_canvas->IsDirty() )
|
||||
{
|
||||
if ( wxMessageBox(_T("Really close?"), _T("Please confirm"),
|
||||
if ( wxMessageBox("Really close?", "Please confirm",
|
||||
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
@@ -503,8 +508,6 @@ void MyChild::OnClose(wxCloseEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
gs_nFrames--;
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@@ -516,13 +519,9 @@ void MyChild::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxClipboardLocker lock;
|
||||
wxTextDataObject data;
|
||||
canvas->SetText(
|
||||
(
|
||||
wxTheClipboard->GetData(data) ?
|
||||
data.GetText() :
|
||||
wxString("No text on clipboard")
|
||||
).c_str()
|
||||
);
|
||||
m_canvas->SetText(wxTheClipboard->GetData(data)
|
||||
? data.GetText()
|
||||
: wxString("No text on clipboard"));
|
||||
}
|
||||
|
||||
void MyChild::OnUpdatePaste(wxUpdateUIEvent& event)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
class MyCanvas : public wxScrolledWindow
|
||||
@@ -26,11 +26,11 @@ public:
|
||||
|
||||
bool IsDirty() const { return m_dirty; }
|
||||
|
||||
void OnEvent(wxMouseEvent& event);
|
||||
|
||||
void SetText(const wxString& text) { m_text = text; Refresh(); }
|
||||
|
||||
private:
|
||||
void OnEvent(wxMouseEvent& event);
|
||||
|
||||
wxString m_text;
|
||||
|
||||
bool m_dirty;
|
||||
@@ -42,11 +42,10 @@ private:
|
||||
class MyFrame : public wxMDIParentFrame
|
||||
{
|
||||
public:
|
||||
wxTextCtrl *textWindow;
|
||||
|
||||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long style);
|
||||
MyFrame();
|
||||
virtual ~MyFrame();
|
||||
|
||||
private:
|
||||
void InitToolBar(wxToolBar* toolBar);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
@@ -55,16 +54,20 @@ public:
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
wxTextCtrl *m_textWindow;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class MyChild: public wxMDIChildFrame
|
||||
class MyChild : public wxMDIChildFrame
|
||||
{
|
||||
public:
|
||||
MyCanvas *canvas;
|
||||
MyChild(wxMDIParentFrame *parent, const wxString& title);
|
||||
~MyChild();
|
||||
MyChild(wxMDIParentFrame *parent);
|
||||
virtual ~MyChild();
|
||||
|
||||
static unsigned GetChildrenCount() { return ms_numChildren; }
|
||||
|
||||
private:
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
void OnRefresh(wxCommandEvent& event);
|
||||
@@ -72,28 +75,28 @@ public:
|
||||
void OnChangeTitle(wxCommandEvent& event);
|
||||
void OnChangePosition(wxCommandEvent& event);
|
||||
void OnChangeSize(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnClose(wxCommandEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnMove(wxMoveEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
static unsigned ms_numChildren;
|
||||
|
||||
MyCanvas *m_canvas;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// menu items ids
|
||||
enum
|
||||
{
|
||||
MDI_QUIT = wxID_EXIT,
|
||||
MDI_NEW_WINDOW = 101,
|
||||
MDI_REFRESH,
|
||||
MDI_CHANGE_TITLE,
|
||||
MDI_CHANGE_POSITION,
|
||||
MDI_CHANGE_SIZE,
|
||||
MDI_CHILD_QUIT,
|
||||
MDI_ABOUT = wxID_ABOUT
|
||||
MDI_CHANGE_SIZE
|
||||
};
|
||||
|
@@ -129,35 +129,12 @@ void wxMDIParentFrame::RemoveMDIChild(wxMDIChildFrame *child)
|
||||
SetActiveChild(NULL);
|
||||
}
|
||||
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
return m_currentChild;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::SetActiveChild(wxMDIChildFrame *child)
|
||||
{
|
||||
m_currentChild = child;
|
||||
wxMenuBarManager::GetInstance()->UpdateMenuBar();
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
|
||||
{
|
||||
return m_clientWindow;
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow( this );
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
{
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious()
|
||||
{
|
||||
}
|
||||
|
||||
wxMenuBar *wxMDIParentFrame::GetAppMenuBar(wxCocoaNSWindow *win)
|
||||
{
|
||||
if(m_currentChild && (win==this))
|
||||
@@ -324,22 +301,9 @@ bool wxMDIChildFrame::Destroy()
|
||||
// ========================================================================
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
{
|
||||
return Create(parent, wxID_ANY, wxPoint(0, 0), wxSize(0, 0), style);
|
||||
}
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow(wxMDIParentFrame *parent, long style)
|
||||
:wxWindow(parent, wxID_ANY)
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // wxUSE_MDI
|
||||
|
File diff suppressed because it is too large
Load Diff
187
src/gtk/mdi.cpp
187
src/gtk/mdi.cpp
@@ -44,11 +44,11 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||
|
||||
// send activate event to new child
|
||||
|
||||
wxMDIClientWindow *client_window = parent->GetClientWindow();
|
||||
if (!client_window)
|
||||
wxMDIClientWindowBase *client_window = parent->GetClientWindow();
|
||||
if ( !client_window )
|
||||
return;
|
||||
|
||||
child = (wxMDIChildFrame*) NULL;
|
||||
child = NULL;
|
||||
|
||||
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
||||
while ( node )
|
||||
@@ -84,11 +84,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
||||
void wxMDIParentFrame::Init()
|
||||
{
|
||||
m_justInserted = false;
|
||||
m_clientWindow = (wxMDIClientWindow *) NULL;
|
||||
}
|
||||
|
||||
wxMDIParentFrame::~wxMDIParentFrame()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
@@ -103,13 +98,15 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
return false;
|
||||
|
||||
m_clientWindow = OnCreateClient();
|
||||
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
|
||||
return false;
|
||||
|
||||
return m_clientWindow != NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnInternalIdle()
|
||||
{
|
||||
/* if a an MDI child window has just been inserted
|
||||
/* if a MDI child window has just been inserted
|
||||
it has to be brought to the top in idle time. we
|
||||
simply set the last notebook page active as new
|
||||
pages can only be appended at the end */
|
||||
@@ -209,27 +206,27 @@ void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const
|
||||
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
||||
if (!m_clientWindow) return NULL;
|
||||
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
||||
if (!notebook) return (wxMDIChildFrame*) NULL;
|
||||
if (!notebook) return NULL;
|
||||
|
||||
gint i = gtk_notebook_get_current_page( notebook );
|
||||
if (i < 0) return (wxMDIChildFrame*) NULL;
|
||||
if (i < 0) return NULL;
|
||||
|
||||
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
||||
if (!page) return (wxMDIChildFrame*) NULL;
|
||||
if (!page) return NULL;
|
||||
|
||||
wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
|
||||
while (node)
|
||||
{
|
||||
if ( wxPendingDelete.Member(node->GetData()) )
|
||||
return (wxMDIChildFrame*) NULL;
|
||||
return NULL;
|
||||
|
||||
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
|
||||
|
||||
if (!child_frame)
|
||||
return (wxMDIChildFrame*) NULL;
|
||||
return NULL;
|
||||
|
||||
if (child_frame->m_page == page)
|
||||
return child_frame;
|
||||
@@ -237,17 +234,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return (wxMDIChildFrame*) NULL;
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
|
||||
{
|
||||
return m_clientWindow;
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow( this );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
@@ -273,68 +260,40 @@ BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
|
||||
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
void wxMDIChildFrame::Init()
|
||||
{
|
||||
m_menuBar = (wxMenuBar *) NULL;
|
||||
m_page = (GtkNotebookPage *) NULL;
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
}
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
wxWindowID id, const wxString& title,
|
||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& WXUNUSED(pos),
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_menuBar = (wxMenuBar *) NULL;
|
||||
m_page = (GtkNotebookPage *) NULL;
|
||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
||||
m_mdiParent = parent;
|
||||
m_title = title;
|
||||
|
||||
return wxWindow::Create(parent->GetClientWindow(), id,
|
||||
wxDefaultPosition, size,
|
||||
style, name);
|
||||
}
|
||||
|
||||
wxMDIChildFrame::~wxMDIChildFrame()
|
||||
{
|
||||
if (m_menuBar)
|
||||
delete m_menuBar;
|
||||
delete m_menuBar;
|
||||
|
||||
// wxMDIClientWindow does not get redrawn properly after last child is removed
|
||||
if (m_parent && m_parent->GetChildren().size() <= 1)
|
||||
gtk_widget_queue_draw(m_parent->m_widget);
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
wxWindowID id, const wxString& title,
|
||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_title = title;
|
||||
|
||||
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Destroy()
|
||||
{
|
||||
// delayed destruction: the frame will be deleted during
|
||||
// the next idle loop iteration.
|
||||
// I'm not sure if delayed destruction really makes so
|
||||
// much sense for MDI child frames, actually, but hiding
|
||||
// it doesn't make any sense.
|
||||
if ( !wxPendingDelete.Member(this) )
|
||||
wxPendingDelete.Append(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
wxWindow::DoSetSize( x, y, width, height, sizeFlags );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::AddChild( wxWindowBase *child )
|
||||
{
|
||||
wxWindow::AddChild(child);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
wxASSERT_MSG( m_menuBar == NULL, wxT("Only one menubar allowed") );
|
||||
wxASSERT_MSG( m_menuBar == NULL, "Only one menubar allowed" );
|
||||
|
||||
m_menuBar = menu_bar;
|
||||
|
||||
@@ -365,10 +324,20 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
|
||||
return m_menuBar;
|
||||
}
|
||||
|
||||
GtkNotebook *wxMDIChildFrame::GTKGetNotebook() const
|
||||
{
|
||||
wxMDIClientWindow * const
|
||||
client = wxStaticCast(GetParent(), wxMDIClientWindow);
|
||||
wxCHECK( client, NULL );
|
||||
|
||||
return GTK_NOTEBOOK(client->m_widget);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
{
|
||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
||||
GtkNotebook * const notebook = GTKGetNotebook();
|
||||
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||
|
||||
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
||||
gtk_notebook_set_current_page( notebook, pageno );
|
||||
}
|
||||
@@ -397,56 +366,24 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
||||
|
||||
m_title = title;
|
||||
|
||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
||||
GtkNotebook * const notebook = GTKGetNotebook();
|
||||
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||
gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) );
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child)
|
||||
{
|
||||
wxMDIChildFrame* child_frame = static_cast<wxMDIChildFrame*>(child);
|
||||
wxString s = child_frame->GetTitle();
|
||||
if (s.IsNull()) s = _("MDI child");
|
||||
|
||||
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
||||
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
||||
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(m_widget);
|
||||
|
||||
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
|
||||
|
||||
child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||
|
||||
wxMDIParentFrame* parent_frame = static_cast<wxMDIParentFrame*>(GetParent());
|
||||
parent_frame->m_justInserted = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
|
||||
{
|
||||
CreateClient( parent, style );
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
{
|
||||
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
|
||||
!CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") ))
|
||||
if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
|
||||
!CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
style, wxDefaultValidator, "wxMDIClientWindow" ))
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") );
|
||||
wxFAIL_MSG( "wxMDIClientWindow creation failed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -467,4 +404,24 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child)
|
||||
{
|
||||
wxMDIChildFrame* child_frame = static_cast<wxMDIChildFrame*>(child);
|
||||
wxString s = child_frame->GetTitle();
|
||||
if ( s.empty() )
|
||||
s = _("MDI child");
|
||||
|
||||
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
||||
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
||||
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(m_widget);
|
||||
|
||||
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
|
||||
|
||||
child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||
|
||||
wxMDIParentFrame* parent_frame = static_cast<wxMDIParentFrame*>(GetParent());
|
||||
parent_frame->m_justInserted = true;
|
||||
}
|
||||
|
||||
#endif // wxUSE_MDI
|
||||
|
115
src/gtk1/mdi.cpp
115
src/gtk1/mdi.cpp
@@ -71,11 +71,11 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||
|
||||
// send activate event to new child
|
||||
|
||||
wxMDIClientWindow *client_window = parent->GetClientWindow();
|
||||
if (!client_window)
|
||||
wxMDIClientWindowBase * const client_window = parent->GetClientWindow();
|
||||
if ( !client_window )
|
||||
return;
|
||||
|
||||
child = (wxMDIChildFrame*) NULL;
|
||||
child = NULL;
|
||||
|
||||
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
||||
while (node)
|
||||
@@ -113,11 +113,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
||||
void wxMDIParentFrame::Init()
|
||||
{
|
||||
m_justInserted = false;
|
||||
m_clientWindow = (wxMDIClientWindow *) NULL;
|
||||
}
|
||||
|
||||
wxMDIParentFrame::~wxMDIParentFrame()
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
@@ -132,8 +128,10 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
return false;
|
||||
|
||||
m_clientWindow = OnCreateClient();
|
||||
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
|
||||
return false;
|
||||
|
||||
return m_clientWindow != NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
@@ -251,23 +249,18 @@ void wxMDIParentFrame::OnInternalIdle()
|
||||
}
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::DoGetClientSize(int *width, int *height ) const
|
||||
{
|
||||
wxFrame::DoGetClientSize( width, height );
|
||||
}
|
||||
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
||||
if (!m_clientWindow) return NULL;
|
||||
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
||||
if (!notebook) return (wxMDIChildFrame*) NULL;
|
||||
if (!notebook) return NULL;
|
||||
|
||||
gint i = gtk_notebook_get_current_page( notebook );
|
||||
if (i < 0) return (wxMDIChildFrame*) NULL;
|
||||
if (i < 0) return NULL;
|
||||
|
||||
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
||||
if (!page) return (wxMDIChildFrame*) NULL;
|
||||
if (!page) return NULL;
|
||||
|
||||
wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
|
||||
while (node)
|
||||
@@ -281,17 +274,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return (wxMDIChildFrame*) NULL;
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
|
||||
{
|
||||
return m_clientWindow;
|
||||
}
|
||||
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow( this );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
@@ -317,26 +300,10 @@ BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
|
||||
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
void wxMDIChildFrame::Init()
|
||||
{
|
||||
m_menuBar = (wxMenuBar *) NULL;
|
||||
m_page = (GtkNotebookPage *) NULL;
|
||||
}
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
wxWindowID id, const wxString& title,
|
||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_menuBar = (wxMenuBar *) NULL;
|
||||
m_page = (GtkNotebookPage *) NULL;
|
||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
||||
}
|
||||
|
||||
wxMDIChildFrame::~wxMDIChildFrame()
|
||||
{
|
||||
if (m_menuBar)
|
||||
delete m_menuBar;
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
@@ -349,24 +316,9 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
wxMDIChildFrame::~wxMDIChildFrame()
|
||||
{
|
||||
wxWindow::DoSetSize( x, y, width, height, sizeFlags );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||
{
|
||||
wxWindow::DoSetClientSize( width, height );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const
|
||||
{
|
||||
wxWindow::DoGetClientSize( width, height );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::AddChild( wxWindowBase *child )
|
||||
{
|
||||
wxWindow::AddChild(child);
|
||||
delete m_menuBar;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
@@ -393,10 +345,20 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
|
||||
return m_menuBar;
|
||||
}
|
||||
|
||||
GtkNotebook *wxMDIChildFrame::GTKGetNotebook() const
|
||||
{
|
||||
wxMDIClientWindow * const
|
||||
client = wxStaticCast(GetParent(), wxMDIClientWindow);
|
||||
wxCHECK( client, NULL );
|
||||
|
||||
return GTK_NOTEBOOK(client->m_widget);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
{
|
||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
||||
GtkNotebook * const notebook = GTKGetNotebook();
|
||||
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||
|
||||
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
||||
gtk_notebook_set_page( notebook, pageno );
|
||||
}
|
||||
@@ -425,8 +387,9 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
||||
|
||||
m_title = title;
|
||||
|
||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
||||
GtkNotebook * const notebook = GTKGetNotebook();
|
||||
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||
|
||||
gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) );
|
||||
}
|
||||
|
||||
@@ -483,20 +446,6 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
|
||||
{
|
||||
CreateClient( parent, style );
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
{
|
||||
m_needParent = true;
|
||||
|
@@ -59,18 +59,15 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxNotebook)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(wxID_NOTEBOOK_CLIENT_AREA, wxMDIClientWindow::OnPageChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
// Parent frame
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame()
|
||||
void wxMDIParentFrame::Init()
|
||||
{
|
||||
m_clientWindow = (wxMDIClientWindow*) NULL;
|
||||
m_activeChild = (wxMDIChildFrame*) NULL;
|
||||
m_activeMenuBar = (wxMenuBar*) NULL;
|
||||
m_activeMenuBar = NULL;
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
@@ -81,29 +78,17 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_clientWindow = (wxMDIClientWindow*) NULL;
|
||||
m_activeChild = (wxMDIChildFrame*) NULL;
|
||||
m_activeMenuBar = (wxMenuBar*) NULL;
|
||||
|
||||
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
|
||||
if (success)
|
||||
{
|
||||
// TODO: app cannot override OnCreateClient since
|
||||
// wxMDIParentFrame::OnCreateClient will still be called
|
||||
// (we're in the constructor). How to resolve?
|
||||
|
||||
m_clientWindow = OnCreateClient();
|
||||
|
||||
// Uses own style for client style
|
||||
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
|
||||
|
||||
int w, h;
|
||||
GetClientSize(& w, & h);
|
||||
m_clientWindow->SetSize(0, 0, w, h);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if ( !wxFrame::Create(parent, id, title, pos, size, style, name) )
|
||||
return false;
|
||||
|
||||
m_clientWindow = OnCreateClient();
|
||||
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
|
||||
return false;
|
||||
|
||||
int w, h;
|
||||
GetClientSize(& w, & h);
|
||||
m_clientWindow->SetSize(0, 0, w, h);
|
||||
return true;
|
||||
}
|
||||
|
||||
wxMDIParentFrame::~wxMDIParentFrame()
|
||||
@@ -121,7 +106,7 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
{
|
||||
m_frameMenuBar = menu_bar;
|
||||
|
||||
SetChildMenuBar((wxMDIChildFrame*) NULL);
|
||||
SetChildMenuBar(NULL);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
@@ -139,35 +124,17 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
GetClientWindow()->SetSize(x, y, width, height);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::DoGetClientSize(int *width, int *height) const
|
||||
{
|
||||
wxFrame::DoGetClientSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
// Returns the active MDI child window
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
return m_activeChild;
|
||||
}
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow ;
|
||||
}
|
||||
|
||||
// Set the child's menu into the parent frame
|
||||
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
||||
{
|
||||
wxMenuBar* oldMenuBar = m_activeMenuBar;
|
||||
|
||||
if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
|
||||
if (child == NULL) // No child: use parent frame
|
||||
{
|
||||
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
|
||||
{
|
||||
@@ -185,7 +152,7 @@ void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
||||
|
||||
}
|
||||
}
|
||||
else if (child->GetMenuBar() == (wxMenuBar*) NULL) // No child menu bar: use parent frame
|
||||
else if (child->GetMenuBar() == NULL) // No child menu bar: use parent frame
|
||||
{
|
||||
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
|
||||
{
|
||||
@@ -231,9 +198,9 @@ bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
|
||||
inEvent = event.GetEventType();
|
||||
|
||||
bool res = false;
|
||||
if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
|
||||
if (m_currentChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
|
||||
{
|
||||
res = m_activeChild->HandleWindowEvent(event);
|
||||
res = m_currentChild->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
if (!res)
|
||||
@@ -244,18 +211,6 @@ bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
|
||||
return res;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags)
|
||||
{
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::DoSetClientSize(int width, int height)
|
||||
{
|
||||
wxWindow::DoSetClientSize(width, height);
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
@@ -265,32 +220,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
wxFrame::OnSysColourChanged(event);
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIParentFrame::Cascade()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::Tile(wxOrientation WXUNUSED(orient))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ArrangeIcons()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Default menu selection behaviour - display a help string
|
||||
void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
||||
{
|
||||
@@ -300,7 +229,7 @@ void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
||||
SetStatusText(wxEmptyString);
|
||||
else
|
||||
{
|
||||
wxMenuBar *menuBar = (wxMenuBar*) NULL;
|
||||
wxMenuBar *menuBar = NULL;
|
||||
if (GetActiveChild())
|
||||
menuBar = GetActiveChild()->GetMenuBar();
|
||||
else
|
||||
@@ -317,11 +246,6 @@ void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
||||
|
||||
// Child frame
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
{
|
||||
m_mdiParentFrame = (wxMDIParentFrame*) NULL;
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
@@ -344,7 +268,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
|
||||
clientWindow->AddChild(this);
|
||||
|
||||
SetMDIParentFrame(parent);
|
||||
m_mdiParent = parent;
|
||||
PreCreation();
|
||||
|
||||
int width = size.x;
|
||||
@@ -414,7 +338,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
||||
wxMDIParentFrame* parentFrame = GetMDIParentFrame();
|
||||
|
||||
if (parentFrame->GetActiveChild() == this)
|
||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
||||
parentFrame->SetActiveChild(NULL);
|
||||
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
|
||||
|
||||
// Remove page if still there
|
||||
@@ -437,76 +361,12 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
||||
}
|
||||
else
|
||||
{
|
||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
||||
parentFrame->SetChildMenuBar((wxMDIChildFrame*) NULL);
|
||||
parentFrame->SetActiveChild(NULL);
|
||||
parentFrame->SetChildMenuBar(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Implementation: intercept and act upon raise and lower commands.
|
||||
void wxMDIChildFrame::OnRaise()
|
||||
{
|
||||
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
||||
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
||||
parentFrame->SetActiveChild(this);
|
||||
|
||||
if (oldActiveChild)
|
||||
{
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, false, oldActiveChild->GetId());
|
||||
event.SetEventObject( oldActiveChild );
|
||||
oldActiveChild->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, true, this->GetId());
|
||||
event.SetEventObject( this );
|
||||
this->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::OnLower()
|
||||
{
|
||||
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
||||
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
||||
|
||||
if (oldActiveChild == this)
|
||||
{
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, false, oldActiveChild->GetId());
|
||||
event.SetEventObject( oldActiveChild );
|
||||
oldActiveChild->HandleWindowEvent(event);
|
||||
}
|
||||
// TODO: unfortunately we don't now know which is the top-most child,
|
||||
// so make the active child NULL.
|
||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set the client size (i.e. leave the calculation of borders etc.
|
||||
// to wxWidgets)
|
||||
void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||
{
|
||||
wxWindow::DoSetClientSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoGetClientSize(int* width, int* height) const
|
||||
{
|
||||
wxWindow::DoGetSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoGetSize(int* width, int* height) const
|
||||
{
|
||||
wxWindow::DoGetSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
wxWindow::DoGetPosition(x, y);
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Show(bool show)
|
||||
{
|
||||
SetVisibleStatus( show );
|
||||
@@ -524,63 +384,14 @@ void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
|
||||
GetMDIParentFrame()->SetChildMenuBar(this);
|
||||
}
|
||||
|
||||
// Set icon
|
||||
void wxMDIChildFrame::SetIcon(const wxIcon& icon)
|
||||
{
|
||||
m_icons = wxIconBundle( icon );
|
||||
|
||||
if (icon.Ok())
|
||||
{
|
||||
// Not appropriate since there are no icons in
|
||||
// a tabbed window
|
||||
}
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetIcons(const wxIconBundle& icons)
|
||||
{
|
||||
m_icons = icons;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetTitle(const wxString& title)
|
||||
{
|
||||
wxTopLevelWindow::SetTitle( title );
|
||||
m_title = title;
|
||||
wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
|
||||
|
||||
// Remove page if still there
|
||||
{
|
||||
int i = clientWindow->FindPage(this);
|
||||
|
||||
if (i != -1)
|
||||
clientWindow->SetPageText(i, title);
|
||||
}
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIChildFrame::Maximize()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Iconize(bool WXUNUSED(iconize))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::IsIconized() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is it maximized? Always maximized under Motif, using the
|
||||
// tabbed MDI implementation.
|
||||
bool wxMDIChildFrame::IsMaximized(void) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Restore()
|
||||
{
|
||||
// TODO
|
||||
int i = clientWindow->FindPage(this);
|
||||
if (i != wxNOT_FOUND)
|
||||
clientWindow->SetPageText(i, title);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
@@ -588,36 +399,8 @@ void wxMDIChildFrame::Activate()
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::CaptureMouse()
|
||||
{
|
||||
wxWindow::CaptureMouse();
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::ReleaseMouse()
|
||||
{
|
||||
wxWindow::ReleaseMouse();
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Raise()
|
||||
{
|
||||
wxWindow::Raise();
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Lower(void)
|
||||
{
|
||||
wxWindow::Raise();
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH))
|
||||
{
|
||||
}
|
||||
|
||||
// Client window
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
// By the time this destructor is called, the child frames will have been
|
||||
@@ -631,13 +414,11 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
{
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
|
||||
if (success)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if ( !wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA,
|
||||
wxPoint(0, 0), wxSize(100, 100), 0) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxMDIClientWindow::FindPage(const wxNotebookPage* page)
|
||||
@@ -651,37 +432,6 @@ int wxMDIClientWindow::FindPage(const wxNotebookPage* page)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::DoSetClientSize(int width, int height)
|
||||
{
|
||||
wxWindow::DoSetClientSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::DoGetClientSize(int *width, int *height) const
|
||||
{
|
||||
wxWindow::DoGetClientSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::DoGetSize(int *width, int *height) const
|
||||
{
|
||||
wxWindow::DoGetSize(width, height);
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
wxWindow::DoGetPosition(x, y);
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
|
||||
{
|
||||
// Default(); // Default processing: OBSOLETE FUNCTION
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
|
||||
{
|
||||
// Notify child that it has been activated
|
||||
|
@@ -140,9 +140,6 @@ END_EVENT_TABLE()
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame()
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_windowMenu = NULL;
|
||||
m_parentFrameActive = true;
|
||||
}
|
||||
|
||||
@@ -154,17 +151,11 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
|
||||
// this style can be used to prevent a window from having the standard MDI
|
||||
// "Window" menu
|
||||
if ( style & wxFRAME_NO_WINDOW_MENU )
|
||||
{
|
||||
m_windowMenu = NULL;
|
||||
}
|
||||
else // normal case: we have the window menu, so construct it
|
||||
if ( !(style & wxFRAME_NO_WINDOW_MENU) )
|
||||
{
|
||||
// normal case: we have the window menu, so construct it
|
||||
m_windowMenu = new wxMenu;
|
||||
|
||||
m_windowMenu->Append(IDM_WINDOWCASCADE, _("&Cascade"));
|
||||
@@ -226,8 +217,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
||||
|
||||
DestroyChildren();
|
||||
|
||||
delete m_windowMenu;
|
||||
|
||||
// the MDI frame menubar is not automatically deleted by Windows unlike for
|
||||
// the normal frames
|
||||
if ( m_hMenu )
|
||||
@@ -319,20 +308,15 @@ void wxMDIParentFrame::InternalSetMenuBar()
|
||||
|
||||
void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
|
||||
{
|
||||
if (m_windowMenu)
|
||||
{
|
||||
RemoveWindowMenu();
|
||||
// notice that Remove/AddWindowMenu() are safe to call even when
|
||||
// m_windowMenu is NULL
|
||||
RemoveWindowMenu();
|
||||
|
||||
delete m_windowMenu;
|
||||
m_windowMenu = NULL;
|
||||
}
|
||||
delete m_windowMenu;
|
||||
|
||||
if (menu)
|
||||
{
|
||||
m_windowMenu = menu;
|
||||
m_windowMenu = menu;
|
||||
|
||||
AddWindowMenu();
|
||||
}
|
||||
AddWindowMenu();
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
|
||||
@@ -411,13 +395,6 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
return (wxMDIChildFrame *)wxFindWinFromHandle(hWnd);
|
||||
}
|
||||
|
||||
// Create the client window class (don't Create the window, just return a new
|
||||
// class)
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow;
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
@@ -738,6 +715,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_mdiParent = parent;
|
||||
|
||||
SetName(name);
|
||||
|
||||
if ( id != wxID_ANY )
|
||||
@@ -859,7 +838,7 @@ bool wxMDIChildFrame::Show(bool show)
|
||||
|
||||
// we need to refresh the MDI frame window menu to include (or exclude if
|
||||
// we've been hidden) this frame
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
MDISetMenu(parent->GetClientWindow(), NULL, NULL);
|
||||
|
||||
return true;
|
||||
@@ -898,8 +877,8 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||
|
||||
// If there's an MDI parent, must subtract the parent's top left corner
|
||||
// since MoveWindow moves relative to the parent
|
||||
wxMDIParentFrame *mdiParent = GetMDIParent();
|
||||
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
|
||||
wxMDIParentFrame * const mdiParent = GetMDIParent();
|
||||
::ScreenToClient(GetHwndOf(mdiParent->GetClientWindow()), &point);
|
||||
|
||||
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
|
||||
|
||||
@@ -934,8 +913,8 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
|
||||
|
||||
// Since we now have the absolute screen coords,
|
||||
// if there's a parent we must subtract its top left corner
|
||||
wxMDIParentFrame *mdiParent = GetMDIParent();
|
||||
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
|
||||
wxMDIParentFrame * const mdiParent = GetMDIParent();
|
||||
::ScreenToClient(GetHwndOf(mdiParent->GetClientWindow()), &point);
|
||||
|
||||
if (x)
|
||||
*x = point.x;
|
||||
@@ -945,7 +924,7 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
|
||||
|
||||
void wxMDIChildFrame::InternalSetMenuBar()
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
|
||||
MDIInsertWindowMenu(parent->GetClientWindow(),
|
||||
m_hMenu, GetMDIWindowMenu(parent));
|
||||
@@ -971,7 +950,7 @@ WXHICON wxMDIChildFrame::GetDefaultIcon() const
|
||||
|
||||
void wxMDIChildFrame::Maximize(bool maximize)
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
if ( parent && parent->GetClientWindow() )
|
||||
{
|
||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()),
|
||||
@@ -982,7 +961,7 @@ void wxMDIChildFrame::Maximize(bool maximize)
|
||||
|
||||
void wxMDIChildFrame::Restore()
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
if ( parent && parent->GetClientWindow() )
|
||||
{
|
||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE,
|
||||
@@ -992,7 +971,7 @@ void wxMDIChildFrame::Restore()
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
if ( parent && parent->GetClientWindow() )
|
||||
{
|
||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE,
|
||||
@@ -1104,7 +1083,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
|
||||
WXHWND hwndAct,
|
||||
WXHWND hwndDeact)
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
|
||||
HMENU menuToSet = 0;
|
||||
|
||||
@@ -1237,7 +1216,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
|
||||
void wxMDIChildFrame::MSWDestroyWindow()
|
||||
{
|
||||
wxMDIParentFrame *parent = GetMDIParent();
|
||||
wxMDIParentFrame * const parent = GetMDIParent();
|
||||
|
||||
// Must make sure this handle is invalidated (set to NULL) since all sorts
|
||||
// of things could happen after the child client is destroyed, but before
|
||||
@@ -1264,7 +1243,7 @@ void wxMDIChildFrame::MSWDestroyWindow()
|
||||
bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
|
||||
{
|
||||
RECT *rect = (RECT *)vrect;
|
||||
wxMDIParentFrame* pFrameWnd = GetMDIParent();
|
||||
wxMDIParentFrame * const pFrameWnd = GetMDIParent();
|
||||
wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
|
||||
|
||||
if (!pChild || (pChild == this))
|
||||
|
@@ -34,10 +34,6 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#define TRACE_MDI "mdi"
|
||||
|
||||
static const int IDM_WINDOWTILEHOR = 4001;
|
||||
@@ -85,9 +81,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
||||
|
||||
void wxMDIParentFrame::Init()
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_windowMenu = (wxMenu*) NULL;
|
||||
m_parentFrameActive = true;
|
||||
m_shouldBeShown = false;
|
||||
}
|
||||
@@ -104,7 +97,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
// "Window" menu
|
||||
if ( style & wxFRAME_NO_WINDOW_MENU )
|
||||
{
|
||||
m_windowMenu = (wxMenu *)NULL;
|
||||
m_windowMenu = NULL;
|
||||
style -= wxFRAME_NO_WINDOW_MENU ;
|
||||
}
|
||||
else // normal case: we have the window menu, so construct it
|
||||
@@ -135,8 +128,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
||||
|
||||
// already deleted by DestroyChildren()
|
||||
m_clientWindow = NULL ;
|
||||
|
||||
delete m_windowMenu;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
@@ -267,19 +258,6 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// Returns the active MDI child window
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
return m_currentChild ;
|
||||
}
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow( this );
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
@@ -289,32 +267,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
wxFrame::OnSysColourChanged(event);
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIParentFrame::Cascade()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::Tile(wxOrientation WXUNUSED(orient))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ArrangeIcons()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::ShouldBeVisible() const
|
||||
{
|
||||
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||
@@ -365,10 +317,6 @@ bool wxMDIParentFrame::Show( bool show )
|
||||
// Child frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
{
|
||||
Init() ;
|
||||
}
|
||||
void wxMDIChildFrame::Init()
|
||||
{
|
||||
}
|
||||
@@ -381,6 +329,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_mdiParent = parent;
|
||||
|
||||
SetName(name);
|
||||
|
||||
if ( id == wxID_ANY )
|
||||
@@ -400,11 +350,6 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
||||
DestroyChildren();
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
{
|
||||
return wxFrame::SetMenuBar( menu_bar ) ;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
|
||||
{
|
||||
wxLogTrace(TRACE_MDI, wxT("MDI child=%p MacActivate(0x%08lx,%s)"),this, timestamp, activating ? wxT("ACTIV") : wxT("deact"));
|
||||
@@ -462,16 +407,6 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIChildFrame::Maximize()
|
||||
{
|
||||
wxFrame::Maximize() ;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Restore()
|
||||
{
|
||||
wxFrame::Restore() ;
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
{
|
||||
Raise ();
|
||||
@@ -481,10 +416,6 @@ void wxMDIChildFrame::Activate()
|
||||
// wxMDIClientWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
DestroyChildren();
|
||||
@@ -498,15 +429,9 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar.
|
||||
void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
|
||||
{
|
||||
wxDisplaySize( x , y ) ;
|
||||
}
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
#endif // wxUSE_MDI
|
||||
|
Reference in New Issue
Block a user