#undef GetNextSibling
#endif
-#include "wx/treectrl.h"
+#include "wx/msw/treectrl.h"
// Bug in headers, sometimes
#ifndef TVIS_FOCUSED
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;
}
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
// ----------------------------------------------------------------------------
tvIns.item.mask = mask;
- HTREEITEM id = TreeView_InsertItem(wxhWnd, &tvIns);
+ HTREEITEM id = (HTREEITEM) TreeView_InsertItem(wxhWnd, &tvIns);
if ( id == 0 )
{
wxLogLastError("TreeView_InsertItem");
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");
}
}
+// TODO
+size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively)
+{
+ return 0;
+}
+
+// delete all children (but don't delete the item itself)
+// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
+void wxTreeCtrl::DeleteChildren(const wxTreeItemId& item)
+{
+ // TODO
+}
+
// ----------------------------------------------------------------------------
// implementation
// ----------------------------------------------------------------------------
// Tree event
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
: wxNotifyEvent(commandType, id)