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