1 /////////////////////////////////////////////////////////////////////////////
2 // Name: configtoolview.h
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _CT_CONFIGTOOLVIEW_H_
13 #define _CT_CONFIGTOOLVIEW_H_
16 #pragma interface "configtoolview.cpp"
19 #include "wx/docview.h"
20 #include "wx/treectrl.h"
21 #include "wx/fdrepdlg.h"
22 #include "configitem.h"
24 class ctConfigTreeCtrl
;
25 class WXDLLEXPORT wxNotebookEvent
;
32 class ctConfigToolView
: public wxView
34 DECLARE_DYNAMIC_CLASS(ctConfigToolView
)
37 ~ctConfigToolView() {};
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();
49 /// Gets the tree item in sync with the item.
50 void SyncItem(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
52 /// Add item and its children to the tree
53 void AddItems(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
56 void OnIconLeftDown(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
59 void AddItem(ctConfigType type
, const wxString
& msg
);
61 /// Regenerate setup.h and configure command
62 void RegenerateSetup();
66 /// Returns the selected config item, if any.
67 ctConfigItem
* GetSelection();
72 void OnUpdateDisable(wxUpdateUIEvent
& event
);
74 /// Enable add item menu items
75 void OnUpdateAddItem(wxUpdateUIEvent
& event
);
77 /// Add a checkbox item
78 void OnAddCheckBoxItem(wxCommandEvent
& event
);
80 /// Add a radiobutton item
81 void OnAddRadioButtonItem(wxCommandEvent
& event
);
84 void OnAddGroupItem(wxCommandEvent
& event
);
86 /// Add a check group item
87 void OnAddCheckGroupItem(wxCommandEvent
& event
);
89 /// Add a radio group item
90 void OnAddRadioGroupItem(wxCommandEvent
& event
);
93 void OnAddStringItem(wxCommandEvent
& event
);
96 void OnDeleteItem(wxCommandEvent
& event
);
99 void OnRenameItem(wxCommandEvent
& event
);
101 /// Copy an item to the clipboard
102 void OnCopy(wxCommandEvent
& event
);
104 /// Copy an item to the clipboard and cut the item
105 void OnCut(wxCommandEvent
& event
);
107 /// Paste an item from the clipboard to the tree
108 void OnPaste(wxCommandEvent
& event
);
111 void OnItemHelp(wxCommandEvent
& event
);
113 /// Update for copy command
114 void OnUpdateCopy(wxUpdateUIEvent
& event
);
117 void OnUpdateCut(wxUpdateUIEvent
& event
);
120 void OnUpdatePaste(wxUpdateUIEvent
& event
);
122 /// Update for item help
123 void OnUpdateItemHelp(wxUpdateUIEvent
& event
);
125 // Context menu events
127 /// Copy an item to the clipboard
128 void OnContextCopy(wxCommandEvent
& event
);
130 /// Copy an item to the clipboard and cut the item
131 void OnContextCut(wxCommandEvent
& event
);
133 /// Paste an item from the clipboard to the tree
134 void OnContextPasteBefore(wxCommandEvent
& event
);
136 /// Paste an item from the clipboard to the tree
137 void OnContextPasteAfter(wxCommandEvent
& event
);
139 /// Paste an item from the clipboard to the tree
140 void OnContextPasteAsChild(wxCommandEvent
& event
);
142 /// Copy an item to the clipboard
143 void OnUpdateContextCopy(wxUpdateUIEvent
& event
);
145 /// Copy an item to the clipboard and cut the item
146 void OnUpdateContextCut(wxUpdateUIEvent
& event
);
148 /// Paste an item from the clipboard to the tree
149 void OnUpdateContextPasteBefore(wxUpdateUIEvent
& event
);
151 /// Paste an item from the clipboard to the tree
152 void OnUpdateContextPasteAfter(wxUpdateUIEvent
& event
);
154 /// Paste an item from the clipboard to the tree
155 void OnUpdateContextPasteAsChild(wxUpdateUIEvent
& event
);
157 // Custom property events
159 /// Add a custom property
160 void OnAddCustomProperty(wxCommandEvent
& event
);
162 /// Edit a custom property
163 void OnEditCustomProperty(wxCommandEvent
& event
);
165 /// Delete a custom property
166 void OnDeleteCustomProperty(wxCommandEvent
& event
);
168 /// Add a custom property: update event
169 void OnUpdateAddCustomProperty(wxUpdateUIEvent
& event
);
171 /// Edit a custom property: update event
172 void OnUpdateEditCustomProperty(wxUpdateUIEvent
& event
);
174 /// Delete a custom property: update event
175 void OnUpdateDeleteCustomProperty(wxUpdateUIEvent
& event
);
179 /// Regenerate if selected a tab
180 void OnTabSelect(wxNotebookEvent
& event
);
182 /// Saving setup file
183 void OnSaveSetupFile(wxCommandEvent
& event
);
185 /// Save configure command file
186 void OnSaveConfigureCommand(wxCommandEvent
& event
);
188 /// Saving setup file update handler
189 void OnUpdateSaveSetupFile(wxUpdateUIEvent
& event
);
191 /// Save configure command file update handler
192 void OnUpdateSaveConfigureCommand(wxUpdateUIEvent
& event
);
197 void OnFind(wxCommandEvent
& event
);
200 void OnUpdateFind(wxUpdateUIEvent
& event
);
202 DECLARE_EVENT_TABLE()
210 * Hint to pass to UpdateAllViews
214 // Update hint symbols
218 #define ctValueChanged 3
219 #define ctSelChanged 4
220 #define ctFilenameChanged 5
221 #define ctInitialUpdate 6
224 class ctConfigToolHint
: public wxObject
227 ctConfigToolHint(ctConfigItem
* item
, int op
) { m_item
= item
; m_op
= op
; }
229 ctConfigItem
* m_item
;
234 * ctFindReplaceDialog
237 class ctFindReplaceDialog
: public wxFindReplaceDialog
240 // constructors and destructors
241 ctFindReplaceDialog( wxWindow
* parent
, const wxString
& title
,
244 void OnFind(wxFindDialogEvent
& event
);
245 void OnClose(wxFindDialogEvent
& event
);
247 // If wrap is TRUE, go back to the beginning if at the end of the
249 bool DoFind(const wxString
& textToFind
, bool matchCase
, bool wholeWord
, bool wrap
= TRUE
);
251 ctConfigItem
* FindNextItem(ctConfigToolDoc
* doc
,
253 const wxString
& text
,
258 static wxFindReplaceData sm_findData
;
259 static wxString sm_currentItem
; // card name
262 DECLARE_EVENT_TABLE()
266 // _CT_CONFIGTOOLVIEW_H_