X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd3f686c274a264e89ea97505350a82c1134f307..16553659df1a8fee8b19cc9a8ff8321711fe983c:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 7a5c6af4f2..cbecafa355 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -54,7 +54,7 @@ #undef GetNextSibling #endif -#include "wx/treectrl.h" +#include "wx/msw/treectrl.h" // Bug in headers, sometimes #ifndef TVIS_FOCUSED @@ -336,16 +336,22 @@ void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) 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 { + // Bug in Gnu-Win32 headers, so don't use the macro TreeView_GetItemRect 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; } +bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const +{ + wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_BOLD); + DoGetItem(&tvItem); + + return (tvItem.state & TVIS_BOLD) != 0; +} + // ---------------------------------------------------------------------------- // navigation // ---------------------------------------------------------------------------- @@ -490,7 +504,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, tvIns.item.mask = mask; - HTREEITEM id = TreeView_InsertItem(wxhWnd, &tvIns); + HTREEITEM id = (HTREEITEM) TreeView_InsertItem(wxhWnd, &tvIns); if ( id == 0 ) { wxLogLastError("TreeView_InsertItem"); @@ -552,10 +566,6 @@ wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent, 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"); @@ -740,6 +750,12 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item, } } +// TODO +size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively) +{ + return 0; +} + // ---------------------------------------------------------------------------- // implementation // ----------------------------------------------------------------------------