]>
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
7 // Copyright: (c) 1998 Julian Smart
8 // (c) 2008 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
13 #define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
15 #include "wx/docview.h"
21 // Define a new application
22 class MyApp
: public wxApp
25 // this sample can be launched in several different ways:
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)
37 // override some wxApp virtual methods
38 virtual bool OnInit();
41 virtual void OnInitCmdLine(wxCmdLineParser
& parser
);
42 virtual bool OnCmdLineParsed(wxCmdLineParser
& parser
);
44 // our specific methods
45 Mode
GetMode() const { return m_mode
; }
46 wxFrame
*CreateChildFrame(wxView
*view
, bool isCanvas
);
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
; }
56 // append the standard document-oriented menu commands to this menu
57 void AppendDocumentFileCommands(wxMenu
*menu
, bool supportsPrinting
);
59 // create the edit menu for drawing documents
60 wxMenu
*CreateDrawingEditMenu();
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
65 void CreateMenuBarForFrame(wxFrame
*frame
, wxMenu
*file
, wxMenu
*edit
);
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
);
74 // the currently used mode
77 // only used if m_mode == Mode_Single
82 wxDECLARE_NO_COPY_CLASS(MyApp
);
87 #endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_