]>
git.saurik.com Git - wxWidgets.git/blob - samples/docview/docview.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/docview/docview.h
3 // Purpose: Document/view demo
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
8 // Copyright: (c) 1998 Julian Smart
9 // (c) 2008 Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
14 #define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
16 #include "wx/docview.h"
22 // Define a new application
23 class MyApp
: public wxApp
26 // this sample can be launched in several different ways:
29 #if wxUSE_MDI_ARCHITECTURE
30 Mode_MDI
, // MDI mode: multiple documents, single top level window
31 #endif // wxUSE_MDI_ARCHITECTURE
32 Mode_SDI
, // SDI mode: multiple documents, multiple top level windows
33 Mode_Single
// single document mode (and hence single top level window)
38 // override some wxApp virtual methods
39 virtual bool OnInit();
42 virtual void OnInitCmdLine(wxCmdLineParser
& parser
);
43 virtual bool OnCmdLineParsed(wxCmdLineParser
& parser
);
45 // our specific methods
46 Mode
GetMode() const { return m_mode
; }
47 wxFrame
*CreateChildFrame(wxDocument
*doc
, wxView
*view
, bool isCanvas
);
49 // these accessors should only be called in single document mode, otherwise
50 // the pointers are NULL and an assert is triggered
51 MyCanvas
*GetMainWindowCanvas() const
52 { wxASSERT(m_canvas
); return m_canvas
; }
53 wxMenu
*GetMainWindowEditMenu() const
54 { wxASSERT(m_menuEdit
); return m_menuEdit
; }
57 // append the standard document-oriented menu commands to this menu
58 void AppendDocumentFileCommands(wxMenu
*menu
, bool supportsPrinting
);
60 // create the edit menu for drawing documents
61 wxMenu
*CreateDrawingEditMenu();
63 // create and associate with the given frame the menu bar containing the
64 // given file and edit (possibly NULL) menus as well as the standard help
66 void CreateMenuBarForFrame(wxFrame
*frame
, wxMenu
*file
, wxMenu
*edit
);
69 // show the about box: as we can have different frames it's more
70 // convenient, even if somewhat less usual, to handle this in the
71 // application object itself
72 void OnAbout(wxCommandEvent
& event
);
75 // the currently used mode
78 // only used if m_mode == Mode_Single
83 wxDECLARE_NO_COPY_CLASS(MyApp
);
88 #endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_