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 // Go (now: save setup.h or configurewx.sh. later: invoke configure/make)
204 /// Save default file type
205 void OnGo(wxCommandEvent
& event
);
208 void OnUpdateGo(wxUpdateUIEvent
& event
);
210 DECLARE_EVENT_TABLE()
218 * Hint to pass to UpdateAllViews
222 // Update hint symbols
226 #define ctValueChanged 3
227 #define ctSelChanged 4
228 #define ctFilenameChanged 5
229 #define ctInitialUpdate 6
232 class ctConfigToolHint
: public wxObject
235 ctConfigToolHint(ctConfigItem
* item
, int op
) { m_item
= item
; m_op
= op
; }
237 ctConfigItem
* m_item
;
242 * ctFindReplaceDialog
245 class ctFindReplaceDialog
: public wxFindReplaceDialog
248 // constructors and destructors
249 ctFindReplaceDialog( wxWindow
* parent
, const wxString
& title
,
252 void OnFind(wxFindDialogEvent
& event
);
253 void OnClose(wxFindDialogEvent
& event
);
255 // If wrap is TRUE, go back to the beginning if at the end of the
257 bool DoFind(const wxString
& textToFind
, bool matchCase
, bool wholeWord
, bool wrap
= TRUE
);
259 ctConfigItem
* FindNextItem(ctConfigToolDoc
* doc
,
261 const wxString
& text
,
266 static wxFindReplaceData sm_findData
;
267 static wxString sm_currentItem
; // card name
270 DECLARE_EVENT_TABLE()
274 // _CT_CONFIGTOOLVIEW_H_