当前位置: 首页>>代码示例>>C++>>正文


C++ wxDataViewItemArray类代码示例

本文整理汇总了C++中wxDataViewItemArray的典型用法代码示例。如果您正苦于以下问题:C++ wxDataViewItemArray类的具体用法?C++ wxDataViewItemArray怎么用?C++ wxDataViewItemArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了wxDataViewItemArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetFilter

	void SetFilter(wxString const& new_filter) {
		std::set<HotkeyModelCombo*> old_visible;
		for (auto item : visible_items)
			old_visible.insert(static_cast<HotkeyModelCombo*>(item.GetID()));

		visible_items.clear();

		wxDataViewItemArray added;
		wxDataViewItemArray removed;

		for (auto& combo : children) {
			bool was_visible = old_visible.count(&combo) > 0;
			bool is_visible = combo.IsVisible(new_filter);

			if (is_visible)
				visible_items.push_back(wxDataViewItem(&combo));
			if (was_visible && !is_visible)
				removed.push_back(wxDataViewItem(&combo));
			if (is_visible && !was_visible)
				added.push_back(wxDataViewItem(&combo));
		}

		if (!added.empty())
			model->ItemsAdded(wxDataViewItem(this), added);
		if (!removed.empty())
			model->ItemsDeleted(wxDataViewItem(this), removed);
	}
开发者ID:KagamiChan,项目名称:Aegisub,代码行数:27,代码来源:hotkey_data_view_model.cpp

示例2: GetChildren

unsigned int MyMusicTreeModel::GetChildren( const wxDataViewItem &parent,
                                            wxDataViewItemArray &array ) const
{
    MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) parent.GetID();
    if (!node)
    {
        array.Add( wxDataViewItem( (void*) m_root ) );
        return 1;
    }

    if (node == m_classical)
    {
        MyMusicTreeModel *model = (MyMusicTreeModel*)(const MyMusicTreeModel*) this;
        model->m_classicalMusicIsKnownToControl = true;
    }

    if (node->GetChildCount() == 0)
    {
        return 0;
    }

    unsigned int count = node->GetChildren().GetCount();
    for (unsigned int pos = 0; pos < count; pos++)
    {
        MyMusicTreeModelNode *child = node->GetChildren().Item( pos );
        array.Add( wxDataViewItem( (void*) child ) );
    }

    return count;
}
开发者ID:euler0,项目名称:Helium,代码行数:30,代码来源:mymodels.cpp

示例3: SetFilter

	void SetFilter(wxRegEx const& new_filter) {
		std::set<HotkeyModelCombo*> old_visible;
		for (size_t i = 0; i < visible_items.size(); ++i)
			old_visible.insert(static_cast<HotkeyModelCombo*>(visible_items[i].GetID()));

		visible_items.clear();

		wxDataViewItemArray added;
		wxDataViewItemArray removed;

		for (std::list<HotkeyModelCombo>::iterator it = children.begin(); it != children.end(); ++it) {
			bool was_visible = old_visible.count(&*it) > 0;
			bool is_visible = it->IsVisible(new_filter);

			if (is_visible)
				visible_items.push_back(wxDataViewItem(&*it));
			if (was_visible && !is_visible)
				removed.push_back(wxDataViewItem(&*it));
			if (is_visible && !was_visible)
				added.push_back(wxDataViewItem(&*it));
		}

		if (!added.empty())
			model->ItemsAdded(wxDataViewItem(this), added);
		if (!removed.empty())
			model->ItemsDeleted(wxDataViewItem(this), removed);
	}
开发者ID:Azpidatziak,项目名称:Aegisub,代码行数:27,代码来源:hotkey_data_view_model.cpp

示例4: GetChildren

unsigned int ArtifactViewModel::GetChildren(const wxDataViewItem &item, wxDataViewItemArray &children) const
{
    // Root item
    if (!item) {
        for (auto& slot : m_artifactBag) {
            auto artifactPtr = slot.second.get();
            children.Add(wxDataViewItem(artifactPtr));
        }

        return m_artifactBag.size();
    }

    const auto& artifact = *reinterpret_cast<Artifact*>(item.GetID());
    if (!artifact.GetInfusedArtifacts().empty()) {
        const auto& infusedArtifacts = artifact.GetInfusedArtifacts();
        for (auto& infusedArtifact : infusedArtifacts) {
            auto artifactPtr = infusedArtifact.get();
            children.Add(wxDataViewItem(artifactPtr));
        }

        return infusedArtifacts.size();
    }

    assert(!!"Should not happen");
    return 0;
}
开发者ID:SteffenL,项目名称:Van-Helsing-game-research,代码行数:26,代码来源:ArtifactViewModel.cpp

示例5: GetChildren

    virtual unsigned int    GetChildren( wxDataViewItemArray& aItems ) const
    {
        /// @todo C++11
        for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
            aItems.push_back( wxDataViewItem( *i ) );

        return aItems.size();
    }
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:8,代码来源:dialog_lib_edit_pin_table.cpp

示例6: DeleteItems

void TreeListModel::DeleteItems(const wxDataViewItem& parent, const wxDataViewItemArray& items)
{
    // sanity
    for(size_t i=0; i<items.GetCount(); ++i) {
        TreeListModel_Item* node = reinterpret_cast<TreeListModel_Item*>(items.Item(i).m_pItem);
        wxUnusedVar(node);
        wxASSERT(node && node->GetParent() == parent.m_pItem);
        DeleteItem(items.Item(i));
    }
}
开发者ID:wuqiong4945,项目名称:memu,代码行数:10,代码来源:treelistmodel.cpp

示例7: GetChildren

/**
 * Adds each child row to the supplied list, and returns the total child count
 */
unsigned int BOM_TABLE_GROUP::GetChildren( wxDataViewItemArray& aChildren ) const
{
    // Show drop-down for child components
    for( auto& row : Components )
    {
        if( row )
        {
            aChildren.push_back( RowToItem( &*row ) );
        }
    }

    return aChildren.size();
}
开发者ID:cpavlina,项目名称:kicad,代码行数:16,代码来源:bom_table_model.cpp

示例8: AdjustRowHeights

void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& items)
{
  if ((m_DataViewCtrlPtr->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) != 0)
  {
      size_t const noOfItems = items.GetCount();

      wxDataViewModel *model = GetOwner();

      for (size_t itemIndex=0; itemIndex<noOfItems; ++itemIndex)
      {
        int height = 20; // TODO find out standard height
        unsigned int num = m_DataViewCtrlPtr->GetColumnCount();
        unsigned int col;

        for (col = 0; col < num; col++)
        {
            wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col));

            if (!(column->IsHidden()))
            {
              wxDataViewCustomRenderer *renderer = dynamic_cast<wxDataViewCustomRenderer*>(column->GetRenderer());
              if (renderer)
              {
                  wxVariant value;
                  model->GetValue( value, items[itemIndex], column->GetModelColumn() );
                  renderer->SetValue( value );
                  height = wxMax( height, renderer->GetSize().y );
              }
            }
        }
        if (height > 20)
          m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(items[itemIndex],height);
      }
  }
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:35,代码来源:dataview_osx.cpp

示例9: SetSelections

void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel)
{
    size_t const noOfSelections = sel.GetCount();

    size_t i;

    wxDataViewItem last_parent;


   // make sure that all to be selected items are visible in the control:
    for (i = 0; i < noOfSelections; i++)
    {
        wxDataViewItem item   = sel[i];
        wxDataViewItem parent = GetModel()->GetParent( item );

        if (parent.IsOk() && (parent != last_parent))
          ExpandAncestors(item);
        last_parent = parent;
    }

   // finally select the items:
    wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); // variable definition for abbreviational purposes

    for (i=0; i<noOfSelections; ++i)
      dataViewWidgetPtr->Select(sel[i]);
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:26,代码来源:dataview_osx.cpp

示例10: DeleteItems

void MyListModel::DeleteItems( const wxDataViewItemArray &items )
{
    unsigned i;
    wxArrayInt rows;
    for (i = 0; i < items.GetCount(); i++)
    {
        unsigned int row = GetRow( items[i] );
        if (row < m_textColValues.GetCount())
            rows.Add( row );
    }

    if (rows.GetCount() == 0)
    {
        // none of the selected items were in the range of the items
        // which we store... for simplicity, don't allow removing them
        wxLogError( "Cannot remove rows with an index greater than %d", m_textColValues.GetCount() );
        return;
    }

    // Sort in descending order so that the last
    // row will be deleted first. Otherwise the
    // remaining indeces would all be wrong.
    rows.Sort( my_sort_reverse );
    for (i = 0; i < rows.GetCount(); i++)
        m_textColValues.RemoveAt( rows[i] );

    // This is just to test if wxDataViewCtrl can
    // cope with removing rows not sorted in
    // descending order
    rows.Sort( my_sort );
    RowsDeleted( rows );
}
开发者ID:euler0,项目名称:Helium,代码行数:32,代码来源:mymodels.cpp

