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/fontdlgg.h \
|
||||||
wx/generic/fontpickerg.h \
|
wx/generic/fontpickerg.h \
|
||||||
wx/generic/listctrl.h \
|
wx/generic/listctrl.h \
|
||||||
|
wx/generic/mdig.h \
|
||||||
wx/generic/notebook.h \
|
wx/generic/notebook.h \
|
||||||
wx/generic/prntdlgg.h \
|
wx/generic/prntdlgg.h \
|
||||||
wx/generic/statline.h \
|
wx/generic/statline.h \
|
||||||
@@ -2716,7 +2717,6 @@ COND_TOOLKIT_MOTIF_GUI_HDR = \
|
|||||||
wx/motif/gauge.h \
|
wx/motif/gauge.h \
|
||||||
wx/motif/icon.h \
|
wx/motif/icon.h \
|
||||||
wx/motif/listbox.h \
|
wx/motif/listbox.h \
|
||||||
wx/motif/mdi.h \
|
|
||||||
wx/motif/menu.h \
|
wx/motif/menu.h \
|
||||||
wx/motif/menuitem.h \
|
wx/motif/menuitem.h \
|
||||||
wx/motif/minifram.h \
|
wx/motif/minifram.h \
|
||||||
@@ -5040,7 +5040,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS = \
|
|||||||
monodll_motif_icon.o \
|
monodll_motif_icon.o \
|
||||||
monodll_motif_listbox.o \
|
monodll_motif_listbox.o \
|
||||||
monodll_motif_main.o \
|
monodll_motif_main.o \
|
||||||
monodll_motif_mdi.o \
|
|
||||||
monodll_motif_menu.o \
|
monodll_motif_menu.o \
|
||||||
monodll_motif_menuitem.o \
|
monodll_motif_menuitem.o \
|
||||||
monodll_motif_minifram.o \
|
monodll_motif_minifram.o \
|
||||||
@@ -5072,6 +5071,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS = \
|
|||||||
monodll_fontdlgg.o \
|
monodll_fontdlgg.o \
|
||||||
monodll_fontpickerg.o \
|
monodll_fontpickerg.o \
|
||||||
monodll_generic_listctrl.o \
|
monodll_generic_listctrl.o \
|
||||||
|
monodll_mdig.o \
|
||||||
monodll_generic_notebook.o \
|
monodll_generic_notebook.o \
|
||||||
monodll_prntdlgg.o \
|
monodll_prntdlgg.o \
|
||||||
monodll_generic_statline.o \
|
monodll_generic_statline.o \
|
||||||
@@ -6853,7 +6853,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_1 = \
|
|||||||
monolib_motif_icon.o \
|
monolib_motif_icon.o \
|
||||||
monolib_motif_listbox.o \
|
monolib_motif_listbox.o \
|
||||||
monolib_motif_main.o \
|
monolib_motif_main.o \
|
||||||
monolib_motif_mdi.o \
|
|
||||||
monolib_motif_menu.o \
|
monolib_motif_menu.o \
|
||||||
monolib_motif_menuitem.o \
|
monolib_motif_menuitem.o \
|
||||||
monolib_motif_minifram.o \
|
monolib_motif_minifram.o \
|
||||||
@@ -6885,6 +6884,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_1 = \
|
|||||||
monolib_fontdlgg.o \
|
monolib_fontdlgg.o \
|
||||||
monolib_fontpickerg.o \
|
monolib_fontpickerg.o \
|
||||||
monolib_generic_listctrl.o \
|
monolib_generic_listctrl.o \
|
||||||
|
monolib_mdig.o \
|
||||||
monolib_generic_notebook.o \
|
monolib_generic_notebook.o \
|
||||||
monolib_prntdlgg.o \
|
monolib_prntdlgg.o \
|
||||||
monolib_generic_statline.o \
|
monolib_generic_statline.o \
|
||||||
@@ -8817,7 +8817,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_2 = \
|
|||||||
coredll_motif_icon.o \
|
coredll_motif_icon.o \
|
||||||
coredll_motif_listbox.o \
|
coredll_motif_listbox.o \
|
||||||
coredll_motif_main.o \
|
coredll_motif_main.o \
|
||||||
coredll_motif_mdi.o \
|
|
||||||
coredll_motif_menu.o \
|
coredll_motif_menu.o \
|
||||||
coredll_motif_menuitem.o \
|
coredll_motif_menuitem.o \
|
||||||
coredll_motif_minifram.o \
|
coredll_motif_minifram.o \
|
||||||
@@ -8849,6 +8848,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_2 = \
|
|||||||
coredll_fontdlgg.o \
|
coredll_fontdlgg.o \
|
||||||
coredll_fontpickerg.o \
|
coredll_fontpickerg.o \
|
||||||
coredll_generic_listctrl.o \
|
coredll_generic_listctrl.o \
|
||||||
|
coredll_mdig.o \
|
||||||
coredll_generic_notebook.o \
|
coredll_generic_notebook.o \
|
||||||
coredll_prntdlgg.o \
|
coredll_prntdlgg.o \
|
||||||
coredll_generic_statline.o \
|
coredll_generic_statline.o \
|
||||||
@@ -10321,7 +10321,6 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_3 = \
|
|||||||
corelib_motif_icon.o \
|
corelib_motif_icon.o \
|
||||||
corelib_motif_listbox.o \
|
corelib_motif_listbox.o \
|
||||||
corelib_motif_main.o \
|
corelib_motif_main.o \
|
||||||
corelib_motif_mdi.o \
|
|
||||||
corelib_motif_menu.o \
|
corelib_motif_menu.o \
|
||||||
corelib_motif_menuitem.o \
|
corelib_motif_menuitem.o \
|
||||||
corelib_motif_minifram.o \
|
corelib_motif_minifram.o \
|
||||||
@@ -10353,6 +10352,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_3 = \
|
|||||||
corelib_fontdlgg.o \
|
corelib_fontdlgg.o \
|
||||||
corelib_fontpickerg.o \
|
corelib_fontpickerg.o \
|
||||||
corelib_generic_listctrl.o \
|
corelib_generic_listctrl.o \
|
||||||
|
corelib_mdig.o \
|
||||||
corelib_generic_notebook.o \
|
corelib_generic_notebook.o \
|
||||||
corelib_prntdlgg.o \
|
corelib_prntdlgg.o \
|
||||||
corelib_generic_statline.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)
|
monodll_motif_main.o: $(srcdir)/src/motif/main.cpp $(MONODLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
$(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)
|
monodll_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(MONODLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
$(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@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_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@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
|
@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@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_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@monodll_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(MONODLL_ODEP)
|
||||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
@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)
|
monolib_motif_main.o: $(srcdir)/src/motif/main.cpp $(MONOLIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
$(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)
|
monolib_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(MONOLIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
$(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@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_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@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
|
@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@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_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@monolib_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(MONOLIB_ODEP)
|
||||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
@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)
|
coredll_motif_main.o: $(srcdir)/src/motif/main.cpp $(COREDLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
$(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)
|
coredll_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(COREDLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
$(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@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_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@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
|
@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@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_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@coredll_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(COREDLL_ODEP)
|
||||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
@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)
|
corelib_motif_main.o: $(srcdir)/src/motif/main.cpp $(CORELIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/motif/main.cpp
|
$(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)
|
corelib_motif_menu.o: $(srcdir)/src/motif/menu.cpp $(CORELIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/motif/menu.cpp
|
$(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@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_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@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
|
@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@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_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@corelib_accelcmn.o: $(srcdir)/src/common/accelcmn.cpp $(CORELIB_ODEP)
|
||||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/accelcmn.cpp
|
@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/icon.cpp
|
||||||
src/motif/listbox.cpp
|
src/motif/listbox.cpp
|
||||||
src/motif/main.cpp
|
src/motif/main.cpp
|
||||||
src/motif/mdi.cpp
|
|
||||||
src/motif/menu.cpp
|
src/motif/menu.cpp
|
||||||
src/motif/menuitem.cpp
|
src/motif/menuitem.cpp
|
||||||
src/motif/minifram.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/fontdlgg.cpp
|
||||||
src/generic/fontpickerg.cpp
|
src/generic/fontpickerg.cpp
|
||||||
src/generic/listctrl.cpp
|
src/generic/listctrl.cpp
|
||||||
|
src/generic/mdig.cpp
|
||||||
src/generic/notebook.cpp
|
src/generic/notebook.cpp
|
||||||
src/generic/prntdlgg.cpp
|
src/generic/prntdlgg.cpp
|
||||||
src/generic/statline.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/fontdlgg.h
|
||||||
wx/generic/fontpickerg.h
|
wx/generic/fontpickerg.h
|
||||||
wx/generic/listctrl.h
|
wx/generic/listctrl.h
|
||||||
|
wx/generic/mdig.h
|
||||||
wx/generic/notebook.h
|
wx/generic/notebook.h
|
||||||
wx/generic/prntdlgg.h
|
wx/generic/prntdlgg.h
|
||||||
wx/generic/statline.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/gauge.h
|
||||||
wx/motif/icon.h
|
wx/motif/icon.h
|
||||||
wx/motif/listbox.h
|
wx/motif/listbox.h
|
||||||
wx/motif/mdi.h
|
|
||||||
wx/motif/menu.h
|
wx/motif/menu.h
|
||||||
wx/motif/menuitem.h
|
wx/motif/menuitem.h
|
||||||
wx/motif/minifram.h
|
wx/motif/minifram.h
|
||||||
|
@@ -134,6 +134,7 @@ library:
|
|||||||
@itemdef{wxUSE_GAUGE, Use wxGauge class.}
|
@itemdef{wxUSE_GAUGE, Use wxGauge class.}
|
||||||
@itemdef{wxUSE_GENERIC_DRAGIMAGE, Used in wxDragImage sample.}
|
@itemdef{wxUSE_GENERIC_DRAGIMAGE, Used in wxDragImage sample.}
|
||||||
@itemdef{wxUSE_GENERIC_DRAWELLIPSE, See comment in wx/dc.h file.}
|
@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_GEOMETRY, Use common geometry classes}
|
||||||
@itemdef{wxUSE_GIF, Use GIF wxImageHandler}
|
@itemdef{wxUSE_GIF, Use GIF wxImageHandler}
|
||||||
@itemdef{wxUSE_GLCANVAS, Enables OpenGL support.}
|
@itemdef{wxUSE_GLCANVAS, Enables OpenGL support.}
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
// Name: wx/cocoa/mdi.h
|
// Name: wx/cocoa/mdi.h
|
||||||
// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
|
// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
|
||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Created: 2003/09/08
|
// Created: 2003/09/08
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2003 David Elliott
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList);
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxMDIParentFrame
|
// wxMDIParentFrame
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
@@ -76,17 +77,16 @@ protected:
|
|||||||
// Implementation
|
// Implementation
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
wxMDIChildFrame *GetActiveChild() const;
|
|
||||||
void SetActiveChild(wxMDIChildFrame *child);
|
void SetActiveChild(wxMDIChildFrame *child);
|
||||||
|
|
||||||
wxMDIClientWindow *GetClientWindow() const;
|
// implement base class pure virtuals
|
||||||
virtual wxMDIClientWindow *OnCreateClient();
|
// ----------------------------------
|
||||||
|
|
||||||
|
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:
|
protected:
|
||||||
wxMDIClientWindow *m_clientWindow;
|
wxMDIClientWindow *m_clientWindow;
|
||||||
wxMDIChildFrame *m_currentChild;
|
wxMDIChildFrame *m_currentChild;
|
||||||
@@ -150,14 +150,15 @@ protected:
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxMDIClientWindow
|
// wxMDIClientWindow
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
class wxMDIClientWindow: public wxWindow
|
class wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
|
||||||
public:
|
public:
|
||||||
wxMDIClientWindow();
|
wxMDIClientWindow() { }
|
||||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
|
||||||
virtual ~wxMDIClientWindow();
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = 0 );
|
long style = wxHSCROLL | wxVSCROLL);
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __WX_COCOA_MDI_H__
|
#endif // __WX_COCOA_MDI_H__
|
||||||
|
@@ -2,334 +2,260 @@
|
|||||||
// Name: wx/generic/mdig.h
|
// Name: wx/generic/mdig.h
|
||||||
// Purpose: Generic MDI (Multiple Document Interface) classes
|
// Purpose: Generic MDI (Multiple Document Interface) classes
|
||||||
// Author: Hans Van Leemputten
|
// Author: Hans Van Leemputten
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Created: 29/07/2002
|
// Created: 29/07/2002
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Hans Van Leemputten
|
// Copyright: (c) 2002 Hans Van Leemputten
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDIG_H_
|
#ifndef _WX_GENERIC_MDIG_H_
|
||||||
#define _WX_MDIG_H_
|
#define _WX_GENERIC_MDIG_H_
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// headers
|
// headers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/frame.h"
|
|
||||||
#include "wx/panel.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 wxIcon;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
|
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
|
// wxGenericMDIParentFrame
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxGenericMDIParentFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxGenericMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGenericMDIParentFrame();
|
wxGenericMDIParentFrame() { Init(); }
|
||||||
wxGenericMDIParentFrame(wxWindow *parent,
|
wxGenericMDIParentFrame(wxWindow *parent,
|
||||||
wxWindowID winid,
|
wxWindowID winid,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
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();
|
virtual ~wxGenericMDIParentFrame();
|
||||||
bool Create( wxWindow *parent,
|
|
||||||
wxWindowID winid,
|
// implement base class pure virtuals
|
||||||
const wxString& title,
|
static bool IsTDI() { return true; }
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
virtual void ActivateNext() { AdvanceActive(true); }
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
virtual void ActivatePrevious() { AdvanceActive(false); }
|
||||||
const wxString& name = wxFrameNameStr );
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
wxMenu* GetWindowMenu() const { return m_pWindowMenu; };
|
virtual void SetWindowMenu(wxMenu* pMenu);
|
||||||
void SetWindowMenu(wxMenu* pMenu);
|
|
||||||
|
|
||||||
virtual void SetMenuBar(wxMenuBar *pMenuBar);
|
virtual void SetMenuBar(wxMenuBar *pMenuBar);
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
void SetChildMenuBar(wxGenericMDIChildFrame *pChild);
|
|
||||||
|
|
||||||
virtual bool ProcessEvent(wxEvent& event);
|
virtual bool ProcessEvent(wxEvent& event);
|
||||||
|
|
||||||
wxGenericMDIChildFrame *GetActiveChild() const;
|
virtual wxGenericMDIClientWindow *OnCreateGenericClient();
|
||||||
inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame);
|
|
||||||
|
|
||||||
wxGenericMDIClientWindow *GetClientWindow() const;
|
|
||||||
virtual wxGenericMDIClientWindow *OnCreateClient();
|
|
||||||
|
|
||||||
virtual void Cascade() { /* Has no effect */ }
|
// implementation only from now on
|
||||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
|
void WXSetChildMenuBar(wxGenericMDIChildFrame *child);
|
||||||
virtual void ArrangeIcons() { /* Has no effect */ }
|
void WXUpdateChildTitle(wxGenericMDIChildFrame *child);
|
||||||
virtual void ActivateNext();
|
void WXActivateChild(wxGenericMDIChildFrame *child);
|
||||||
virtual void ActivatePrevious();
|
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:
|
protected:
|
||||||
wxGenericMDIClientWindow *m_pClientWindow;
|
|
||||||
wxGenericMDIChildFrame *m_pActiveChild;
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
wxMenu *m_pWindowMenu;
|
wxMenuBar *m_pMyMenuBar;
|
||||||
wxMenuBar *m_pMyMenuBar;
|
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
protected:
|
// advance the activation forward or backwards
|
||||||
|
void AdvanceActive(bool forward);
|
||||||
|
|
||||||
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
void RemoveWindowMenu(wxMenuBar *pMenuBar);
|
void RemoveWindowMenu(wxMenuBar *pMenuBar);
|
||||||
void AddWindowMenu(wxMenuBar *pMenuBar);
|
void AddWindowMenu(wxMenuBar *pMenuBar);
|
||||||
|
|
||||||
void DoHandleMenu(wxCommandEvent &event);
|
void OnWindowMenu(wxCommandEvent& event);
|
||||||
#endif // wxUSE_MENUS
|
#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_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame)
|
DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGenericMDIChildFrame
|
// wxGenericMDIChildFrame
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxGenericMDIChildFrame: public wxPanel
|
class WXDLLIMPEXP_CORE wxGenericMDIChildFrame : public wxTDIChildFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGenericMDIChildFrame();
|
wxGenericMDIChildFrame() { Init(); }
|
||||||
wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent,
|
wxGenericMDIChildFrame(wxGenericMDIParentFrame *parent,
|
||||||
wxWindowID winid,
|
wxWindowID winid,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr );
|
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();
|
virtual ~wxGenericMDIChildFrame();
|
||||||
bool Create( wxGenericMDIParentFrame *parent,
|
|
||||||
wxWindowID winid,
|
// implement MDI operations
|
||||||
const wxString& title,
|
virtual void Activate();
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
|
||||||
const wxString& name = wxFrameNameStr );
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||||
virtual wxMenuBar *GetMenuBar() const;
|
virtual wxMenuBar *GetMenuBar() const;
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
|
virtual wxString GetTitle() const { return m_title; }
|
||||||
virtual void SetTitle(const wxString& title);
|
virtual void SetTitle(const wxString& title);
|
||||||
virtual wxString GetTitle() const;
|
|
||||||
|
|
||||||
virtual void Activate();
|
virtual bool TryParent(wxEvent& event);
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
// implementation only from now on
|
||||||
// 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; }
|
|
||||||
|
|
||||||
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
wxGenericMDIParentFrame* GetGenericMDIParent() const
|
||||||
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
|
{
|
||||||
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
|
#if wxUSE_GENERIC_MDI_AS_NATIVE
|
||||||
|
return GetMDIParent();
|
||||||
|
#else // generic != native
|
||||||
|
return m_mdiParentGeneric;
|
||||||
#endif
|
#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:
|
protected:
|
||||||
wxGenericMDIParentFrame *m_pMDIParentFrame;
|
wxString m_title;
|
||||||
wxRect m_MDIRect;
|
|
||||||
wxString m_Title;
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
wxMenuBar *m_pMenuBar;
|
wxMenuBar *m_pMenuBar;
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
|
#if !wxUSE_GENERIC_MDI_AS_NATIVE
|
||||||
|
wxGenericMDIParentFrame *m_mdiParentGeneric;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init();
|
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:
|
private:
|
||||||
|
void OnMenuHighlight(wxMenuEvent& event);
|
||||||
|
void OnClose(wxCloseEvent& event);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame)
|
DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
friend class wxGenericMDIClientWindow;
|
friend class wxGenericMDIClientWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGenericMDIClientWindow
|
// wxGenericMDIClientWindow
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxGenericMDIClientWindow: public wxNotebook
|
class WXDLLIMPEXP_CORE wxGenericMDIClientWindow : public wxMDIClientWindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGenericMDIClientWindow();
|
wxGenericMDIClientWindow() { }
|
||||||
wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 );
|
|
||||||
virtual ~wxGenericMDIClientWindow();
|
|
||||||
virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
|
||||||
|
|
||||||
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 PageChanged(int OldSelection, int newSelection);
|
||||||
|
|
||||||
void OnPageChanged(wxBookCtrlEvent& event);
|
void OnPageChanged(wxBookCtrlEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
private:
|
// the notebook containing all MDI children as its pages
|
||||||
|
wxNotebook *m_notebook;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow)
|
DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow)
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// inline functions implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
inline bool
|
||||||
* Define normal wxMDI classes based on wxGenericMDI
|
wxGenericMDIParentFrame::
|
||||||
*/
|
WXIsInsideChildHandler(wxGenericMDIChildFrame *child) const
|
||||||
|
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
public:
|
return child == m_childHandler;
|
||||||
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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIChildFrame * GetActiveChild() const ;
|
#endif // _WX_GENERIC_MDIG_H_
|
||||||
|
|
||||||
|
|
||||||
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_
|
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/gtk/mdi.h
|
// Name: wx/gtk/mdi.h
|
||||||
// Purpose:
|
// Purpose: TDI-based MDI implementation for wxGTK
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -15,11 +17,13 @@
|
|||||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||||
|
|
||||||
|
typedef struct _GtkNotebook GtkNotebook;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMDIParentFrame
|
// wxMDIParentFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIParentFrame() { Init(); }
|
wxMDIParentFrame() { Init(); }
|
||||||
@@ -36,29 +40,28 @@ public:
|
|||||||
(void)Create(parent, id, title, pos, size, style, name);
|
(void)Create(parent, id, title, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxMDIParentFrame();
|
bool Create(wxWindow *parent,
|
||||||
bool Create( wxWindow *parent,
|
wxWindowID id,
|
||||||
wxWindowID id,
|
const wxString& title,
|
||||||
const wxString& title,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
const wxString& name = wxFrameNameStr);
|
||||||
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;
|
// implement base class pure virtuals
|
||||||
virtual wxMDIClientWindow *OnCreateClient();
|
// ----------------------------------
|
||||||
|
|
||||||
virtual void Cascade() {}
|
|
||||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
|
|
||||||
virtual void ArrangeIcons() {}
|
|
||||||
virtual void ActivateNext();
|
virtual void ActivateNext();
|
||||||
virtual void ActivatePrevious();
|
virtual void ActivatePrevious();
|
||||||
|
|
||||||
|
static bool IsTDI() { return true; }
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
wxMDIClientWindow *m_clientWindow;
|
|
||||||
bool m_justInserted;
|
bool m_justInserted;
|
||||||
|
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
@@ -77,95 +80,54 @@ private:
|
|||||||
// wxMDIChildFrame
|
// wxMDIChildFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIChildFrame();
|
wxMDIChildFrame() { Init(); }
|
||||||
wxMDIChildFrame( wxMDIParentFrame *parent,
|
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr );
|
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 );
|
|
||||||
|
|
||||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||||
virtual wxMenuBar *GetMenuBar() const;
|
virtual wxMenuBar *GetMenuBar() const;
|
||||||
|
|
||||||
virtual void AddChild( wxWindowBase *child );
|
|
||||||
|
|
||||||
virtual void Activate();
|
virtual void Activate();
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
virtual void SetTitle(const wxString& title);
|
||||||
// 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 wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
// implementation
|
||||||
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();
|
|
||||||
|
|
||||||
void OnActivate( wxActivateEvent& event );
|
void OnActivate( wxActivateEvent& event );
|
||||||
void OnMenuHighlight( wxMenuEvent& event );
|
void OnMenuHighlight( wxMenuEvent& event );
|
||||||
|
|
||||||
// implementation
|
|
||||||
|
|
||||||
wxMenuBar *m_menuBar;
|
wxMenuBar *m_menuBar;
|
||||||
GtkNotebookPage *m_page;
|
GtkNotebookPage *m_page;
|
||||||
bool m_justInserted;
|
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:
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
GtkNotebook *GTKGetNotebook() const;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||||
};
|
};
|
||||||
@@ -174,13 +136,13 @@ private:
|
|||||||
// wxMDIClientWindow
|
// wxMDIClientWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIClientWindow();
|
wxMDIClientWindow() { }
|
||||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
|
||||||
virtual ~wxMDIClientWindow();
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
long style = wxVSCROLL | wxHSCROLL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void AddChildGTK(wxWindowGTK* child);
|
virtual void AddChildGTK(wxWindowGTK* child);
|
||||||
|
@@ -1,42 +1,29 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/gtk1/mdi.h
|
// Name: wx/gtk1/mdi.h
|
||||||
// Purpose:
|
// Purpose: TDI-based MDI implementation for wxGTK1
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __MDIH__
|
#ifndef _WX_GTK1_MDI_H_
|
||||||
#define __MDIH__
|
#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/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 wxMDIChildFrame;
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
typedef struct _GtkNotebook GtkNotebook;
|
||||||
// global data
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMDIParentFrame
|
// wxMDIParentFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIParentFrame() { Init(); }
|
wxMDIParentFrame() { Init(); }
|
||||||
@@ -53,41 +40,35 @@ public:
|
|||||||
(void)Create(parent, id, title, pos, size, style, name);
|
(void)Create(parent, id, title, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxMDIParentFrame();
|
bool Create(wxWindow *parent,
|
||||||
bool Create( wxWindow *parent,
|
wxWindowID id,
|
||||||
wxWindowID id,
|
const wxString& title,
|
||||||
const wxString& title,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
const wxString& name = wxFrameNameStr);
|
||||||
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;
|
// implement base class pure virtuals
|
||||||
virtual wxMDIClientWindow *OnCreateClient();
|
// ----------------------------------
|
||||||
|
|
||||||
virtual void Cascade() {}
|
|
||||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
|
|
||||||
virtual void ArrangeIcons() {}
|
|
||||||
virtual void ActivateNext();
|
virtual void ActivateNext();
|
||||||
virtual void ActivatePrevious();
|
virtual void ActivatePrevious();
|
||||||
|
|
||||||
|
static bool IsTDI() { return true; }
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
wxMDIClientWindow *m_clientWindow;
|
|
||||||
bool m_justInserted;
|
bool m_justInserted;
|
||||||
|
|
||||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
protected:
|
|
||||||
void Init();
|
|
||||||
|
|
||||||
virtual void DoGetClientSize(int *width, int *height) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class wxMDIChildFrame;
|
void Init();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||||
};
|
};
|
||||||
@@ -96,98 +77,54 @@ private:
|
|||||||
// wxMDIChildFrame
|
// wxMDIChildFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIChildFrame();
|
wxMDIChildFrame() { Init(); }
|
||||||
wxMDIChildFrame( wxMDIParentFrame *parent,
|
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr );
|
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 );
|
|
||||||
|
|
||||||
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
virtual void SetMenuBar( wxMenuBar *menu_bar );
|
||||||
virtual wxMenuBar *GetMenuBar() const;
|
virtual wxMenuBar *GetMenuBar() const;
|
||||||
|
|
||||||
virtual void AddChild( wxWindowBase *child );
|
|
||||||
|
|
||||||
virtual void Activate();
|
virtual void Activate();
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
virtual void SetTitle(const wxString& title);
|
||||||
// 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 wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
|
// implementation
|
||||||
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; }
|
|
||||||
|
|
||||||
void OnActivate( wxActivateEvent& event );
|
void OnActivate( wxActivateEvent& event );
|
||||||
void OnMenuHighlight( wxMenuEvent& event );
|
void OnMenuHighlight( wxMenuEvent& event );
|
||||||
|
|
||||||
// implementation
|
|
||||||
|
|
||||||
wxMenuBar *m_menuBar;
|
wxMenuBar *m_menuBar;
|
||||||
GtkNotebookPage *m_page;
|
GtkNotebookPage *m_page;
|
||||||
bool m_justInserted;
|
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:
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
GtkNotebook *GTKGetNotebook() const;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||||
};
|
};
|
||||||
@@ -196,16 +133,16 @@ private:
|
|||||||
// wxMDIClientWindow
|
// wxMDIClientWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIClientWindow();
|
wxMDIClientWindow() { }
|
||||||
wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
|
|
||||||
virtual ~wxMDIClientWindow();
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
|
long style = wxVSCROLL | wxHSCROLL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
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
|
// Name: wx/mdi.h
|
||||||
// Purpose: wxMDI base header
|
// Purpose: wxMDI base header
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart (original)
|
||||||
// Modified by:
|
// Vadim Zeitlin (base MDI classes refactoring)
|
||||||
// Created:
|
// Copyright: (c) 1998 Julian Smart
|
||||||
// Copyright: (c) Julian Smart
|
// (c) 2008 Vadim Zeitlin
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -16,12 +16,330 @@
|
|||||||
|
|
||||||
#if wxUSE_MDI
|
#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"
|
#include "wx/generic/mdig.h"
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
#include "wx/msw/mdi.h"
|
#include "wx/msw/mdi.h"
|
||||||
#elif defined(__WXMOTIF__)
|
|
||||||
#include "wx/motif/mdi.h"
|
|
||||||
#elif defined(__WXGTK20__)
|
#elif defined(__WXGTK20__)
|
||||||
#include "wx/gtk/mdi.h"
|
#include "wx/gtk/mdi.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
@@ -30,11 +348,13 @@
|
|||||||
#include "wx/osx/mdi.h"
|
#include "wx/osx/mdi.h"
|
||||||
#elif defined(__WXCOCOA__)
|
#elif defined(__WXCOCOA__)
|
||||||
#include "wx/cocoa/mdi.h"
|
#include "wx/cocoa/mdi.h"
|
||||||
#elif defined(__WXPM__)
|
|
||||||
#include "wx/generic/mdig.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient()
|
||||||
|
{
|
||||||
|
return new wxMDIClientWindow;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_MDI
|
#endif // wxUSE_MDI
|
||||||
|
|
||||||
#endif
|
#endif // _WX_MDI_H_BASE_
|
||||||
// _WX_MDI_H_BASE_
|
|
||||||
|
@@ -2,58 +2,62 @@
|
|||||||
// Name: wx/motif/mdi.h
|
// Name: wx/motif/mdi.h
|
||||||
// Purpose: MDI (Multiple Document Interface) classes.
|
// Purpose: MDI (Multiple Document Interface) classes.
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1998 Julian Smart
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDI_H_
|
#ifndef _WX_MOTIF_MDI_H_
|
||||||
#define _WX_MDI_H_
|
#define _WX_MOTIF_MDI_H_
|
||||||
|
|
||||||
/*
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
|
||||||
|
|
||||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
|
||||||
public:
|
public:
|
||||||
|
wxMDIParentFrame() { Init(); }
|
||||||
wxMDIParentFrame();
|
wxMDIParentFrame(wxWindow *parent,
|
||||||
inline wxMDIParentFrame(wxWindow *parent,
|
wxWindowID id,
|
||||||
wxWindowID id,
|
const wxString& title,
|
||||||
const wxString& title,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
|
const wxString& name = wxFrameNameStr)
|
||||||
const wxString& name = wxFrameNameStr)
|
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
Create(parent, id, title, pos, size, style, name);
|
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,
|
// implement base class pure virtuals
|
||||||
wxWindowID id,
|
// ----------------------------------
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
static bool IsTDI() { return true; }
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
virtual void ActivateNext() { /* TODO */ }
|
||||||
const wxString& name = wxFrameNameStr);
|
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 OnSize(wxSizeEvent& event);
|
||||||
void OnActivate(wxActivateEvent& event);
|
void OnActivate(wxActivateEvent& event);
|
||||||
@@ -62,82 +66,41 @@ public:
|
|||||||
|
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
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:
|
protected:
|
||||||
virtual void DoSetSize(int x, int y,
|
wxMenuBar *m_activeMenuBar;
|
||||||
int width, int height,
|
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
|
||||||
virtual void DoSetClientSize(int width, int height);
|
|
||||||
|
|
||||||
// Gets the size available for subwindows after menu size, toolbar size
|
private:
|
||||||
// and status bar size have been subtracted. If you want to manage your own
|
void Init();
|
||||||
// toolbar(s), don't call SetToolBar.
|
|
||||||
void DoGetClientSize(int *width, int *height) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
wxMDIClientWindow* m_clientWindow;
|
|
||||||
wxMDIChildFrame* m_activeChild;
|
|
||||||
wxMenuBar* m_activeMenuBar;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMDIChildFrame();
|
wxMDIChildFrame() { }
|
||||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr)
|
const wxString& name = wxFrameNameStr)
|
||||||
{
|
{
|
||||||
Create(parent, id, title, pos, size, style, name);
|
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);
|
|
||||||
|
|
||||||
// Set menu bar
|
// Set menu bar
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
void SetMenuBar(wxMenuBar *menu_bar);
|
||||||
@@ -174,55 +137,18 @@ public:
|
|||||||
WXWidget GetTopWidget() const { return m_mainWidget; };
|
WXWidget GetTopWidget() const { return m_mainWidget; };
|
||||||
WXWidget GetClientWidget() 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:
|
protected:
|
||||||
wxMDIParentFrame* m_mdiParentFrame;
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||||
|
|
||||||
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The client window is a child of the parent MDI frame, and itself
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
* 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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMDIClientWindow() ;
|
wxMDIClientWindow() { }
|
||||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
|
||||||
{
|
|
||||||
CreateClient(parent, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~wxMDIClientWindow();
|
virtual ~wxMDIClientWindow();
|
||||||
|
|
||||||
// Note: this is virtual, to allow overridden behaviour.
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
|
long style = wxVSCROLL | wxHSCROLL);
|
||||||
|
|
||||||
// Explicitly call default scroll behaviour
|
|
||||||
void OnScroll(wxScrollEvent& event);
|
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
void OnPageChanged(wxBookCtrlEvent& event);
|
void OnPageChanged(wxBookCtrlEvent& event);
|
||||||
@@ -231,17 +157,19 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoSetSize(int x, int y,
|
virtual void DoSetSize(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
|
||||||
void DoGetClientSize(int *width, int *height) const;
|
virtual void DoGetClientSize(int *width, int *height) const;
|
||||||
void DoGetSize(int *width, int *height) const ;
|
virtual void DoGetSize(int *width, int *height) const ;
|
||||||
void DoGetPosition(int *x, int *y) const ;
|
virtual void DoGetPosition(int *x, int *y) const ;
|
||||||
|
|
||||||
|
wxNotebook *m_notebook;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _WX_MOTIF_MDI_H_
|
||||||
// _WX_MDI_H_
|
|
||||||
|
@@ -2,28 +2,24 @@
|
|||||||
// Name: wx/msw/mdi.h
|
// Name: wx/msw/mdi.h
|
||||||
// Purpose: MDI (Multiple Document Interface) classes
|
// Purpose: MDI (Multiple Document Interface) classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1997 Julian Smart
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDI_H_
|
#ifndef _WX_MSW_MDI_H_
|
||||||
#define _WX_MDI_H_
|
#define _WX_MSW_MDI_H_
|
||||||
|
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// wxMDIParentFrame
|
// wxMDIParentFrame
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIParentFrame();
|
wxMDIParentFrame();
|
||||||
@@ -48,41 +44,26 @@ public:
|
|||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
const wxString& name = wxFrameNameStr);
|
const wxString& name = wxFrameNameStr);
|
||||||
|
|
||||||
// accessors
|
// override/implement base class [pure] virtual methods
|
||||||
// ---------
|
// ----------------------------------------------------
|
||||||
|
|
||||||
// Get the active MDI child window
|
static bool IsTDI() { return false; }
|
||||||
wxMDIChildFrame *GetActiveChild() const;
|
|
||||||
|
|
||||||
// Get the client window
|
// we don't store the active child in m_currentChild so override this
|
||||||
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
// 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 Cascade();
|
||||||
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
||||||
virtual void ArrangeIcons();
|
virtual void ArrangeIcons();
|
||||||
virtual void ActivateNext();
|
virtual void ActivateNext();
|
||||||
virtual void ActivatePrevious();
|
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
|
// implementation only from now on
|
||||||
|
|
||||||
@@ -127,12 +108,6 @@ protected:
|
|||||||
void UpdateClientSize();
|
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
|
// true if MDI Frame is intercepting commands, not child
|
||||||
bool m_parentFrameActive;
|
bool m_parentFrameActive;
|
||||||
|
|
||||||
@@ -155,7 +130,7 @@ private:
|
|||||||
// wxMDIChildFrame
|
// wxMDIChildFrame
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIChildFrame() { Init(); }
|
wxMDIChildFrame() { Init(); }
|
||||||
@@ -172,8 +147,6 @@ public:
|
|||||||
Create(parent, id, title, pos, size, style, name);
|
Create(parent, id, title, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxMDIChildFrame();
|
|
||||||
|
|
||||||
bool Create(wxMDIParentFrame *parent,
|
bool Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
@@ -182,21 +155,20 @@ public:
|
|||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr);
|
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 Maximize(bool maximize = true);
|
||||||
virtual void Restore();
|
virtual void Restore();
|
||||||
virtual void Activate();
|
|
||||||
|
virtual bool Show(bool show = true);
|
||||||
|
|
||||||
// Implementation only from now on
|
// Implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
wxMDIParentFrame* GetMDIParent() const
|
|
||||||
{
|
|
||||||
return wxStaticCast(wxFrame::GetParent(), wxMDIParentFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||||
bool HandleWindowPosChanging(void *lpPos);
|
bool HandleWindowPosChanging(void *lpPos);
|
||||||
@@ -213,8 +185,6 @@ public:
|
|||||||
|
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
virtual bool Show(bool show = true);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoGetScreenPosition(int *x, int *y) const;
|
virtual void DoGetScreenPosition(int *x, int *y) const;
|
||||||
virtual void DoGetPosition(int *x, int *y) const;
|
virtual void DoGetPosition(int *x, int *y) const;
|
||||||
@@ -240,16 +210,10 @@ private:
|
|||||||
// wxMDIClientWindow
|
// wxMDIClientWindow
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxWindow
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIClientWindow() { Init(); }
|
wxMDIClientWindow() { Init(); }
|
||||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
|
|
||||||
CreateClient(parent, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: this is virtual, to allow overridden behaviour.
|
// Note: this is virtual, to allow overridden behaviour.
|
||||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
@@ -272,5 +236,4 @@ private:
|
|||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _WX_MSW_MDI_H_
|
||||||
// _WX_MDI_H_
|
|
||||||
|
@@ -1,88 +1,72 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mdi.h
|
// Name: wx/osx/carbon/mdi.h
|
||||||
// Purpose: MDI (Multiple Document Interface) classes.
|
// 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
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDI_H_
|
#ifndef _WX_OSX_CARBON_MDI_H_
|
||||||
#define _WX_MDI_H_
|
#define _WX_OSX_CARBON_MDI_H_
|
||||||
|
|
||||||
#include "wx/frame.h"
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
|
|
||||||
WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr[];
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
|
||||||
|
|
||||||
public:
|
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(); }
|
bool Create(wxWindow *parent,
|
||||||
wxMDIParentFrame(wxWindow *parent,
|
wxWindowID id,
|
||||||
wxWindowID id,
|
const wxString& title,
|
||||||
const wxString& title,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
|
const wxString& name = wxFrameNameStr);
|
||||||
const wxString& name = wxFrameNameStr)
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
Create(parent, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~wxMDIParentFrame();
|
virtual ~wxMDIParentFrame();
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
// implement/override base class [pure] virtuals
|
||||||
wxWindowID id,
|
// ---------------------------------------------
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
|
||||||
const wxString& name = wxFrameNameStr);
|
|
||||||
|
|
||||||
// Mac OS activate event
|
static bool IsTDI() { return false; }
|
||||||
virtual void MacActivate(long timestamp, bool activating);
|
|
||||||
|
|
||||||
// wxWidgets activate event
|
virtual void AddChild(wxWindowBase *child);
|
||||||
void OnActivate(wxActivateEvent& event);
|
virtual void RemoveChild(wxWindowBase *child);
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
||||||
|
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
virtual void ActivateNext() { /* TODO */ }
|
||||||
|
virtual void ActivatePrevious() { /* TODO */ }
|
||||||
|
|
||||||
// Get the active MDI child window (Windows only)
|
virtual bool Show(bool show = true);
|
||||||
wxMDIChildFrame *GetActiveChild() const ;
|
|
||||||
|
|
||||||
// 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,
|
// Mac-specific implementation from now on
|
||||||
// just return a new class)
|
// ---------------------------------------
|
||||||
virtual wxMDIClientWindow *OnCreateClient() ;
|
|
||||||
|
|
||||||
// MDI operations
|
// Mac OS activate event
|
||||||
virtual void Cascade();
|
virtual void MacActivate(long timestamp, bool activating);
|
||||||
virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL);
|
|
||||||
virtual void ArrangeIcons();
|
|
||||||
virtual void ActivateNext();
|
|
||||||
virtual void ActivatePrevious();
|
|
||||||
|
|
||||||
virtual bool Show( bool show = true );
|
// wxWidgets activate event
|
||||||
|
void OnActivate(wxActivateEvent& event);
|
||||||
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
// overridden base clas virtuals
|
void SetMenuBar(wxMenuBar *menu_bar);
|
||||||
virtual void AddChild(wxWindowBase *child);
|
|
||||||
virtual void RemoveChild(wxWindowBase *child);
|
// Get rect to be used to center top-level children
|
||||||
|
virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
@@ -93,9 +77,6 @@ protected:
|
|||||||
bool ShouldBeVisible() const;
|
bool ShouldBeVisible() const;
|
||||||
|
|
||||||
|
|
||||||
// TODO maybe have this member
|
|
||||||
wxMDIClientWindow *m_clientWindow;
|
|
||||||
wxMDIChildFrame *m_currentChild;
|
|
||||||
wxMenu *m_windowMenu;
|
wxMenu *m_windowMenu;
|
||||||
|
|
||||||
// true if MDI Frame is intercepting commands, not child
|
// true if MDI Frame is intercepting commands, not child
|
||||||
@@ -107,88 +88,67 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
|
||||||
public:
|
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();
|
bool Create(wxMDIParentFrame *parent,
|
||||||
inline wxMDIChildFrame(wxMDIParentFrame *parent,
|
wxWindowID id,
|
||||||
wxWindowID id,
|
const wxString& title,
|
||||||
const wxString& title,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
const wxString& name = wxFrameNameStr);
|
||||||
const wxString& name = wxFrameNameStr)
|
|
||||||
{
|
|
||||||
Init() ;
|
|
||||||
Create(parent, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~wxMDIChildFrame();
|
virtual ~wxMDIChildFrame();
|
||||||
|
|
||||||
bool Create(wxMDIParentFrame *parent,
|
// un-override the base class override
|
||||||
wxWindowID id,
|
virtual bool IsTopLevel() const { return true; }
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
|
||||||
const wxString& name = wxFrameNameStr);
|
|
||||||
|
|
||||||
// Mac OS activate event
|
// implement MDI operations
|
||||||
virtual void MacActivate(long timestamp, bool activating);
|
virtual void Activate();
|
||||||
|
|
||||||
// Set menu bar
|
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
|
||||||
|
|
||||||
// MDI operations
|
// Mac OS activate event
|
||||||
virtual void Maximize();
|
virtual void MacActivate(long timestamp, bool activating);
|
||||||
virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
|
|
||||||
virtual void Restore();
|
|
||||||
virtual void Activate();
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The client window is a child of the parent MDI frame, and itself
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
||||||
* 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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
public:
|
||||||
public:
|
wxMDIClientWindow() { }
|
||||||
|
virtual ~wxMDIClientWindow();
|
||||||
|
|
||||||
wxMDIClientWindow() ;
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||||
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
long style = wxVSCROLL | wxHSCROLL);
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Gets the size available for subwindows after menu size, toolbar size
|
virtual void DoGetClientSize(int *width, int *height) const;
|
||||||
// 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;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _WX_OSX_CARBON_MDI_H_
|
||||||
// _WX_MDI_H_
|
|
||||||
|
@@ -36,34 +36,28 @@
|
|||||||
class wxMDIClientWindow : public wxWindow
|
class wxMDIClientWindow : public wxWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Default constructor.
|
Default constructor.
|
||||||
*/
|
|
||||||
|
Objects of this class are only created by wxMDIParentFrame which uses
|
||||||
|
the default constructor and calls CreateClient() immediately
|
||||||
|
afterwards.
|
||||||
|
*/
|
||||||
wxMDIClientWindow();
|
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
|
@param parent
|
||||||
The window parent.
|
The window parent.
|
||||||
@param style
|
@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);
|
virtual bool CreateClient(wxMDIParentFrame* parent, long style = 0);
|
||||||
};
|
};
|
||||||
@@ -73,65 +67,45 @@ public:
|
|||||||
/**
|
/**
|
||||||
@class wxMDIParentFrame
|
@class wxMDIParentFrame
|
||||||
|
|
||||||
An MDI (Multiple Document Interface) parent frame is a window which can contain
|
An MDI (Multiple Document Interface) parent frame is a window which can
|
||||||
MDI child frames in its own 'desktop'. It is a convenient way to avoid window
|
contain MDI child frames in its client area which emulates the full
|
||||||
clutter, and is used in many popular Windows applications, such as Microsoft Word(TM).
|
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
|
@remarks
|
||||||
|
|
||||||
There may be multiple MDI parent frames in a single application, but this probably
|
Although it is possible to have multiple MDI parent frames, a typical MDI
|
||||||
only makes sense within programming development environments.
|
application has a single MDI parent frame window inside which multiple MDI
|
||||||
|
child frames, i.e. objects of class wxMDIChildFrame, can be created.
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxCAPTION}
|
|
||||||
Puts a caption on the frame.
|
There are no special styles for this class, all wxFrame styles apply to it
|
||||||
@style{wxDEFAULT_FRAME_STYLE}
|
in the usual way. The only exception is that wxHSCROLL and wxVSCROLL styles
|
||||||
Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
|
apply not to the frame itself but to the client window, so that using them
|
||||||
@c wxSYSTEM_MENU | @c wxCAPTION.
|
enables horizontal and vertical scrollbars for this window and not the
|
||||||
@style{wxHSCROLL}
|
frame.
|
||||||
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.
|
|
||||||
@endStyleTable
|
@endStyleTable
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@@ -145,38 +119,47 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Default constructor.
|
Default constructor.
|
||||||
|
|
||||||
|
Use Create() for the objects created using this constructor.
|
||||||
*/
|
*/
|
||||||
wxMDIParentFrame();
|
wxMDIParentFrame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor, creating the window.
|
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
|
@param parent
|
||||||
The window parent. This should be @NULL.
|
The window parent. Usually is @NULL.
|
||||||
@param id
|
@param id
|
||||||
The window identifier. It may take a value of -1 to indicate a default
|
The window identifier. It may take a value of @c wxID_ANY to
|
||||||
value.
|
indicate a default value.
|
||||||
@param title
|
@param title
|
||||||
The caption to be displayed on the frame's title bar.
|
The caption to be displayed on the frame's title bar.
|
||||||
@param pos
|
@param pos
|
||||||
The window position. The value @c wxDefaultPosition indicates a default position,
|
The window position. The value @c wxDefaultPosition indicates a
|
||||||
chosen by either the windowing system or wxWidgets, depending on platform.
|
default position, chosen by either the windowing system or
|
||||||
|
wxWidgets, depending on platform.
|
||||||
@param size
|
@param size
|
||||||
The window size. The value @c wxDefaultSize indicates a default size, chosen by
|
The window size. The value @c wxDefaultSize indicates a default
|
||||||
either the windowing system or wxWidgets, depending on platform.
|
size, chosen by either the windowing system or wxWidgets, depending
|
||||||
|
on platform.
|
||||||
@param style
|
@param style
|
||||||
The window style. See wxMDIParentFrame.
|
The window style. Default value includes wxHSCROLL and wxVSCROLL
|
||||||
|
styles.
|
||||||
@param name
|
@param name
|
||||||
The name of the window. This parameter is used to associate a 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
|
with the item, allowing the application user to set Motif resource
|
||||||
for individual windows.
|
values for individual windows.
|
||||||
|
|
||||||
@remarks During the construction of the frame, the client window will be
|
@remarks
|
||||||
created. To use a different class from wxMDIClientWindow, override
|
|
||||||
OnCreateClient().
|
Under Windows 95, the client window will automatically have a sunken
|
||||||
Under Windows 95, the client window will automatically have a
|
border style when the active child is not maximized, and no border
|
||||||
sunken border style when the active child is not maximized,
|
style when a child is maximized.
|
||||||
and no border style when a child is maximized.
|
|
||||||
|
|
||||||
@see Create(), OnCreateClient()
|
@see Create(), OnCreateClient()
|
||||||
*/
|
*/
|
||||||
@@ -188,13 +171,19 @@ public:
|
|||||||
const wxString& name = "frame");
|
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();
|
virtual ~wxMDIParentFrame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Activates the MDI child following the currently active one.
|
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()
|
@see ActivatePrevious()
|
||||||
*/
|
*/
|
||||||
virtual void ActivateNext();
|
virtual void ActivateNext();
|
||||||
@@ -209,6 +198,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
Arranges any iconized (minimized) MDI child windows.
|
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()
|
@see Cascade(), Tile()
|
||||||
*/
|
*/
|
||||||
virtual void ArrangeIcons();
|
virtual void ArrangeIcons();
|
||||||
@@ -216,92 +208,76 @@ public:
|
|||||||
/**
|
/**
|
||||||
Arranges the MDI child windows in a cascade.
|
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()
|
@see Tile(), ArrangeIcons()
|
||||||
*/
|
*/
|
||||||
virtual void Cascade();
|
virtual void Cascade();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used in two-step frame construction.
|
Used in two-step frame construction.
|
||||||
|
|
||||||
See wxMDIParentFrame() for further details.
|
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 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);
|
const wxString& name = wxFrameNameStr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a pointer to the active MDI child, if there is one.
|
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;
|
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.
|
Returns a pointer to the client window.
|
||||||
|
|
||||||
@see OnCreateClient()
|
@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
|
Returns whether the MDI implementation is tab-based.
|
||||||
function
|
|
||||||
is available under Windows only.
|
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
|
||||||
wxMenu* GetWindowMenu() const;
|
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
|
Override this to return a different kind of client window.
|
||||||
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.
|
If you override this function, you must create your parent frame in two
|
||||||
For example:
|
stages, or your function will never be called, due to the way C++
|
||||||
|
treats virtual functions called from constructors. For example:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
frame = new MyParentFrame;
|
frame = new MyParentFrame;
|
||||||
@@ -310,8 +286,9 @@ public:
|
|||||||
|
|
||||||
@remarks
|
@remarks
|
||||||
|
|
||||||
You might wish to derive from wxMDIClientWindow in order to implement different
|
You might wish to derive from wxMDIClientWindow in order to implement
|
||||||
erase behaviour, for example, such as painting a bitmap on the background.
|
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
|
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
|
as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar
|
||||||
@@ -322,50 +299,31 @@ public:
|
|||||||
virtual wxMDIClientWindow* OnCreateClient();
|
virtual wxMDIClientWindow* OnCreateClient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the window to be used as a toolbar for this
|
Replace the current MDI Window menu.
|
||||||
MDI parent window. It saves the application having to manage the positioning
|
|
||||||
of the toolbar MDI client window.
|
|
||||||
|
|
||||||
@param toolbar
|
Ownership of the menu object passes to the frame when you call this
|
||||||
Toolbar to manage.
|
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
|
This function is currently not available under OS X.
|
||||||
client area, and the toolbar height is kept the same.
|
|
||||||
|
|
||||||
When the frame is resized, the toolbar is resized to be the width of the frame
|
@param menu
|
||||||
client area, and the toolbar height is kept the same.
|
The menu to be used instead of the standard MDI Window menu or @NULL.
|
||||||
|
|
||||||
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()
|
|
||||||
*/
|
*/
|
||||||
virtual void SetToolBar(wxToolBar* toolbar);
|
void SetWindowMenu(wxMenu *menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call this to change the current Window menu.
|
Tiles the MDI child windows either horizontally or vertically depending
|
||||||
Ownership of the menu object passes to the frame when you call this function.
|
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);
|
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
||||||
};
|
};
|
||||||
@@ -375,48 +333,24 @@ public:
|
|||||||
/**
|
/**
|
||||||
@class wxMDIChildFrame
|
@class wxMDIChildFrame
|
||||||
|
|
||||||
An MDI child frame is a frame that can only exist on a wxMDIClientWindow,
|
An MDI child frame is a frame that can only exist inside a
|
||||||
which is itself a child of wxMDIParentFrame.
|
wxMDIClientWindow, which is itself a child of wxMDIParentFrame.
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxCAPTION}
|
All of the standard wxFrame styles can be used but most of them are ignored
|
||||||
Puts a caption on the frame.
|
by TDI-based MDI implementations.
|
||||||
@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).
|
|
||||||
@endStyleTable
|
@endStyleTable
|
||||||
|
|
||||||
@remarks
|
@remarks
|
||||||
Although internally an MDI child frame is a child of the MDI client window,
|
Although internally an MDI child frame is a child of the MDI client window,
|
||||||
in wxWidgets you create it as a child of wxMDIParentFrame.
|
in wxWidgets you create it as a child of wxMDIParentFrame. In fact, you can
|
||||||
You can usually forget that the client window exists.
|
usually forget that the client window exists. MDI child frames are clipped
|
||||||
MDI child frames are clipped to the area of the MDI client window, and may
|
to the area of the MDI client window, and may be iconized on the client
|
||||||
be iconized on the client window.
|
window. You can associate a menubar with a child frame as usual, although
|
||||||
You can associate a menubar with a child frame as usual, although an MDI
|
an MDI child doesn't display its menubar under its own title bar. The MDI
|
||||||
child doesn't display its menubar under its own title bar.
|
parent frame's menubar will be changed to reflect the currently active
|
||||||
The MDI parent frame's menubar will be changed to reflect the currently
|
child frame. If there are currently no children, the parent frame's own
|
||||||
active child frame.
|
menubar will be displayed.
|
||||||
If there are currently no children, the parent frame's own menubar will
|
|
||||||
be displayed.
|
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{managedwnd}
|
@category{managedwnd}
|
||||||
@@ -426,7 +360,6 @@ public:
|
|||||||
class wxMDIChildFrame : public wxFrame
|
class wxMDIChildFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Default constructor.
|
Default constructor.
|
||||||
*/
|
*/
|
||||||
@@ -486,15 +419,41 @@ public:
|
|||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr);
|
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.
|
Maximizes this MDI child frame.
|
||||||
|
|
||||||
|
This function doesn't do anything if IsAlwaysMaximized() returns @true.
|
||||||
|
|
||||||
@see Activate(), Restore()
|
@see Activate(), Restore()
|
||||||
*/
|
*/
|
||||||
virtual void Maximize(bool maximize = true);
|
virtual void Maximize(bool maximize = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Restores this MDI child frame (unmaximizes).
|
Restores this MDI child frame (unmaximizes).
|
||||||
|
|
||||||
|
This function doesn't do anything if IsAlwaysMaximized() returns @true.
|
||||||
|
|
||||||
|
@see Activate(), Maximize()
|
||||||
*/
|
*/
|
||||||
virtual void Restore();
|
virtual void Restore();
|
||||||
};
|
};
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
// Name: mdi.cpp
|
// Name: mdi.cpp
|
||||||
// Purpose: MDI sample
|
// Purpose: MDI sample
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: 2008-10-31 Vadim Zeitlin: big clean up
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1997 Julian Smart
|
||||||
|
// (c) 2008 Vadim Zeitlin
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -45,42 +46,36 @@
|
|||||||
#include "bitmaps/print.xpm"
|
#include "bitmaps/print.xpm"
|
||||||
#include "bitmaps/help.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"
|
#include "mdi.h"
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
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
|
// event tables
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
|
||||||
EVT_MENU(MDI_ABOUT, MyFrame::OnAbout)
|
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||||
EVT_MENU(MDI_NEW_WINDOW, MyFrame::OnNewWindow)
|
EVT_MENU(wxID_NEW, MyFrame::OnNewWindow)
|
||||||
EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
|
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||||
|
|
||||||
EVT_CLOSE(MyFrame::OnClose)
|
EVT_CLOSE(MyFrame::OnClose)
|
||||||
EVT_SIZE(MyFrame::OnSize)
|
|
||||||
END_EVENT_TABLE()
|
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
|
// to the parent window for processing, so no need to
|
||||||
// duplicate event handlers here.
|
// duplicate event handlers here.
|
||||||
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
|
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_REFRESH, MyChild::OnRefresh)
|
||||||
EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
|
EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
|
||||||
EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
|
EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
|
||||||
@@ -94,7 +89,7 @@ BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
|
|||||||
EVT_SIZE(MyChild::OnSize)
|
EVT_SIZE(MyChild::OnSize)
|
||||||
EVT_MOVE(MyChild::OnMove)
|
EVT_MOVE(MyChild::OnMove)
|
||||||
|
|
||||||
EVT_CLOSE(MyChild::OnClose)
|
EVT_CLOSE(MyChild::OnCloseWindow)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||||
@@ -117,44 +112,10 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
|
|
||||||
frame = new MyFrame((wxFrame *)NULL, wxID_ANY, _T("MDI Demo"),
|
MyFrame *frame = new MyFrame;
|
||||||
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
|
|
||||||
|
|
||||||
frame->Show(true);
|
frame->Show(true);
|
||||||
|
|
||||||
SetTopWindow(frame);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,17 +124,46 @@ bool MyApp::OnInit()
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
MyFrame::MyFrame(wxWindow *parent,
|
MyFrame::MyFrame()
|
||||||
const wxWindowID id,
|
: wxMDIParentFrame(NULL, wxID_ANY, "wxWidgets MDI Sample",
|
||||||
const wxString& title,
|
wxDefaultPosition, wxSize(500, 400))
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
const long style)
|
|
||||||
: wxMDIParentFrame(parent, id, title, pos, size, style)
|
|
||||||
{
|
{
|
||||||
textWindow = new wxTextCtrl(this, wxID_ANY, _T("A help window"),
|
SetIcon(wxICON(sample));
|
||||||
wxDefaultPosition, wxDefaultSize,
|
|
||||||
wxTE_MULTILINE | wxSUNKEN_BORDER);
|
// 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
|
#if wxUSE_TOOLBAR
|
||||||
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
|
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
|
||||||
@@ -183,21 +173,32 @@ MyFrame::MyFrame(wxWindow *parent,
|
|||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
// Accelerators
|
// Accelerators
|
||||||
wxAcceleratorEntry entries[3];
|
wxAcceleratorEntry entries[3];
|
||||||
entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW);
|
entries[0].Set(wxACCEL_CTRL, (int) 'N', wxID_NEW);
|
||||||
entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT);
|
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
|
||||||
entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT);
|
entries[2].Set(wxACCEL_CTRL, (int) 'A', wxID_ABOUT);
|
||||||
wxAcceleratorTable accel(3, entries);
|
wxAcceleratorTable accel(3, entries);
|
||||||
SetAcceleratorTable(accel);
|
SetAcceleratorTable(accel);
|
||||||
#endif // wxUSE_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)
|
void MyFrame::OnClose(wxCloseEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.CanVeto() && (gs_nFrames > 0) )
|
unsigned numChildren = MyChild::GetChildrenCount();
|
||||||
|
if ( event.CanVeto() && (numChildren > 0) )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(_T("%d windows still open, close anyhow?"), gs_nFrames);
|
msg.Printf("%d windows still open, close anyhow?", numChildren);
|
||||||
if ( wxMessageBox(msg, _T("Please confirm"),
|
if ( wxMessageBox(msg, "Please confirm",
|
||||||
wxICON_QUESTION | wxYES_NO) != wxYES )
|
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||||
{
|
{
|
||||||
event.Veto();
|
event.Veto();
|
||||||
@@ -216,66 +217,15 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
(void)wxMessageBox(_T("wxWidgets 2.0 MDI Demo\n")
|
(void)wxMessageBox("wxWidgets 2.0 MDI Demo\n"
|
||||||
_T("Author: Julian Smart (c) 1997\n")
|
"Author: Julian Smart (c) 1997\n"
|
||||||
_T("Usage: mdi.exe"), _T("About MDI Demo"));
|
"Usage: mdi.exe", "About MDI Demo");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// Make another frame, containing a canvas
|
// create and show another child frame
|
||||||
MyChild *subframe = new MyChild(frame, _T("Canvas Frame"));
|
MyChild *subframe = new MyChild(this);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
subframe->Show(true);
|
subframe->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +240,7 @@ void MyFrame::OnSize(wxSizeEvent&
|
|||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&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);
|
GetClientWindow()->SetSize(200, 0, w - 200, h);
|
||||||
|
|
||||||
// FIXME: On wxX11, we need the MDI frame to process this
|
// 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[6] = wxBitmap( print_xpm );
|
||||||
bitmaps[7] = wxBitmap( help_xpm );
|
bitmaps[7] = wxBitmap( help_xpm );
|
||||||
|
|
||||||
toolBar->AddTool(MDI_NEW_WINDOW, _T("New"), bitmaps[0], _T("New file"));
|
toolBar->AddTool(wxID_NEW, "New", bitmaps[0], "New file");
|
||||||
toolBar->AddTool(1, _T("Open"), bitmaps[1], _T("Open file"));
|
toolBar->AddTool(1, "Open", bitmaps[1], "Open file");
|
||||||
toolBar->AddTool(2, _T("Save"), bitmaps[2], _T("Save file"));
|
toolBar->AddTool(2, "Save", bitmaps[2], "Save file");
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(3, _T("Copy"), bitmaps[3], _T("Copy"));
|
toolBar->AddTool(3, "Copy", bitmaps[3], "Copy");
|
||||||
toolBar->AddTool(4, _T("Cut"), bitmaps[4], _T("Cut"));
|
toolBar->AddTool(4, "Cut", bitmaps[4], "Cut");
|
||||||
toolBar->AddTool(5, _T("Paste"), bitmaps[5], _T("Paste"));
|
toolBar->AddTool(5, "Paste", bitmaps[5], "Paste");
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(6, _T("Print"), bitmaps[6], _T("Print"));
|
toolBar->AddTool(6, "Print", bitmaps[6], "Print");
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(MDI_ABOUT, _T("About"), bitmaps[7], _T("Help"));
|
toolBar->AddTool(wxID_ABOUT, "About", bitmaps[7], "Help");
|
||||||
|
|
||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
}
|
}
|
||||||
@@ -342,7 +292,10 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
|||||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||||
wxVSCROLL | wxHSCROLL)
|
wxVSCROLL | wxHSCROLL)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxColour(_T("WHITE")));
|
SetBackgroundColour(wxColour("WHITE"));
|
||||||
|
SetCursor(wxCursor(wxCURSOR_PENCIL));
|
||||||
|
|
||||||
|
SetScrollbars(20, 20, 50, 50);
|
||||||
|
|
||||||
m_dirty = false;
|
m_dirty = false;
|
||||||
}
|
}
|
||||||
@@ -368,7 +321,7 @@ void MyCanvas::OnDraw(wxDC& dc)
|
|||||||
dc.DrawSpline(50, 200, 50, 100, 200, 10);
|
dc.DrawSpline(50, 200, 50, 100, 200, 10);
|
||||||
#endif // wxUSE_SPLINES
|
#endif // wxUSE_SPLINES
|
||||||
dc.DrawLine(50, 230, 200, 230);
|
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];
|
wxPoint points[3];
|
||||||
points[0].x = 200; points[0].y = 300;
|
points[0].x = 200; points[0].y = 300;
|
||||||
@@ -387,6 +340,9 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
wxPoint pt(event.GetLogicalPosition(dc));
|
wxPoint pt(event.GetLogicalPosition(dc));
|
||||||
|
|
||||||
|
static long xpos = -1;
|
||||||
|
static long ypos = -1;
|
||||||
|
|
||||||
if (xpos > -1 && ypos > -1 && event.Dragging())
|
if (xpos > -1 && ypos > -1 && event.Dragging())
|
||||||
{
|
{
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
@@ -403,31 +359,80 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
|
|||||||
// MyChild
|
// MyChild
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title)
|
unsigned MyChild::ms_numChildren = 0;
|
||||||
: wxMDIChildFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize,
|
|
||||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
|
||||||
{
|
|
||||||
canvas = (MyCanvas *) NULL;
|
|
||||||
my_children.Append(this);
|
|
||||||
|
|
||||||
// this should work for MDI frames as well as for normal ones
|
MyChild::MyChild(wxMDIParentFrame *parent)
|
||||||
SetSizeHints(100, 100);
|
: 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()
|
MyChild::~MyChild()
|
||||||
{
|
{
|
||||||
my_children.DeleteObject(this);
|
ms_numChildren--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyChild::OnClose(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyChild::OnRefresh(wxCommandEvent& WXUNUSED(event))
|
void MyChild::OnRefresh(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( canvas )
|
if ( m_canvas )
|
||||||
canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyChild::OnChangePosition(wxCommandEvent& WXUNUSED(event))
|
void MyChild::OnChangePosition(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -443,10 +448,10 @@ void MyChild::OnChangeSize(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event))
|
void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#if wxUSE_TEXTDLG
|
#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"),
|
wxString title = wxGetTextFromUser("Enter the new title for MDI child",
|
||||||
_T("MDI sample question"),
|
"MDI sample question",
|
||||||
s_title,
|
s_title,
|
||||||
GetParent()->GetParent());
|
GetParent()->GetParent());
|
||||||
if ( !title )
|
if ( !title )
|
||||||
@@ -459,8 +464,8 @@ void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyChild::OnActivate(wxActivateEvent& event)
|
void MyChild::OnActivate(wxActivateEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.GetActive() && canvas )
|
if ( event.GetActive() && m_canvas )
|
||||||
canvas->SetFocus();
|
m_canvas->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyChild::OnMove(wxMoveEvent& event)
|
void MyChild::OnMove(wxMoveEvent& event)
|
||||||
@@ -470,7 +475,7 @@ void MyChild::OnMove(wxMoveEvent& event)
|
|||||||
// to be the width of the MDI canvas border)
|
// to be the width of the MDI canvas border)
|
||||||
wxPoint pos1 = event.GetPosition(),
|
wxPoint pos1 = event.GetPosition(),
|
||||||
pos2 = 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);
|
pos1.x, pos1.y, pos2.x, pos2.y);
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@@ -484,17 +489,17 @@ void MyChild::OnSize(wxSizeEvent& event)
|
|||||||
wxSize size1 = event.GetSize(),
|
wxSize size1 = event.GetSize(),
|
||||||
size2 = GetSize(),
|
size2 = GetSize(),
|
||||||
size3 = GetClientSize();
|
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);
|
size1.x, size1.y, size2.x, size2.y, size3.x, size3.y);
|
||||||
|
|
||||||
event.Skip();
|
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 )
|
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||||
{
|
{
|
||||||
event.Veto();
|
event.Veto();
|
||||||
@@ -503,8 +508,6 @@ void MyChild::OnClose(wxCloseEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gs_nFrames--;
|
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,13 +519,9 @@ void MyChild::OnPaste(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxClipboardLocker lock;
|
wxClipboardLocker lock;
|
||||||
wxTextDataObject data;
|
wxTextDataObject data;
|
||||||
canvas->SetText(
|
m_canvas->SetText(wxTheClipboard->GetData(data)
|
||||||
(
|
? data.GetText()
|
||||||
wxTheClipboard->GetData(data) ?
|
: wxString("No text on clipboard"));
|
||||||
data.GetText() :
|
|
||||||
wxString("No text on clipboard")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyChild::OnUpdatePaste(wxUpdateUIEvent& event)
|
void MyChild::OnUpdatePaste(wxUpdateUIEvent& event)
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
class MyApp : public wxApp
|
class MyApp : public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
virtual bool OnInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyCanvas : public wxScrolledWindow
|
class MyCanvas : public wxScrolledWindow
|
||||||
@@ -26,11 +26,11 @@ public:
|
|||||||
|
|
||||||
bool IsDirty() const { return m_dirty; }
|
bool IsDirty() const { return m_dirty; }
|
||||||
|
|
||||||
void OnEvent(wxMouseEvent& event);
|
|
||||||
|
|
||||||
void SetText(const wxString& text) { m_text = text; Refresh(); }
|
void SetText(const wxString& text) { m_text = text; Refresh(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnEvent(wxMouseEvent& event);
|
||||||
|
|
||||||
wxString m_text;
|
wxString m_text;
|
||||||
|
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
@@ -42,11 +42,10 @@ private:
|
|||||||
class MyFrame : public wxMDIParentFrame
|
class MyFrame : public wxMDIParentFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTextCtrl *textWindow;
|
MyFrame();
|
||||||
|
virtual ~MyFrame();
|
||||||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
|
||||||
const wxPoint& pos, const wxSize& size, const long style);
|
|
||||||
|
|
||||||
|
private:
|
||||||
void InitToolBar(wxToolBar* toolBar);
|
void InitToolBar(wxToolBar* toolBar);
|
||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
@@ -55,16 +54,20 @@ public:
|
|||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
|
|
||||||
|
wxTextCtrl *m_textWindow;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyChild: public wxMDIChildFrame
|
class MyChild : public wxMDIChildFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas *canvas;
|
MyChild(wxMDIParentFrame *parent);
|
||||||
MyChild(wxMDIParentFrame *parent, const wxString& title);
|
virtual ~MyChild();
|
||||||
~MyChild();
|
|
||||||
|
|
||||||
|
static unsigned GetChildrenCount() { return ms_numChildren; }
|
||||||
|
|
||||||
|
private:
|
||||||
void OnActivate(wxActivateEvent& event);
|
void OnActivate(wxActivateEvent& event);
|
||||||
|
|
||||||
void OnRefresh(wxCommandEvent& event);
|
void OnRefresh(wxCommandEvent& event);
|
||||||
@@ -72,28 +75,28 @@ public:
|
|||||||
void OnChangeTitle(wxCommandEvent& event);
|
void OnChangeTitle(wxCommandEvent& event);
|
||||||
void OnChangePosition(wxCommandEvent& event);
|
void OnChangePosition(wxCommandEvent& event);
|
||||||
void OnChangeSize(wxCommandEvent& event);
|
void OnChangeSize(wxCommandEvent& event);
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnClose(wxCommandEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnMove(wxMoveEvent& event);
|
void OnMove(wxMoveEvent& event);
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
void OnPaste(wxCommandEvent& event);
|
void OnPaste(wxCommandEvent& event);
|
||||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
|
static unsigned ms_numChildren;
|
||||||
|
|
||||||
|
MyCanvas *m_canvas;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
// menu items ids
|
// menu items ids
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MDI_QUIT = wxID_EXIT,
|
|
||||||
MDI_NEW_WINDOW = 101,
|
|
||||||
MDI_REFRESH,
|
MDI_REFRESH,
|
||||||
MDI_CHANGE_TITLE,
|
MDI_CHANGE_TITLE,
|
||||||
MDI_CHANGE_POSITION,
|
MDI_CHANGE_POSITION,
|
||||||
MDI_CHANGE_SIZE,
|
MDI_CHANGE_SIZE
|
||||||
MDI_CHILD_QUIT,
|
|
||||||
MDI_ABOUT = wxID_ABOUT
|
|
||||||
};
|
};
|
||||||
|
@@ -129,35 +129,12 @@ void wxMDIParentFrame::RemoveMDIChild(wxMDIChildFrame *child)
|
|||||||
SetActiveChild(NULL);
|
SetActiveChild(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|
||||||
{
|
|
||||||
return m_currentChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIParentFrame::SetActiveChild(wxMDIChildFrame *child)
|
void wxMDIParentFrame::SetActiveChild(wxMDIChildFrame *child)
|
||||||
{
|
{
|
||||||
m_currentChild = child;
|
m_currentChild = child;
|
||||||
wxMenuBarManager::GetInstance()->UpdateMenuBar();
|
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)
|
wxMenuBar *wxMDIParentFrame::GetAppMenuBar(wxCocoaNSWindow *win)
|
||||||
{
|
{
|
||||||
if(m_currentChild && (win==this))
|
if(m_currentChild && (win==this))
|
||||||
@@ -324,22 +301,9 @@ bool wxMDIChildFrame::Destroy()
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
|
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)
|
#endif // wxUSE_MDI
|
||||||
:wxWindow(parent, wxID_ANY)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow::~wxMDIClientWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
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
|
// send activate event to new child
|
||||||
|
|
||||||
wxMDIClientWindow *client_window = parent->GetClientWindow();
|
wxMDIClientWindowBase *client_window = parent->GetClientWindow();
|
||||||
if (!client_window)
|
if ( !client_window )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
child = (wxMDIChildFrame*) NULL;
|
child = NULL;
|
||||||
|
|
||||||
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
||||||
while ( node )
|
while ( node )
|
||||||
@@ -84,11 +84,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
|||||||
void wxMDIParentFrame::Init()
|
void wxMDIParentFrame::Init()
|
||||||
{
|
{
|
||||||
m_justInserted = false;
|
m_justInserted = false;
|
||||||
m_clientWindow = (wxMDIClientWindow *) NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIParentFrame::~wxMDIParentFrame()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||||
@@ -103,13 +98,15 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_clientWindow = OnCreateClient();
|
m_clientWindow = OnCreateClient();
|
||||||
|
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
|
||||||
|
return false;
|
||||||
|
|
||||||
return m_clientWindow != NULL;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnInternalIdle()
|
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
|
it has to be brought to the top in idle time. we
|
||||||
simply set the last notebook page active as new
|
simply set the last notebook page active as new
|
||||||
pages can only be appended at the end */
|
pages can only be appended at the end */
|
||||||
@@ -209,27 +206,27 @@ void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const
|
|||||||
|
|
||||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||||
{
|
{
|
||||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
if (!m_clientWindow) return NULL;
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
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 );
|
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);
|
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();
|
wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
if ( wxPendingDelete.Member(node->GetData()) )
|
if ( wxPendingDelete.Member(node->GetData()) )
|
||||||
return (wxMDIChildFrame*) NULL;
|
return NULL;
|
||||||
|
|
||||||
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
|
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
|
||||||
|
|
||||||
if (!child_frame)
|
if (!child_frame)
|
||||||
return (wxMDIChildFrame*) NULL;
|
return NULL;
|
||||||
|
|
||||||
if (child_frame->m_page == page)
|
if (child_frame->m_page == page)
|
||||||
return child_frame;
|
return child_frame;
|
||||||
@@ -237,17 +234,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (wxMDIChildFrame*) NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
|
|
||||||
{
|
|
||||||
return m_clientWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
|
||||||
{
|
|
||||||
return new wxMDIClientWindow( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivateNext()
|
void wxMDIParentFrame::ActivateNext()
|
||||||
@@ -273,68 +260,40 @@ BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
|
|||||||
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame()
|
void wxMDIChildFrame::Init()
|
||||||
{
|
{
|
||||||
m_menuBar = (wxMenuBar *) NULL;
|
m_menuBar = NULL;
|
||||||
m_page = (GtkNotebookPage *) NULL;
|
m_page = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id, const wxString& title,
|
wxWindowID id,
|
||||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
const wxString& title,
|
||||||
long style, const wxString& name )
|
const wxPoint& WXUNUSED(pos),
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_menuBar = (wxMenuBar *) NULL;
|
m_mdiParent = parent;
|
||||||
m_page = (GtkNotebookPage *) NULL;
|
m_title = title;
|
||||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
|
||||||
|
return wxWindow::Create(parent->GetClientWindow(), id,
|
||||||
|
wxDefaultPosition, size,
|
||||||
|
style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMDIChildFrame::~wxMDIChildFrame()
|
wxMDIChildFrame::~wxMDIChildFrame()
|
||||||
{
|
{
|
||||||
if (m_menuBar)
|
delete m_menuBar;
|
||||||
delete m_menuBar;
|
|
||||||
|
|
||||||
// wxMDIClientWindow does not get redrawn properly after last child is removed
|
// wxMDIClientWindow does not get redrawn properly after last child is removed
|
||||||
if (m_parent && m_parent->GetChildren().size() <= 1)
|
if (m_parent && m_parent->GetChildren().size() <= 1)
|
||||||
gtk_widget_queue_draw(m_parent->m_widget);
|
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 )
|
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;
|
m_menuBar = menu_bar;
|
||||||
|
|
||||||
@@ -365,10 +324,20 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
|
|||||||
return m_menuBar;
|
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()
|
void wxMDIChildFrame::Activate()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
GtkNotebook * const notebook = GTKGetNotebook();
|
||||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||||
|
|
||||||
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
||||||
gtk_notebook_set_current_page( notebook, pageno );
|
gtk_notebook_set_current_page( notebook, pageno );
|
||||||
}
|
}
|
||||||
@@ -397,56 +366,24 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
|||||||
|
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
|
||||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
GtkNotebook * const notebook = GTKGetNotebook();
|
||||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||||
gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) );
|
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
|
// wxMDIClientWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||||
|
|
||||||
wxMDIClientWindow::wxMDIClientWindow()
|
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||||
{
|
{
|
||||||
}
|
if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
|
||||||
|
!CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
|
style, wxDefaultValidator, "wxMDIClientWindow" ))
|
||||||
{
|
|
||||||
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") ))
|
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") );
|
wxFAIL_MSG( "wxMDIClientWindow creation failed" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,4 +404,24 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
|||||||
return true;
|
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
|
#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
|
// send activate event to new child
|
||||||
|
|
||||||
wxMDIClientWindow *client_window = parent->GetClientWindow();
|
wxMDIClientWindowBase * const client_window = parent->GetClientWindow();
|
||||||
if (!client_window)
|
if ( !client_window )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
child = (wxMDIChildFrame*) NULL;
|
child = NULL;
|
||||||
|
|
||||||
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -113,11 +113,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
|||||||
void wxMDIParentFrame::Init()
|
void wxMDIParentFrame::Init()
|
||||||
{
|
{
|
||||||
m_justInserted = false;
|
m_justInserted = false;
|
||||||
m_clientWindow = (wxMDIClientWindow *) NULL;
|
m_clientWindow = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIParentFrame::~wxMDIParentFrame()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||||
@@ -132,8 +128,10 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_clientWindow = OnCreateClient();
|
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 )
|
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
|
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||||
{
|
{
|
||||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
if (!m_clientWindow) return NULL;
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
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 );
|
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);
|
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();
|
wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -281,17 +274,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (wxMDIChildFrame*) NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
|
|
||||||
{
|
|
||||||
return m_clientWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
|
||||||
{
|
|
||||||
return new wxMDIClientWindow( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivateNext()
|
void wxMDIParentFrame::ActivateNext()
|
||||||
@@ -317,26 +300,10 @@ BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
|
|||||||
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame()
|
void wxMDIChildFrame::Init()
|
||||||
{
|
{
|
||||||
m_menuBar = (wxMenuBar *) NULL;
|
m_menuBar = NULL;
|
||||||
m_page = (GtkNotebookPage *) 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 )
|
|
||||||
{
|
|
||||||
m_menuBar = (wxMenuBar *) NULL;
|
|
||||||
m_page = (GtkNotebookPage *) NULL;
|
|
||||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIChildFrame::~wxMDIChildFrame()
|
|
||||||
{
|
|
||||||
if (m_menuBar)
|
|
||||||
delete m_menuBar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||||
@@ -349,24 +316,9 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
|||||||
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
|
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 );
|
delete m_menuBar;
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||||
@@ -393,10 +345,20 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
|
|||||||
return m_menuBar;
|
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()
|
void wxMDIChildFrame::Activate()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
GtkNotebook * const notebook = GTKGetNotebook();
|
||||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||||
|
|
||||||
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
gint pageno = gtk_notebook_page_num( notebook, m_widget );
|
||||||
gtk_notebook_set_page( notebook, pageno );
|
gtk_notebook_set_page( notebook, pageno );
|
||||||
}
|
}
|
||||||
@@ -425,8 +387,9 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
|||||||
|
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
|
||||||
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
|
GtkNotebook * const notebook = GTKGetNotebook();
|
||||||
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
|
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||||
|
|
||||||
gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) );
|
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)
|
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 )
|
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||||
{
|
{
|
||||||
m_needParent = true;
|
m_needParent = true;
|
||||||
|
@@ -59,18 +59,15 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxNotebook)
|
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxNotebook)
|
||||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(wxID_NOTEBOOK_CLIENT_AREA, wxMDIClientWindow::OnPageChanged)
|
EVT_NOTEBOOK_PAGE_CHANGED(wxID_NOTEBOOK_CLIENT_AREA, wxMDIClientWindow::OnPageChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
// Parent frame
|
// Parent frame
|
||||||
|
|
||||||
wxMDIParentFrame::wxMDIParentFrame()
|
void wxMDIParentFrame::Init()
|
||||||
{
|
{
|
||||||
m_clientWindow = (wxMDIClientWindow*) NULL;
|
m_activeMenuBar = NULL;
|
||||||
m_activeChild = (wxMDIChildFrame*) NULL;
|
|
||||||
m_activeMenuBar = (wxMenuBar*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||||
@@ -81,29 +78,17 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_clientWindow = (wxMDIClientWindow*) NULL;
|
if ( !wxFrame::Create(parent, id, title, pos, size, style, name) )
|
||||||
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
|
|
||||||
return false;
|
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()
|
wxMDIParentFrame::~wxMDIParentFrame()
|
||||||
@@ -121,7 +106,7 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
|||||||
{
|
{
|
||||||
m_frameMenuBar = menu_bar;
|
m_frameMenuBar = menu_bar;
|
||||||
|
|
||||||
SetChildMenuBar((wxMDIChildFrame*) NULL);
|
SetChildMenuBar(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||||
@@ -139,35 +124,17 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
|||||||
GetClientWindow()->SetSize(x, y, width, height);
|
GetClientWindow()->SetSize(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::DoGetClientSize(int *width, int *height) const
|
|
||||||
{
|
|
||||||
wxFrame::DoGetClientSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
|
void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// Do nothing
|
// 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
|
// Set the child's menu into the parent frame
|
||||||
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
||||||
{
|
{
|
||||||
wxMenuBar* oldMenuBar = m_activeMenuBar;
|
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))
|
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))
|
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
|
||||||
{
|
{
|
||||||
@@ -231,9 +198,9 @@ bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
|
|||||||
inEvent = event.GetEventType();
|
inEvent = event.GetEventType();
|
||||||
|
|
||||||
bool res = false;
|
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)
|
if (!res)
|
||||||
@@ -244,18 +211,6 @@ bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
|
|||||||
return res;
|
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.
|
// Responds to colour changes, and passes event on to children.
|
||||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
@@ -265,32 +220,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
wxFrame::OnSysColourChanged(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
|
// Default menu selection behaviour - display a help string
|
||||||
void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
||||||
{
|
{
|
||||||
@@ -300,7 +229,7 @@ void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
|||||||
SetStatusText(wxEmptyString);
|
SetStatusText(wxEmptyString);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMenuBar *menuBar = (wxMenuBar*) NULL;
|
wxMenuBar *menuBar = NULL;
|
||||||
if (GetActiveChild())
|
if (GetActiveChild())
|
||||||
menuBar = GetActiveChild()->GetMenuBar();
|
menuBar = GetActiveChild()->GetMenuBar();
|
||||||
else
|
else
|
||||||
@@ -317,11 +246,6 @@ void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
|
|||||||
|
|
||||||
// Child frame
|
// Child frame
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame()
|
|
||||||
{
|
|
||||||
m_mdiParentFrame = (wxMDIParentFrame*) NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
@@ -344,7 +268,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
|
|
||||||
clientWindow->AddChild(this);
|
clientWindow->AddChild(this);
|
||||||
|
|
||||||
SetMDIParentFrame(parent);
|
m_mdiParent = parent;
|
||||||
PreCreation();
|
PreCreation();
|
||||||
|
|
||||||
int width = size.x;
|
int width = size.x;
|
||||||
@@ -414,7 +338,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
wxMDIParentFrame* parentFrame = GetMDIParentFrame();
|
wxMDIParentFrame* parentFrame = GetMDIParentFrame();
|
||||||
|
|
||||||
if (parentFrame->GetActiveChild() == this)
|
if (parentFrame->GetActiveChild() == this)
|
||||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
parentFrame->SetActiveChild(NULL);
|
||||||
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
|
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
|
||||||
|
|
||||||
// Remove page if still there
|
// Remove page if still there
|
||||||
@@ -437,76 +361,12 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
parentFrame->SetActiveChild(NULL);
|
||||||
parentFrame->SetChildMenuBar((wxMDIChildFrame*) 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)
|
bool wxMDIChildFrame::Show(bool show)
|
||||||
{
|
{
|
||||||
SetVisibleStatus( show );
|
SetVisibleStatus( show );
|
||||||
@@ -524,63 +384,14 @@ void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
|
|||||||
GetMDIParentFrame()->SetChildMenuBar(this);
|
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)
|
void wxMDIChildFrame::SetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
wxTopLevelWindow::SetTitle( title );
|
m_title = title;
|
||||||
wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
|
wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
|
||||||
|
|
||||||
// Remove page if still there
|
int i = clientWindow->FindPage(this);
|
||||||
{
|
if (i != wxNOT_FOUND)
|
||||||
int i = clientWindow->FindPage(this);
|
clientWindow->SetPageText(i, title);
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIChildFrame::Activate()
|
void wxMDIChildFrame::Activate()
|
||||||
@@ -588,36 +399,8 @@ void wxMDIChildFrame::Activate()
|
|||||||
// TODO
|
// 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
|
// Client window
|
||||||
|
|
||||||
wxMDIClientWindow::wxMDIClientWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow::~wxMDIClientWindow()
|
wxMDIClientWindow::~wxMDIClientWindow()
|
||||||
{
|
{
|
||||||
// By the time this destructor is called, the child frames will have been
|
// 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);
|
SetWindowStyleFlag(style);
|
||||||
|
|
||||||
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
|
if ( !wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA,
|
||||||
if (success)
|
wxPoint(0, 0), wxSize(100, 100), 0) )
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMDIClientWindow::FindPage(const wxNotebookPage* page)
|
int wxMDIClientWindow::FindPage(const wxNotebookPage* page)
|
||||||
@@ -651,37 +432,6 @@ int wxMDIClientWindow::FindPage(const wxNotebookPage* page)
|
|||||||
return -1;
|
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)
|
void wxMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
|
||||||
{
|
{
|
||||||
// Notify child that it has been activated
|
// Notify child that it has been activated
|
||||||
|
@@ -140,9 +140,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxMDIParentFrame::wxMDIParentFrame()
|
wxMDIParentFrame::wxMDIParentFrame()
|
||||||
{
|
{
|
||||||
m_clientWindow = NULL;
|
|
||||||
m_currentChild = NULL;
|
|
||||||
m_windowMenu = NULL;
|
|
||||||
m_parentFrameActive = true;
|
m_parentFrameActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,17 +151,11 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_clientWindow = NULL;
|
|
||||||
m_currentChild = NULL;
|
|
||||||
|
|
||||||
// this style can be used to prevent a window from having the standard MDI
|
// this style can be used to prevent a window from having the standard MDI
|
||||||
// "Window" menu
|
// "Window" menu
|
||||||
if ( style & wxFRAME_NO_WINDOW_MENU )
|
if ( !(style & wxFRAME_NO_WINDOW_MENU) )
|
||||||
{
|
|
||||||
m_windowMenu = NULL;
|
|
||||||
}
|
|
||||||
else // normal case: we have the window menu, so construct it
|
|
||||||
{
|
{
|
||||||
|
// normal case: we have the window menu, so construct it
|
||||||
m_windowMenu = new wxMenu;
|
m_windowMenu = new wxMenu;
|
||||||
|
|
||||||
m_windowMenu->Append(IDM_WINDOWCASCADE, _("&Cascade"));
|
m_windowMenu->Append(IDM_WINDOWCASCADE, _("&Cascade"));
|
||||||
@@ -226,8 +217,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
delete m_windowMenu;
|
|
||||||
|
|
||||||
// the MDI frame menubar is not automatically deleted by Windows unlike for
|
// the MDI frame menubar is not automatically deleted by Windows unlike for
|
||||||
// the normal frames
|
// the normal frames
|
||||||
if ( m_hMenu )
|
if ( m_hMenu )
|
||||||
@@ -319,20 +308,15 @@ void wxMDIParentFrame::InternalSetMenuBar()
|
|||||||
|
|
||||||
void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
|
void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
|
||||||
{
|
{
|
||||||
if (m_windowMenu)
|
// notice that Remove/AddWindowMenu() are safe to call even when
|
||||||
{
|
// m_windowMenu is NULL
|
||||||
RemoveWindowMenu();
|
RemoveWindowMenu();
|
||||||
|
|
||||||
delete m_windowMenu;
|
delete m_windowMenu;
|
||||||
m_windowMenu = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menu)
|
m_windowMenu = menu;
|
||||||
{
|
|
||||||
m_windowMenu = menu;
|
|
||||||
|
|
||||||
AddWindowMenu();
|
AddWindowMenu();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
|
void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
|
||||||
@@ -411,13 +395,6 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
return (wxMDIChildFrame *)wxFindWinFromHandle(hWnd);
|
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.
|
// Responds to colour changes, and passes event on to children.
|
||||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
@@ -738,6 +715,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
m_mdiParent = parent;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
if ( id != wxID_ANY )
|
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 need to refresh the MDI frame window menu to include (or exclude if
|
||||||
// we've been hidden) this frame
|
// we've been hidden) this frame
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
MDISetMenu(parent->GetClientWindow(), NULL, NULL);
|
MDISetMenu(parent->GetClientWindow(), NULL, NULL);
|
||||||
|
|
||||||
return true;
|
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
|
// If there's an MDI parent, must subtract the parent's top left corner
|
||||||
// since MoveWindow moves relative to the parent
|
// since MoveWindow moves relative to the parent
|
||||||
wxMDIParentFrame *mdiParent = GetMDIParent();
|
wxMDIParentFrame * const mdiParent = GetMDIParent();
|
||||||
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
|
::ScreenToClient(GetHwndOf(mdiParent->GetClientWindow()), &point);
|
||||||
|
|
||||||
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
|
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,
|
// Since we now have the absolute screen coords,
|
||||||
// if there's a parent we must subtract its top left corner
|
// if there's a parent we must subtract its top left corner
|
||||||
wxMDIParentFrame *mdiParent = GetMDIParent();
|
wxMDIParentFrame * const mdiParent = GetMDIParent();
|
||||||
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
|
::ScreenToClient(GetHwndOf(mdiParent->GetClientWindow()), &point);
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
*x = point.x;
|
*x = point.x;
|
||||||
@@ -945,7 +924,7 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
|
|||||||
|
|
||||||
void wxMDIChildFrame::InternalSetMenuBar()
|
void wxMDIChildFrame::InternalSetMenuBar()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
|
|
||||||
MDIInsertWindowMenu(parent->GetClientWindow(),
|
MDIInsertWindowMenu(parent->GetClientWindow(),
|
||||||
m_hMenu, GetMDIWindowMenu(parent));
|
m_hMenu, GetMDIWindowMenu(parent));
|
||||||
@@ -971,7 +950,7 @@ WXHICON wxMDIChildFrame::GetDefaultIcon() const
|
|||||||
|
|
||||||
void wxMDIChildFrame::Maximize(bool maximize)
|
void wxMDIChildFrame::Maximize(bool maximize)
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
if ( parent && parent->GetClientWindow() )
|
if ( parent && parent->GetClientWindow() )
|
||||||
{
|
{
|
||||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()),
|
::SendMessage(GetWinHwnd(parent->GetClientWindow()),
|
||||||
@@ -982,7 +961,7 @@ void wxMDIChildFrame::Maximize(bool maximize)
|
|||||||
|
|
||||||
void wxMDIChildFrame::Restore()
|
void wxMDIChildFrame::Restore()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
if ( parent && parent->GetClientWindow() )
|
if ( parent && parent->GetClientWindow() )
|
||||||
{
|
{
|
||||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE,
|
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE,
|
||||||
@@ -992,7 +971,7 @@ void wxMDIChildFrame::Restore()
|
|||||||
|
|
||||||
void wxMDIChildFrame::Activate()
|
void wxMDIChildFrame::Activate()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
if ( parent && parent->GetClientWindow() )
|
if ( parent && parent->GetClientWindow() )
|
||||||
{
|
{
|
||||||
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE,
|
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE,
|
||||||
@@ -1104,7 +1083,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
|
|||||||
WXHWND hwndAct,
|
WXHWND hwndAct,
|
||||||
WXHWND hwndDeact)
|
WXHWND hwndDeact)
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
|
|
||||||
HMENU menuToSet = 0;
|
HMENU menuToSet = 0;
|
||||||
|
|
||||||
@@ -1237,7 +1216,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
|||||||
|
|
||||||
void wxMDIChildFrame::MSWDestroyWindow()
|
void wxMDIChildFrame::MSWDestroyWindow()
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *parent = GetMDIParent();
|
wxMDIParentFrame * const parent = GetMDIParent();
|
||||||
|
|
||||||
// Must make sure this handle is invalidated (set to NULL) since all sorts
|
// 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
|
// of things could happen after the child client is destroyed, but before
|
||||||
@@ -1264,7 +1243,7 @@ void wxMDIChildFrame::MSWDestroyWindow()
|
|||||||
bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
|
bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
|
||||||
{
|
{
|
||||||
RECT *rect = (RECT *)vrect;
|
RECT *rect = (RECT *)vrect;
|
||||||
wxMDIParentFrame* pFrameWnd = GetMDIParent();
|
wxMDIParentFrame * const pFrameWnd = GetMDIParent();
|
||||||
wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
|
wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
|
||||||
|
|
||||||
if (!pChild || (pChild == this))
|
if (!pChild || (pChild == this))
|
||||||
|
@@ -34,10 +34,6 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
|||||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
|
||||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
#define TRACE_MDI "mdi"
|
#define TRACE_MDI "mdi"
|
||||||
|
|
||||||
static const int IDM_WINDOWTILEHOR = 4001;
|
static const int IDM_WINDOWTILEHOR = 4001;
|
||||||
@@ -85,9 +81,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
|||||||
|
|
||||||
void wxMDIParentFrame::Init()
|
void wxMDIParentFrame::Init()
|
||||||
{
|
{
|
||||||
m_clientWindow = NULL;
|
|
||||||
m_currentChild = NULL;
|
|
||||||
m_windowMenu = (wxMenu*) NULL;
|
|
||||||
m_parentFrameActive = true;
|
m_parentFrameActive = true;
|
||||||
m_shouldBeShown = false;
|
m_shouldBeShown = false;
|
||||||
}
|
}
|
||||||
@@ -104,7 +97,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
// "Window" menu
|
// "Window" menu
|
||||||
if ( style & wxFRAME_NO_WINDOW_MENU )
|
if ( style & wxFRAME_NO_WINDOW_MENU )
|
||||||
{
|
{
|
||||||
m_windowMenu = (wxMenu *)NULL;
|
m_windowMenu = NULL;
|
||||||
style -= wxFRAME_NO_WINDOW_MENU ;
|
style -= wxFRAME_NO_WINDOW_MENU ;
|
||||||
}
|
}
|
||||||
else // normal case: we have the window menu, so construct it
|
else // normal case: we have the window menu, so construct it
|
||||||
@@ -135,8 +128,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
|
|
||||||
// already deleted by DestroyChildren()
|
// already deleted by DestroyChildren()
|
||||||
m_clientWindow = NULL ;
|
m_clientWindow = NULL ;
|
||||||
|
|
||||||
delete m_windowMenu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||||
@@ -267,19 +258,6 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
|||||||
event.Skip();
|
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.
|
// Responds to colour changes, and passes event on to children.
|
||||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
@@ -289,32 +267,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
wxFrame::OnSysColourChanged(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
|
bool wxMDIParentFrame::ShouldBeVisible() const
|
||||||
{
|
{
|
||||||
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||||
@@ -365,10 +317,6 @@ bool wxMDIParentFrame::Show( bool show )
|
|||||||
// Child frame
|
// Child frame
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame()
|
|
||||||
{
|
|
||||||
Init() ;
|
|
||||||
}
|
|
||||||
void wxMDIChildFrame::Init()
|
void wxMDIChildFrame::Init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -381,13 +329,15 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
m_mdiParent = parent;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
if ( id == wxID_ANY )
|
if ( id == wxID_ANY )
|
||||||
id = (int)NewControlId();
|
id = (int)NewControlId();
|
||||||
|
|
||||||
wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||||
|
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||||
@@ -400,11 +350,6 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
|
|
||||||
{
|
|
||||||
return wxFrame::SetMenuBar( menu_bar ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
|
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"));
|
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
|
// MDI operations
|
||||||
void wxMDIChildFrame::Maximize()
|
|
||||||
{
|
|
||||||
wxFrame::Maximize() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIChildFrame::Restore()
|
|
||||||
{
|
|
||||||
wxFrame::Restore() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIChildFrame::Activate()
|
void wxMDIChildFrame::Activate()
|
||||||
{
|
{
|
||||||
Raise ();
|
Raise ();
|
||||||
@@ -481,10 +416,6 @@ void wxMDIChildFrame::Activate()
|
|||||||
// wxMDIClientWindow
|
// wxMDIClientWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMDIClientWindow::wxMDIClientWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMDIClientWindow::~wxMDIClientWindow()
|
wxMDIClientWindow::~wxMDIClientWindow()
|
||||||
{
|
{
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
@@ -498,15 +429,9 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get size *available for subwindows* i.e. excluding menu bar.
|
|
||||||
void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
|
void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxDisplaySize( x , y ) ;
|
wxDisplaySize( x , y ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly call default scroll behaviour
|
|
||||||
void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_MDI
|
#endif // wxUSE_MDI
|
||||||
|
Reference in New Issue
Block a user