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

Public Member Functions

 Pin (DataViewModel &aModel, LIB_PIN *aBacking)
 
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 &) const override
 
void SetGroup (Group *aGroup)
 

Static Public Member Functions

static bool Compare (const Pin &lhs, const Pin &rhs)
 

Private Attributes

DataViewModelm_Model
 
LIB_PINm_Backing
 
Groupm_Group
 

Detailed Description

Definition at line 142 of file dialog_lib_edit_pin_table.cpp.

Constructor & Destructor Documentation

Member Function Documentation

static bool DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::Compare ( const Pin lhs,
const Pin rhs 
)
inlinestatic

Definition at line 157 of file dialog_lib_edit_pin_table.cpp.

References PinNumbers::Compare(), LIB_PIN::GetNumber(), and m_Backing.

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::DataViewModel().

158  {
159  return PinNumbers::Compare( lhs.m_Backing->GetNumber(), rhs.m_Backing->GetNumber() ) < 0;
160  }
static int Compare(PinNumber const &lhs, PinNumber const &rhs)
Definition: pin_number.cpp:110
YYCODETYPE lhs
virtual unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetChildren ( wxDataViewItemArray &  ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 153 of file dialog_lib_edit_pin_table.cpp.

153 { return 0; }
virtual wxDataViewItem DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetParent ( ) const
inlineoverridevirtual
wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetString ( unsigned int  aCol) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 543 of file dialog_lib_edit_pin_table.cpp.

References DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::m_Backing, DIALOG_LIB_EDIT_PIN_TABLE::m_Model, name, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_NAME, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_NUMBER, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_POSITION, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_TYPE, wxPoint::x, and wxPoint::y.

544 {
545  switch( aCol )
546  {
547  case PIN_NUMBER:
548  return m_Backing->GetNumber();
549 
550  case PIN_NAME:
551  if( m_Model.m_UnitCount > 1 )
552  {
553  wxString name;
554  int unit = m_Backing->GetPartNumber();
555 
556  if( unit )
557  name << unit;
558  else
559  name << "com";
560 
561  name << ':';
562  name << m_Backing->GetName();
563  return name;
564  }
565  else
566  {
567  return m_Backing->GetName();
568  }
569 
570  case PIN_TYPE:
572 
573  case PIN_POSITION:
574  {
575  wxPoint position = m_Backing->GetPosition();
576  wxString value;
577  value << "(" << position.x << "," << position.y << ")";
578  return value;
579  }
580  }
581 
582  return wxEmptyString;
583 }
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:274
int GetPartNumber() const
Get the pin part number.
Definition: lib_pin.h:314
const wxString & GetNumber() const
Definition: lib_pin.h:193
const wxString & GetName() const
Definition: lib_pin.h:165
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:462
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetValue ( wxVariant &  aValue,
unsigned int  aCol 
) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 521 of file dialog_lib_edit_pin_table.cpp.

References GetBitmap(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetString(), KiBitmap(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::m_Backing, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_NAME, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_NUMBER, DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_POSITION, and DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::PIN_TYPE.

523 {
524  switch( aCol )
525  {
526  case PIN_NUMBER:
527  case PIN_NAME:
528  case PIN_POSITION:
529  aValue = GetString( aCol );
530  break;
531 
532  case PIN_TYPE:
533  {
534  wxIcon icon;
535  icon.CopyFromBitmap( KiBitmap ( GetBitmap( m_Backing->GetType() ) ) );
536  aValue << wxDataViewIconText( m_Backing->GetElectricalTypeName(), icon );
537  }
538  break;
539  }
540 }
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:274
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:250
virtual wxString GetString(unsigned int aCol) const override
BITMAP_DEF GetBitmap(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:70
virtual bool DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::IsContainer ( ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 152 of file dialog_lib_edit_pin_table.cpp.

152 { return false; }
void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::SetGroup ( Group aGroup)
inline

Member Data Documentation

LIB_PIN* DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::m_Backing
private

Definition at line 164 of file dialog_lib_edit_pin_table.cpp.

Referenced by Compare().

Group* DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::m_Group
private

Definition at line 165 of file dialog_lib_edit_pin_table.cpp.

DataViewModel& DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::m_Model
private

Definition at line 163 of file dialog_lib_edit_pin_table.cpp.


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