]>
Commit | Line | Data |
---|---|---|
457814b5 | 1 | ///////////////////////////////////////////////////////////////////////////// |
2d1df0fc | 2 | // Name: samples/docview/docview.h |
457814b5 JS |
3 | // Purpose: Document/view demo |
4 | // Author: Julian Smart | |
2d1df0fc | 5 | // Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup |
457814b5 JS |
6 | // Created: 04/01/98 |
7 | // RCS-ID: $Id$ | |
2d1df0fc VZ |
8 | // Copyright: (c) 1998 Julian Smart |
9 | // (c) 2008 Vadim Zeitlin | |
2f6c54eb | 10 | // Licence: wxWindows license |
457814b5 JS |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
2d1df0fc VZ |
13 | #ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_ |
14 | #define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_ | |
457814b5 JS |
15 | |
16 | #include "wx/docview.h" | |
17 | ||
2d1df0fc VZ |
18 | class MyFrame; |
19 | class MyCanvas; | |
20 | class DrawingView; | |
457814b5 JS |
21 | |
22 | // Define a new application | |
6bdf5153 | 23 | class MyApp : public wxApp |
457814b5 | 24 | { |
f6bcfd97 | 25 | public: |
2d1df0fc VZ |
26 | // this sample can be launched in several different ways: |
27 | enum Mode | |
28 | { | |
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) | |
34 | }; | |
35 | ||
36 | MyApp(); | |
37 | ||
38 | // override some wxApp virtual methods | |
39 | virtual bool OnInit(); | |
40 | virtual int OnExit(); | |
41 | ||
42 | virtual void OnInitCmdLine(wxCmdLineParser& parser); | |
43 | virtual bool OnCmdLineParsed(wxCmdLineParser& parser); | |
44 | ||
45 | // our specific methods | |
46 | Mode GetMode() const { return m_mode; } | |
457814b5 | 47 | wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas); |
6bdf5153 | 48 | |
2d1df0fc VZ |
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; } | |
457814b5 | 55 | |
2d1df0fc VZ |
56 | private: |
57 | // append the standard document-oriented menu commands to this menu | |
58 | void AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting); | |
457814b5 | 59 | |
2d1df0fc VZ |
60 | // create the edit menu for drawing documents |
61 | wxMenu *CreateDrawingEditMenu(); | |
6bdf5153 | 62 | |
2d1df0fc VZ |
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 | |
65 | // one | |
66 | void CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit); | |
6bdf5153 | 67 | |
6bdf5153 | 68 | |
2d1df0fc VZ |
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 | |
f6bcfd97 | 72 | void OnAbout(wxCommandEvent& event); |
457814b5 | 73 | |
457814b5 | 74 | |
2d1df0fc VZ |
75 | // the currently used mode |
76 | Mode m_mode; | |
77 | ||
78 | // only used if m_mode == Mode_Single | |
79 | MyCanvas *m_canvas; | |
80 | wxMenu *m_menuEdit; | |
457814b5 | 81 | |
2d1df0fc | 82 | DECLARE_EVENT_TABLE() |
c0c133e1 | 83 | wxDECLARE_NO_COPY_CLASS(MyApp); |
2d1df0fc VZ |
84 | }; |
85 | ||
86 | DECLARE_APP(MyApp) | |
457814b5 | 87 | |
2d1df0fc | 88 | #endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_ |