1998-05-22 15:57:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-10-03 11:16:01 -04:00
|
|
|
// Name: samples/docview/docview.h
|
1998-05-22 15:57:05 -04:00
|
|
|
// Purpose: Document/view demo
|
|
|
|
// Author: Julian Smart
|
2008-10-03 11:16:01 -04:00
|
|
|
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
|
1998-05-22 15:57:05 -04:00
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
2008-10-03 11:16:01 -04:00
|
|
|
// Copyright: (c) 1998 Julian Smart
|
|
|
|
// (c) 2008 Vadim Zeitlin
|
2002-03-17 09:16:03 -05:00
|
|
|
// Licence: wxWindows license
|
1998-05-22 15:57:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
#ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
|
|
|
|
#define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
|
1998-05-22 15:57:05 -04:00
|
|
|
|
|
|
|
#include "wx/docview.h"
|
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
class MyFrame;
|
|
|
|
class MyCanvas;
|
|
|
|
class DrawingView;
|
1998-05-22 15:57:05 -04:00
|
|
|
|
|
|
|
// Define a new application
|
2008-04-06 09:57:23 -04:00
|
|
|
class MyApp : public wxApp
|
1998-05-22 15:57:05 -04:00
|
|
|
{
|
2000-07-15 15:51:35 -04:00
|
|
|
public:
|
2008-10-03 11:16:01 -04:00
|
|
|
// this sample can be launched in several different ways:
|
|
|
|
enum Mode
|
|
|
|
{
|
|
|
|
#if wxUSE_MDI_ARCHITECTURE
|
|
|
|
Mode_MDI, // MDI mode: multiple documents, single top level window
|
|
|
|
#endif // wxUSE_MDI_ARCHITECTURE
|
|
|
|
Mode_SDI, // SDI mode: multiple documents, multiple top level windows
|
|
|
|
Mode_Single // single document mode (and hence single top level window)
|
|
|
|
};
|
|
|
|
|
|
|
|
MyApp();
|
|
|
|
|
|
|
|
// override some wxApp virtual methods
|
|
|
|
virtual bool OnInit();
|
|
|
|
virtual int OnExit();
|
|
|
|
|
|
|
|
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
|
|
|
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
|
|
|
|
|
|
|
// our specific methods
|
|
|
|
Mode GetMode() const { return m_mode; }
|
1998-05-22 15:57:05 -04:00
|
|
|
wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas);
|
2008-04-06 09:57:23 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
// these accessors should only be called in single document mode, otherwise
|
|
|
|
// the pointers are NULL and an assert is triggered
|
|
|
|
MyCanvas *GetMainWindowCanvas() const
|
|
|
|
{ wxASSERT(m_canvas); return m_canvas; }
|
|
|
|
wxMenu *GetMainWindowEditMenu() const
|
|
|
|
{ wxASSERT(m_menuEdit); return m_menuEdit; }
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
private:
|
|
|
|
// append the standard document-oriented menu commands to this menu
|
|
|
|
void AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting);
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
// create the edit menu for drawing documents
|
|
|
|
wxMenu *CreateDrawingEditMenu();
|
2008-04-06 09:57:23 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
// create and associate with the given frame the menu bar containing the
|
|
|
|
// given file and edit (possibly NULL) menus as well as the standard help
|
|
|
|
// one
|
|
|
|
void CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit);
|
2008-04-06 09:57:23 -04:00
|
|
|
|
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
// show the about box: as we can have different frames it's more
|
|
|
|
// convenient, even if somewhat less usual, to handle this in the
|
|
|
|
// application object itself
|
2000-07-15 15:51:35 -04:00
|
|
|
void OnAbout(wxCommandEvent& event);
|
1998-05-22 15:57:05 -04:00
|
|
|
|
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
// the currently used mode
|
|
|
|
Mode m_mode;
|
|
|
|
|
|
|
|
// only used if m_mode == Mode_Single
|
|
|
|
MyCanvas *m_canvas;
|
|
|
|
wxMenu *m_menuEdit;
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(MyApp);
|
2008-10-03 11:16:01 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_APP(MyApp)
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2008-10-03 11:16:01 -04:00
|
|
|
#endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
|