]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/treectrl.cpp
tab traversal now works better (using uninitialized variable was a bad idea :-)
[wxWidgets.git] / src / gtk1 / treectrl.cpp
CommitLineData
f4e325b3
DP
1/////////////////////////////////////////////////////////////////////////////
2// Name: treectrl.cpp
3// Purpose:
4// Author: Denis Pershin
5// Created: 07/05/98
6// Id: $Id$
7// Copyright: (c) 1998 Denis Pershin and Julian Smart
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
e8cd8b1b 12#pragma implementation "treectrl.h"
f4e325b3
DP
13#endif
14
15#include "wx/gtk/treectrl.h"
16#include "wx/settings.h"
17#include "wx/log.h"
18
19#ifdef USE_GDK_IMLIB
20#include "../gdk_imlib/gdk_imlib.h"
21#endif
22
23//-----------------------------------------------------------------------------
24// wxTreeItem
25//-----------------------------------------------------------------------------
26
27// clicked
28
29void gtk_treeitem_expand_callback(GtkWidget *WXUNUSED(widget), wxTreeItem *treeitem) {
befe54c6
DP
30 if (treeitem->ignore)
31 return;
f4e325b3
DP
32 treeitem->SendExpanding(treeitem->m_owner);
33 treeitem->SendExpand(treeitem->m_owner);
34};
35
36void gtk_treeitem_collapse_callback( GtkWidget *WXUNUSED(widget), wxTreeItem *treeitem) {
befe54c6
DP
37 if (treeitem->ignore)
38 return;
f4e325b3
DP
39 treeitem->SendCollapsing(treeitem->m_owner);
40 treeitem->SendCollapse(treeitem->m_owner);
41};
42
43void gtk_treeitem_select_callback( GtkWidget *WXUNUSED(widget), wxTreeItem *treeitem) {
44 treeitem->SendSelChanging(treeitem->m_owner);
45 treeitem->m_state |= wxTREE_STATE_SELECTED;
46 treeitem->SendSelChanged(treeitem->m_owner);
47}
48
49void gtk_treeitem_deselect_callback( GtkWidget *WXUNUSED(widget), wxTreeItem *treeitem) {
50 treeitem->SendSelChanging(treeitem->m_owner);
51 treeitem->m_state &= !wxTREE_STATE_SELECTED;
52 treeitem->SendSelChanged(treeitem->m_owner);
53}
54
55IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
56
57wxTreeItem::wxTreeItem() {
58 m_mask = 0;
59 m_itemId = 0;
60 m_state = 0;
61 m_stateMask = 0;
62 m_image = -1;
63 m_children = 0;
64 m_selectedImage = -1;
65 m_tree = NULL;
66 m_parentwidget = NULL;
67 m_widget = NULL;
68 m_data = 0;
69 m_owner = 0;
70 expand_handler = 0;
71 collapse_handler = 0;
72};
73
74wxTreeItem::wxTreeItem(GtkWidget *parent, const wxTreeItem &item) {
75 m_mask = item.m_mask;
76 m_text = item.m_text;
77 m_itemId = item.m_itemId;
78 m_state = item.m_state;
79 m_stateMask = item.m_stateMask;
80 m_image = item.m_image;
81 m_tree = NULL;
82 m_owner = 0;
83 m_selectedImage = item.m_selectedImage;
84 m_children = item.m_children;
85 m_childlist = item.m_childlist;
86 m_data = item.m_data;
87 m_parentwidget = parent;
88 expand_handler = 0;
89 collapse_handler = 0;
90
91 Create();
92}
93
94void wxTreeItem::Create() {
95 wxASSERT(m_parentwidget != NULL);
96
97 m_widget = GTK_TREE_ITEM(gtk_tree_item_new_with_label ((char *)(const char *)m_text));
98 gtk_container_add (GTK_CONTAINER(m_parentwidget), GTK_WIDGET(m_widget));
99 gtk_widget_show(GTK_WIDGET(m_widget));
100
befe54c6
DP
101 ignore = FALSE;
102
f4e325b3
DP
103 gtk_signal_connect(GTK_OBJECT(m_widget), "select",
104 GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this );
105
106 gtk_signal_connect(GTK_OBJECT(m_widget), "deselect",
107 GTK_SIGNAL_FUNC(gtk_treeitem_deselect_callback), (gpointer)this );
108
befe54c6
DP
109 if (expand_handler == 0)
110 expand_handler = gtk_signal_connect(GTK_OBJECT(m_widget), "expand",
111 GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback), (gpointer)this );
112
113 if (collapse_handler == 0)
114 collapse_handler = gtk_signal_connect( GTK_OBJECT(m_widget), "collapse",
115 GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback), (gpointer)this );
116
f4e325b3
DP
117 if ((m_mask & wxTREE_MASK_CHILDREN) != 0)
118 AddSubtree();
119}
120
121wxTreeItem::~wxTreeItem() {
122 if (m_owner != NULL)
123 SendDelete(m_owner);
124 DeleteChildren();
125 if ((m_widget != NULL) && (m_parentwidget != NULL))
126 gtk_container_remove(GTK_CONTAINER(m_parentwidget),
127 GTK_WIDGET(m_widget));
128// if (m_tree != NULL) {
129// gtk_widget_destroy(GTK_WIDGET(m_tree));
130// m_tree = NULL;
131// }
132
133// if (m_widget != NULL)
134// gtk_widget_destroy(GTK_WIDGET(m_widget));
135}
136
137void wxTreeItem::AddSubtree() {
138 if (m_widget == NULL)
139 return;
140
141 m_tree = GTK_TREE(gtk_tree_new());
f4e325b3
DP
142 gtk_tree_item_set_subtree(GTK_TREE_ITEM(m_widget), GTK_WIDGET(m_tree));
143 gtk_widget_show(GTK_WIDGET(m_tree));
befe54c6
DP
144
145 ignore = TRUE;
146 gtk_tree_item_expand(m_widget);
147 gtk_tree_item_collapse(m_widget);
148 ignore = FALSE;
f4e325b3
DP
149}
150
151void wxTreeItem::AddChild(wxTreeItem *child) {
152 wxASSERT(child != NULL);
153
154 m_childlist.Append(child);
155}
156
157bool wxTreeItem::HasChildren() {
158 return (m_childlist.Number() != 0);
159}
160
161void wxTreeItem::DeleteChildren() {
162 wxTreeItem *item;
befe54c6 163
f4e325b3
DP
164 long no = GetChildrenNumber();
165 for (long i=0; i<no; i++)
166 if ((item = GetChild(i)) != 0)
167 delete item;
168 m_childlist.Clear();
befe54c6
DP
169
170 if ((no == 0) && (m_widget != NULL))
171 gtk_tree_item_remove_subtree(m_widget);
172
f4e325b3
DP
173 m_tree = NULL;
174
175 if ((m_mask & wxTREE_MASK_CHILDREN) != 0)
176 if (m_widget != NULL)
177 if (m_widget->subtree == 0)
178 AddSubtree();
179}
180
181int wxTreeItem::NumberOfVisibleDescendents() {
182 wxTreeItem *item;
183 long no = GetChildrenNumber();
184 long num = 0;
185 for (long i=0; i<no; i++)
186 if ((item = GetChild(i)) != 0)
187 num += item->NumberOfVisibleDescendents();
188
189 num+=no;
190
191 return num;
192}
193
194wxTreeItem *wxTreeItem::FindItem(long itemId) const {
195 if (m_itemId == itemId) return (wxTreeItem*)(this);
196 wxNode *node = m_childlist.First();
197 while (node) {
198 wxTreeItem *item = (wxTreeItem*)node->Data();
199 wxTreeItem *res = item->FindItem( itemId );
200 if (res) return (wxTreeItem*)(res);
201 node = node->Next();
202 };
203 return NULL;
204};
205
206wxTreeItem *wxTreeItem::FindItem(GtkTreeItem *item) const {
207 if (m_widget == item)
208 return (wxTreeItem*)(this);
209 wxNode *node = m_childlist.First();
210 while (node) {
211 wxTreeItem *i = (wxTreeItem*)node->Data();
212 wxTreeItem *res = i->FindItem(item);
213 if (res) return (wxTreeItem*)(res);
214 node = node->Next();
215 };
216 return NULL;
217};
218
219void wxTreeItem::PrepareEvent(wxTreeEvent &event) {
220 event.m_item.m_itemId = m_itemId;
221 event.m_item.m_state = m_state;
222 event.m_item.m_text = m_text;
223 event.m_item.m_image = m_image;
224 event.m_item.m_selectedImage = m_selectedImage;
225 event.m_item.m_children = (GetChildrenNumber() > 0);
226 event.m_item.m_data = m_data;
227 event.m_oldItem = 0;
228 event.m_code = 0;
229// event.m_pointDrag.x = 0;
230// event.m_pointDrag.y = 0;
231};
232
233void wxTreeItem::SendDelete(wxWindow *target) {
234 wxTreeEvent event(wxEVT_COMMAND_TREE_DELETE_ITEM, target->GetId());
235 PrepareEvent(event);
236 event.SetEventObject(target);
237 target->ProcessEvent(event);
238};
239
240void wxTreeItem::SendExpand(wxWindow *target) {
241 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDED, target->GetId());
242 PrepareEvent(event);
243 event.SetEventObject(target);
244 target->ProcessEvent(event);
245};
246
247void wxTreeItem::SendExpanding(wxWindow *target) {
248 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, target->GetId());
249 PrepareEvent(event);
250 event.SetEventObject(target);
251 target->ProcessEvent(event);
252};
253
254void wxTreeItem::SendCollapse(wxWindow *target) {
255 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, target->GetId());
256 PrepareEvent(event);
257 event.SetEventObject(target);
258 target->ProcessEvent(event);
259};
260
261void wxTreeItem::SendCollapsing(wxWindow *target) {
262 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, target->GetId());
263 PrepareEvent(event);
264 event.SetEventObject(target);
265 target->ProcessEvent(event);
266};
267
268void wxTreeItem::SendSelChanged(wxWindow *target) {
269 wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGED, target->GetId());
270 PrepareEvent(event);
271 event.SetEventObject(target);
272 target->ProcessEvent(event);
273};
274
275void wxTreeItem::SendSelChanging(wxWindow *target) {
276 wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, target->GetId());
277 PrepareEvent(event);
278 event.SetEventObject(target);
279 target->ProcessEvent(event);
280};
281
282//-----------------------------------------------------------------------------
283// wxTreeCtrl
284//-----------------------------------------------------------------------------
285
286IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxScrolledWindow)
287
288wxTreeCtrl::wxTreeCtrl() {
289 m_current = NULL;
290 m_lastId = 0;
291 m_isCreated = FALSE;
292 m_imageList = NULL;
293 m_smallImageList = NULL;
294};
295
296wxTreeCtrl::wxTreeCtrl(wxWindow *parent, wxWindowID id,
297 const wxPoint& pos, const wxSize& size,
298 long style, const wxString& name ) {
299 m_current = NULL;
300 m_lastId = 0;
301 m_isCreated = FALSE;
302 m_imageList = NULL;
303 m_smallImageList = NULL;
304 Create( parent, id, pos, size, style, name );
305};
306
307wxTreeCtrl::~wxTreeCtrl() {
308 DeleteAllItems();
309};
310
311bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
312 const wxPoint& pos, const wxSize& size,
313 long style, const wxString& name ) {
314 m_needParent = TRUE;
315
316 PreCreation( parent, id, pos, size, style, name );
317
318 m_widget = gtk_scrolled_window_new(NULL, NULL);
319 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_widget),
320 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
321
322 m_tree = GTK_TREE(gtk_tree_new());
323
324/*
325 gtk_signal_connect( GTK_OBJECT(m_tree), "selection_changed",
326 GTK_SIGNAL_FUNC(gtk_treectrl_selection_changed_callback), (gpointer)this);
327 gtk_signal_connect( GTK_OBJECT(m_tree), "select_child",
328 GTK_SIGNAL_FUNC(gtk_treectrl_select_child_callback), (gpointer)this);
329 gtk_signal_connect( GTK_OBJECT(m_tree), "unselect_child",
330 GTK_SIGNAL_FUNC(gtk_treectrl_unselect_child_callback), (gpointer)this);
331*/
332
333 gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_tree));
334 gtk_widget_show(GTK_WIDGET(m_tree));
335
336 PostCreation();
337
338 gtk_widget_realize(GTK_WIDGET(m_tree));
339
340 Show(TRUE);
341
342 return TRUE;
343};
344
345int wxTreeCtrl::GetCount() const
346{
347 if (!m_anchor) return 0;
348 return m_anchor->NumberOfVisibleDescendents();
349};
350
befe54c6 351long wxTreeCtrl::InsertItem(long parent, const wxString& label,
f4e325b3
DP
352 int image, int selImage, long insertAfter) {
353 wxTreeItem item;
f4e325b3
DP
354 if (!label.IsNull() || (label == "")) {
355 item.m_text = label;
356 item.m_mask |= wxTREE_MASK_TEXT;
357 };
358
359 if (image >= 0) {
360 item.m_image = image;
361 item.m_mask |= wxTREE_MASK_IMAGE;
362 };
363
364 if (selImage >= 0) {
365 item.m_selectedImage = selImage;
366 item.m_mask |= wxTREE_MASK_SELECTED_IMAGE;
367 };
368
369 return InsertItem(parent, item, insertAfter);
370};
371
372long wxTreeCtrl::InsertItem( long parent, wxTreeItem &info, long WXUNUSED(insertAfter) ) {
373 int oldMask = info.m_mask;
374 long ret = 0;
375 wxTreeItem *p = NULL;
376 wxTreeItem *new_child;
377
378 if (parent == 0) {
379 if (m_anchor)
380 return -1;
381 } else {
382 p = FindItem(parent);
383 if (!p) return -1;
384 };
385
386 if ((info.m_mask & wxTREE_MASK_HANDLE) == 0) {
387 m_lastId++;
388 info.m_itemId = m_lastId;
389 info.m_mask |= wxTREE_MASK_HANDLE;
390 ret = m_lastId;
391 } else
392 ret = info.m_itemId;
393
394 if (p) {
395 if (p->m_tree == NULL)
396 p->AddSubtree();
397
398 new_child = new wxTreeItem(GTK_WIDGET(p->m_tree), info);
399 p->AddChild(new_child);
befe54c6 400gtk_widget_draw_default(GTK_WIDGET(m_tree));
f4e325b3
DP
401 } else {
402 new_child = new wxTreeItem(GTK_WIDGET(m_tree), info);
403 m_anchor = new_child;
404 }
405
befe54c6
DP
406/* Disabled until wxImageList q solved >>> seems it solved */
407/*
408 wxBitmap *bmp;
409 if ((new_child->m_mask & wxTREE_MASK_IMAGE) != 0) {
410 if (m_imageList != NULL) {
411// if ((bmp = m_imageList->GetBitmap(new_child->m_image)) != NULL) {
412 if ((bmp = m_imageList->GetBitmap(0)) != NULL) {
413 if (bmp->Ok()) {
414 GdkBitmap *mask = NULL;
415 if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
416 GtkWidget *pixmap = gtk_pixmap_new(bmp->GetPixmap(), mask);
417
418gtk_widget_unref(new_child->m_widget->plus_pix_widget);
419gtk_container_remove(GTK_CONTAINER(new_child->m_widget->pixmaps_box),
420 new_child->m_widget->plus_pix_widget);
421gtk_container_add(GTK_CONTAINER(new_child->m_widget->pixmaps_box),
422 pixmap);
423 gtk_widget_show(pixmap);
424 GTK_TREE_ITEM(new_child->m_widget)->plus_pix_widget = pixmap;
425 }
426 }
427
428 if ((bmp = m_imageList->GetBitmap(1)) != NULL) {
429 if (bmp->Ok()) {
430 GdkBitmap *mask = NULL;
431 if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
432 GtkWidget *pixmap = gtk_pixmap_new(bmp->GetPixmap(), mask);
433
434gtk_widget_unref(new_child->m_widget->minus_pix_widget);
435//gtk_container_remove(GTK_CONTAINER(new_child->m_widget->pixmaps_box),
436// new_child->m_widget->plus_pix_widget);
437//gtk_container_add(GTK_CONTAINER(new_child->m_widget->pixmaps_box),
438// pixmap);
439 gtk_widget_show(pixmap);
440 GTK_TREE_ITEM(new_child->m_widget)->minus_pix_widget = pixmap;
441 }
442 }
f4e325b3
DP
443 }
444 }
445*/
446
447 new_child->m_owner = this;
448
449 info.m_mask = oldMask;
450 return ret;
451};
452
453
454bool wxTreeCtrl::ExpandItem( long item, int action ) {
455 wxTreeItem *i = FindItem( item );
456 if (!i)
457 return FALSE;
458
459 switch (action) {
460 case wxTREE_EXPAND_EXPAND:
461 gtk_tree_item_expand(GTK_TREE_ITEM(i->m_widget));
462 break;
463
464 case wxTREE_EXPAND_COLLAPSE_RESET:
465 case wxTREE_EXPAND_COLLAPSE:
466 gtk_tree_item_collapse(GTK_TREE_ITEM(i->m_widget));
467 break;
468
469 case wxTREE_EXPAND_TOGGLE:
470 if ((i->GetState() & wxTREE_STATE_EXPANDED) == 0)
471 gtk_tree_item_expand(GTK_TREE_ITEM(i->m_widget));
472 else
473 gtk_tree_item_collapse(GTK_TREE_ITEM(i->m_widget));
474 break;
475 }
476
477 return TRUE;
478};
479
480void wxTreeCtrl::DeleteItem( long item )
481{
482 wxTreeItem *pItem = FindItem( item );
483 wxCHECK_RET( pItem != NULL, "wxTreeCtrl::DeleteItem: no such pItem." );
484
485// pItem->m_parent->m_childlist.DeleteObject(pItem);
486}
487
488void wxTreeCtrl::DeleteChildren( long item )
489{
490 wxTreeItem *pItem = FindItem( item );
491 wxCHECK_RET( pItem != NULL, "wxTreeCtrl::DeleteChildren: no such pItem." );
492
493 pItem->DeleteChildren();
494}
495
496bool wxTreeCtrl::DeleteAllItems()
497{
498 delete m_anchor;
499 m_anchor = NULL;
500 return TRUE;
501};
502
503/*
504bool wxTreeCtrl::GetItem( wxTreeItem &info ) const
505{
506 wxTreeItem *i = FindItem( info.m_itemId );
507 if (!i) return FALSE;
508 i->GetItem( info );
509 return TRUE;
510};
511*/
512
513long wxTreeCtrl::GetItemData( long item ) const
514{
515 wxTreeItem *i = FindItem( item );
516 if (!i) return 0;
517 return i->m_data;
518};
519
520wxString wxTreeCtrl::GetItemText( long item ) const
521{
522 wxTreeItem *i = FindItem( item );
523 if (!i) return "";
524 return i->m_text;
525};
526
527int wxTreeCtrl::GetItemImage(long item) const
528{
529 wxTreeItem *i = FindItem( item );
530 return i == 0 ? -1 : i->GetImage();
531}
532
533long wxTreeCtrl::GetParent( long item ) const
534{
535 wxTreeItem *i = FindItem( item );
536 if (!i) return -1;
537/*
538 i = i->m_parent;
539 if (!i) return -1;
540 return i->m_parent->m_itemId;
541*/
542 return -1;
543};
544
545long wxTreeCtrl::GetRootItem() const
546{
547 if (m_anchor) return m_anchor->m_itemId;
548 return -1;
549};
550
551/*
552long wxTreeCtrl::GetSelection() const
553{
554 return m_current ? m_current->GetItemId() : -1;
555};
556
557bool wxTreeCtrl::SelectItem(long itemId)
558{
559 wxTreeItem *pItem = FindItem(itemId);
560 if ( !pItem ) {
561 wxLogDebug("Can't select an item %d which doesn't exist.", itemId);
562
563 return FALSE;
564 }
565
566 SelectItem(pItem);
567
568 return TRUE;
569};
570
571void wxTreeCtrl::SelectItem(wxTreeItem *item, bool bDoEvents )
572{
573 if (m_current != item)
574 {
575 if (m_current)
576 {
577 m_current->SetHilight( FALSE );
578// RefreshLine( m_current );
579 };
580 m_current = item;
581 m_current->SetHilight( TRUE );
582// RefreshLine( m_current );
583
584 if (bDoEvents) m_current->SendSelected( this );
585 }
586}
587*/
588
589bool wxTreeCtrl::ItemHasChildren( long item ) const
590{
591 wxTreeItem *i = FindItem( item );
592 if (!i) return FALSE;
593 return i->HasChildren();
594};
595
596void wxTreeCtrl::SetIndent( int indent )
597{
598 m_indent = indent;
599 Refresh();
600};
601
602int wxTreeCtrl::GetIndent() const
603{
604 return m_indent;
605};
606
607/*
608bool wxTreeCtrl::SetItem( wxTreeItem &info )
609{
610 wxTreeItem *i = FindItem( info.m_itemId );
611 if (!i) return FALSE;
612 wxClientDC dc(this);
613 i->SetItem( info, &dc );
614 Refresh();
615 return TRUE;
616};
617
618bool wxTreeCtrl::SetItemData( long item, long data )
619{
620 wxTreeItem *i = FindItem( item );
621 if (!i) return FALSE;
622 i->m_data = data;
623 return TRUE;
624};
625
626bool wxTreeCtrl::SetItemText( long item, const wxString &text )
627{
628 wxTreeItem *i = FindItem( item );
629 if (!i) return FALSE;
630 wxClientDC dc(this);
631 i->SetText( text, &dc );
632 return TRUE;
633};
634
635void wxTreeCtrl::SetItemImage(long item, int image, int imageSel) const
636{
637 wxTreeItem *i = FindItem( item );
638 if ( i != 0 ) {
639 i->SetImage(image);
640 i->SetSelectedImage(imageSel);
641 }
642}
643
644long wxTreeCtrl::HitTest( const wxPoint& point, int &flags )
645{
646 flags = 0;
647 if (!m_anchor) return -1;
648 return m_anchor->HitTest( point, flags );
649};
650*/
651
652wxImageList *wxTreeCtrl::GetImageList( int which ) const
653{
654 if (which == wxIMAGE_LIST_NORMAL) return m_imageList;
655 return m_smallImageList;
656};
657
658void wxTreeCtrl::SetImageList( wxImageList *imageList, int which )
659{
660 if (which == wxIMAGE_LIST_NORMAL)
661 {
662 if (m_imageList) delete m_imageList;
663 m_imageList = imageList;
664 }
665 else
666 {
667 if (m_smallImageList) delete m_smallImageList;
668 m_smallImageList = imageList;
669 };
670};
671
672wxTreeItem *wxTreeCtrl::FindItem( long itemId ) const {
673 if (!m_anchor) return NULL;
674 return m_anchor->FindItem( itemId );
675 return 0;
676};
677
678wxTreeItem *wxTreeCtrl::FindItem(GtkTreeItem *item) const {
679 if (!m_anchor) return NULL;
680 return m_anchor->FindItem(item);
681 return 0;
682};
683
684//-----------------------------------------------------------------------------
685// wxTreeEvent
686//-----------------------------------------------------------------------------
687
688IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent,wxCommandEvent)
689
690wxTreeEvent::wxTreeEvent( wxEventType commandType, int id ) :
691 wxCommandEvent( commandType, id )
692{
693 m_code = 0;
694 m_oldItem = 0;
695};
696
697/* Bunch of old code might be useful */
698/*
699 wxBitmap *bmp;
700
701 if ((bmp = m_imageList->GetItem(0))->Ok()) {
702 GdkBitmap *mask = NULL;
703 if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
704 GtkWidget *pixmap = gtk_pixmap_new( bmp->GetPixmap(), mask );
705
706 gtk_widget_set_parent(pixmap, GTK_WIDGET(new_child->m_widget));
707 gtk_widget_show(pixmap);
708 GTK_TREE_ITEM(new_child->m_widget)->pixmaps_box = pixmap;
709 }
710
711 if ((bmp = m_imageList->GetItem(1))->Ok()) {
712 GdkBitmap *mask = NULL;
713 if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
714 GtkWidget *pixmap = gtk_pixmap_new( bmp->GetPixmap(), mask );
715
716 gtk_widget_set_parent(pixmap, GTK_WIDGET(new_child->m_widget));
717 gtk_widget_show(pixmap);
718 GTK_TREE_ITEM(new_child->m_widget)->plus_pix_widget = pixmap;
719 }
720
721 if ((bmp = m_imageList->GetItem(2))->Ok()) {
722 GdkBitmap *mask = NULL;
723 if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
724 GtkWidget *pixmap = gtk_pixmap_new( bmp->GetPixmap(), mask );
725
726 gtk_widget_set_parent(pixmap, GTK_WIDGET(new_child->m_widget));
727 gtk_widget_show(pixmap);
728 GTK_TREE_ITEM(new_child->m_widget)->minus_pix_widget = pixmap;
729 }
730
731 if (p)
732 if (p->m_childlist.Number() == 1) {
733 gtk_tree_item_collapse(GTK_TREE_ITEM(p->m_widget));
734 gtk_tree_item_expand(GTK_TREE_ITEM(p->m_widget));
735 }
736*/