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:
10
configure.in
10
configure.in
@@ -4228,10 +4228,12 @@ 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
|
||||
|
||||
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)
|
||||
|
@@ -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
|
||||
|
@@ -44,5 +44,6 @@ src/mac/macsock/*.lib
|
||||
src/mac/morefile/*.h
|
||||
src/mac/morefile/*.cpp
|
||||
|
||||
include/wx_pb.h
|
||||
include/wx/mac/*.h
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
@@ -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);
|
||||
|
@@ -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()
|
||||
};
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
@@ -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__)
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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 \
|
||||
|
Reference in New Issue
Block a user