示例11: 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;
}
开发者ID:KETMGaming,项目名称:Helium,代码行数:35,代码来源:ProjectViewModel.cpp

示例12: DeleteItems

void CTimeBarListModel::DeleteItems( const wxDataViewItemArray &items )
{
    wxArrayInt rows;
    for (unsigned i = 0; i < items.GetCount(); i++)
    {
        unsigned int row = GetRow( items[i] );
        if (row < m_textColValues.GetCount())
            rows.Add( row );
    }

    if (rows.GetCount() > 0)
    {
        // Sort in descending order so that the last
        // row will be deleted first. Otherwise the
        // remaining indeces would all be wrong.
        rows.Sort([](int *v1, int *v2)
        {
            return *v2-*v1;
        });
        for (unsigned i = 0; i < rows.GetCount(); i++)
        {
            m_textColValues.RemoveAt( rows[i] );
            m_view.RemoveAt( rows[i] );
            m_lock.RemoveAt( rows[i] );
        }
        // This is just to test if wxDataViewCtrl can
        // cope with removing rows not sorted in
        // descending order
        rows.Sort([](int *v1, int *v2)
        {
            return *v1-*v2;
        });
        RowsDeleted( rows );
    }
}
开发者ID:nobitalwm,项目名称:FCEngine,代码行数:35,代码来源:DataViewListModel.cpp

示例13: wxDataViewItem

unsigned int GNC::GUI::AcquisitionTableModel::GetChildren( const wxDataViewItem &parent, wxDataViewItemArray &array ) const
{
        AcquisitionNode *node = (AcquisitionNode*) parent.GetID();
        if (!node) {
                unsigned int count = studyMap.size();
                for (TMapIndex::const_iterator it = studyMap.begin(); it !=  studyMap.end(); ++it) {
                        array.Add( wxDataViewItem( (void*) (*it).second) );
                }
                return count;
        } else if (node->IsStudyNode()) {
                //return series from study...
                node->GetChildren(array);
                return array.Count();
        }
        return 0;
}
开发者ID:151706061,项目名称:ginkgocadx,代码行数:16,代码来源:acquisitiontablemodel.cpp

示例14: wxDataViewItem

unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetChildren( const wxDataViewItem& aItem,
        wxDataViewItemArray& aItems ) const
{
    if( !aItem.IsOk() )
    {
        for( std::map<wxString, Group>::iterator i = m_Groups.begin(); i != m_Groups.end(); ++i )
            if( i->second.GetCount() > 1 )
                aItems.push_back( wxDataViewItem( &i->second ) );

        for( std::list<Pin>::iterator i = m_Pins.begin(); i != m_Pins.end(); ++i )
            if( !i->GetParent().IsOk() )
                aItems.push_back( wxDataViewItem( &*i ) );

        return aItems.size();
    }
    else
        return reinterpret_cast<Item const*>( aItem.GetID() )->GetChildren( aItems );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:18,代码来源:dialog_lib_edit_pin_table.cpp

示例15: GetChildren

unsigned int TreeListModel::GetChildren(const wxDataViewItem& item, wxDataViewItemArray& children) const
{
    if(item.GetID() == NULL) {
        // Root
        for(size_t i=0; i<m_data.size(); ++i) {
            children.Add( wxDataViewItem( m_data.at(i) ) );
        }
        return children.size();
    }

    children.Clear();
    TreeListModel_Item* node = reinterpret_cast<TreeListModel_Item*>(item.m_pItem);
    if ( node ) {
        for(size_t i=0; i<node->GetChildren().size(); ++i) {
            children.Add( wxDataViewItem( node->GetChildren().at(i) ) );
        }
    }
    return children.GetCount();
}
开发者ID:wuqiong4945,项目名称:memu,代码行数:19,代码来源:treelistmodel.cpp


注:本文中的wxDataViewItemArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。