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