KiCad PCB EDA Suite
cmp_tree_model_adapter.cpp File Reference
#include <cmp_tree_model_adapter.h>
#include <class_library.h>
#include <eda_pattern_match.h>
#include <wx/tokenzr.h>

Go to the source code of this file.

Functions

static wxDataViewItem ToItem (CMP_TREE_NODE const *aNode)
 Convert CMP_TREE_NODE -> wxDataViewItem. More...
 
static CMP_TREE_NODE const * ToNode (wxDataViewItem aItem)
 Convert wxDataViewItem -> CMP_TREE_NODE. More...
 
static unsigned int IntoArray (CMP_TREE_NODE const &aNode, wxDataViewItemArray &aChildren)
 Convert CMP_TREE_NODE's children to wxDataViewItemArray. More...
 

Variables

static const int kDataViewIndent = 20
 

Function Documentation

static unsigned int IntoArray ( CMP_TREE_NODE const &  aNode,
wxDataViewItemArray &  aChildren 
)
static

Convert CMP_TREE_NODE's children to wxDataViewItemArray.

Definition at line 56 of file cmp_tree_model_adapter.cpp.

References CMP_TREE_NODE::Children, and ToItem().

Referenced by CMP_TREE_MODEL_ADAPTER::GetChildren().

57 {
58  unsigned int n = 0;
59 
60  for( auto const& child: aNode.Children )
61  {
62  if( child->Score > 0 )
63  {
64  aChildren.Add( ToItem( &*child ) );
65  ++n;
66  }
67  }
68 
69  return n;
70 }
static wxDataViewItem ToItem(CMP_TREE_NODE const *aNode)
Convert CMP_TREE_NODE -> wxDataViewItem.
static wxDataViewItem ToItem ( CMP_TREE_NODE const *  aNode)
static

Convert CMP_TREE_NODE -> wxDataViewItem.

Definition at line 38 of file cmp_tree_model_adapter.cpp.

Referenced by CMP_TREE_MODEL_ADAPTER::GetParent(), and IntoArray().

39 {
40  return wxDataViewItem( const_cast<void*>( static_cast<void const*>( aNode ) ) );
41 }
static CMP_TREE_NODE const* ToNode ( wxDataViewItem  aItem)
static

Convert wxDataViewItem -> CMP_TREE_NODE.

Definition at line 47 of file cmp_tree_model_adapter.cpp.

Referenced by CMP_TREE_MODEL_ADAPTER::GetAliasFor(), CMP_TREE_MODEL_ADAPTER::GetChildren(), CMP_TREE_MODEL_ADAPTER::GetParent(), CMP_TREE_MODEL_ADAPTER::GetUnitFor(), CMP_TREE_MODEL_ADAPTER::GetValue(), and CMP_TREE_MODEL_ADAPTER::IsContainer().

48 {
49  return static_cast<CMP_TREE_NODE const*>( aItem.GetID() );
50 }
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.

Variable Documentation

const int kDataViewIndent = 20
static