KiCad PCB EDA Suite
DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group Class Reference
Inheritance diagram for DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group:
DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item

Public Member Functions

 Group (unsigned int aGroupingColumn)
 
virtual void GetValue (wxVariant &aValue, unsigned int aCol) const override
 
virtual wxString GetString (unsigned int aCol) const override
 
virtual wxDataViewItem GetParent () const override
 
virtual bool IsContainer () const override
 
virtual unsigned int GetChildren (wxDataViewItemArray &aItems) const override
 
unsigned int GetCount () const
 
void Add (Pin *aPin)
 

Private Attributes

std::list< Pin * > m_Members
 
unsigned int m_GroupingColumn
 

Detailed Description

Definition at line 115 of file dialog_lib_edit_pin_table.cpp.

Constructor & Destructor Documentation

DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Group ( unsigned int  aGroupingColumn)
inline

Member Function Documentation

void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Add ( Pin aPin)

Definition at line 501 of file dialog_lib_edit_pin_table.cpp.

References DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::SetGroup().

502 {
503  switch( GetCount() )
504  {
505  case 0:
506  aPin->SetGroup( 0 );
507  break;
508 
509  case 1:
510  m_Members.front()->SetGroup( this );
511  // fall through
512 
513  default:
514  aPin->SetGroup( this );
515  }
516 
517  m_Members.push_back( aPin );
518 }
virtual unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetChildren ( wxDataViewItemArray &  aItems) const
inlineoverridevirtual
Todo:
C++11

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 125 of file dialog_lib_edit_pin_table.cpp.

126  {
128  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
129  aItems.push_back( wxDataViewItem( *i ) );
130 
131  return aItems.size();
132  }
unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetCount ( ) const
inline

Definition at line 134 of file dialog_lib_edit_pin_table.cpp.

virtual wxDataViewItem DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetParent ( ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 123 of file dialog_lib_edit_pin_table.cpp.

123 { return wxDataViewItem(); }
wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetString ( unsigned int  aCol) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 484 of file dialog_lib_edit_pin_table.cpp.

References PinNumbers::insert(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::m_GroupingColumn, and PinNumbers::size().

485 {
486  if( aCol == m_GroupingColumn )
487  return m_Members.front()->GetString( aCol );
488 
489  PinNumbers values;
490 
491  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
492  values.insert( (*i)->GetString( aCol ) );
493 
494  if( values.size() > 1 )
495  return boost::algorithm::join( values, "," );
496  else
497  return m_Members.front()->GetString( aCol );
498 }
void insert(value_type const &v)
Definition: pin_number.h:57
container_type::size_type size() const
Definition: pin_number.h:58
void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetValue ( wxVariant &  aValue,
unsigned int  aCol 
) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 453 of file dialog_lib_edit_pin_table.cpp.

References DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetString(), PinNumbers::insert(), KiBitmap(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::m_GroupingColumn, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_TYPE, and PinNumbers::size().

455 {
456  if( aCol == m_GroupingColumn )
457  // shortcut
458  m_Members.front()->GetValue( aValue, aCol );
459  else if( aCol != PIN_TYPE )
460  aValue = GetString( aCol );
461  else
462  {
463  PinNumbers values;
464 
465  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
466  values.insert( (*i)->GetString( aCol ) );
467 
468  if( values.size() > 1 )
469  {
470  // when multiple pins are grouped, thes have not necessary the same electrical type
471  // therefore use a neutral icon to show a type.
472  // Do Not use a null icon, because on some OS (Linux), for an obscure reason,
473  // if a null icon is used somewhere, no other icon is displayed
474  wxIcon icon_notype;
475  icon_notype.CopyFromBitmap( KiBitmap ( pintype_notspecif_xpm ) ); // could be tree_nosel_xpm
476  aValue << wxDataViewIconText( boost::algorithm::join( values, "," ), icon_notype );
477  }
478  else
479  m_Members.front()->GetValue( aValue, aCol );
480  }
481 }
virtual wxString GetString(unsigned int aCol) const override
void insert(value_type const &v)
Definition: pin_number.h:57
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
container_type::size_type size() const
Definition: pin_number.h:58
virtual bool DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::IsContainer ( ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 124 of file dialog_lib_edit_pin_table.cpp.

124 { return true; }

Member Data Documentation

unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::m_GroupingColumn
private

Definition at line 139 of file dialog_lib_edit_pin_table.cpp.

std::list<Pin*> DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::m_Members
private

Definition at line 138 of file dialog_lib_edit_pin_table.cpp.


The documentation for this class was generated from the following file: