本文整理汇总了C++中wxDataViewItem::IsOk方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDataViewItem::IsOk方法的具体用法?C++ wxDataViewItem::IsOk怎么用?C++ wxDataViewItem::IsOk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDataViewItem
的用法示例。
在下文中一共展示了wxDataViewItem::IsOk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compare
int MyMusicTreeModel::Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
unsigned int column, bool ascending ) const
{
wxASSERT(item1.IsOk() && item2.IsOk());
// should never happen
if (IsContainer(item1) && IsContainer(item2))
{
wxVariant value1, value2;
GetValue( value1, item1, 0 );
GetValue( value2, item2, 0 );
wxString str1 = value1.GetString();
wxString str2 = value2.GetString();
int res = str1.Cmp( str2 );
if (res) return res;
// items must be different
wxUIntPtr litem1 = (wxUIntPtr) item1.GetID();
wxUIntPtr litem2 = (wxUIntPtr) item2.GetID();
return litem1-litem2;
}
return wxDataViewModel::Compare( item1, item2, column, ascending );
}
示例2: GetAttr
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const
{
if ( !item.IsOk() )
{
return false;
}
Asset *node = static_cast< Asset* >( item.GetID() );
HELIUM_ASSERT( node );
// bold the entry if the node is active
attr.SetBold( node->IsPackage() );
if ( node->GetAllFlagsSet( Asset::FLAG_EDITOR_FORCIBLY_LOADED ) )
{
attr.SetColour( *wxBLACK );
}
else
{
attr.SetColour( *wxLIGHT_GREY );
}
// italicize the entry if it is modified
attr.SetItalic( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) );
if ( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) )
{
attr.SetColour( *wxRED );
}
return true;
}
示例3: GetAttr
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const
{
if ( !item.IsOk() )
{
return false;
}
ProjectViewModelNode *node = static_cast< ProjectViewModelNode* >( item.GetID() );
HELIUM_ASSERT( node );
// bold the entry if the node is active
attr.SetBold( node->m_IsActive );
// italicize the entry if it is modified
attr.SetItalic( ( node->GetDocument() && node->GetDocument()->HasChanged() ) );
Path nodePath = node->GetPath().GetAbsolutePath( m_Project->a_Path.Get() );
if ( !nodePath.Exists() )
{
attr.SetColour( *wxRED );
}
else
{
attr.SetColour( *wxBLACK );
}
return true;
}
示例4:
//=====================================================================================
/*virtual*/ bool WinnerPanel::WinEntryDataViewModel::IsContainer( const wxDataViewItem& item ) const
{
if( !item.IsOk() )
return true;
return false;
}
示例5:
bool DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::IsContainer( const wxDataViewItem& aItem ) const
{
if( aItem.IsOk() )
return reinterpret_cast<Item const*>( aItem.GetID() )->IsContainer();
else
return true;
}
示例6: assert
wxDataViewItem DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetParent( const wxDataViewItem& aItem )
const
{
assert( aItem.IsOk() );
return reinterpret_cast<Item const*>( aItem.GetID() )->GetParent();
}
示例7: IsContainer
bool TreeModelFilter::IsContainer(const wxDataViewItem& item) const
{
if (!item.IsOk())
{
return true;
}
#ifdef __WXGTK__
// greebo: The GTK DataViewCtrl implementation treats nodes differently
// based on whether they have children or not. If a tree model node has no children
// now it's not possible to add any children later on, causing assertions.
// wxGTK wants to know *in advance* whether a node has children, so let's assume true
// unless this is a listmodel (in which case non-root nodes never have children)
return !IsListModel() ? true : false;
#else
bool isContainer = _childModel->IsContainer(item);
if (!isContainer)
{
return false;
}
// Check if the node actually has visible children
wxDataViewItemArray children;
return GetChildren(item, children) > 0;
#endif
}
示例8: GetValue
void vvStampsModel::GetValue(
wxVariant& cValue,
const wxDataViewItem& cItem,
unsigned int uColumn
) const
{
wxASSERT(cItem.IsOk());
const DataItem* pItem = this->ConvertDataItem(cItem);
switch (static_cast<Column>(uColumn))
{
case COLUMN_B_CHECKED:
cValue = pItem->bChecked;
return;
case COLUMN_BS_NAME:
case COLUMN_S_NAME:
cValue = pItem->sName;
return;
case COLUMN_U_COUNT:
cValue = static_cast<long>(pItem->uCount);
return;
default:
wxLogError("Unknown StampsModel column: %u", uColumn);
cValue.MakeNull();
return;
}
}
示例9: GetChildren
unsigned int ProjectViewModel::GetChildren( const wxDataViewItem& item, wxDataViewItemArray& items ) const
{
int count = 0;
Asset *pAsset = NULL;
if (!item.IsOk())
{
ForciblyFullyLoadedPackageManager::GetStaticInstance()->ForceFullyLoadRootPackages();
pAsset = Asset::GetFirstTopLevelAsset();
}
else
{
Asset* pParentAsset = static_cast< Asset* >( item.GetID() );
if ( pParentAsset->IsPackage() )
{
ForciblyFullyLoadedPackageManager::GetStaticInstance()->ForceFullyLoadPackage( pParentAsset->GetPath() );
}
pAsset = pParentAsset->GetFirstChild();
}
while (pAsset)
{
//if ( m_AssetsInTree.Insert( pAsset ).Second() )
{
items.Add( wxDataViewItem( pAsset ) );
++count;
}
pAsset = pAsset->GetNextSibling();
}
return count;
}
示例10: ItemIsVisible
bool TreeModelFilter::ItemIsVisible(const wxDataViewItem& item) const
{
if (!item.IsOk()) return true;
Row row(item, *const_cast<TreeModelFilter*>(this));
return ItemIsVisible(row);
}
示例11: SetValue
bool MyMusicTreeModel::SetValue( const wxVariant &variant,
const wxDataViewItem &item, unsigned int col )
{
wxASSERT(item.IsOk());
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
switch (col)
{
case 0:
node->m_title = variant.GetString();
return true;
case 1:
node->m_artist = variant.GetString();
return true;
case 2:
node->m_year = variant.GetLong();
return true;
case 3:
node->m_quality = variant.GetString();
return true;
default:
wxLogError( "MyMusicTreeModel::SetValue: wrong column" );
}
return false;
}
示例12: wrap
VALUE wrap(wxDataViewModel *model, const wxDataViewItem& item)
{
if(!item.IsOk())
return Qnil;
wxClientData* cd = dynamic_cast<DataViewClientHolder*>(model)->getClientValue(item);
return static_cast<RubyClientData*>(cd)->mRuby;
}
示例13: GetItemRect
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
{
if (item.IsOk() && (columnPtr != NULL))
return GetDataViewPeer()->GetRectangle(item,columnPtr);
else
return wxRect();
}
示例14: GetValue
void MyMusicTreeModel::GetValue( wxVariant &variant,
const wxDataViewItem &item, unsigned int col ) const
{
wxASSERT(item.IsOk());
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
switch (col)
{
case 0:
variant = node->m_title;
break;
case 1:
variant = node->m_artist;
break;
case 2:
variant = (long) node->m_year;
break;
case 3:
variant = node->m_quality;
break;
case 4:
variant = 80L; // all music is very 80% popular
break;
case 5:
if (GetYear(item) < 1900)
variant = "old";
else
variant = "new";
break;
default:
wxLogError( "MyMusicTreeModel::GetValue: wrong column %d", col );
}
}
示例15: 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;
}