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 "configitem.h"
23 class ctConfigTreeCtrl
;
24 class WXDLLEXPORT wxNotebookEvent
;
31 class ctConfigToolView
: public wxView
33 DECLARE_DYNAMIC_CLASS(ctConfigToolView
)
36 ~ctConfigToolView() {};
40 bool OnCreate(wxDocument
*doc
, long flags
);
41 void OnDraw(wxDC
*dc
);
42 void OnUpdate(wxView
*sender
, wxObject
*hint
= (wxObject
*) NULL
);
43 bool OnClose(bool deleteWindow
= TRUE
);
44 void OnChangeFilename();
48 /// Gets the tree item in sync with the item.
49 void SyncItem(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
51 /// Add item and its children to the tree
52 void AddItems(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
55 void OnIconLeftDown(ctConfigTreeCtrl
* treeControl
, ctConfigItem
* item
);
58 void AddItem(ctConfigType type
, const wxString
& msg
);
60 /// Regenerate setup.h and configure command
61 void RegenerateSetup();
65 /// Returns the selected config item, if any.
66 ctConfigItem
* GetSelection();
71 void OnUpdateDisable(wxUpdateUIEvent
& event
);
73 /// Enable add item menu items
74 void OnUpdateAddItem(wxUpdateUIEvent
& event
);
76 /// Add a checkbox item
77 void OnAddCheckBoxItem(wxCommandEvent
& event
);
79 /// Add a radiobutton item
80 void OnAddRadioButtonItem(wxCommandEvent
& event
);
83 void OnAddGroupItem(wxCommandEvent
& event
);
85 /// Add a check group item
86 void OnAddCheckGroupItem(wxCommandEvent
& event
);
88 /// Add a radio group item
89 void OnAddRadioGroupItem(wxCommandEvent
& event
);
92 void OnAddStringItem(wxCommandEvent
& event
);
95 void OnDeleteItem(wxCommandEvent
& event
);
98 void OnRenameItem(wxCommandEvent
& event
);
100 /// Copy an item to the clipboard
101 void OnCopy(wxCommandEvent
& event
);
103 /// Copy an item to the clipboard and cut the item
104 void OnCut(wxCommandEvent
& event
);
106 /// Paste an item from the clipboard to the tree
107 void OnPaste(wxCommandEvent
& event
);
110 void OnItemHelp(wxCommandEvent
& event
);
112 /// Update for copy command
113 void OnUpdateCopy(wxUpdateUIEvent
& event
);
116 void OnUpdateCut(wxUpdateUIEvent
& event
);
119 void OnUpdatePaste(wxUpdateUIEvent
& event
);
121 /// Update for item help
122 void OnUpdateItemHelp(wxUpdateUIEvent
& event
);
124 // Context menu events
126 /// Copy an item to the clipboard
127 void OnContextCopy(wxCommandEvent
& event
);
129 /// Copy an item to the clipboard and cut the item
130 void OnContextCut(wxCommandEvent
& event
);
132 /// Paste an item from the clipboard to the tree
133 void OnContextPasteBefore(wxCommandEvent
& event
);
135 /// Paste an item from the clipboard to the tree
136 void OnContextPasteAfter(wxCommandEvent
& event
);
138 /// Paste an item from the clipboard to the tree
139 void OnContextPasteAsChild(wxCommandEvent
& event
);
141 /// Copy an item to the clipboard
142 void OnUpdateContextCopy(wxUpdateUIEvent
& event
);
144 /// Copy an item to the clipboard and cut the item
145 void OnUpdateContextCut(wxUpdateUIEvent
& event
);
147 /// Paste an item from the clipboard to the tree
148 void OnUpdateContextPasteBefore(wxUpdateUIEvent
& event
);
150 /// Paste an item from the clipboard to the tree
151 void OnUpdateContextPasteAfter(wxUpdateUIEvent
& event
);
153 /// Paste an item from the clipboard to the tree
154 void OnUpdateContextPasteAsChild(wxUpdateUIEvent
& event
);
156 // Custom property events
158 /// Add a custom property
159 void OnAddCustomProperty(wxCommandEvent
& event
);
161 /// Edit a custom property
162 void OnEditCustomProperty(wxCommandEvent
& event
);
164 /// Delete a custom property
165 void OnDeleteCustomProperty(wxCommandEvent
& event
);
167 /// Add a custom property: update event
168 void OnUpdateAddCustomProperty(wxUpdateUIEvent
& event
);
170 /// Edit a custom property: update event
171 void OnUpdateEditCustomProperty(wxUpdateUIEvent
& event
);
173 /// Delete a custom property: update event
174 void OnUpdateDeleteCustomProperty(wxUpdateUIEvent
& event
);
178 /// Regenerate if selected a tab
179 void OnTabSelect(wxNotebookEvent
& event
);
181 /// Saving setup file
182 void OnSaveSetupFile(wxCommandEvent
& event
);
184 /// Save configure command file
185 void OnSaveConfigureCommand(wxCommandEvent
& event
);
187 /// Saving setup file update handler
188 void OnUpdateSaveSetupFile(wxUpdateUIEvent
& event
);
190 /// Save configure command file update handler
191 void OnUpdateSaveConfigureCommand(wxUpdateUIEvent
& event
);
193 DECLARE_EVENT_TABLE()
201 * Hint to pass to UpdateAllViews
205 // Update hint symbols
209 #define ctValueChanged 3
210 #define ctSelChanged 4
211 #define ctFilenameChanged 5
212 #define ctInitialUpdate 6
215 class ctConfigToolHint
: public wxObject
218 ctConfigToolHint(ctConfigItem
* item
, int op
) { m_item
= item
; m_op
= op
; }
220 ctConfigItem
* m_item
;
225 // _CT_CONFIGTOOLVIEW_H_