Document domain parameter of wxTranslations::GetTranslatedString().
[wxWidgets.git] / 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
6 // Created: 04/01/98
7 // Copyright: (c) 1998 Julian Smart
8 // (c) 2008 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
13 #define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
14
15 #include "wx/docview.h"
16
17 class MyFrame;
18 class MyCanvas;
19 class DrawingView;
20
21 // Define a new application
22 class MyApp : public wxApp
23 {
24 public:
25 // this sample can be launched in several different ways:
26 enum Mode
27 {
28 #if wxUSE_MDI_ARCHITECTURE
29 Mode_MDI, // MDI mode: multiple documents, single top level window
30 #endif // wxUSE_MDI_ARCHITECTURE
31 Mode_SDI, // SDI mode: multiple documents, multiple top level windows
32 Mode_Single // single document mode (and hence single top level window)
33 };
34
35 MyApp();
36
37 // override some wxApp virtual methods
38 virtual bool OnInit();
39 virtual int OnExit();
40
41 virtual void OnInitCmdLine(wxCmdLineParser& parser);
42 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
43
44 // our specific methods
45 Mode GetMode() const { return m_mode; }
46 wxFrame *CreateChildFrame(wxView *view, bool isCanvas);
47
48 // these accessors should only be called in single document mode, otherwise
49 // the pointers are NULL and an assert is triggered
50 MyCanvas *GetMainWindowCanvas() const
51 { wxASSERT(m_canvas); return m_canvas; }
52 wxMenu *GetMainWindowEditMenu() const
53 { wxASSERT(m_menuEdit); return m_menuEdit; }
54
55 private:
56 // append the standard document-oriented menu commands to this menu
57 void AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting);
58
59 // create the edit menu for drawing documents
60 wxMenu *CreateDrawingEditMenu();
61
62 // create and associate with the given frame the menu bar containing the
63 // given file and edit (possibly NULL) menus as well as the standard help
64 // one
65 void CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit);
66
67
68 // show the about box: as we can have different frames it's more
69 // convenient, even if somewhat less usual, to handle this in the
70 // application object itself
71 void OnAbout(wxCommandEvent& event);
72
73
74 // the currently used mode
75 Mode m_mode;
76
77 // only used if m_mode == Mode_Single
78 MyCanvas *m_canvas;
79 wxMenu *m_menuEdit;
80
81 DECLARE_EVENT_TABLE()
82 wxDECLARE_NO_COPY_CLASS(MyApp);
83 };
84
85 DECLARE_APP(MyApp)
86
87 #endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_