]>
Commit | Line | Data |
---|---|---|
d7463f75 JS |
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 "configitem.h" | |
22 | ||
23 | class ctConfigTreeCtrl; | |
24 | class WXDLLEXPORT wxNotebookEvent; | |
25 | ||
26 | /* | |
27 | * ctConfigToolView | |
28 | */ | |
29 | ||
30 | class ctConfigItem; | |
31 | class ctConfigToolView: public wxView | |
32 | { | |
33 | DECLARE_DYNAMIC_CLASS(ctConfigToolView) | |
34 | public: | |
35 | ctConfigToolView(); | |
36 | ~ctConfigToolView() {}; | |
37 | ||
38 | //// Overrides | |
39 | ||
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(); | |
45 | ||
46 | //// Operations | |
47 | ||
48 | /// Gets the tree item in sync with the item. | |
49 | void SyncItem(ctConfigTreeCtrl* treeControl, ctConfigItem* item); | |
50 | ||
51 | /// Add item and its children to the tree | |
52 | void AddItems(ctConfigTreeCtrl* treeControl, ctConfigItem* item); | |
53 | ||
54 | /// Clicked an icon | |
55 | void OnIconLeftDown(ctConfigTreeCtrl* treeControl, ctConfigItem* item); | |
56 | ||
57 | /// Add an item | |
58 | void AddItem(ctConfigType type, const wxString& msg); | |
59 | ||
60 | /// Regenerate setup.h and configure command | |
61 | void RegenerateSetup(); | |
62 | ||
63 | //// Accessors | |
64 | ||
65 | /// Returns the selected config item, if any. | |
66 | ctConfigItem* GetSelection(); | |
67 | ||
68 | //// Event handlers | |
69 | ||
70 | /// General disabler | |
71 | void OnUpdateDisable(wxUpdateUIEvent& event); | |
72 | ||
73 | /// Enable add item menu items | |
74 | void OnUpdateAddItem(wxUpdateUIEvent& event); | |
75 | ||
76 | /// Add a checkbox item | |
77 | void OnAddCheckBoxItem(wxCommandEvent& event); | |
78 | ||
79 | /// Add a radiobutton item | |
80 | void OnAddRadioButtonItem(wxCommandEvent& event); | |
81 | ||
82 | /// Add a group item | |
83 | void OnAddGroupItem(wxCommandEvent& event); | |
84 | ||
85 | /// Add a check group item | |
86 | void OnAddCheckGroupItem(wxCommandEvent& event); | |
87 | ||
88 | /// Add a radio group item | |
89 | void OnAddRadioGroupItem(wxCommandEvent& event); | |
90 | ||
91 | /// Add a string item | |
92 | void OnAddStringItem(wxCommandEvent& event); | |
93 | ||
94 | /// Delete an item | |
95 | void OnDeleteItem(wxCommandEvent& event); | |
96 | ||
97 | /// Rename an item | |
98 | void OnRenameItem(wxCommandEvent& event); | |
99 | ||
100 | /// Copy an item to the clipboard | |
101 | void OnCopy(wxCommandEvent& event); | |
102 | ||
103 | /// Copy an item to the clipboard and cut the item | |
104 | void OnCut(wxCommandEvent& event); | |
105 | ||
106 | /// Paste an item from the clipboard to the tree | |
107 | void OnPaste(wxCommandEvent& event); | |
108 | ||
109 | /// Item help | |
110 | void OnItemHelp(wxCommandEvent& event); | |
111 | ||
112 | /// Update for copy command | |
113 | void OnUpdateCopy(wxUpdateUIEvent& event); | |
114 | ||
115 | /// Update for cut | |
116 | void OnUpdateCut(wxUpdateUIEvent& event); | |
117 | ||
118 | /// Update for paste | |
119 | void OnUpdatePaste(wxUpdateUIEvent& event); | |
120 | ||
121 | /// Update for item help | |
122 | void OnUpdateItemHelp(wxUpdateUIEvent& event); | |
123 | ||
124 | // Context menu events | |
125 | ||
126 | /// Copy an item to the clipboard | |
127 | void OnContextCopy(wxCommandEvent& event); | |
128 | ||
129 | /// Copy an item to the clipboard and cut the item | |
130 | void OnContextCut(wxCommandEvent& event); | |
131 | ||
132 | /// Paste an item from the clipboard to the tree | |
133 | void OnContextPasteBefore(wxCommandEvent& event); | |
134 | ||
135 | /// Paste an item from the clipboard to the tree | |
136 | void OnContextPasteAfter(wxCommandEvent& event); | |
137 | ||
138 | /// Paste an item from the clipboard to the tree | |
139 | void OnContextPasteAsChild(wxCommandEvent& event); | |
140 | ||
141 | /// Copy an item to the clipboard | |
142 | void OnUpdateContextCopy(wxUpdateUIEvent& event); | |
143 | ||
144 | /// Copy an item to the clipboard and cut the item | |
145 | void OnUpdateContextCut(wxUpdateUIEvent& event); | |
146 | ||
147 | /// Paste an item from the clipboard to the tree | |
148 | void OnUpdateContextPasteBefore(wxUpdateUIEvent& event); | |
149 | ||
150 | /// Paste an item from the clipboard to the tree | |
151 | void OnUpdateContextPasteAfter(wxUpdateUIEvent& event); | |
152 | ||
153 | /// Paste an item from the clipboard to the tree | |
154 | void OnUpdateContextPasteAsChild(wxUpdateUIEvent& event); | |
155 | ||
156 | // Custom property events | |
157 | ||
158 | /// Add a custom property | |
159 | void OnAddCustomProperty(wxCommandEvent& event); | |
160 | ||
161 | /// Edit a custom property | |
162 | void OnEditCustomProperty(wxCommandEvent& event); | |
163 | ||
164 | /// Delete a custom property | |
165 | void OnDeleteCustomProperty(wxCommandEvent& event); | |
166 | ||
167 | /// Add a custom property: update event | |
168 | void OnUpdateAddCustomProperty(wxUpdateUIEvent& event); | |
169 | ||
170 | /// Edit a custom property: update event | |
171 | void OnUpdateEditCustomProperty(wxUpdateUIEvent& event); | |
172 | ||
173 | /// Delete a custom property: update event | |
174 | void OnUpdateDeleteCustomProperty(wxUpdateUIEvent& event); | |
175 | ||
176 | // Notebook events | |
177 | ||
178 | /// Regenerate if selected a tab | |
179 | void OnTabSelect(wxNotebookEvent& event); | |
180 | ||
181 | /// Saving setup file | |
182 | void OnSaveSetupFile(wxCommandEvent& event); | |
183 | ||
184 | /// Save configure command file | |
185 | void OnSaveConfigureCommand(wxCommandEvent& event); | |
186 | ||
187 | /// Saving setup file update handler | |
188 | void OnUpdateSaveSetupFile(wxUpdateUIEvent& event); | |
189 | ||
190 | /// Save configure command file update handler | |
191 | void OnUpdateSaveConfigureCommand(wxUpdateUIEvent& event); | |
192 | ||
193 | DECLARE_EVENT_TABLE() | |
194 | ||
195 | protected: | |
196 | }; | |
197 | ||
198 | /* | |
199 | * ctConfigToolHint | |
200 | * | |
201 | * Hint to pass to UpdateAllViews | |
202 | * | |
203 | */ | |
204 | ||
205 | // Update hint symbols | |
206 | #define ctNoHint 0 | |
207 | #define ctAllSaved 1 | |
208 | #define ctClear 2 | |
209 | #define ctValueChanged 3 | |
210 | #define ctSelChanged 4 | |
211 | #define ctFilenameChanged 5 | |
212 | #define ctInitialUpdate 6 | |
213 | ||
214 | class ctConfigItem; | |
215 | class ctConfigToolHint: public wxObject | |
216 | { | |
217 | public: | |
218 | ctConfigToolHint(ctConfigItem* item, int op) { m_item = item; m_op = op; } | |
219 | ||
220 | ctConfigItem* m_item; | |
221 | int m_op; | |
222 | }; | |
223 | ||
224 | #endif | |
225 | // _CT_CONFIGTOOLVIEW_H_ |