1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Denis Pershin
8 // Copyright: (c) Denis Pershin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "treectrl.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/gtk/treectrl.h"
28 #include <wx/textctrl.h>
33 //static void wxConvertToGtkTreeItem(wxTreeCtrl *owner, wxTreeItem& info, GtkTreeItem **gtkItem);
34 //static void wxConvertFromGtkTreeItem(wxTreeItem& info, GtkTreeItem *gtkItem);
35 static void gtk_treectrl_count_callback (GtkWidget
*widget
, gpointer data
);
36 static void gtk_treectrl_first_selected_callback(GtkWidget
*widget
, gpointer data
);
37 // static void gtk_treectrl_next_callback (GtkWidget *widget, gpointer data);
38 // static void gtk_treectrl_next_visible_callback (GtkWidget *widget, gpointer data);
39 // static void gtk_treectrl_next_selected_callback (GtkWidget *widget, gpointer data);
41 static void gtk_treeitem_expand_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
);
42 static void gtk_treeitem_collapse_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
);
43 static void gtk_treeitem_select_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
);
45 static void gtk_treeitem_expand_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
) {
46 wxTreeCtrl
*owner
= (wxTreeCtrl
*)gtk_object_get_data(GTK_OBJECT(widget
), "owner");
50 // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id");
51 owner
->SendExpanding(GTK_TREE_ITEM(widget
));
52 owner
->SendExpanded(GTK_TREE_ITEM(widget
));
55 static void gtk_treeitem_collapse_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
) {
56 wxTreeCtrl
*owner
= (wxTreeCtrl
*)gtk_object_get_data(GTK_OBJECT(widget
), "owner");
60 // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id");
61 owner
->SendCollapsing(GTK_TREE_ITEM(widget
));
62 owner
->SendCollapsed(GTK_TREE_ITEM(widget
));
65 static void gtk_treeitem_select_callback(GtkWidget
*widget
, wxTreeItemId
*treeitem
) {
66 wxTreeCtrl
*owner
= (wxTreeCtrl
*)gtk_object_get_data(GTK_OBJECT(widget
), "owner");
70 // long id = (long)gtk_object_get_data(GTK_OBJECT(widget), "id");
71 owner
->SendSelChanging(GTK_TREE_ITEM(widget
));
72 owner
->SendSelChanged(GTK_TREE_ITEM(widget
));
75 #if !USE_SHARED_LIBRARY
76 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl
, wxControl
)
80 void wxTreeCtrl::Init() {
81 m_imageListNormal
= NULL
;
82 m_imageListState
= NULL
;
86 bool wxTreeCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
,
87 const wxSize
& size
, long style
,
88 const wxValidator
& validator
, const wxString
& name
) {
96 m_windowStyle
= style
;
111 printf("precreate\n");
112 PreCreation( parent
, id
, pos
, size
, style
, name
);
116 m_widget
= gtk_scrolled_window_new(NULL
, NULL
);
118 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_widget
),
119 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
122 m_tree
= GTK_TREE(gtk_tree_new());
125 gtk_container_add(GTK_CONTAINER(m_widget
), GTK_WIDGET(m_tree
));
127 // gtk_widget_set_parent(GTK_WIDGET(m_tree), m_widget);
129 gtk_widget_show(GTK_WIDGET(m_tree
));
132 SetValidator(validator
);
134 printf("postcreate\n");
137 gtk_widget_realize(GTK_WIDGET(m_tree
));
144 wxTreeCtrl::~wxTreeCtrl(void) {
150 static void gtk_treectrl_count_callback (GtkWidget
*widget
, gpointer data
) {
151 int count
= (*((int *)data
));
154 if (GTK_IS_CONTAINER(widget
))
155 gtk_container_foreach(GTK_CONTAINER(widget
), gtk_treectrl_count_callback
, data
);
158 size_t wxTreeCtrl::GetCount() const {
161 if (m_anchor
!= NULL
)
162 gtk_treectrl_count_callback(GTK_WIDGET(m_anchor
), &count
);
166 unsigned int wxTreeCtrl::GetIndent() const {
167 return m_tree
->indent_value
;
170 void wxTreeCtrl::SetIndent(unsigned int indent
) {
171 m_tree
->indent_value
= indent
;
174 wxImageList
*wxTreeCtrl::GetImageList() const {
175 return m_imageListNormal
;
178 wxImageList
*wxTreeCtrl::GetStateImageList() const {
179 return m_imageListState
;
182 void wxTreeCtrl::SetImageList(wxImageList
*imageList
) {
183 m_imageListNormal
= imageList
;
186 void wxTreeCtrl::SetStateImageList(wxImageList
*imageList
) {
187 m_imageListState
= imageList
;
190 wxString
wxTreeCtrl::GetItemText(const wxTreeItemId
&item
) const {
196 GtkLabel
*l
= GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "w_label"));
197 gtk_label_get(l
, &t
);
202 int wxTreeCtrl::GetItemImage(const wxTreeItemId
& item
) const {
206 return (int)gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "image");
209 int wxTreeCtrl::GetItemSelectedImage(const wxTreeItemId
& item
) const {
213 return (int)gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "selectedImage");
216 wxTreeItemData
*wxTreeCtrl::GetItemData(const wxTreeItemId
& item
) const {
220 return (wxTreeItemData
*)gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "data");
223 void wxTreeCtrl::SetItemText(const wxTreeItemId
& item
, const wxString
& text
) {
227 GtkLabel
*l
= GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "w_label"));
228 gtk_label_set(l
, text
);
231 void wxTreeCtrl::SetItemImage(const wxTreeItemId
& item
, int image
) {
235 gtk_object_set_data(GTK_OBJECT((GtkTreeItem
*)item
), "image", (void *)image
);
238 void wxTreeCtrl::SetItemSelectedImage(const wxTreeItemId
& item
, int image
) {
242 gtk_object_set_data(GTK_OBJECT((GtkTreeItem
*)item
), "selectedImage", (void *)image
);
245 void wxTreeCtrl::SetItemData(const wxTreeItemId
& item
, wxTreeItemData
*data
) {
249 gtk_object_set_data(GTK_OBJECT((GtkTreeItem
*)item
), "data", data
);
252 bool wxTreeCtrl::IsVisible(const wxTreeItemId
& item
) const {
253 #warning "Need to implement IsVisible"
257 bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId
& item
) const {
258 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
260 if (p
->subtree
== NULL
)
263 if (GTK_TREE(p
->subtree
)->children
== NULL
)
266 if (g_list_length(GTK_TREE(p
->subtree
)->children
) == 0)
272 bool wxTreeCtrl::IsExpanded(const wxTreeItemId
& item
) const {
273 return (((GtkTreeItem
*)item
)->expanded
!= 0);
276 bool wxTreeCtrl::IsSelected(const wxTreeItemId
& item
) const {
277 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
278 GtkWidget
*parent
= GTK_WIDGET(p
)->parent
;
280 if (!GTK_IS_TREE(parent
))
283 if (g_list_index(GTK_TREE(parent
)->children
, p
) == -1)
289 wxTreeItemId
wxTreeCtrl::GetRootItem() const {
293 static void gtk_treectrl_first_selected_callback(GtkWidget
*widget
, gpointer data
) {
294 GtkTreeItem
*p
= (*((GtkTreeItem
**)data
));
296 GtkTree
*tree
= GTK_TREE(GTK_TREE_ITEM(widget
)->subtree
);
298 if (tree
->selection
!= NULL
) {
299 p
= (GtkTreeItem
*)tree
->selection
->data
;
303 if (GTK_IS_CONTAINER(widget
))
304 gtk_container_foreach(GTK_CONTAINER(widget
), gtk_treectrl_first_selected_callback
, data
);
307 wxTreeItemId
wxTreeCtrl::GetSelection() const {
308 GtkTreeItem
*p
= NULL
;
310 if (m_anchor
== NULL
)
313 gtk_treectrl_first_selected_callback(GTK_WIDGET(m_anchor
), &p
);
318 wxTreeItemId
wxTreeCtrl::GetParent(const wxTreeItemId
& item
) const {
320 return (GtkTreeItem
*)gtk_object_get_data(GTK_OBJECT((GtkTreeItem
*)item
), "parent");
325 wxTreeItemId
wxTreeCtrl::GetFirstChild(const wxTreeItemId
& item
, long& cookie
) const {
326 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
327 GtkWidget
*parent
= GTK_WIDGET(p
)->parent
;
329 if (!GTK_IS_TREE(parent
))
333 return GTK_TREE_ITEM(g_list_first(GTK_TREE(parent
)->children
)->data
);
336 wxTreeItemId
wxTreeCtrl::GetNextChild(const wxTreeItemId
& item
, long& cookie
) const {
337 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
338 GtkWidget
*parent
= GTK_WIDGET(p
)->parent
;
340 if (!GTK_IS_TREE(parent
))
344 return GTK_TREE_ITEM(g_list_nth(GTK_TREE(parent
)->children
, cookie
)->data
);
347 wxTreeItemId
wxTreeCtrl::GetNextSibling(const wxTreeItemId
& item
) const {
348 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
349 GtkWidget
*parent
= GTK_WIDGET(p
)->parent
;
351 if (!GTK_IS_TREE(parent
))
354 if (g_list_index(GTK_TREE(parent
)->children
, p
) == -1)
357 return GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent
)->children
, p
))->data
);
360 wxTreeItemId
wxTreeCtrl::GetPrevSibling(const wxTreeItemId
& item
) const {
361 GtkTreeItem
*p
= (GtkTreeItem
*)item
;
362 GtkWidget
*parent
= GTK_WIDGET(p
)->parent
;
364 if (!GTK_IS_TREE(parent
))
367 if (g_list_index(GTK_TREE(parent
)->children
, p
) == -1)
370 return GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent
)->children
, p
))->data
);
373 wxTreeItemId
wxTreeCtrl::GetFirstVisibleItem() const {
374 #warning "Need to implement GetFirstVisibleItem"
378 wxTreeItemId
wxTreeCtrl::GetNextVisible(const wxTreeItemId
& item
) const {
379 #warning "Need to implement GetNextVisible"
383 wxTreeItemId
wxTreeCtrl::GetPrevVisible(const wxTreeItemId
& item
) const {
384 #warning "Need to implement GetPrevVisible"
388 wxTreeItemId
wxTreeCtrl::AddRoot(const wxString
& text
, int image
,
389 int selectedImage
, wxTreeItemData
*data
) {
390 return p_InsertItem(0, text
, image
, selectedImage
, data
);
393 wxTreeItemId
wxTreeCtrl::PrependItem(const wxTreeItemId
& parent
,
394 const wxString
& text
, int image
, int selectedImage
,
395 wxTreeItemData
*data
) {
396 #warning "Need to implement PrependItem"
400 wxTreeItemId
wxTreeCtrl::InsertItem(const wxTreeItemId
& parent
,
401 const wxTreeItemId
& idPrevious
, const wxString
& text
,
402 int image
, int selectedImage
, wxTreeItemData
*data
) {
403 #warning "Need to implement InsertItem"
407 wxTreeItemId
wxTreeCtrl::AppendItem(const wxTreeItemId
& parent
,
408 const wxString
& text
, int image
, int selectedImage
,
409 wxTreeItemData
*data
) {
410 return p_InsertItem(parent
, text
, image
, selectedImage
, data
);
413 wxTreeItemId
wxTreeCtrl::p_InsertItem(GtkTreeItem
*p
,
414 const wxString
& text
, int image
, int selectedImage
,
415 wxTreeItemData
*data
) {
418 printf("begin insert\n");
420 item
= GTK_TREE_ITEM(gtk_tree_item_new());
422 GtkHBox
*m_box
= GTK_HBOX(gtk_hbox_new(FALSE
, 0));
423 gtk_container_add (GTK_CONTAINER (item
), GTK_WIDGET(m_box
));
425 gtk_object_set_data(GTK_OBJECT(item
), "w_box", m_box
);
428 const wxImageList
*list
;
429 if ((list
= GetImageList(wxIMAGE_LIST_NORMAL
)) != NULL
)
430 if ((bmp
= list
->GetBitmap(image
)) != NULL
)
432 GdkBitmap
*mask
= NULL
;
434 mask
= bmp
->GetMask()->GetBitmap();
435 GtkPixmap
*m_image_widget
= GTK_PIXMAP(gtk_pixmap_new(bmp
->GetPixmap(), mask
));
436 gtk_misc_set_alignment (GTK_MISC (m_image_widget
), 0.0, 0.5);
437 gtk_box_pack_start(GTK_BOX(m_box
), GTK_WIDGET(m_image_widget
), FALSE
, FALSE
, 0);
438 gtk_object_set_data(GTK_OBJECT(item
), "w_image", (void *)m_image_widget
);
439 gtk_object_set_data(GTK_OBJECT(item
), "image", (void *)image
);
440 gtk_widget_show (GTK_WIDGET(m_image_widget
));
442 GtkLabel
*m_label_widget
= GTK_LABEL(gtk_label_new ((char *)(const char *)text
));
443 gtk_misc_set_alignment (GTK_MISC (m_label_widget
), 0.5, 0.5);
444 gtk_box_pack_start(GTK_BOX(m_box
), GTK_WIDGET(m_label_widget
), FALSE
, FALSE
, 0);
445 gtk_object_set_data(GTK_OBJECT(item
), "w_label", m_label_widget
);
446 gtk_widget_show (GTK_WIDGET(m_label_widget
));
448 gtk_widget_show(GTK_WIDGET(m_box
));
450 gtk_object_set_data(GTK_OBJECT(item
), "owner", this);
451 gtk_object_set_data(GTK_OBJECT(item
), "data", data
);
452 gtk_object_set_data(GTK_OBJECT(item
), "parent", p
);
455 if (p
->subtree
== NULL
) {
456 GtkTree
*tree
= GTK_TREE(gtk_tree_new());
457 gtk_tree_item_set_subtree(GTK_TREE_ITEM(p
), GTK_WIDGET(tree
));
458 gtk_widget_show(GTK_WIDGET(tree
));
462 gtk_container_add(GTK_CONTAINER(p
->subtree
), GTK_WIDGET(item
));
464 printf("Adding root\n");
465 printf("m_tree = %p\n", m_tree
);
467 gtk_container_add(GTK_CONTAINER(m_tree
), GTK_WIDGET(item
));
470 gtk_widget_show(GTK_WIDGET(item
));
472 gtk_signal_connect(GTK_OBJECT(item
), "select",
473 GTK_SIGNAL_FUNC(gtk_treeitem_select_callback
), (gpointer
)this );
475 gtk_signal_connect(GTK_OBJECT(item
), "deselect",
476 GTK_SIGNAL_FUNC(gtk_treeitem_select_callback
), (gpointer
)this );
478 gtk_signal_connect(GTK_OBJECT(item
), "expand",
479 GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback
), (gpointer
)this );
480 gtk_signal_connect(GTK_OBJECT(item
), "collapse",
481 GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback
), (gpointer
)this );
486 void wxTreeCtrl::Delete(const wxTreeItemId
& item
) {
490 GtkTreeItem
*parent
= GTK_TREE_ITEM(GTK_WIDGET((GtkTreeItem
*)item
)->parent
);
494 gtk_container_remove(GTK_CONTAINER(parent
), GTK_WIDGET((GtkTreeItem
*)item
));
499 void wxTreeCtrl::DeleteAllItems() {
500 gtk_tree_item_remove_subtree(m_anchor
);
503 void wxTreeCtrl::Expand(const wxTreeItemId
& item
) {
507 gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem
*)item
));
510 void wxTreeCtrl::Collapse(const wxTreeItemId
& item
) {
514 gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem
*)item
));
517 void wxTreeCtrl::CollapseAndReset(const wxTreeItemId
& item
) {
521 gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem
*)item
));
522 gtk_tree_item_remove_subtree(GTK_TREE_ITEM((GtkTreeItem
*)item
));
525 void wxTreeCtrl::Toggle(const wxTreeItemId
& item
) {
529 if (((GtkTreeItem
*)item
)->expanded
)
530 gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem
*)item
));
532 gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem
*)item
));
535 void wxTreeCtrl::Unselect() {
536 #warning "Need to implement Unselect"
539 void wxTreeCtrl::SelectItem(const wxTreeItemId
& item
) {
543 gtk_tree_item_select((GtkTreeItem
*)item
);
546 void wxTreeCtrl::EnsureVisible(const wxTreeItemId
& item
) {
547 #warning "Need to implement EnsureVisible"
550 void wxTreeCtrl::ScrollTo(const wxTreeItemId
& item
) {
551 #warning "Need to implement ScrollTo"
554 wxTextCtrl
* wxTreeCtrl::EditLabel(const wxTreeItemId
& item
,
555 wxClassInfo
* textControlClass
) {
556 wxASSERT( textControlClass
->IsKindOf(CLASSINFO(wxTextCtrl
)) );
557 #warning "Need to implement EditLabel"
561 wxTextCtrl
* wxTreeCtrl::GetEditControl() const {
565 void wxTreeCtrl::EndEditLabel(const wxTreeItemId
& item
, bool discardChanges
) {
566 #warning "Need to implement EndEditLabel"
569 void wxTreeCtrl::ExpandItem(const wxTreeItemId
& item
, int action
) {
571 case wxTREE_EXPAND_EXPAND
:
575 case wxTREE_EXPAND_COLLAPSE
:
579 case wxTREE_EXPAND_COLLAPSE_RESET
:
580 CollapseAndReset(item
);
583 case wxTREE_EXPAND_TOGGLE
:
588 wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
592 wxTreeItemId
wxTreeCtrl::InsertItem(const wxTreeItemId
& parent
,
593 const wxString
& text
, int image
, int selImage
,
595 // InsertItem(parent, insertAfter, text, image, selImage);
596 #warning "Need to implement InsertItem"
601 long wxTreeCtrl::GetChild(long item) const {
603 GtkTreeItem *next = NULL;
605 p = findGtkTreeItem(item);
606 GList *list = gtk_container_children(GTK_CONTAINER(p));
607 next = GTK_TREE_ITEM(list->data);;
610 return (long)gtk_object_get_data(GTK_OBJECT(next), "id");
615 long wxTreeCtrl::GetFirstVisibleItem(void) const {
616 GtkTreeItem *next = NULL;
618 GList *list = gtk_container_children(GTK_CONTAINER(m_anchor));
619 next = GTK_TREE_ITEM(list->data);;
620 // gtk_container_foreach(GTK_CONTAINER(m_anchor), gtk_treectrl_next_visible_callback, &next);
623 return (long)gtk_object_get_data(GTK_OBJECT(next), "id");
628 long wxTreeCtrl::GetNextVisibleItem(long item) const {
630 GtkTreeItem *next = NULL;
632 p = findGtkTreeItem(item);
633 GList *list = gtk_container_children(GTK_CONTAINER(p));
634 next = GTK_TREE_ITEM(list->data);;
635 // gtk_container_foreach(GTK_CONTAINER(p), gtk_treectrl_next_visible_callback, &next);
638 return (long)gtk_object_get_data(GTK_OBJECT(next), "id");
643 bool wxTreeCtrl::GetItem(wxTreeItem& info) const {
646 p = findGtkTreeItem(info.m_itemId);
649 wxLogSysError("TreeCtrl::GetItem failed");
653 wxConvertFromGtkTreeItem(info, p);
658 bool wxTreeCtrl::SetItem(wxTreeItem& info) {
661 p = findGtkTreeItem(info.m_itemId);
664 wxLogSysError("TreeCtrl::SetItem failed");
668 wxConvertToGtkTreeItem(this, info, &p);
673 int wxTreeCtrl::GetItemState(long item, long stateMask) const {
676 info.m_mask = wxTREE_MASK_STATE ;
677 info.m_stateMask = stateMask;
678 info.m_itemId = item;
686 bool wxTreeCtrl::SetItemState(long item, long state, long stateMask) {
689 info.m_mask = wxTREE_MASK_STATE ;
690 info.m_state = state;
691 info.m_stateMask = stateMask;
692 info.m_itemId = item;
694 return SetItem(info);
700 bool wxTreeCtrl::DeleteChildren(long item) {
703 p = findGtkTreeItem(item);
707 gtk_tree_item_remove_subtree(GTK_TREE_ITEM(p));
714 long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter) {
716 GtkTreeItem *item = NULL;
718 info.m_itemId = m_curitemId;
721 wxConvertToGtkTreeItem(this, info, &item);
724 p = findGtkTreeItem(parent);
725 if (p->subtree == NULL) {
726 GtkTree *tree = GTK_TREE(gtk_tree_new());
727 gtk_tree_item_set_subtree(GTK_TREE_ITEM(p), GTK_WIDGET(tree));
728 gtk_widget_show(GTK_WIDGET(tree));
732 gtk_container_add(GTK_CONTAINER(p->subtree), GTK_WIDGET(item));
735 gtk_container_add(GTK_CONTAINER(m_tree), GTK_WIDGET(item));
738 if ((info.m_mask & wxTREE_MASK_CHILDREN) != 0) {
739 GtkTree *tree = GTK_TREE(gtk_tree_new());
740 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), GTK_WIDGET(tree));
741 gtk_widget_show(GTK_WIDGET(tree));
744 gtk_widget_show(GTK_WIDGET(item));
746 gtk_signal_connect(GTK_OBJECT(item), "select",
747 GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this );
749 gtk_signal_connect(GTK_OBJECT(item), "deselect",
750 GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this );
752 gtk_signal_connect(GTK_OBJECT(item), "expand",
753 GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback), (gpointer)this );
754 gtk_signal_connect(GTK_OBJECT(item), "collapse",
755 GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback), (gpointer)this );
757 return info.m_itemId;
760 long wxTreeCtrl::InsertItem(long parent, const wxString& label, int image,
761 int selImage, long insertAfter) {
765 info.m_mask = wxTREE_MASK_TEXT;
767 info.m_mask |= wxTREE_MASK_IMAGE | wxTREE_MASK_SELECTED_IMAGE;
768 info.m_image = image;
770 info.m_selectedImage = image;
772 info.m_selectedImage = selImage;
775 return InsertItem(parent, info, insertAfter);
779 void wxTreeCtrl::SendMessage(wxEventType command
, const wxTreeItemId
& item
) {
780 wxTreeEvent
event(command
, GetId());
781 event
.SetEventObject(this);
786 void wxTreeCtrl::SendExpanding(const wxTreeItemId
& item
) {
787 SendMessage(wxEVT_COMMAND_TREE_ITEM_EXPANDING
, item
);
790 void wxTreeCtrl::SendExpanded(const wxTreeItemId
& item
) {
791 SendMessage(wxEVT_COMMAND_TREE_ITEM_EXPANDED
, item
);
794 void wxTreeCtrl::SendCollapsing(const wxTreeItemId
& item
) {
795 SendMessage(wxEVT_COMMAND_TREE_ITEM_COLLAPSING
, item
);
798 void wxTreeCtrl::SendCollapsed(const wxTreeItemId
& item
) {
799 SendMessage(wxEVT_COMMAND_TREE_ITEM_COLLAPSED
, item
);
802 void wxTreeCtrl::SendSelChanging(const wxTreeItemId
& item
) {
803 SendMessage(wxEVT_COMMAND_TREE_SEL_CHANGED
, item
);
806 void wxTreeCtrl::SendSelChanged(const wxTreeItemId
& item
) {
807 SendMessage(wxEVT_COMMAND_TREE_SEL_CHANGING
, item
);
811 IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent
, wxCommandEvent
)
813 wxTreeEvent::wxTreeEvent(wxEventType commandType
, int id
):
814 wxCommandEvent(commandType
, id
) {