static wxTreeItemId GetNextItem( const wxTreeCtrl& tree, const wxTreeItemId& item ) { wxTreeItemId nextItem; if( tree.IsExpanded( item ) ) { wxTreeItemIdValue dummy; nextItem = tree.GetFirstChild( item, dummy ); } else { // Walk up levels until we find one that has a next sibling. for ( wxTreeItemId walk = item; walk.IsOk(); walk = tree.GetItemParent( walk ) ) { nextItem = tree.GetNextSibling( walk ); if( nextItem.IsOk() ) break; } } return nextItem; }
static wxTreeItemId GetPrevItem( const wxTreeCtrl& tree, const wxTreeItemId& item ) { wxTreeItemId prevItem = tree.GetPrevSibling( item ); if( !prevItem.IsOk() ) { prevItem = tree.GetItemParent( item ); } else if( tree.IsExpanded( prevItem ) ) { prevItem = tree.GetLastChild( prevItem ); } return prevItem; }