]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
Cured radiobutton non-setting by using BS_AUTORADIOBUTTON; cured gridg.cpp
[wxWidgets.git] / src / msw / treectrl.cpp
index 7a5c6af4f2bc5876966a5686ce16081e1000d36c..7fcab3a9a81f10dc2cef5467cb3cd97a5db9c00a 100644 (file)
@@ -54,7 +54,7 @@
 #undef GetNextSibling
 #endif
 
 #undef GetNextSibling
 #endif
 
-#include "wx/treectrl.h"
+#include "wx/msw/treectrl.h"
 
 // Bug in headers, sometimes
 #ifndef TVIS_FOCUSED
 
 // Bug in headers, sometimes
 #ifndef TVIS_FOCUSED
@@ -336,16 +336,22 @@ void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has)
     DoSetItem(&tvItem);
 }
 
     DoSetItem(&tvItem);
 }
 
+void wxTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold)
+{
+    wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_BOLD);
+    tvItem.state = bold ? TVIS_BOLD : 0;
+    DoSetItem(&tvItem);
+}
+
 // ----------------------------------------------------------------------------
 // Item status
 // ----------------------------------------------------------------------------
 
 bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const
 {
 // ----------------------------------------------------------------------------
 // Item status
 // ----------------------------------------------------------------------------
 
 bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const
 {
+    // Bug in Gnu-Win32 headers, so don't use the macro TreeView_GetItemRect
     RECT rect;
     RECT rect;
-//    return (TreeView_GetItemRect(wxhWnd, (HTREEITEM) (WXHTREEITEM)item, &rect, FALSE) != 0);
-    // Bug in Gnu-Win32 headers, so don't use the macro.
-    return (SendMessage((wxhWnd), TVM_GETITEMRECT, (WPARAM) FALSE, (LPARAM) & rect) != 0);
+    return SendMessage(wxhWnd, TVM_GETITEMRECT, FALSE, (LPARAM)&rect) != 0;
 
 }
 
 
 }
 
@@ -376,6 +382,14 @@ bool wxTreeCtrl::IsSelected(const wxTreeItemId& item) const
     return (tvItem.state & TVIS_SELECTED) != 0;
 }
 
     return (tvItem.state & TVIS_SELECTED) != 0;
 }
 
+bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const
+{
+    wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_BOLD);
+    DoGetItem(&tvItem);
+
+    return (tvItem.state & TVIS_BOLD) != 0;
+}
+
 // ----------------------------------------------------------------------------
 // navigation
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // navigation
 // ----------------------------------------------------------------------------
@@ -490,7 +504,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
 
     tvIns.item.mask = mask;
 
 
     tvIns.item.mask = mask;
 
-    HTREEITEM id = TreeView_InsertItem(wxhWnd, &tvIns);
+    HTREEITEM id = (HTREEITEM) TreeView_InsertItem(wxhWnd, &tvIns);
     if ( id == 0 )
     {
         wxLogLastError("TreeView_InsertItem");
     if ( id == 0 )
     {
         wxLogLastError("TreeView_InsertItem");
@@ -552,10 +566,6 @@ wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent,
 
 void wxTreeCtrl::Delete(const wxTreeItemId& item)
 {
 
 void wxTreeCtrl::Delete(const wxTreeItemId& item)
 {
-    wxTreeItemData *data = GetItemData(item);
-       if(data!=NULL)
-               delete data;    // may be NULL, ok
-
     if ( !TreeView_DeleteItem(wxhWnd, (HTREEITEM)(WXHTREEITEM)item) )
     {
         wxLogLastError("TreeView_DeleteItem");
     if ( !TreeView_DeleteItem(wxhWnd, (HTREEITEM)(WXHTREEITEM)item) )
     {
         wxLogLastError("TreeView_DeleteItem");
@@ -740,6 +750,12 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item,
     }
 }
 
     }
 }
 
+// TODO
+size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively)
+{
+    return 0;
+}
+
 // ----------------------------------------------------------------------------
 // implementation
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // implementation
 // ----------------------------------------------------------------------------
@@ -923,7 +939,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
 // Tree event
 // ----------------------------------------------------------------------------
 
 // Tree event
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
 
 wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
            : wxNotifyEvent(commandType, id)
 
 wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
            : wxNotifyEvent(commandType, id)