]>
Commit | Line | Data |
---|---|---|
d7463f75 JS |
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 | ||
71ada1a5 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
f8105809 JS |
16 | #pragma interface "mainframe.cpp" |
17 | #endif | |
18 | ||
d7463f75 JS |
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; | |
e7767867 | 29 | class ctFindReplaceDialog; |
61775320 | 30 | class ctConfigurationBrowserWindow; |
d7463f75 JS |
31 | |
32 | /*! | |
33 | * \brief The main window of the application. | |
34 | */ | |
35 | ||
36 | class ctMainFrame: public wxDocParentFrame | |
37 | { | |
38 | DECLARE_CLASS(ctMainFrame) | |
39 | public: | |
40 | /// Constructor. | |
41 | ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style); | |
42 | ||
43 | // Event handlers | |
44 | ||
45 | /// Handles the close window event. | |
46 | void OnCloseWindow(wxCloseEvent& event); | |
47 | ||
48 | /// Handles the About menu event. | |
49 | void OnAbout(wxCommandEvent& event); | |
50 | ||
51 | /// Handles the frame activation event. | |
52 | void OnActivate(wxActivateEvent& event); | |
53 | ||
54 | /// Handles the File Open menu event. | |
55 | void OnOpen(wxCommandEvent& event); | |
56 | ||
57 | /// Handles the File New menu event. | |
58 | void OnNew(wxCommandEvent& event); | |
59 | ||
60 | /// Handles the Exit menu event. | |
61 | void OnExit(wxCommandEvent& event); | |
62 | ||
63 | /// Handles the Settings menu event. | |
64 | void OnSettings(wxCommandEvent& event); | |
65 | ||
66 | /// Handles the Show Toolbar menu event. | |
67 | void OnShowToolbar(wxCommandEvent& event); | |
68 | ||
69 | /// Handles the Help Contents menu event. | |
70 | void OnHelp(wxCommandEvent& event); | |
71 | ||
72 | /// Handles context help | |
73 | void OnContextHelp(wxCommandEvent& event); | |
74 | ||
75 | /// Handles the Help Contents menu event for the reference manual. | |
76 | void OnReferenceHelp(wxCommandEvent& event); | |
77 | ||
78 | /// General disabler | |
79 | void OnUpdateDisable(wxUpdateUIEvent& event); | |
80 | ||
81 | // Operations | |
82 | ||
83 | /// Creates the main frame subwindows. | |
84 | bool CreateWindows(wxWindow* parent); | |
85 | ||
86 | /// Initialises the toolbar. | |
87 | void InitToolBar(wxToolBar* toolbar); | |
88 | ||
89 | /// Creates the menubar. | |
90 | wxMenuBar* CreateMenuBar(); | |
91 | ||
92 | /// Resizes the main frame according to the | |
93 | /// state of the toolbar | |
94 | void ResizeFrame(); | |
95 | ||
96 | /// Update the frame title. | |
97 | void UpdateFrameTitle(); | |
98 | ||
99 | // Accessors | |
100 | ||
101 | /// Returns the tree control. | |
102 | ctConfigTreeCtrl* GetConfigTreeCtrl() const { return m_configTreeCtrl; } | |
103 | ||
104 | /// Returns the property editor window. | |
105 | ctPropertyEditor* GetPropertyEditor() const { return m_propertyEditor; } | |
106 | ||
107 | /// Returns the document for this frame. | |
108 | ctConfigToolDoc* GetDocument() const { return m_document; } | |
109 | ||
110 | /// Sets the document for this frame. | |
111 | void SetDocument(ctConfigToolDoc* doc) { m_document = doc; } | |
112 | ||
113 | /// Returns the edit menu. | |
114 | wxMenu* GetEditMenu() const { return m_editMenu; } | |
115 | ||
116 | /// Returns the setup page window | |
117 | ctOutputWindow* GetSetupPage() const { return m_setupPage; } | |
118 | ||
119 | /// Returns the configure page window | |
120 | ctOutputWindow* GetConfigurePage() const { return m_configurePage; } | |
121 | ||
122 | /// Returns the main notebook containing editor and text tabs | |
123 | wxNotebook* GetMainNotebook() const { return m_mainNotebook; } | |
124 | ||
e7767867 JS |
125 | /// Sets the find dialog for future closing |
126 | void SetFindDialog(ctFindReplaceDialog* findDialog) { m_findDialog = findDialog; } | |
127 | ||
128 | /// Gets the find dialog | |
129 | ctFindReplaceDialog* GetFindDialog() const { return m_findDialog ; } | |
130 | ||
d7463f75 JS |
131 | DECLARE_EVENT_TABLE() |
132 | ||
133 | protected: | |
134 | wxImageList m_imageList; | |
135 | ||
136 | /// The splitter between the tree and the property window. | |
137 | wxSplitterWindow* m_treeSplitterWindow; | |
138 | ||
139 | /// The config tree window. | |
140 | ctConfigTreeCtrl* m_configTreeCtrl; | |
141 | ||
142 | /// The property editor window. | |
143 | ctPropertyEditor* m_propertyEditor; | |
144 | ||
145 | /// The document for this frame. | |
146 | ctConfigToolDoc* m_document; | |
147 | ||
148 | /// The edit menu. | |
149 | wxMenu* m_editMenu; | |
150 | ||
151 | /// The notebook with property editor and setup.h/configure | |
152 | /// views | |
153 | wxNotebook* m_mainNotebook; | |
154 | ctOutputWindow* m_setupPage; | |
155 | ctOutputWindow* m_configurePage; | |
e7767867 | 156 | |
61775320 JS |
157 | // The control panel for browsing, adding and removing |
158 | // configurations. | |
159 | ctConfigurationBrowserWindow* m_configBrowserPage; | |
160 | ||
e7767867 | 161 | ctFindReplaceDialog* m_findDialog; |
d7463f75 JS |
162 | }; |
163 | ||
164 | /*! | |
165 | * ctOutputWindow represents a page showing a setup.h file or config command. | |
166 | */ | |
167 | ||
168 | class ctOutputWindow: public wxPanel | |
169 | { | |
170 | DECLARE_CLASS(ctOutputWindow) | |
171 | public: | |
172 | ctOutputWindow(wxWindow* parent, wxWindowID id, | |
173 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); | |
174 | ~ctOutputWindow(); | |
175 | ||
176 | /// Initialise the windows. | |
177 | void CreateWindows(); | |
178 | ||
179 | /// Copies the text to the clipboard. | |
180 | void OnCopyToClipboard(wxCommandEvent& event); | |
181 | void OnUpdateCopy(wxUpdateUIEvent& event); | |
182 | ||
183 | /// Regenerates setup.h/configure command | |
184 | void OnRegenerate(wxCommandEvent& event); | |
185 | void OnUpdateRegenerate(wxUpdateUIEvent& event); | |
186 | ||
187 | /// Saves the file. | |
188 | void OnSaveText(wxCommandEvent& event); | |
189 | void OnUpdateSaveText(wxUpdateUIEvent& event); | |
190 | ||
191 | /// Sets the code in the text control. | |
192 | void SetText(const wxString& text); | |
193 | ||
194 | /// Sets the filename. | |
195 | void SetFilename(const wxString& filename); | |
196 | ||
197 | /// Sets the document | |
198 | void SetDocument(ctConfigToolDoc* doc) { m_doc = doc; } | |
199 | ||
200 | /// Get text control | |
201 | wxTextCtrl* GetCodeCtrl() const { return m_codeCtrl; } | |
202 | ||
203 | /// Get filename control | |
204 | wxTextCtrl* GetFilenameCtrl() const { return m_filenameCtrl; } | |
205 | ||
206 | protected: | |
207 | wxTextCtrl* m_codeCtrl; | |
208 | wxTextCtrl* m_filenameCtrl; | |
209 | ctConfigToolDoc* m_doc; | |
210 | ||
211 | DECLARE_EVENT_TABLE() | |
212 | }; | |
213 | ||
214 | ||
215 | #endif | |
216 | // _AP_MAINFRAME_H_ | |
217 |