]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/mainframe.h
fix some more samples for digital mars
[wxWidgets.git] / utils / configtool / src / mainframe.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mainframe.h
3 // Purpose: Main frame class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2002-09-04
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence:
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _AP_MAINFRAME_H_
13 #define _AP_MAINFRAME_H_
14
15 #ifdef __GNUG__
16 #pragma interface "mainframe.cpp"
17 #endif
18
19 #include "wx/imaglist.h"
20 #include "wx/docview.h"
21
22 class WXDLLEXPORT wxHtmlWindow;
23 class WXDLLEXPORT wxSplitterWindow;
24 class WXDLLEXPORT wxNotebookEvent;
25
26 class ctConfigTreeCtrl;
27 class ctPropertyEditor;
28 class ctOutputWindow;
29
30 /*!
31 * \brief The main window of the application.
32 */
33
34 class ctMainFrame: public wxDocParentFrame
35 {
36 DECLARE_CLASS(ctMainFrame)
37 public:
38 /// Constructor.
39 ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
40
41 // Event handlers
42
43 /// Handles the close window event.
44 void OnCloseWindow(wxCloseEvent& event);
45
46 /// Handles the About menu event.
47 void OnAbout(wxCommandEvent& event);
48
49 /// Handles the frame activation event.
50 void OnActivate(wxActivateEvent& event);
51
52 /// Handles the File Open menu event.
53 void OnOpen(wxCommandEvent& event);
54
55 /// Handles the File New menu event.
56 void OnNew(wxCommandEvent& event);
57
58 /// Handles the Exit menu event.
59 void OnExit(wxCommandEvent& event);
60
61 /// Handles the Settings menu event.
62 void OnSettings(wxCommandEvent& event);
63
64 /// Handles the Show Toolbar menu event.
65 void OnShowToolbar(wxCommandEvent& event);
66
67 /// Handles the Help Contents menu event.
68 void OnHelp(wxCommandEvent& event);
69
70 /// Handles context help
71 void OnContextHelp(wxCommandEvent& event);
72
73 /// Handles the Help Contents menu event for the reference manual.
74 void OnReferenceHelp(wxCommandEvent& event);
75
76 /// General disabler
77 void OnUpdateDisable(wxUpdateUIEvent& event);
78
79 // Operations
80
81 /// Creates the main frame subwindows.
82 bool CreateWindows(wxWindow* parent);
83
84 /// Initialises the toolbar.
85 void InitToolBar(wxToolBar* toolbar);
86
87 /// Creates the menubar.
88 wxMenuBar* CreateMenuBar();
89
90 /// Resizes the main frame according to the
91 /// state of the toolbar
92 void ResizeFrame();
93
94 /// Update the frame title.
95 void UpdateFrameTitle();
96
97 // Accessors
98
99 /// Returns the tree control.
100 ctConfigTreeCtrl* GetConfigTreeCtrl() const { return m_configTreeCtrl; }
101
102 /// Returns the property editor window.
103 ctPropertyEditor* GetPropertyEditor() const { return m_propertyEditor; }
104
105 /// Returns the document for this frame.
106 ctConfigToolDoc* GetDocument() const { return m_document; }
107
108 /// Sets the document for this frame.
109 void SetDocument(ctConfigToolDoc* doc) { m_document = doc; }
110
111 /// Returns the edit menu.
112 wxMenu* GetEditMenu() const { return m_editMenu; }
113
114 /// Returns the setup page window
115 ctOutputWindow* GetSetupPage() const { return m_setupPage; }
116
117 /// Returns the configure page window
118 ctOutputWindow* GetConfigurePage() const { return m_configurePage; }
119
120 /// Returns the main notebook containing editor and text tabs
121 wxNotebook* GetMainNotebook() const { return m_mainNotebook; }
122
123 DECLARE_EVENT_TABLE()
124
125 protected:
126 wxImageList m_imageList;
127
128 /// The splitter between the tree and the property window.
129 wxSplitterWindow* m_treeSplitterWindow;
130
131 /// The config tree window.
132 ctConfigTreeCtrl* m_configTreeCtrl;
133
134 /// The property editor window.
135 ctPropertyEditor* m_propertyEditor;
136
137 /// The document for this frame.
138 ctConfigToolDoc* m_document;
139
140 /// The edit menu.
141 wxMenu* m_editMenu;
142
143 /// The notebook with property editor and setup.h/configure
144 /// views
145 wxNotebook* m_mainNotebook;
146 ctOutputWindow* m_setupPage;
147 ctOutputWindow* m_configurePage;
148 };
149
150 /*!
151 * ctOutputWindow represents a page showing a setup.h file or config command.
152 */
153
154 class ctOutputWindow: public wxPanel
155 {
156 DECLARE_CLASS(ctOutputWindow)
157 public:
158 ctOutputWindow(wxWindow* parent, wxWindowID id,
159 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
160 ~ctOutputWindow();
161
162 /// Initialise the windows.
163 void CreateWindows();
164
165 /// Copies the text to the clipboard.
166 void OnCopyToClipboard(wxCommandEvent& event);
167 void OnUpdateCopy(wxUpdateUIEvent& event);
168
169 /// Regenerates setup.h/configure command
170 void OnRegenerate(wxCommandEvent& event);
171 void OnUpdateRegenerate(wxUpdateUIEvent& event);
172
173 /// Saves the file.
174 void OnSaveText(wxCommandEvent& event);
175 void OnUpdateSaveText(wxUpdateUIEvent& event);
176
177 /// Sets the code in the text control.
178 void SetText(const wxString& text);
179
180 /// Sets the filename.
181 void SetFilename(const wxString& filename);
182
183 /// Sets the document
184 void SetDocument(ctConfigToolDoc* doc) { m_doc = doc; }
185
186 /// Get text control
187 wxTextCtrl* GetCodeCtrl() const { return m_codeCtrl; }
188
189 /// Get filename control
190 wxTextCtrl* GetFilenameCtrl() const { return m_filenameCtrl; }
191
192 protected:
193 wxTextCtrl* m_codeCtrl;
194 wxTextCtrl* m_filenameCtrl;
195 ctConfigToolDoc* m_doc;
196
197 DECLARE_EVENT_TABLE()
198 };
199
200
201 #endif
202 // _AP_MAINFRAME_H_
203