]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/configtoolview.h
More details about the internal module name changes
[wxWidgets.git] / utils / configtool / src / configtoolview.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: configtoolview.h
3 // Purpose: View class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2003-06-04
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence:
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _CT_CONFIGTOOLVIEW_H_
13 #define _CT_CONFIGTOOLVIEW_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "configtoolview.cpp"
17 #endif
18
19 #include "wx/docview.h"
20 #include "wx/treectrl.h"
21 #include "wx/fdrepdlg.h"
22 #include "configitem.h"
23
24 class ctConfigTreeCtrl;
25 class WXDLLEXPORT wxNotebookEvent;
26
27 /*
28 * ctConfigToolView
29 */
30
31 class ctConfigItem;
32 class ctConfigToolView: public wxView
33 {
34 DECLARE_DYNAMIC_CLASS(ctConfigToolView)
35 public:
36 ctConfigToolView();
37 ~ctConfigToolView() {};
38
39 //// Overrides
40
41 bool OnCreate(wxDocument *doc, long flags);
42 void OnDraw(wxDC *dc);
43 void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
44 bool OnClose(bool deleteWindow = TRUE);
45 void OnChangeFilename();
46
47 //// Operations
48
49 /// Gets the tree item in sync with the item.
50 void SyncItem(ctConfigTreeCtrl* treeControl, ctConfigItem* item);
51
52 /// Add item and its children to the tree
53 void AddItems(ctConfigTreeCtrl* treeControl, ctConfigItem* item);
54
55 /// Clicked an icon
56 void OnIconLeftDown(ctConfigTreeCtrl* treeControl, ctConfigItem* item);
57
58 /// Add an item
59 void AddItem(ctConfigType type, const wxString& msg);
60
61 /// Regenerate setup.h and configure command
62 void RegenerateSetup();
63
64 //// Accessors
65
66 /// Returns the selected config item, if any.
67 ctConfigItem* GetSelection();
68
69 //// Event handlers
70
71 /// General disabler
72 void OnUpdateDisable(wxUpdateUIEvent& event);
73
74 /// Enable add item menu items
75 void OnUpdateAddItem(wxUpdateUIEvent& event);
76
77 /// Add a checkbox item
78 void OnAddCheckBoxItem(wxCommandEvent& event);
79
80 /// Add a radiobutton item
81 void OnAddRadioButtonItem(wxCommandEvent& event);
82
83 /// Add a group item
84 void OnAddGroupItem(wxCommandEvent& event);
85
86 /// Add a check group item
87 void OnAddCheckGroupItem(wxCommandEvent& event);
88
89 /// Add a radio group item
90 void OnAddRadioGroupItem(wxCommandEvent& event);
91
92 /// Add a string item
93 void OnAddStringItem(wxCommandEvent& event);
94
95 /// Delete an item
96 void OnDeleteItem(wxCommandEvent& event);
97
98 /// Rename an item
99 void OnRenameItem(wxCommandEvent& event);
100
101 /// Copy an item to the clipboard
102 void OnCopy(wxCommandEvent& event);
103
104 /// Copy an item to the clipboard and cut the item
105 void OnCut(wxCommandEvent& event);
106
107 /// Paste an item from the clipboard to the tree
108 void OnPaste(wxCommandEvent& event);
109
110 /// Item help
111 void OnItemHelp(wxCommandEvent& event);
112
113 /// Update for copy command
114 void OnUpdateCopy(wxUpdateUIEvent& event);
115
116 /// Update for cut
117 void OnUpdateCut(wxUpdateUIEvent& event);
118
119 /// Update for paste
120 void OnUpdatePaste(wxUpdateUIEvent& event);
121
122 /// Update for item help
123 void OnUpdateItemHelp(wxUpdateUIEvent& event);
124
125 // Context menu events
126
127 /// Copy an item to the clipboard
128 void OnContextCopy(wxCommandEvent& event);
129
130 /// Copy an item to the clipboard and cut the item
131 void OnContextCut(wxCommandEvent& event);
132
133 /// Paste an item from the clipboard to the tree
134 void OnContextPasteBefore(wxCommandEvent& event);
135
136 /// Paste an item from the clipboard to the tree
137 void OnContextPasteAfter(wxCommandEvent& event);
138
139 /// Paste an item from the clipboard to the tree
140 void OnContextPasteAsChild(wxCommandEvent& event);
141
142 /// Copy an item to the clipboard
143 void OnUpdateContextCopy(wxUpdateUIEvent& event);
144
145 /// Copy an item to the clipboard and cut the item
146 void OnUpdateContextCut(wxUpdateUIEvent& event);
147
148 /// Paste an item from the clipboard to the tree
149 void OnUpdateContextPasteBefore(wxUpdateUIEvent& event);
150
151 /// Paste an item from the clipboard to the tree
152 void OnUpdateContextPasteAfter(wxUpdateUIEvent& event);
153
154 /// Paste an item from the clipboard to the tree
155 void OnUpdateContextPasteAsChild(wxUpdateUIEvent& event);
156
157 // Custom property events
158
159 /// Add a custom property
160 void OnAddCustomProperty(wxCommandEvent& event);
161
162 /// Edit a custom property
163 void OnEditCustomProperty(wxCommandEvent& event);
164
165 /// Delete a custom property
166 void OnDeleteCustomProperty(wxCommandEvent& event);
167
168 /// Add a custom property: update event
169 void OnUpdateAddCustomProperty(wxUpdateUIEvent& event);
170
171 /// Edit a custom property: update event
172 void OnUpdateEditCustomProperty(wxUpdateUIEvent& event);
173
174 /// Delete a custom property: update event
175 void OnUpdateDeleteCustomProperty(wxUpdateUIEvent& event);
176
177 // Notebook events
178
179 /// Regenerate if selected a tab
180 void OnTabSelect(wxNotebookEvent& event);
181
182 /// Saving setup file
183 void OnSaveSetupFile(wxCommandEvent& event);
184
185 /// Save configure command file
186 void OnSaveConfigureCommand(wxCommandEvent& event);
187
188 /// Saving setup file update handler
189 void OnUpdateSaveSetupFile(wxUpdateUIEvent& event);
190
191 /// Save configure command file update handler
192 void OnUpdateSaveConfigureCommand(wxUpdateUIEvent& event);
193
194 // Find
195
196 /// Find text
197 void OnFind(wxCommandEvent& event);
198
199 /// Update find text
200 void OnUpdateFind(wxUpdateUIEvent& event);
201
202 // Go (now: save setup.h or configurewx.sh. later: invoke configure/make)
203
204 /// Save default file type
205 void OnGo(wxCommandEvent& event);
206
207 /// Update
208 void OnUpdateGo(wxUpdateUIEvent& event);
209
210 DECLARE_EVENT_TABLE()
211
212 protected:
213 };
214
215 /*
216 * ctConfigToolHint
217 *
218 * Hint to pass to UpdateAllViews
219 *
220 */
221
222 // Update hint symbols
223 #define ctNoHint 0
224 #define ctAllSaved 1
225 #define ctClear 2
226 #define ctValueChanged 3
227 #define ctSelChanged 4
228 #define ctFilenameChanged 5
229 #define ctInitialUpdate 6
230
231 class ctConfigItem;
232 class ctConfigToolHint: public wxObject
233 {
234 public:
235 ctConfigToolHint(ctConfigItem* item, int op) { m_item = item; m_op = op; }
236
237 ctConfigItem* m_item;
238 int m_op;
239 };
240
241 /*
242 * ctFindReplaceDialog
243 */
244
245 class ctFindReplaceDialog: public wxFindReplaceDialog
246 {
247 public:
248 // constructors and destructors
249 ctFindReplaceDialog( wxWindow* parent, const wxString& title,
250 long style = 0 );
251
252 void OnFind(wxFindDialogEvent& event);
253 void OnClose(wxFindDialogEvent& event);
254
255 // If wrap is TRUE, go back to the beginning if at the end of the
256 // document.
257 bool DoFind(const wxString& textToFind, bool matchCase, bool wholeWord, bool wrap = TRUE);
258
259 ctConfigItem* FindNextItem(ctConfigToolDoc* doc,
260 ctConfigItem* item,
261 const wxString& text,
262 bool matchCase,
263 bool matchWordOnly,
264 bool wrap,
265 bool skipFirst);
266 static wxFindReplaceData sm_findData;
267 static wxString sm_currentItem; // card name
268
269 private:
270 DECLARE_EVENT_TABLE()
271 };
272
273 #endif
274 // _CT_CONFIGTOOLVIEW_H_