From b9f933ab5d4a293790d0f5186c434229678c76ea Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 20 Aug 2002 09:09:55 +0000 Subject: [PATCH] Applied patch [ 597398 ] Generic MDI, wxNotebook based. By Hans Van Leemputten (hansvl) - This patch implements a generic notebook based mdi, due to that wxMDIChildFrame could not derive from wxFrame some things in the samples and in the docmdi classes needed to be adjusted... basically this comes down to not do (wxFrame *) but instead do (wxMDIChildFrame *), or store a pointer to the frame in a wxWindow* instead of a wxFrame variable... - The main reason wxMDIChildFrame cannot derive from wxFrame is that it would take to much platform specific functions to be overwritten (= lot of ifdef's). This then couldn't be called generic anymore, so that's why we need to derive from wxPanel... - Tested on/with: 1. wxMSW (I disabled the MSW MDI implementation to be able to test it), tested it with the MDI sample, docvwmdi sample and docview sample and also tested it with wxWorkshop. (test = compile and run) 2. wxX11, tested with the same set wxWin samples as the wxMSW test. I also compiled wxWorkshop with it, but could not run wxWorkshop due to some issue not related to the MDI implementation. - How to apply: * Apply the patch * move mdig.cpp into wxWindows/src/generic/ * move mdig.h into wxWindows/include/wx/generic/ - Some extra things that still need to be done: * File lists, project files should be updated to include mdig.cpp (the patch only change this on wxX11) * The configuration script should be updated. * Maybe wxUSE_GENERIC_MDI_ARCHITECTURE also should be added so it is only included when wanted... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure.in | 18 ++++++++++-------- distrib/msw/cw.rsp | 5 +---- distrib/msw/mac.rsp | 1 + distrib/msw/tmake/filelist.txt | 2 ++ docs/msw/install.txt | 4 ++-- include/wx/docmdi.h | 2 +- include/wx/docview.h | 6 +++--- include/wx/mdi.h | 4 +++- samples/docvwmdi/docview.cpp | 2 +- samples/docvwmdi/docview.h | 4 +++- samples/docvwmdi/view.cpp | 4 ++-- samples/docvwmdi/view.h | 12 ++++++------ samples/mdi/mdi.cpp | 4 +++- src/msw/joystick.cpp | 5 +++++ src/msw/mdi.cpp | 6 ++++++ src/wxUniv.dsp | 4 ++++ src/x11/files.lst | 3 +++ 17 files changed, 56 insertions(+), 30 deletions(-) diff --git a/configure.in b/configure.in index e82e69e7df..0b9cf15826 100644 --- a/configure.in +++ b/configure.in @@ -4228,15 +4228,17 @@ if test "$wxUSE_CONSTRAINTS" = "yes"; then fi if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then - if test "$wxUSE_UNIVERSAL" = "yes"; then - AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled) - wxUSE_MDI_ARCHITECTURE=no - fi - if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then - AC_DEFINE(wxUSE_MDI_ARCHITECTURE) - SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi" - fi +dnl There is now experimental generic MDI support +dnl if test "$wxUSE_UNIVERSAL" = "yes"; then +dnl AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled) +dnl wxUSE_MDI_ARCHITECTURE=no +dnl fi + + if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then + AC_DEFINE(wxUSE_MDI_ARCHITECTURE) + SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi" + fi fi if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then diff --git a/distrib/msw/cw.rsp b/distrib/msw/cw.rsp index 0493ffe439..02f62f771c 100644 --- a/distrib/msw/cw.rsp +++ b/distrib/msw/cw.rsp @@ -1,7 +1,4 @@ -include/wx_cw.pch -include/wx_cw.pch++ -include/wx_cw_d.pch -include/wx_cw_d.pch++ +include/wx*.pch* include/wx/wx_cw.h include/wx/wx_cw_d.h diff --git a/distrib/msw/mac.rsp b/distrib/msw/mac.rsp index 642e12f84e..9e26848b76 100644 --- a/distrib/msw/mac.rsp +++ b/distrib/msw/mac.rsp @@ -44,5 +44,6 @@ src/mac/macsock/*.lib src/mac/morefile/*.h src/mac/morefile/*.cpp +include/wx_pb.h include/wx/mac/*.h diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index c63602233d..d98e4575fc 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -90,6 +90,7 @@ imaglist.cpp Generic NotWin32 laywin.cpp Generic listctrl.cpp Generic NotWin32 logg.cpp Generic +mdig.cpp Generic NotWin32,NotGTK,NotOS2,NotMac msgdlgg.cpp Generic Generic notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotX11,NotMac,NotMicro numdlgg.cpp Generic @@ -1483,6 +1484,7 @@ helphtml.h GenericH imaglist.h GenericH laywin.h GenericH listctrl.h GenericH NotWin32 +mdig.cpp GenericH NotWin32,NotGTK,NotOS2,NotMac msgdlgg.h GenericH notebook.h GenericH paletteg.h GenericH NotMSW,NotX,NotX11,NotOS2 diff --git a/docs/msw/install.txt b/docs/msw/install.txt index 974f37312d..33edeefe0e 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.txt @@ -29,8 +29,8 @@ program contains the following: - All common, generic and MSW-specific wxWindows source; - samples; - documentation in Windows Help format; -- makefiles for most Windows compilers, plus BC++ and - VC++ IDE files; +- makefiles for most Windows compilers, plus CodeWarrior, + BC++ and VC++ IDE files; - JPEG library source; - TIFF library source; - Object Graphics Library; diff --git a/include/wx/docmdi.h b/include/wx/docmdi.h index 1e3047bdd8..f4922834d8 100644 --- a/include/wx/docmdi.h +++ b/include/wx/docmdi.h @@ -75,7 +75,7 @@ class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame inline wxView *GetView(void) const { return m_childView; } inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } inline void SetView(wxView *view) { m_childView = view; } - bool Destroy() { m_childView = (wxView *)NULL; return wxFrame::Destroy(); } + bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } protected: wxDocument* m_childDocument; wxView* m_childView; diff --git a/include/wx/docview.h b/include/wx/docview.h index 0fc38cf3d5..9ffe954246 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -177,8 +177,8 @@ public: wxString GetViewName() const { return m_viewTypeName; } void SetViewName(const wxString& name) { m_viewTypeName = name; }; - wxFrame *GetFrame() const { return m_viewFrame ; } - void SetFrame(wxFrame *frame) { m_viewFrame = frame; } + wxWindow *GetFrame() const { return m_viewFrame ; } + void SetFrame(wxWindow *frame) { m_viewFrame = frame; } virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); virtual void OnDraw(wxDC *dc) = 0; @@ -221,7 +221,7 @@ public: protected: wxDocument* m_viewDocument; wxString m_viewTypeName; - wxFrame* m_viewFrame; + wxWindow* m_viewFrame; }; // Represents user interface (and other) properties of documents and views diff --git a/include/wx/mdi.h b/include/wx/mdi.h index 2eae537791..0fc75128ff 100644 --- a/include/wx/mdi.h +++ b/include/wx/mdi.h @@ -1,7 +1,9 @@ #ifndef _WX_MDI_H_BASE_ #define _WX_MDI_H_BASE_ -#if defined(__WXMSW__) +#if defined(__WXUNIVERSAL__) +#include "wx/generic/mdig.h" +#elif defined(__WXMSW__) #include "wx/msw/mdi.h" #elif defined(__WXMOTIF__) #include "wx/motif/mdi.h" diff --git a/samples/docvwmdi/docview.cpp b/samples/docvwmdi/docview.cpp index a0cee05037..69ce099317 100644 --- a/samples/docvwmdi/docview.cpp +++ b/samples/docvwmdi/docview.cpp @@ -208,7 +208,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) // Creates a canvas. Called from view.cpp when a new drawing // view is created. -MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) +MyCanvas *MyFrame::CreateCanvas(wxView *view, wxMDIChildFrame *parent) { int width, height; parent->GetClientSize(&width, &height); diff --git a/samples/docvwmdi/docview.h b/samples/docvwmdi/docview.h index 3d0ad4274d..2674c6a36e 100644 --- a/samples/docvwmdi/docview.h +++ b/samples/docvwmdi/docview.h @@ -16,6 +16,8 @@ #ifndef __DOCVIEWSAMPLEH__ #define __DOCVIEWSAMPLEH__ +#include "wx/mdi.h" +#include "wx/docview.h" #include "wx/docmdi.h" class wxDocManager; @@ -48,7 +50,7 @@ class MyFrame: public wxDocMDIParentFrame long type); void OnAbout(wxCommandEvent& event); - MyCanvas *CreateCanvas(wxView *view, wxFrame *parent); + MyCanvas *CreateCanvas(wxView *view, wxMDIChildFrame *parent); DECLARE_EVENT_TABLE() }; diff --git a/samples/docvwmdi/view.cpp b/samples/docvwmdi/view.cpp index d359871f46..2f873099a8 100644 --- a/samples/docvwmdi/view.cpp +++ b/samples/docvwmdi/view.cpp @@ -189,7 +189,7 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) END_EVENT_TABLE() // Define a constructor for my canvas -MyCanvas::MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style): +MyCanvas::MyCanvas(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style): wxScrolledWindow(frame, -1, pos, size, style) { view = v; @@ -256,7 +256,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) } // Define a constructor for my text subwindow -MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style): +MyTextWindow::MyTextWindow(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style): wxTextCtrl(frame, -1, "", pos, size, style) { view = v; diff --git a/samples/docvwmdi/view.h b/samples/docvwmdi/view.h index 11f2ff6aed..3f62a60453 100644 --- a/samples/docvwmdi/view.h +++ b/samples/docvwmdi/view.h @@ -23,7 +23,7 @@ class MyCanvas: public wxScrolledWindow public: wxView *view; - MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style); + MyCanvas(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style); virtual void OnDraw(wxDC& dc); void OnMouseEvent(wxMouseEvent& event); @@ -36,16 +36,16 @@ class MyTextWindow: public wxTextCtrl public: wxView *view; - MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style); + MyTextWindow(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style); }; class DrawingView: public wxView { public: - wxFrame *frame; + wxMDIChildFrame *frame; MyCanvas *canvas; - DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; } + DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxMDIChildFrame *) NULL; } ~DrawingView() {} bool OnCreate(wxDocument *doc, long flags); @@ -63,10 +63,10 @@ private: class TextEditView: public wxView { public: - wxFrame *frame; + wxMDIChildFrame *frame; MyTextWindow *textsw; - TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; } + TextEditView(): wxView() { frame = (wxMDIChildFrame *) NULL; textsw = (MyTextWindow *) NULL; } ~TextEditView() {} bool OnCreate(wxDocument *doc, long flags); diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index 3721a03308..06b778e8e4 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -275,13 +275,15 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) ) subframe->Show(TRUE); } -void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) +void MyFrame::OnSize(wxSizeEvent& event) { int w, h; GetClientSize(&w, &h); textWindow->SetSize(0, 0, 200, h); GetClientWindow()->SetSize(200, 0, w - 200, h); + + event.Skip(); } void MyFrame::InitToolBar(wxToolBar* toolBar) diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index b8920854e6..0cd1a0307f 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -98,6 +98,7 @@ int wxJoystick::GetPOVPosition() const #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; joyInfo.dwFlags = JOY_RETURNPOV; + joyInfo.dwSize = sizeof(joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); if (res == JOYERR_NOERROR ) { @@ -115,6 +116,7 @@ int wxJoystick::GetPOVCTSPosition() const #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; joyInfo.dwFlags = JOY_RETURNPOVCTS; + joyInfo.dwSize = sizeof(joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); if (res == JOYERR_NOERROR ) { @@ -132,6 +134,7 @@ int wxJoystick::GetRudderPosition() const #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; joyInfo.dwFlags = JOY_RETURNR; + joyInfo.dwSize = sizeof(joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); if (res == JOYERR_NOERROR ) { @@ -149,6 +152,7 @@ int wxJoystick::GetUPosition() const #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; joyInfo.dwFlags = JOY_RETURNU; + joyInfo.dwSize = sizeof(joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); if (res == JOYERR_NOERROR ) { @@ -166,6 +170,7 @@ int wxJoystick::GetVPosition() const #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; joyInfo.dwFlags = JOY_RETURNV; + joyInfo.dwSize = sizeof(joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); if (res == JOYERR_NOERROR ) { diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 611dbbe4ae..41e02c6b1b 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -43,6 +43,8 @@ #include "wx/log.h" #endif +#if wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__) + #include "wx/mdi.h" #include "wx/msw/private.h" @@ -1387,3 +1389,7 @@ static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, *hwndDeact = (WXHWND)HIWORD(lParam); #endif // Win32/Win16 } + +#endif +// wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__) + diff --git a/src/wxUniv.dsp b/src/wxUniv.dsp index 8f76e41b40..db54216826 100644 --- a/src/wxUniv.dsp +++ b/src/wxUniv.dsp @@ -703,6 +703,10 @@ SOURCE=.\generic\logg.cpp # End Source File # Begin Source File +SOURCE=.\generic\mdig.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\msgdlgg.cpp # End Source File # Begin Source File diff --git a/src/x11/files.lst b/src/x11/files.lst index 1c5a2a0bbc..74ca34d4ac 100644 --- a/src/x11/files.lst +++ b/src/x11/files.lst @@ -55,6 +55,7 @@ ALL_SOURCES = \ generic/laywin.cpp \ generic/listctrl.cpp \ generic/logg.cpp \ + generic/mdig.cpp \ generic/msgdlgg.cpp \ generic/numdlgg.cpp \ generic/panelg.cpp \ @@ -573,6 +574,7 @@ ALL_HEADERS = \ generic/imaglist.h \ generic/laywin.h \ generic/listctrl.h \ + generic/mdig.h \ generic/msgdlgg.h \ generic/notebook.h \ generic/paletteg.h \ @@ -806,6 +808,7 @@ GENERICOBJS = \ laywin.o \ listctrl.o \ logg.o \ + mdig.o \ msgdlgg.o \ numdlgg.o \ panelg.o \ -- 2.45.2