本文整理汇总了C++中wxDataViewCtrl::GetModel方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDataViewCtrl::GetModel方法的具体用法?C++ wxDataViewCtrl::GetModel怎么用?C++ wxDataViewCtrl::GetModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDataViewCtrl
的用法示例。
在下文中一共展示了wxDataViewCtrl::GetModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextItem
wxDataViewItem GetNextItem( wxDataViewCtrl const& aView, wxDataViewItem const& aItem )
{
wxDataViewItem nextItem;
if( !aItem.IsOk() )
{
// No selection. Select the first.
wxDataViewItemArray children;
aView.GetModel()->GetChildren( aItem, children );
return children[0];
}
if( aView.IsExpanded( aItem ) )
{
wxDataViewItemArray children;
aView.GetModel()->GetChildren( aItem, children );
nextItem = children[0];
}
else
{
// Walk up levels until we find one that has a next sibling.
for( wxDataViewItem walk = aItem; walk.IsOk(); walk = aView.GetModel()->GetParent( walk ) )
{
nextItem = GetNextSibling( aView, walk );
if( nextItem.IsOk() )
break;
}
}
return nextItem;
}
示例2: GetPrevItem
wxDataViewItem GetPrevItem( wxDataViewCtrl const& aView, wxDataViewItem const& aItem )
{
auto prevItem = GetPrevSibling( aView, aItem );
if( !prevItem.IsOk() )
{
prevItem = aView.GetModel()->GetParent( aItem );
}
else if( aView.IsExpanded( prevItem ) )
{
wxDataViewItemArray children;
aView.GetModel()->GetChildren( prevItem, children );
prevItem = children[children.size() - 1];
}
return prevItem;
}
示例3: GetNextSibling
wxDataViewItem GetNextSibling( wxDataViewCtrl const& aView, wxDataViewItem const& aItem )
{
wxDataViewItemArray siblings;
wxDataViewItem invalid;
wxDataViewItem parent = aView.GetModel()->GetParent( aItem );
aView.GetModel()->GetChildren( parent, siblings );
for( size_t i = 0; i < siblings.size(); ++i )
{
if( siblings[i] == aItem )
{
if( i == siblings.size() - 1 )
return invalid;
else
return siblings[i + 1];
}
}
return invalid;
}