+int wxTreeCtrl::GetItemState( long item, long stateMask ) const
+{
+ wxGenericTreeItem *i = FindItem( item );
+ if (!i) return 0;
+ int ret = 0;
+
+ // Currently, an item is always selected _and_ focussed in wxGTK
+
+ if (stateMask & wxTREE_STATE_FOCUSED)
+ if (m_current == i)
+ ret += wxTREE_STATE_FOCUSED;
+
+ if (stateMask & wxTREE_STATE_SELECTED)
+ if (m_current == i)
+ ret += wxTREE_STATE_SELECTED;
+
+ if (stateMask & wxTREE_STATE_EXPANDED)
+ if (i->IsExpanded())
+ ret += wxTREE_STATE_EXPANDED;
+
+ return ret;
+}
+
+bool wxTreeCtrl::SetItemState( long item, long state, long stateMask )
+{
+ wxGenericTreeItem *i = FindItem( item );
+ if (!i) return FALSE;
+
+ if (stateMask & wxTREE_STATE_FOCUSED)
+ {
+ if (state & wxTREE_STATE_FOCUSED)
+ SelectItem( i );
+ }
+
+ if (stateMask & wxTREE_STATE_SELECTED)
+ {
+ if (state & wxTREE_STATE_SELECTED)
+ SelectItem( i );
+ }
+
+ if (stateMask & wxTREE_STATE_EXPANDED)
+ {
+ if (state & wxTREE_STATE_EXPANDED)
+ ExpandItem( i->m_itemId, wxTREE_EXPAND_EXPAND );
+ else
+ ExpandItem( i->m_itemId, wxTREE_EXPAND_COLLAPSE );
+ }
+
+ return TRUE;
+}
+