1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: mdi.cpp
|
|
|
|
// Purpose: MDI sample
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart and Markus Holzem
|
1999-05-23 19:45:47 -04:00
|
|
|
// Licence: wxWindows license
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-07-24 16:47:43 -04:00
|
|
|
#include <wx/toolbar.h>
|
1998-05-27 09:56:59 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
// Define a new application
|
1999-05-23 19:45:47 -04:00
|
|
|
class MyApp : public wxApp
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-05-23 19:45:47 -04:00
|
|
|
public:
|
|
|
|
bool OnInit();
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-05-23 19:45:47 -04:00
|
|
|
class MyCanvas : public wxScrolledWindow
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-05-23 19:45:47 -04:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
|
|
|
virtual void OnDraw(wxDC& dc);
|
1999-05-23 19:45:47 -04:00
|
|
|
|
|
|
|
bool IsDirty() const { return m_dirty; }
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnEvent(wxMouseEvent& event);
|
|
|
|
|
1999-05-23 19:45:47 -04:00
|
|
|
private:
|
|
|
|
bool m_dirty;
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
// Define a new frame
|
1999-05-23 19:45:47 -04:00
|
|
|
class MyFrame : public wxMDIParentFrame
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-05-23 19:45:47 -04:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
wxTextCtrl *textWindow;
|
1999-05-23 19:45:47 -04:00
|
|
|
|
|
|
|
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
|
|
|
const wxPoint& pos, const wxSize& size, const long style);
|
1998-07-27 05:47:57 -04:00
|
|
|
|
|
|
|
void InitToolBar(wxToolBar* toolBar);
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnAbout(wxCommandEvent& event);
|
|
|
|
void OnNewWindow(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
1999-05-23 19:45:47 -04:00
|
|
|
void OnClose(wxCloseEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-23 19:45:47 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class MyChild: public wxMDIChildFrame
|
|
|
|
{
|
1999-05-23 19:45:47 -04:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
MyCanvas *canvas;
|
|
|
|
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
1999-05-23 19:45:47 -04:00
|
|
|
~MyChild();
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnActivate(wxActivateEvent& event);
|
1999-05-23 19:45:47 -04:00
|
|
|
|
|
|
|
void OnRefresh(wxCommandEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnQuit(wxCommandEvent& event);
|
1999-05-23 19:45:47 -04:00
|
|
|
void OnClose(wxCloseEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-23 19:45:47 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-05-23 19:45:47 -04:00
|
|
|
// menu items ids
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MDI_QUIT = 100,
|
|
|
|
MDI_NEW_WINDOW,
|
|
|
|
MDI_REFRESH,
|
|
|
|
MDI_CHILD_QUIT,
|
|
|
|
MDI_ABOUT
|
|
|
|
};
|