]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/configtoolview.h
Added Find dialog
[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 #ifdef __GNUG__
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 DECLARE_EVENT_TABLE()
203
204 protected:
205 };
206
207 /*
208 * ctConfigToolHint
209 *
210 * Hint to pass to UpdateAllViews
211 *
212 */
213
214 // Update hint symbols
215 #define ctNoHint 0
216 #define ctAllSaved 1
217 #define ctClear 2
218 #define ctValueChanged 3
219 #define ctSelChanged 4
220 #define ctFilenameChanged 5
221 #define ctInitialUpdate 6
222
223 class ctConfigItem;
224 class ctConfigToolHint: public wxObject
225 {
226 public:
227 ctConfigToolHint(ctConfigItem* item, int op) { m_item = item; m_op = op; }
228
229 ctConfigItem* m_item;
230 int m_op;
231 };
232
233 /*
234 * ctFindReplaceDialog
235 */
236
237 class ctFindReplaceDialog: public wxFindReplaceDialog
238 {
239 public:
240 // constructors and destructors
241 ctFindReplaceDialog( wxWindow* parent, const wxString& title,
242 long style = 0 );
243
244 void OnFind(wxFindDialogEvent& event);
245 void OnClose(wxFindDialogEvent& event);
246
247 // If wrap is TRUE, go back to the beginning if at the end of the
248 // document.
249 bool DoFind(const wxString& textToFind, bool matchCase, bool wholeWord, bool wrap = TRUE);
250
251 ctConfigItem* FindNextItem(ctConfigToolDoc* doc,
252 ctConfigItem* item,
253 const wxString& text,
254 bool matchCase,
255 bool matchWordOnly,
256 bool wrap,
257 bool skipFirst);
258 static wxFindReplaceData sm_findData;
259 static wxString sm_currentItem; // card name
260
261 private:
262 DECLARE_EVENT_TABLE()
263 };
264
265 #endif
266 // _CT_CONFIGTOOLVIEW_H_