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