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;
}
Exemple #3
0
// Create a drag image for the given tree control item
bool wxDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
{
    if ( m_hImageList )
        ImageList_Destroy(GetHimageList());
    m_hImageList = (WXHIMAGELIST)
        TreeView_CreateDragImage(GetHwndOf(&treeCtrl), (HTREEITEM) id.m_pItem);
    if ( !m_hImageList )
    {
        // fall back on just the item text if there is no image
        return Create(treeCtrl.GetItemText(id));
    }

    return true;
}
Exemple #4
0
// Create a drag image for the given tree control item
bool wxGenericDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
{
    wxString str = treeCtrl.GetItemText(id);
    return Create(str);
}