+ TV_ITEM tvi;
+ tvi.hItem = (HTREEITEM)node.m_pItem;
+ tvi.mask = TVIF_STATE;
+ tvi.stateMask = TVIS_STATEIMAGEMASK;
+
+ // Select the specified state, or -1 == cycle to the next one.
+ if ( state == -1 )
+ {
+ TreeView_GetItem(GetHwnd(), &tvi);
+
+ state = STATEIMAGEMASKTOINDEX(tvi.state) + 1;
+ if ( state == m_imageListState->GetImageCount() )
+ state = 1;
+ }
+
+ wxCHECK_RET( state < m_imageListState->GetImageCount(),
+ _T("wxTreeCtrl::SetState(): item index out of bounds") );
+
+ tvi.state = INDEXTOSTATEIMAGEMASK(state);
+
+ TreeView_SetItem(GetHwnd(), &tvi);
+}
+
+int wxTreeCtrl::GetState(const wxTreeItemId& node)
+{
+ TV_ITEM tvi;
+ tvi.hItem = (HTREEITEM)node.m_pItem;
+ tvi.mask = TVIF_STATE;
+ tvi.stateMask = TVIS_STATEIMAGEMASK;
+ TreeView_GetItem(GetHwnd(), &tvi);
+
+ return STATEIMAGEMASKTOINDEX(tvi.state);