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
This commit is contained in:
Julian Smart
2002-08-20 09:09:55 +00:00
parent 90b18154c8
commit b9f933ab5d
17 changed files with 56 additions and 30 deletions

View File

@@ -4228,15 +4228,17 @@ if test "$wxUSE_CONSTRAINTS" = "yes"; then
fi fi
if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then 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 dnl There is now experimental generic MDI support
AC_DEFINE(wxUSE_MDI_ARCHITECTURE) dnl if test "$wxUSE_UNIVERSAL" = "yes"; then
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi" dnl AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled)
fi 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 fi
if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then

View File

@@ -1,7 +1,4 @@
include/wx_cw.pch include/wx*.pch*
include/wx_cw.pch++
include/wx_cw_d.pch
include/wx_cw_d.pch++
include/wx/wx_cw.h include/wx/wx_cw.h
include/wx/wx_cw_d.h include/wx/wx_cw_d.h

View File

@@ -44,5 +44,6 @@ src/mac/macsock/*.lib
src/mac/morefile/*.h src/mac/morefile/*.h
src/mac/morefile/*.cpp src/mac/morefile/*.cpp
include/wx_pb.h
include/wx/mac/*.h include/wx/mac/*.h

View File

@@ -90,6 +90,7 @@ imaglist.cpp Generic NotWin32
laywin.cpp Generic laywin.cpp Generic
listctrl.cpp Generic NotWin32 listctrl.cpp Generic NotWin32
logg.cpp Generic logg.cpp Generic
mdig.cpp Generic NotWin32,NotGTK,NotOS2,NotMac
msgdlgg.cpp Generic Generic msgdlgg.cpp Generic Generic
notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotX11,NotMac,NotMicro notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotX11,NotMac,NotMicro
numdlgg.cpp Generic numdlgg.cpp Generic
@@ -1483,6 +1484,7 @@ helphtml.h GenericH
imaglist.h GenericH imaglist.h GenericH
laywin.h GenericH laywin.h GenericH
listctrl.h GenericH NotWin32 listctrl.h GenericH NotWin32
mdig.cpp GenericH NotWin32,NotGTK,NotOS2,NotMac
msgdlgg.h GenericH msgdlgg.h GenericH
notebook.h GenericH notebook.h GenericH
paletteg.h GenericH NotMSW,NotX,NotX11,NotOS2 paletteg.h GenericH NotMSW,NotX,NotX11,NotOS2

View File

@@ -29,8 +29,8 @@ program contains the following:
- All common, generic and MSW-specific wxWindows source; - All common, generic and MSW-specific wxWindows source;
- samples; - samples;
- documentation in Windows Help format; - documentation in Windows Help format;
- makefiles for most Windows compilers, plus BC++ and - makefiles for most Windows compilers, plus CodeWarrior,
VC++ IDE files; BC++ and VC++ IDE files;
- JPEG library source; - JPEG library source;
- TIFF library source; - TIFF library source;
- Object Graphics Library; - Object Graphics Library;

View File

@@ -75,7 +75,7 @@ class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame
inline wxView *GetView(void) const { return m_childView; } inline wxView *GetView(void) const { return m_childView; }
inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } inline void SetDocument(wxDocument *doc) { m_childDocument = doc; }
inline void SetView(wxView *view) { m_childView = view; } 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: protected:
wxDocument* m_childDocument; wxDocument* m_childDocument;
wxView* m_childView; wxView* m_childView;

View File

@@ -177,8 +177,8 @@ public:
wxString GetViewName() const { return m_viewTypeName; } wxString GetViewName() const { return m_viewTypeName; }
void SetViewName(const wxString& name) { m_viewTypeName = name; }; void SetViewName(const wxString& name) { m_viewTypeName = name; };
wxFrame *GetFrame() const { return m_viewFrame ; } wxWindow *GetFrame() const { return m_viewFrame ; }
void SetFrame(wxFrame *frame) { m_viewFrame = frame; } void SetFrame(wxWindow *frame) { m_viewFrame = frame; }
virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
virtual void OnDraw(wxDC *dc) = 0; virtual void OnDraw(wxDC *dc) = 0;
@@ -221,7 +221,7 @@ public:
protected: protected:
wxDocument* m_viewDocument; wxDocument* m_viewDocument;
wxString m_viewTypeName; wxString m_viewTypeName;
wxFrame* m_viewFrame; wxWindow* m_viewFrame;
}; };
// Represents user interface (and other) properties of documents and views // Represents user interface (and other) properties of documents and views

View File

@@ -1,7 +1,9 @@
#ifndef _WX_MDI_H_BASE_ #ifndef _WX_MDI_H_BASE_
#define _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" #include "wx/msw/mdi.h"
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
#include "wx/motif/mdi.h" #include "wx/motif/mdi.h"

View File

@@ -208,7 +208,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
// Creates a canvas. Called from view.cpp when a new drawing // Creates a canvas. Called from view.cpp when a new drawing
// view is created. // view is created.
MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) MyCanvas *MyFrame::CreateCanvas(wxView *view, wxMDIChildFrame *parent)
{ {
int width, height; int width, height;
parent->GetClientSize(&width, &height); parent->GetClientSize(&width, &height);

View File

@@ -16,6 +16,8 @@
#ifndef __DOCVIEWSAMPLEH__ #ifndef __DOCVIEWSAMPLEH__
#define __DOCVIEWSAMPLEH__ #define __DOCVIEWSAMPLEH__
#include "wx/mdi.h"
#include "wx/docview.h"
#include "wx/docmdi.h" #include "wx/docmdi.h"
class wxDocManager; class wxDocManager;
@@ -48,7 +50,7 @@ class MyFrame: public wxDocMDIParentFrame
long type); long type);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
MyCanvas *CreateCanvas(wxView *view, wxFrame *parent); MyCanvas *CreateCanvas(wxView *view, wxMDIChildFrame *parent);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -189,7 +189,7 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// Define a constructor for my canvas // 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) wxScrolledWindow(frame, -1, pos, size, style)
{ {
view = v; view = v;
@@ -256,7 +256,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
} }
// Define a constructor for my text subwindow // 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) wxTextCtrl(frame, -1, "", pos, size, style)
{ {
view = v; view = v;

View File

@@ -23,7 +23,7 @@ class MyCanvas: public wxScrolledWindow
public: public:
wxView *view; 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); virtual void OnDraw(wxDC& dc);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
@@ -36,16 +36,16 @@ class MyTextWindow: public wxTextCtrl
public: public:
wxView *view; 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 class DrawingView: public wxView
{ {
public: public:
wxFrame *frame; wxMDIChildFrame *frame;
MyCanvas *canvas; MyCanvas *canvas;
DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; } DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxMDIChildFrame *) NULL; }
~DrawingView() {} ~DrawingView() {}
bool OnCreate(wxDocument *doc, long flags); bool OnCreate(wxDocument *doc, long flags);
@@ -63,10 +63,10 @@ private:
class TextEditView: public wxView class TextEditView: public wxView
{ {
public: public:
wxFrame *frame; wxMDIChildFrame *frame;
MyTextWindow *textsw; MyTextWindow *textsw;
TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; } TextEditView(): wxView() { frame = (wxMDIChildFrame *) NULL; textsw = (MyTextWindow *) NULL; }
~TextEditView() {} ~TextEditView() {}
bool OnCreate(wxDocument *doc, long flags); bool OnCreate(wxDocument *doc, long flags);

View File

@@ -275,13 +275,15 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
subframe->Show(TRUE); subframe->Show(TRUE);
} }
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) void MyFrame::OnSize(wxSizeEvent& event)
{ {
int w, h; int w, h;
GetClientSize(&w, &h); GetClientSize(&w, &h);
textWindow->SetSize(0, 0, 200, h); textWindow->SetSize(0, 0, 200, h);
GetClientWindow()->SetSize(200, 0, w - 200, h); GetClientWindow()->SetSize(200, 0, w - 200, h);
event.Skip();
} }
void MyFrame::InitToolBar(wxToolBar* toolBar) void MyFrame::InitToolBar(wxToolBar* toolBar)

View File

@@ -98,6 +98,7 @@ int wxJoystick::GetPOVPosition() const
#ifndef NO_JOYGETPOSEX #ifndef NO_JOYGETPOSEX
JOYINFOEX joyInfo; JOYINFOEX joyInfo;
joyInfo.dwFlags = JOY_RETURNPOV; joyInfo.dwFlags = JOY_RETURNPOV;
joyInfo.dwSize = sizeof(joyInfo);
MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo);
if (res == JOYERR_NOERROR ) if (res == JOYERR_NOERROR )
{ {
@@ -115,6 +116,7 @@ int wxJoystick::GetPOVCTSPosition() const
#ifndef NO_JOYGETPOSEX #ifndef NO_JOYGETPOSEX
JOYINFOEX joyInfo; JOYINFOEX joyInfo;
joyInfo.dwFlags = JOY_RETURNPOVCTS; joyInfo.dwFlags = JOY_RETURNPOVCTS;
joyInfo.dwSize = sizeof(joyInfo);
MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo);
if (res == JOYERR_NOERROR ) if (res == JOYERR_NOERROR )
{ {
@@ -132,6 +134,7 @@ int wxJoystick::GetRudderPosition() const
#ifndef NO_JOYGETPOSEX #ifndef NO_JOYGETPOSEX
JOYINFOEX joyInfo; JOYINFOEX joyInfo;
joyInfo.dwFlags = JOY_RETURNR; joyInfo.dwFlags = JOY_RETURNR;
joyInfo.dwSize = sizeof(joyInfo);
MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo);
if (res == JOYERR_NOERROR ) if (res == JOYERR_NOERROR )
{ {
@@ -149,6 +152,7 @@ int wxJoystick::GetUPosition() const
#ifndef NO_JOYGETPOSEX #ifndef NO_JOYGETPOSEX
JOYINFOEX joyInfo; JOYINFOEX joyInfo;
joyInfo.dwFlags = JOY_RETURNU; joyInfo.dwFlags = JOY_RETURNU;
joyInfo.dwSize = sizeof(joyInfo);
MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo);
if (res == JOYERR_NOERROR ) if (res == JOYERR_NOERROR )
{ {
@@ -166,6 +170,7 @@ int wxJoystick::GetVPosition() const
#ifndef NO_JOYGETPOSEX #ifndef NO_JOYGETPOSEX
JOYINFOEX joyInfo; JOYINFOEX joyInfo;
joyInfo.dwFlags = JOY_RETURNV; joyInfo.dwFlags = JOY_RETURNV;
joyInfo.dwSize = sizeof(joyInfo);
MMRESULT res = joyGetPosEx(m_joystick, & joyInfo); MMRESULT res = joyGetPosEx(m_joystick, & joyInfo);
if (res == JOYERR_NOERROR ) if (res == JOYERR_NOERROR )
{ {

View File

@@ -43,6 +43,8 @@
#include "wx/log.h" #include "wx/log.h"
#endif #endif
#if wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__)
#include "wx/mdi.h" #include "wx/mdi.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -1387,3 +1389,7 @@ static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
*hwndDeact = (WXHWND)HIWORD(lParam); *hwndDeact = (WXHWND)HIWORD(lParam);
#endif // Win32/Win16 #endif // Win32/Win16
} }
#endif
// wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__)

View File

@@ -703,6 +703,10 @@ SOURCE=.\generic\logg.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\generic\mdig.cpp
# End Source File
# Begin Source File
SOURCE=.\generic\msgdlgg.cpp SOURCE=.\generic\msgdlgg.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -55,6 +55,7 @@ ALL_SOURCES = \
generic/laywin.cpp \ generic/laywin.cpp \
generic/listctrl.cpp \ generic/listctrl.cpp \
generic/logg.cpp \ generic/logg.cpp \
generic/mdig.cpp \
generic/msgdlgg.cpp \ generic/msgdlgg.cpp \
generic/numdlgg.cpp \ generic/numdlgg.cpp \
generic/panelg.cpp \ generic/panelg.cpp \
@@ -573,6 +574,7 @@ ALL_HEADERS = \
generic/imaglist.h \ generic/imaglist.h \
generic/laywin.h \ generic/laywin.h \
generic/listctrl.h \ generic/listctrl.h \
generic/mdig.h \
generic/msgdlgg.h \ generic/msgdlgg.h \
generic/notebook.h \ generic/notebook.h \
generic/paletteg.h \ generic/paletteg.h \
@@ -806,6 +808,7 @@ GENERICOBJS = \
laywin.o \ laywin.o \
listctrl.o \ listctrl.o \
logg.o \ logg.o \
mdig.o \
msgdlgg.o \ msgdlgg.o \
numdlgg.o \ numdlgg.o \
panelg.o \ panelg.o \