+void wxTreeCtrl::ScrollTo(const wxTreeItemId& WXUNUSED(item))
+{
+ wxFAIL_MSG(_T("not implemented"));
+}
+
+wxTextCtrl *wxTreeCtrl::EditLabel( const wxTreeItemId& WXUNUSED(item),
+ wxClassInfo* WXUNUSED(textCtrlClass) )
+{
+ wxFAIL_MSG(_T("not implemented"));
+
+ return (wxTextCtrl*)NULL;
+}
+
+wxTextCtrl *wxTreeCtrl::GetEditControl() const
+{
+ wxFAIL_MSG(_T("not implemented"));
+
+ return (wxTextCtrl*)NULL;
+}
+
+void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool WXUNUSED(discardChanges))
+{
+ wxFAIL_MSG(_T("not implemented"));
+}
+
+// FIXME: tree sorting functions are not reentrant and not MT-safe!
+static wxTreeCtrl *s_treeBeingSorted = NULL;
+
+static int tree_ctrl_compare_func(wxGenericTreeItem **item1,
+ wxGenericTreeItem **item2)
+{
+ wxCHECK_MSG( s_treeBeingSorted, 0, _T("bug in wxTreeCtrl::SortChildren()") );
+
+ return s_treeBeingSorted->OnCompareItems(*item1, *item2);
+}
+
+int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
+ const wxTreeItemId& item2)
+{
+ return wxStrcmp(GetItemText(item1), GetItemText(item2));
+}
+
+void wxTreeCtrl::SortChildren(const wxTreeItemId& itemId)
+{
+ wxCHECK_RET( itemId.IsOk(), _T("invalid tree item") );
+
+ wxGenericTreeItem *item = itemId.m_pItem;
+
+ wxCHECK_RET( !s_treeBeingSorted,
+ _T("wxTreeCtrl::SortChildren is not reentrant") );
+
+ wxArrayTreeItems& children = item->GetChildren();
+ if ( children.Count() > 1 )
+ {
+ s_treeBeingSorted = this;
+ children.Sort(tree_ctrl_compare_func);
+ s_treeBeingSorted = NULL;
+
+ m_dirty = TRUE;
+ }
+ //else: don't make the tree dirty as nothing changed
+}
+
+wxImageList *wxTreeCtrl::GetImageList() const
+{
+ return m_imageListNormal;
+}
+
+wxImageList *wxTreeCtrl::GetStateImageList() const
+{
+ return m_imageListState;
+}
+
+void wxTreeCtrl::SetImageList(wxImageList *imageList)
+{
+ m_imageListNormal = imageList;
+ // calculate a m_lineHeight value from the image sizes
+ wxPaintDC dc(this);
+ PrepareDC( dc );
+ m_lineHeight = (int)(dc.GetCharHeight() + 4);
+ int
+ width = 0,
+ height = 0,
+ n = m_imageListNormal->GetImageCount();
+ for(int i = 0; i < n ; i++)
+ {
+ m_imageListNormal->GetSize(i, width, height);
+ height += height/5; //20% extra spacing
+ if(height > m_lineHeight) m_lineHeight = height;
+ }
+}
+
+void wxTreeCtrl::SetStateImageList(wxImageList *imageList)
+{
+ m_imageListState = imageList;
+}
+
+// -----------------------------------------------------------------------------
+// helpers
+// -----------------------------------------------------------------------------
+
+void wxTreeCtrl::AdjustMyScrollbars()
+{
+ if (m_anchor)
+ {
+ int x = 0;
+ int y = 0;
+ m_anchor->GetSize( x, y );
+ y += 2*m_lineHeight;
+ int x_pos = GetScrollPos( wxHORIZONTAL );
+ int y_pos = GetScrollPos( wxVERTICAL );
+ SetScrollbars( 10, 10, x/10, y/10, x_pos, y_pos );
+ }
+ else
+ {
+ SetScrollbars( 0, 0, 0, 0 );
+ }
+}
+
+void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
+{
+ // render bold items in bold
+ wxFont fontOld;
+ wxFont fontNew;
+
+ if (item->IsBold())
+ {
+ fontOld = dc.GetFont();
+ if (fontOld.Ok())