]>
Commit | Line | Data |
---|---|---|
f4e325b3 DP |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: treectrl.cpp | |
d9692df7 | 3 | // Purpose: wxTreeCtrl |
f4e325b3 | 4 | // Author: Denis Pershin |
d9692df7 | 5 | // Modified by: |
f4e325b3 | 6 | // Created: 07/05/98 |
d9692df7 DP |
7 | // RCS-ID: $Id$ |
8 | // Copyright: (c) Denis Pershin | |
e21a5048 | 9 | // Licence: wxWindows licence |
f4e325b3 DP |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifdef __GNUG__ | |
e8cd8b1b | 13 | #pragma implementation "treectrl.h" |
f4e325b3 DP |
14 | #endif |
15 | ||
d9692df7 DP |
16 | // For compilers that support precompilation, includes "wx.h". |
17 | #include "wx/wxprec.h" | |
18 | ||
19 | #ifdef __BORLANDC__ | |
20 | #pragma hdrstop | |
21 | #endif | |
22 | ||
23 | #ifndef WX_PRECOMP | |
24 | #include "wx/wx.h" | |
25 | #endif | |
26 | ||
f4e325b3 | 27 | #include "wx/gtk/treectrl.h" |
e21a5048 | 28 | #include <wx/textctrl.h> |
f4e325b3 DP |
29 | #include "wx/log.h" |
30 | ||
d9692df7 | 31 | #include <gtk/gtk.h> |
f4e325b3 | 32 | |
e21a5048 DP |
33 | //static void wxConvertToGtkTreeItem(wxTreeCtrl *owner, wxTreeItem& info, GtkTreeItem **gtkItem); |
34 | //static void wxConvertFromGtkTreeItem(wxTreeItem& info, GtkTreeItem *gtkItem); | |
e1dc4cc6 | 35 | |
d9692df7 | 36 | static void gtk_treectrl_count_callback (GtkWidget *widget, gpointer data); |
e895ec45 | 37 | static void gtk_treectrl_first_selected_callback(GtkWidget *widget, gpointer data); |
e1dc4cc6 DP |
38 | static void gtk_treectrl_first_visible_callback(GtkWidget *widget, gpointer data); |
39 | ||
d9692df7 DP |
40 | // static void gtk_treectrl_next_callback (GtkWidget *widget, gpointer data); |
41 | // static void gtk_treectrl_next_visible_callback (GtkWidget *widget, gpointer data); | |
42 | // static void gtk_treectrl_next_selected_callback (GtkWidget *widget, gpointer data); | |
f4e325b3 | 43 | |
e21a5048 DP |
44 | static void gtk_treeitem_expand_callback(GtkWidget *widget, wxTreeItemId *treeitem); |
45 | static void gtk_treeitem_collapse_callback(GtkWidget *widget, wxTreeItemId *treeitem); | |
46 | static void gtk_treeitem_select_callback(GtkWidget *widget, wxTreeItemId *treeitem); | |
f4e325b3 | 47 | |
e21a5048 | 48 | static void gtk_treeitem_expand_callback(GtkWidget *widget, wxTreeItemId *treeitem) { |
d9692df7 DP |
49 | wxTreeCtrl *owner = (wxTreeCtrl *)gtk_object_get_data(GTK_OBJECT(widget), "owner"); |
50 | if (owner == NULL) | |
befe54c6 | 51 | return; |
d9692df7 | 52 | |
e21a5048 DP |
53 | // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id"); |
54 | owner->SendExpanding(GTK_TREE_ITEM(widget)); | |
55 | owner->SendExpanded(GTK_TREE_ITEM(widget)); | |
f4e325b3 DP |
56 | }; |
57 | ||
e21a5048 | 58 | static void gtk_treeitem_collapse_callback(GtkWidget *widget, wxTreeItemId *treeitem) { |
d9692df7 DP |
59 | wxTreeCtrl *owner = (wxTreeCtrl *)gtk_object_get_data(GTK_OBJECT(widget), "owner"); |
60 | if (owner == NULL) | |
befe54c6 | 61 | return; |
d9692df7 | 62 | |
e21a5048 DP |
63 | // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id"); |
64 | owner->SendCollapsing(GTK_TREE_ITEM(widget)); | |
65 | owner->SendCollapsed(GTK_TREE_ITEM(widget)); | |
f4e325b3 DP |
66 | }; |
67 | ||
e21a5048 | 68 | static void gtk_treeitem_select_callback(GtkWidget *widget, wxTreeItemId *treeitem) { |
d9692df7 DP |
69 | wxTreeCtrl *owner = (wxTreeCtrl *)gtk_object_get_data(GTK_OBJECT(widget), "owner"); |
70 | if (owner == NULL) | |
71 | return; | |
f4e325b3 | 72 | |
e21a5048 DP |
73 | // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id"); |
74 | owner->SendSelChanging(GTK_TREE_ITEM(widget)); | |
75 | owner->SendSelChanged(GTK_TREE_ITEM(widget)); | |
f4e325b3 DP |
76 | } |
77 | ||
d9692df7 | 78 | #if !USE_SHARED_LIBRARY |
e21a5048 DP |
79 | IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl) |
80 | ||
d9692df7 | 81 | #endif |
f4e325b3 | 82 | |
e21a5048 | 83 | void wxTreeCtrl::Init() { |
d9692df7 DP |
84 | m_imageListNormal = NULL; |
85 | m_imageListState = NULL; | |
86 | m_textCtrl = NULL; | |
d9692df7 DP |
87 | } |
88 | ||
e21a5048 DP |
89 | bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, |
90 | const wxSize& size, long style, | |
91 | const wxValidator& validator, const wxString& name) { | |
92 | Init(); | |
d9692df7 DP |
93 | |
94 | int x = pos.x; | |
95 | int y = pos.y; | |
96 | int width = size.x; | |
97 | int height = size.y; | |
98 | ||
99 | m_windowStyle = style; | |
100 | ||
101 | SetParent(parent); | |
102 | ||
103 | if (width <= 0) | |
104 | width = 100; | |
105 | if (height <= 0) | |
106 | height = 30; | |
107 | if (x < 0) | |
108 | x = 0; | |
109 | if (y < 0) | |
110 | y = 0; | |
111 | ||
112 | m_needParent = TRUE; | |
113 | ||
e21a5048 | 114 | printf("precreate\n"); |
d9692df7 DP |
115 | PreCreation( parent, id, pos, size, style, name ); |
116 | ||
e21a5048 DP |
117 | printf("1\n"); |
118 | ||
d9692df7 | 119 | m_widget = gtk_scrolled_window_new(NULL, NULL); |
e21a5048 | 120 | printf("2\n"); |
d9692df7 | 121 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_widget), |
e21a5048 | 122 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
f4e325b3 | 123 | |
e21a5048 | 124 | printf("3\n"); |
f4e325b3 | 125 | m_tree = GTK_TREE(gtk_tree_new()); |
d9692df7 | 126 | |
e21a5048 | 127 | printf("4\n"); |
d9692df7 | 128 | gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_tree)); |
e21a5048 | 129 | printf("5\n"); |
f4e325b3 | 130 | gtk_widget_show(GTK_WIDGET(m_tree)); |
befe54c6 | 131 | |
d9692df7 DP |
132 | SetName(name); |
133 | SetValidator(validator); | |
134 | ||
6ca41e57 RR |
135 | printf("Robert's new insertion code :-)\n"); |
136 | m_parent->AddChild( this ); | |
137 | (m_parent->m_insertCallback)( m_parent, this ); | |
138 | ||
e21a5048 | 139 | printf("postcreate\n"); |
d9692df7 DP |
140 | PostCreation(); |
141 | ||
142 | gtk_widget_realize(GTK_WIDGET(m_tree)); | |
143 | ||
144 | Show(TRUE); | |
145 | ||
146 | return TRUE; | |
147 | } | |
148 | ||
e21a5048 DP |
149 | wxTreeCtrl::~wxTreeCtrl(void) { |
150 | if (m_textCtrl) | |
151 | delete m_textCtrl; | |
f4e325b3 DP |
152 | } |
153 | ||
d9692df7 | 154 | // Attributes |
e21a5048 | 155 | static void gtk_treectrl_count_callback (GtkWidget *widget, gpointer data) { |
d9692df7 | 156 | int count = (*((int *)data)); |
f4e325b3 | 157 | |
d9692df7 DP |
158 | count++; |
159 | if (GTK_IS_CONTAINER(widget)) | |
160 | gtk_container_foreach(GTK_CONTAINER(widget), gtk_treectrl_count_callback, data); | |
f4e325b3 DP |
161 | } |
162 | ||
e21a5048 | 163 | size_t wxTreeCtrl::GetCount() const { |
d9692df7 DP |
164 | int count = 0; |
165 | ||
166 | if (m_anchor != NULL) | |
e895ec45 | 167 | gtk_treectrl_count_callback(GTK_WIDGET(m_anchor), &count); |
d9692df7 | 168 | return count; |
f4e325b3 DP |
169 | } |
170 | ||
e21a5048 | 171 | unsigned int wxTreeCtrl::GetIndent() const { |
d9692df7 DP |
172 | return m_tree->indent_value; |
173 | } | |
befe54c6 | 174 | |
e21a5048 | 175 | void wxTreeCtrl::SetIndent(unsigned int indent) { |
d9692df7 DP |
176 | m_tree->indent_value = indent; |
177 | } | |
178 | ||
e21a5048 DP |
179 | wxImageList *wxTreeCtrl::GetImageList() const { |
180 | return m_imageListNormal; | |
d9692df7 DP |
181 | } |
182 | ||
e21a5048 DP |
183 | wxImageList *wxTreeCtrl::GetStateImageList() const { |
184 | return m_imageListState; | |
d9692df7 DP |
185 | } |
186 | ||
e21a5048 DP |
187 | void wxTreeCtrl::SetImageList(wxImageList *imageList) { |
188 | m_imageListNormal = imageList; | |
189 | } | |
d9692df7 | 190 | |
e21a5048 DP |
191 | void wxTreeCtrl::SetStateImageList(wxImageList *imageList) { |
192 | m_imageListState = imageList; | |
d9692df7 DP |
193 | } |
194 | ||
e21a5048 DP |
195 | wxString wxTreeCtrl::GetItemText(const wxTreeItemId &item) const { |
196 | char *t; | |
d9692df7 | 197 | |
e21a5048 DP |
198 | if (!item.IsOk()) |
199 | return wxString(""); | |
f4e325b3 | 200 | |
e21a5048 DP |
201 | GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label")); |
202 | gtk_label_get(l, &t); | |
203 | ||
204 | return t; | |
205 | } | |
206 | ||
207 | int wxTreeCtrl::GetItemImage(const wxTreeItemId& item) const { | |
208 | if (!item.IsOk()) | |
209 | return (-1); | |
210 | ||
211 | return (int)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "image"); | |
f4e325b3 DP |
212 | } |
213 | ||
e21a5048 DP |
214 | int wxTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const { |
215 | if (!item.IsOk()) | |
216 | return (-1); | |
f4e325b3 | 217 | |
e21a5048 DP |
218 | return (int)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "selectedImage"); |
219 | } | |
f4e325b3 | 220 | |
e21a5048 DP |
221 | wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const { |
222 | if (!item.IsOk()) | |
d9692df7 | 223 | return NULL; |
f4e325b3 | 224 | |
e21a5048 DP |
225 | return (wxTreeItemData *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "data"); |
226 | } | |
f4e325b3 | 227 | |
e21a5048 DP |
228 | void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) { |
229 | if (!item.IsOk()) | |
230 | return; | |
f4e325b3 | 231 | |
e21a5048 DP |
232 | GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label")); |
233 | gtk_label_set(l, text); | |
234 | } | |
f4e325b3 | 235 | |
e21a5048 DP |
236 | void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image) { |
237 | if (!item.IsOk()) | |
238 | return; | |
239 | ||
240 | gtk_object_set_data(GTK_OBJECT((GtkTreeItem *)item), "image", (void *)image); | |
d9692df7 | 241 | } |
f4e325b3 | 242 | |
e21a5048 DP |
243 | void wxTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image) { |
244 | if (!item.IsOk()) | |
245 | return; | |
246 | ||
247 | gtk_object_set_data(GTK_OBJECT((GtkTreeItem *)item), "selectedImage", (void *)image); | |
d9692df7 | 248 | } |
f4e325b3 | 249 | |
e21a5048 DP |
250 | void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) { |
251 | if (!item.IsOk()) | |
252 | return; | |
f4e325b3 | 253 | |
e21a5048 DP |
254 | gtk_object_set_data(GTK_OBJECT((GtkTreeItem *)item), "data", data); |
255 | } | |
f4e325b3 | 256 | |
e21a5048 | 257 | bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const { |
c9d9f242 | 258 | return GTK_WIDGET_VISIBLE(GTK_TREE_ITEM((GtkTreeItem *)item)); |
d9692df7 | 259 | } |
f4e325b3 | 260 | |
e21a5048 | 261 | bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const { |
e895ec45 DP |
262 | GtkTreeItem *p = (GtkTreeItem *)item; |
263 | ||
264 | if (p->subtree == NULL) | |
265 | return wxFalse; | |
f4e325b3 | 266 | |
e895ec45 DP |
267 | if (GTK_TREE(p->subtree)->children == NULL) |
268 | return wxFalse; | |
f4e325b3 | 269 | |
e895ec45 DP |
270 | if (g_list_length(GTK_TREE(p->subtree)->children) == 0) |
271 | return wxFalse; | |
272 | ||
273 | return wxTrue; | |
d9692df7 | 274 | } |
f4e325b3 | 275 | |
e21a5048 DP |
276 | bool wxTreeCtrl::IsExpanded(const wxTreeItemId& item) const { |
277 | return (((GtkTreeItem *)item)->expanded != 0); | |
278 | } | |
279 | ||
280 | bool wxTreeCtrl::IsSelected(const wxTreeItemId& item) const { | |
e895ec45 DP |
281 | GtkTreeItem *p = (GtkTreeItem *)item; |
282 | GtkWidget *parent = GTK_WIDGET(p)->parent; | |
283 | ||
284 | if (!GTK_IS_TREE(parent)) | |
285 | return wxFalse; | |
286 | ||
287 | if (g_list_index(GTK_TREE(parent)->children, p) == -1) | |
288 | return wxFalse; | |
289 | ||
290 | return wxTrue; | |
e21a5048 DP |
291 | } |
292 | ||
293 | wxTreeItemId wxTreeCtrl::GetRootItem() const { | |
294 | return m_anchor; | |
295 | } | |
296 | ||
e895ec45 DP |
297 | static void gtk_treectrl_first_selected_callback(GtkWidget *widget, gpointer data) { |
298 | GtkTreeItem *p = (*((GtkTreeItem **)data)); | |
299 | ||
300 | GtkTree *tree = GTK_TREE(GTK_TREE_ITEM(widget)->subtree); | |
301 | ||
302 | if (tree->selection != NULL) { | |
303 | p = (GtkTreeItem *)tree->selection->data; | |
304 | return; | |
305 | } | |
306 | ||
307 | if (GTK_IS_CONTAINER(widget)) | |
308 | gtk_container_foreach(GTK_CONTAINER(widget), gtk_treectrl_first_selected_callback, data); | |
309 | } | |
310 | ||
e21a5048 | 311 | wxTreeItemId wxTreeCtrl::GetSelection() const { |
e895ec45 | 312 | GtkTreeItem *p = NULL; |
f4e325b3 | 313 | |
e895ec45 DP |
314 | if (m_anchor == NULL) |
315 | return NULL; | |
d9692df7 | 316 | |
e895ec45 DP |
317 | gtk_treectrl_first_selected_callback(GTK_WIDGET(m_anchor), &p); |
318 | ||
319 | return p; | |
d9692df7 DP |
320 | } |
321 | ||
e21a5048 | 322 | wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const { |
e21a5048 DP |
323 | if (item.IsOk()) |
324 | return (GtkTreeItem *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "parent"); | |
d9692df7 | 325 | |
e21a5048 DP |
326 | return NULL; |
327 | } | |
d9692df7 | 328 | |
e21a5048 | 329 | wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item, long& cookie) const { |
e895ec45 DP |
330 | GtkTreeItem *p = (GtkTreeItem *)item; |
331 | GtkWidget *parent = GTK_WIDGET(p)->parent; | |
332 | ||
333 | if (!GTK_IS_TREE(parent)) | |
334 | return NULL; | |
335 | ||
336 | cookie = 0; | |
337 | return GTK_TREE_ITEM(g_list_first(GTK_TREE(parent)->children)->data); | |
d9692df7 | 338 | } |
f4e325b3 | 339 | |
e21a5048 | 340 | wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& item, long& cookie) const { |
e895ec45 DP |
341 | GtkTreeItem *p = (GtkTreeItem *)item; |
342 | GtkWidget *parent = GTK_WIDGET(p)->parent; | |
343 | ||
344 | if (!GTK_IS_TREE(parent)) | |
345 | return NULL; | |
346 | ||
347 | cookie++; | |
348 | return GTK_TREE_ITEM(g_list_nth(GTK_TREE(parent)->children, cookie)->data); | |
e21a5048 | 349 | } |
f4e325b3 | 350 | |
e21a5048 | 351 | wxTreeItemId wxTreeCtrl::GetNextSibling(const wxTreeItemId& item) const { |
e895ec45 DP |
352 | GtkTreeItem *p = (GtkTreeItem *)item; |
353 | GtkWidget *parent = GTK_WIDGET(p)->parent; | |
354 | ||
355 | if (!GTK_IS_TREE(parent)) | |
356 | return NULL; | |
357 | ||
358 | if (g_list_index(GTK_TREE(parent)->children, p) == -1) | |
359 | return NULL; | |
360 | ||
361 | return GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent)->children, p))->data); | |
e21a5048 | 362 | } |
f4e325b3 | 363 | |
e21a5048 | 364 | wxTreeItemId wxTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const { |
e895ec45 DP |
365 | GtkTreeItem *p = (GtkTreeItem *)item; |
366 | GtkWidget *parent = GTK_WIDGET(p)->parent; | |
367 | ||
368 | if (!GTK_IS_TREE(parent)) | |
369 | return NULL; | |
370 | ||
371 | if (g_list_index(GTK_TREE(parent)->children, p) == -1) | |
372 | return NULL; | |
373 | ||
374 | return GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent)->children, p))->data); | |
d9692df7 DP |
375 | } |
376 | ||
c9d9f242 DP |
377 | static void gtk_treectrl_first_visible_callback(GtkWidget *widget, gpointer data) { |
378 | GtkTreeItem *p = (*((GtkTreeItem **)data)); | |
379 | ||
380 | GtkTree *tree = GTK_TREE(GTK_TREE_ITEM(widget)->subtree); | |
381 | ||
382 | if (tree->children != NULL) { | |
383 | guint len = g_list_length(tree->children); | |
384 | for (guint i=0; i<len; i++) { | |
385 | if (GTK_WIDGET_VISIBLE(GTK_WIDGET(GTK_TREE_ITEM((GtkTreeItem *)g_list_nth(tree->children, i)->data)))) { | |
386 | p = GTK_TREE_ITEM((GtkTreeItem *)g_list_nth(tree->children, i)->data); | |
387 | return; | |
388 | } | |
389 | } | |
390 | } | |
391 | ||
392 | if (GTK_IS_CONTAINER(widget)) | |
393 | gtk_container_foreach(GTK_CONTAINER(widget), gtk_treectrl_first_visible_callback, data); | |
394 | } | |
395 | ||
e21a5048 | 396 | wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const { |
c9d9f242 DP |
397 | GtkTreeItem *p = NULL; |
398 | ||
399 | if (m_anchor == NULL) | |
400 | return NULL; | |
401 | ||
402 | gtk_treectrl_first_visible_callback(GTK_WIDGET(m_anchor), &p); | |
403 | ||
404 | return p; | |
d9692df7 DP |
405 | } |
406 | ||
e21a5048 | 407 | wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const { |
c9d9f242 DP |
408 | GtkTreeItem *p = (GtkTreeItem *)item; |
409 | GtkTree *parent = GTK_TREE(GTK_WIDGET(p)->parent); | |
410 | GtkTreeItem *q; | |
411 | ||
412 | if (!GTK_IS_TREE(parent)) | |
413 | return NULL; | |
414 | ||
415 | if (parent->children == NULL) | |
416 | return NULL; | |
417 | ||
418 | q = GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent)->children, p))->data); | |
419 | ||
420 | while (q != p) { | |
421 | q = GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent)->children, q))->data); | |
422 | if (GTK_WIDGET_VISIBLE(GTK_WIDGET(q))) | |
423 | return q; | |
424 | } | |
425 | ||
e21a5048 DP |
426 | return NULL; |
427 | } | |
d9692df7 | 428 | |
e21a5048 | 429 | wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const { |
c9d9f242 DP |
430 | GtkTreeItem *p = (GtkTreeItem *)item; |
431 | GtkTree *parent = GTK_TREE(GTK_WIDGET(p)->parent); | |
432 | GtkTreeItem *q; | |
433 | ||
434 | if (!GTK_IS_TREE(parent)) | |
435 | return NULL; | |
436 | ||
437 | if (parent->children == NULL) | |
438 | return NULL; | |
439 | ||
440 | q = GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent)->children, p))->data); | |
441 | ||
442 | while (q != p) { | |
443 | q = GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent)->children, q))->data); | |
444 | if (GTK_WIDGET_VISIBLE(GTK_WIDGET(q))) | |
445 | return q; | |
446 | } | |
447 | ||
e21a5048 DP |
448 | return NULL; |
449 | } | |
d9692df7 | 450 | |
e21a5048 DP |
451 | wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, int image, |
452 | int selectedImage, wxTreeItemData *data) { | |
453 | return p_InsertItem(0, text, image, selectedImage, data); | |
454 | } | |
d9692df7 | 455 | |
e21a5048 DP |
456 | wxTreeItemId wxTreeCtrl::PrependItem(const wxTreeItemId& parent, |
457 | const wxString& text, int image, int selectedImage, | |
458 | wxTreeItemData *data) { | |
459 | #warning "Need to implement PrependItem" | |
460 | return NULL; | |
461 | } | |
f4e325b3 | 462 | |
e21a5048 DP |
463 | wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, |
464 | const wxTreeItemId& idPrevious, const wxString& text, | |
465 | int image, int selectedImage, wxTreeItemData *data) { | |
466 | #warning "Need to implement InsertItem" | |
467 | return NULL; | |
d9692df7 | 468 | } |
f4e325b3 | 469 | |
e21a5048 DP |
470 | wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent, |
471 | const wxString& text, int image, int selectedImage, | |
472 | wxTreeItemData *data) { | |
473 | return p_InsertItem(parent, text, image, selectedImage, data); | |
474 | } | |
f4e325b3 | 475 | |
e21a5048 DP |
476 | wxTreeItemId wxTreeCtrl::p_InsertItem(GtkTreeItem *p, |
477 | const wxString& text, int image, int selectedImage, | |
478 | wxTreeItemData *data) { | |
479 | GtkTreeItem *item; | |
d9692df7 | 480 | |
e21a5048 DP |
481 | printf("begin insert\n"); |
482 | ||
483 | item = GTK_TREE_ITEM(gtk_tree_item_new()); | |
484 | ||
485 | GtkHBox *m_box = GTK_HBOX(gtk_hbox_new(FALSE, 0)); | |
486 | gtk_container_add (GTK_CONTAINER (item), GTK_WIDGET(m_box)); | |
487 | ||
488 | gtk_object_set_data(GTK_OBJECT(item), "w_box", m_box); | |
489 | ||
490 | const wxBitmap *bmp; | |
491 | const wxImageList *list; | |
492 | if ((list = GetImageList(wxIMAGE_LIST_NORMAL)) != NULL) | |
493 | if ((bmp = list->GetBitmap(image)) != NULL) | |
494 | if (bmp->Ok()) { | |
495 | GdkBitmap *mask = NULL; | |
496 | if (bmp->GetMask()) | |
497 | mask = bmp->GetMask()->GetBitmap(); | |
498 | GtkPixmap *m_image_widget = GTK_PIXMAP(gtk_pixmap_new(bmp->GetPixmap(), mask)); | |
499 | gtk_misc_set_alignment (GTK_MISC (m_image_widget), 0.0, 0.5); | |
500 | gtk_box_pack_start(GTK_BOX(m_box), GTK_WIDGET(m_image_widget), FALSE, FALSE, 0); | |
501 | gtk_object_set_data(GTK_OBJECT(item), "w_image", (void *)m_image_widget); | |
502 | gtk_object_set_data(GTK_OBJECT(item), "image", (void *)image); | |
503 | gtk_widget_show (GTK_WIDGET(m_image_widget)); | |
504 | } | |
505 | GtkLabel *m_label_widget = GTK_LABEL(gtk_label_new ((char *)(const char *)text)); | |
506 | gtk_misc_set_alignment (GTK_MISC (m_label_widget), 0.5, 0.5); | |
507 | gtk_box_pack_start(GTK_BOX(m_box), GTK_WIDGET(m_label_widget), FALSE, FALSE, 0); | |
508 | gtk_object_set_data(GTK_OBJECT(item), "w_label", m_label_widget); | |
509 | gtk_widget_show (GTK_WIDGET(m_label_widget)); | |
510 | ||
511 | gtk_widget_show(GTK_WIDGET(m_box)); | |
512 | ||
513 | gtk_object_set_data(GTK_OBJECT(item), "owner", this); | |
e895ec45 DP |
514 | gtk_object_set_data(GTK_OBJECT(item), "data", data); |
515 | gtk_object_set_data(GTK_OBJECT(item), "parent", p); | |
e21a5048 DP |
516 | |
517 | if (p != 0) { | |
518 | if (p->subtree == NULL) { | |
519 | GtkTree *tree = GTK_TREE(gtk_tree_new()); | |
520 | gtk_tree_item_set_subtree(GTK_TREE_ITEM(p), GTK_WIDGET(tree)); | |
521 | gtk_widget_show(GTK_WIDGET(tree)); | |
522 | p->expanded = 1; | |
523 | } | |
524 | ||
525 | gtk_container_add(GTK_CONTAINER(p->subtree), GTK_WIDGET(item)); | |
526 | } else { | |
527 | printf("Adding root\n"); | |
528 | printf("m_tree = %p\n", m_tree); | |
529 | m_anchor = item; | |
530 | gtk_container_add(GTK_CONTAINER(m_tree), GTK_WIDGET(item)); | |
d9692df7 | 531 | } |
f4e325b3 | 532 | |
e21a5048 | 533 | gtk_widget_show(GTK_WIDGET(item)); |
d9692df7 | 534 | |
e21a5048 DP |
535 | gtk_signal_connect(GTK_OBJECT(item), "select", |
536 | GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this ); | |
d9692df7 | 537 | |
e21a5048 DP |
538 | gtk_signal_connect(GTK_OBJECT(item), "deselect", |
539 | GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this ); | |
d9692df7 | 540 | |
e21a5048 DP |
541 | gtk_signal_connect(GTK_OBJECT(item), "expand", |
542 | GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback), (gpointer)this ); | |
543 | gtk_signal_connect(GTK_OBJECT(item), "collapse", | |
544 | GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback), (gpointer)this ); | |
545 | ||
546 | return item; | |
d9692df7 DP |
547 | } |
548 | ||
e21a5048 DP |
549 | void wxTreeCtrl::Delete(const wxTreeItemId& item) { |
550 | if (!item.IsOk()) | |
551 | return; | |
d9692df7 | 552 | |
e21a5048 DP |
553 | GtkTreeItem *parent = GTK_TREE_ITEM(GTK_WIDGET((GtkTreeItem *)item)->parent); |
554 | if (parent == NULL) | |
555 | return; | |
d9692df7 | 556 | |
e21a5048 DP |
557 | gtk_container_remove(GTK_CONTAINER(parent), GTK_WIDGET((GtkTreeItem *)item)); |
558 | ||
559 | return; | |
d9692df7 DP |
560 | } |
561 | ||
e21a5048 DP |
562 | void wxTreeCtrl::DeleteAllItems() { |
563 | gtk_tree_item_remove_subtree(m_anchor); | |
564 | } | |
d9692df7 | 565 | |
e21a5048 DP |
566 | void wxTreeCtrl::Expand(const wxTreeItemId& item) { |
567 | if (!item.IsOk()) | |
568 | return; | |
d9692df7 | 569 | |
e21a5048 | 570 | gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem *)item)); |
d9692df7 DP |
571 | } |
572 | ||
e21a5048 DP |
573 | void wxTreeCtrl::Collapse(const wxTreeItemId& item) { |
574 | if (!item.IsOk()) | |
575 | return; | |
d9692df7 | 576 | |
e21a5048 DP |
577 | gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item)); |
578 | } | |
d9692df7 | 579 | |
e21a5048 DP |
580 | void wxTreeCtrl::CollapseAndReset(const wxTreeItemId& item) { |
581 | if (!item.IsOk()) | |
582 | return; | |
583 | ||
584 | gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item)); | |
585 | gtk_tree_item_remove_subtree(GTK_TREE_ITEM((GtkTreeItem *)item)); | |
d9692df7 DP |
586 | } |
587 | ||
e21a5048 DP |
588 | void wxTreeCtrl::Toggle(const wxTreeItemId& item) { |
589 | if (!item.IsOk()) | |
590 | return; | |
d9692df7 | 591 | |
e21a5048 DP |
592 | if (((GtkTreeItem *)item)->expanded) |
593 | gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item)); | |
594 | else | |
595 | gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem *)item)); | |
596 | } | |
d9692df7 | 597 | |
e1dc4cc6 DP |
598 | static void gtk_treectrl_unselect_callback(GtkWidget *widget, gpointer data) { |
599 | GtkTreeItem *p; | |
600 | ||
601 | GtkTree *tree = GTK_TREE(GTK_TREE_ITEM(widget)->subtree); | |
602 | ||
603 | if (tree->selection != NULL) { | |
604 | guint len = g_list_length(tree->selection); | |
605 | for (guint i=0; i<len; i++) { | |
606 | p = GTK_TREE_ITEM((GtkTreeItem *)g_list_nth(tree->selection, i)->data); | |
607 | gtk_tree_unselect_child(tree, GTK_WIDGET(p)); | |
608 | } | |
609 | } | |
610 | ||
611 | if (GTK_IS_CONTAINER(widget)) | |
612 | gtk_container_foreach(GTK_CONTAINER(widget), gtk_treectrl_unselect_callback, data); | |
613 | } | |
614 | ||
e21a5048 | 615 | void wxTreeCtrl::Unselect() { |
e1dc4cc6 DP |
616 | if (m_anchor == NULL) |
617 | return; | |
618 | ||
619 | gtk_treectrl_unselect_callback(GTK_WIDGET(m_anchor), NULL); | |
d9692df7 DP |
620 | } |
621 | ||
e21a5048 DP |
622 | void wxTreeCtrl::SelectItem(const wxTreeItemId& item) { |
623 | if (!item.IsOk()) | |
624 | return; | |
d9692df7 | 625 | |
e21a5048 DP |
626 | gtk_tree_item_select((GtkTreeItem *)item); |
627 | } | |
d9692df7 | 628 | |
e21a5048 DP |
629 | void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) { |
630 | #warning "Need to implement EnsureVisible" | |
d9692df7 DP |
631 | } |
632 | ||
e21a5048 DP |
633 | void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) { |
634 | #warning "Need to implement ScrollTo" | |
635 | } | |
f4e325b3 | 636 | |
e21a5048 DP |
637 | wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, |
638 | wxClassInfo* textControlClass) { | |
639 | wxASSERT( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)) ); | |
640 | #warning "Need to implement EditLabel" | |
e1dc4cc6 DP |
641 | /* |
642 | char *s; | |
643 | m_editItem = item; | |
644 | ||
645 | GtkLabel *m_label = (GtkLabel *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"); | |
646 | gtk_label_get(m_label, &s); | |
647 | ||
648 | m_textCtrl = new wxTextCtrl(this, -1, s); | |
649 | // m_textCtrl->SetValue(s); | |
650 | ||
651 | gtk_object_set_data(GTK_OBJECT((GtkTreeItem *)item), "w_edit", m_textCtrl->m_widget); | |
652 | ||
653 | gtk_container_remove(GTK_CONTAINER((GtkTreeItem *)item), GTK_WIDGET(m_label)); | |
654 | gtk_container_add(GTK_CONTAINER((GtkTreeItem *)item), m_textCtrl->m_widget); | |
655 | ||
656 | */ | |
657 | return m_textCtrl; | |
e21a5048 | 658 | } |
d9692df7 | 659 | |
e21a5048 DP |
660 | wxTextCtrl* wxTreeCtrl::GetEditControl() const { |
661 | return m_textCtrl; | |
d9692df7 DP |
662 | } |
663 | ||
e21a5048 DP |
664 | void wxTreeCtrl::EndEditLabel(const wxTreeItemId& item, bool discardChanges) { |
665 | #warning "Need to implement EndEditLabel" | |
e1dc4cc6 DP |
666 | /* |
667 | GtkLabel *m_label = (GtkLabel *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)m_editItem), "w_label"); | |
668 | gtk_label_set(m_label, m_textCtrl->GetValue()); | |
669 | ||
670 | gtk_object_remove_data(GTK_OBJECT((GtkTreeItem *)m_editItem), "w_edit"); | |
671 | ||
672 | gtk_container_remove(GTK_CONTAINER((GtkTreeItem *)m_editItem), m_textCtrl->m_widget); | |
673 | gtk_container_add(GTK_CONTAINER((GtkTreeItem *)m_editItem), GTK_WIDGET(m_label)); | |
674 | ||
675 | delete m_textCtrl; | |
676 | m_textCtrl = NULL; | |
677 | */ | |
e21a5048 | 678 | } |
befe54c6 | 679 | |
e21a5048 DP |
680 | void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action) { |
681 | switch (action) { | |
682 | case wxTREE_EXPAND_EXPAND: | |
683 | Expand(item); | |
684 | break; | |
d9692df7 | 685 | |
e21a5048 DP |
686 | case wxTREE_EXPAND_COLLAPSE: |
687 | Collapse(item); | |
688 | break; | |
c89a6106 | 689 | |
e21a5048 DP |
690 | case wxTREE_EXPAND_COLLAPSE_RESET: |
691 | CollapseAndReset(item); | |
692 | break; | |
693 | ||
694 | case wxTREE_EXPAND_TOGGLE: | |
695 | Toggle(item); | |
696 | break; | |
697 | ||
698 | default: | |
699 | wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem"); | |
700 | } | |
d9692df7 | 701 | } |
f4e325b3 | 702 | |
e21a5048 DP |
703 | wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, |
704 | const wxString& text, int image, int selImage, | |
705 | long insertAfter) { | |
706 | // InsertItem(parent, insertAfter, text, image, selImage); | |
707 | #warning "Need to implement InsertItem" | |
708 | return NULL; | |
d9692df7 | 709 | } |
f4e325b3 | 710 | |
e21a5048 DP |
711 | /* Old functions |
712 | long wxTreeCtrl::GetChild(long item) const { | |
d9692df7 | 713 | GtkTreeItem *p; |
e21a5048 | 714 | GtkTreeItem *next = NULL; |
f4e325b3 | 715 | |
d9692df7 | 716 | p = findGtkTreeItem(item); |
e21a5048 DP |
717 | GList *list = gtk_container_children(GTK_CONTAINER(p)); |
718 | next = GTK_TREE_ITEM(list->data);; | |
f4e325b3 | 719 | |
e21a5048 DP |
720 | if (next != NULL) |
721 | return (long)gtk_object_get_data(GTK_OBJECT(next), "id"); | |
722 | ||
723 | return (-1); | |
724 | } | |
d9692df7 | 725 | |
e21a5048 DP |
726 | long wxTreeCtrl::GetFirstVisibleItem(void) const { |
727 | GtkTreeItem *next = NULL; | |
d9692df7 | 728 | |
e21a5048 DP |
729 | GList *list = gtk_container_children(GTK_CONTAINER(m_anchor)); |
730 | next = GTK_TREE_ITEM(list->data);; | |
731 | // gtk_container_foreach(GTK_CONTAINER(m_anchor), gtk_treectrl_next_visible_callback, &next); | |
732 | ||
733 | if (next != NULL) | |
734 | return (long)gtk_object_get_data(GTK_OBJECT(next), "id"); | |
735 | ||
736 | return (-1); | |
d9692df7 DP |
737 | } |
738 | ||
e21a5048 | 739 | long wxTreeCtrl::GetNextVisibleItem(long item) const { |
d9692df7 | 740 | GtkTreeItem *p; |
e21a5048 | 741 | GtkTreeItem *next = NULL; |
d9692df7 DP |
742 | |
743 | p = findGtkTreeItem(item); | |
e21a5048 DP |
744 | GList *list = gtk_container_children(GTK_CONTAINER(p)); |
745 | next = GTK_TREE_ITEM(list->data);; | |
746 | // gtk_container_foreach(GTK_CONTAINER(p), gtk_treectrl_next_visible_callback, &next); | |
747 | ||
748 | if (next != NULL) | |
749 | return (long)gtk_object_get_data(GTK_OBJECT(next), "id"); | |
750 | ||
751 | return (-1); | |
752 | } | |
753 | ||
754 | bool wxTreeCtrl::GetItem(wxTreeItem& info) const { | |
755 | GtkTreeItem *p; | |
756 | ||
757 | p = findGtkTreeItem(info.m_itemId); | |
758 | ||
759 | if (p == NULL) { | |
760 | wxLogSysError("TreeCtrl::GetItem failed"); | |
d9692df7 | 761 | return FALSE; |
e21a5048 | 762 | } |
d9692df7 | 763 | |
e21a5048 | 764 | wxConvertFromGtkTreeItem(info, p); |
d9692df7 DP |
765 | |
766 | return TRUE; | |
767 | } | |
768 | ||
e21a5048 | 769 | bool wxTreeCtrl::SetItem(wxTreeItem& info) { |
d9692df7 DP |
770 | GtkTreeItem *p; |
771 | ||
e21a5048 | 772 | p = findGtkTreeItem(info.m_itemId); |
d9692df7 | 773 | |
e21a5048 DP |
774 | if (p == NULL) { |
775 | wxLogSysError("TreeCtrl::SetItem failed"); | |
f4e325b3 | 776 | return FALSE; |
e21a5048 | 777 | } |
f4e325b3 | 778 | |
e21a5048 | 779 | wxConvertToGtkTreeItem(this, info, &p); |
f4e325b3 | 780 | |
e21a5048 DP |
781 | return TRUE; |
782 | } | |
d9692df7 | 783 | |
e21a5048 DP |
784 | int wxTreeCtrl::GetItemState(long item, long stateMask) const { |
785 | wxTreeItem info; | |
f4e325b3 | 786 | |
e21a5048 DP |
787 | info.m_mask = wxTREE_MASK_STATE ; |
788 | info.m_stateMask = stateMask; | |
789 | info.m_itemId = item; | |
d9692df7 | 790 | |
e21a5048 DP |
791 | if (!GetItem(info)) |
792 | return 0; | |
793 | ||
794 | return info.m_state; | |
795 | } | |
796 | ||
797 | bool wxTreeCtrl::SetItemState(long item, long state, long stateMask) { | |
798 | wxTreeItem info; | |
799 | ||
800 | info.m_mask = wxTREE_MASK_STATE ; | |
801 | info.m_state = state; | |
802 | info.m_stateMask = stateMask; | |
803 | info.m_itemId = item; | |
804 | ||
805 | return SetItem(info); | |
806 | } | |
807 | */ | |
808 | ||
809 | // Operations | |
810 | /* | |
811 | bool wxTreeCtrl::DeleteChildren(long item) { | |
812 | GtkTreeItem *p; | |
813 | ||
814 | p = findGtkTreeItem(item); | |
815 | if (p == NULL) | |
816 | return FALSE; | |
817 | ||
818 | gtk_tree_item_remove_subtree(GTK_TREE_ITEM(p)); | |
f4e325b3 DP |
819 | |
820 | return TRUE; | |
d9692df7 | 821 | } |
e21a5048 | 822 | */ |
f4e325b3 | 823 | |
e21a5048 DP |
824 | /* |
825 | long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter) { | |
d9692df7 DP |
826 | GtkTreeItem *p; |
827 | GtkTreeItem *item = NULL; | |
828 | ||
829 | info.m_itemId = m_curitemId; | |
830 | m_curitemId++; | |
831 | ||
832 | wxConvertToGtkTreeItem(this, info, &item); | |
833 | ||
834 | if (parent != 0) { | |
835 | p = findGtkTreeItem(parent); | |
836 | if (p->subtree == NULL) { | |
837 | GtkTree *tree = GTK_TREE(gtk_tree_new()); | |
838 | gtk_tree_item_set_subtree(GTK_TREE_ITEM(p), GTK_WIDGET(tree)); | |
839 | gtk_widget_show(GTK_WIDGET(tree)); | |
840 | p->expanded = 1; | |
841 | } | |
f4e325b3 | 842 | |
d9692df7 DP |
843 | gtk_container_add(GTK_CONTAINER(p->subtree), GTK_WIDGET(item)); |
844 | } else { | |
845 | m_anchor = item; | |
846 | gtk_container_add(GTK_CONTAINER(m_tree), GTK_WIDGET(item)); | |
847 | } | |
848 | ||
849 | if ((info.m_mask & wxTREE_MASK_CHILDREN) != 0) { | |
850 | GtkTree *tree = GTK_TREE(gtk_tree_new()); | |
851 | gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), GTK_WIDGET(tree)); | |
852 | gtk_widget_show(GTK_WIDGET(tree)); | |
853 | } | |
854 | ||
855 | gtk_widget_show(GTK_WIDGET(item)); | |
856 | ||
857 | gtk_signal_connect(GTK_OBJECT(item), "select", | |
858 | GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this ); | |
859 | ||
860 | gtk_signal_connect(GTK_OBJECT(item), "deselect", | |
861 | GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this ); | |
862 | ||
863 | gtk_signal_connect(GTK_OBJECT(item), "expand", | |
864 | GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback), (gpointer)this ); | |
865 | gtk_signal_connect(GTK_OBJECT(item), "collapse", | |
866 | GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback), (gpointer)this ); | |
867 | ||
868 | return info.m_itemId; | |
f4e325b3 DP |
869 | } |
870 | ||
d9692df7 DP |
871 | long wxTreeCtrl::InsertItem(long parent, const wxString& label, int image, |
872 | int selImage, long insertAfter) { | |
873 | ||
874 | wxTreeItem info; | |
875 | info.m_text = label; | |
876 | info.m_mask = wxTREE_MASK_TEXT; | |
877 | if (image > -1) { | |
878 | info.m_mask |= wxTREE_MASK_IMAGE | wxTREE_MASK_SELECTED_IMAGE; | |
879 | info.m_image = image; | |
880 | if (selImage == -1) | |
881 | info.m_selectedImage = image; | |
882 | else | |
883 | info.m_selectedImage = selImage; | |
884 | } | |
f4e325b3 | 885 | |
d9692df7 | 886 | return InsertItem(parent, info, insertAfter); |
f4e325b3 | 887 | } |
d9692df7 | 888 | */ |
f4e325b3 | 889 | |
e895ec45 DP |
890 | void wxTreeCtrl::SendMessage(wxEventType command, const wxTreeItemId& item) { |
891 | wxTreeEvent event(command, GetId()); | |
d9692df7 | 892 | event.SetEventObject(this); |
e895ec45 | 893 | event.m_item = item; |
d9692df7 DP |
894 | ProcessEvent(event); |
895 | } | |
f4e325b3 | 896 | |
e895ec45 DP |
897 | void wxTreeCtrl::SendExpanding(const wxTreeItemId& item) { |
898 | SendMessage(wxEVT_COMMAND_TREE_ITEM_EXPANDING, item); | |
899 | } | |
900 | ||
e21a5048 | 901 | void wxTreeCtrl::SendExpanded(const wxTreeItemId& item) { |
e895ec45 | 902 | SendMessage(wxEVT_COMMAND_TREE_ITEM_EXPANDED, item); |
d9692df7 | 903 | } |
f4e325b3 | 904 | |
e21a5048 | 905 | void wxTreeCtrl::SendCollapsing(const wxTreeItemId& item) { |
e895ec45 | 906 | SendMessage(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, item); |
d9692df7 | 907 | } |
f4e325b3 | 908 | |
e21a5048 | 909 | void wxTreeCtrl::SendCollapsed(const wxTreeItemId& item) { |
e895ec45 | 910 | SendMessage(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, item); |
d9692df7 | 911 | } |
f4e325b3 | 912 | |
e21a5048 | 913 | void wxTreeCtrl::SendSelChanging(const wxTreeItemId& item) { |
e895ec45 | 914 | SendMessage(wxEVT_COMMAND_TREE_SEL_CHANGED, item); |
f4e325b3 DP |
915 | } |
916 | ||
e21a5048 | 917 | void wxTreeCtrl::SendSelChanged(const wxTreeItemId& item) { |
e895ec45 | 918 | SendMessage(wxEVT_COMMAND_TREE_SEL_CHANGING, item); |
d9692df7 | 919 | } |
f4e325b3 | 920 | |
d9692df7 DP |
921 | // Tree event |
922 | IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent) | |
923 | ||
e21a5048 DP |
924 | wxTreeEvent::wxTreeEvent(wxEventType commandType, int id): |
925 | wxCommandEvent(commandType, id) { | |
d9692df7 | 926 | m_code = 0; |
e21a5048 | 927 | m_itemOld = 0; |
d9692df7 | 928 | } |