wxWidgets/samples/docvwmdi/view.h
Julian Smart b9f933ab5d 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
2002-08-20 09:09:55 +00:00

82 lines
1.9 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: view.h
// Purpose: View classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma interface
#endif
#ifndef __VIEWSAMPLEH__
#define __VIEWSAMPLEH__
#include "wx/docview.h"
class MyCanvas: public wxScrolledWindow
{
public:
wxView *view;
MyCanvas(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style);
virtual void OnDraw(wxDC& dc);
void OnMouseEvent(wxMouseEvent& event);
private:
DECLARE_EVENT_TABLE()
};
class MyTextWindow: public wxTextCtrl
{
public:
wxView *view;
MyTextWindow(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style);
};
class DrawingView: public wxView
{
public:
wxMDIChildFrame *frame;
MyCanvas *canvas;
DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxMDIChildFrame *) NULL; }
~DrawingView() {}
bool OnCreate(wxDocument *doc, long flags);
void OnDraw(wxDC *dc);
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
bool OnClose(bool deleteWindow = TRUE);
void OnCut(wxCommandEvent& event);
private:
DECLARE_DYNAMIC_CLASS(DrawingView)
DECLARE_EVENT_TABLE()
};
class TextEditView: public wxView
{
public:
wxMDIChildFrame *frame;
MyTextWindow *textsw;
TextEditView(): wxView() { frame = (wxMDIChildFrame *) NULL; textsw = (MyTextWindow *) NULL; }
~TextEditView() {}
bool OnCreate(wxDocument *doc, long flags);
void OnDraw(wxDC *dc);
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
bool OnClose(bool deleteWindow = TRUE);
private:
DECLARE_DYNAMIC_CLASS(TextEditView)
};
#endif