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