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