KiCad PCB EDA Suite
ALT_PIN_DATA_MODEL Class Reference
Inheritance diagram for ALT_PIN_DATA_MODEL:

Public Member Functions

 ALT_PIN_DATA_MODEL (EDA_UNITS aUserUnits)
 
int GetNumberRows () override
 
int GetNumberCols () override
 
wxString GetColLabelValue (int aCol) override
 
bool IsEmptyCell (int row, int col) override
 
wxString GetValue (int aRow, int aCol) override
 
void SetValue (int aRow, int aCol, const wxString &aValue) override
 
void AppendRow (const LIB_PIN::ALT &aAlt)
 
void RemoveRow (int aRow)
 

Detailed Description

Definition at line 36 of file dialog_pin_properties.cpp.

Constructor & Destructor Documentation

◆ ALT_PIN_DATA_MODEL()

ALT_PIN_DATA_MODEL::ALT_PIN_DATA_MODEL ( EDA_UNITS  aUserUnits)
inline

Definition at line 39 of file dialog_pin_properties.cpp.

40  {
41  }

Member Function Documentation

◆ AppendRow()

void ALT_PIN_DATA_MODEL::AppendRow ( const LIB_PIN::ALT aAlt)
inline

Definition at line 99 of file dialog_pin_properties.cpp.

100  {
101  push_back( aAlt );
102 
103  if ( GetView() )
104  {
105  wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
106  GetView()->ProcessTableMessage( msg );
107  }
108  }

Referenced by DIALOG_PIN_PROPERTIES::OnAddAlternate(), and DIALOG_PIN_PROPERTIES::TransferDataToWindow().

◆ GetColLabelValue()

wxString ALT_PIN_DATA_MODEL::GetColLabelValue ( int  aCol)
inlineoverride

Definition at line 46 of file dialog_pin_properties.cpp.

47  {
48  switch( aCol )
49  {
50  case COL_NAME: return _( "Alternate Pin Name" );
51  case COL_TYPE: return _( "Electrical Type" );
52  case COL_SHAPE: return _( "Graphic Style" );
53  default: wxFAIL; return wxEmptyString;
54  }
55  }
#define _(s)
Definition: 3d_actions.cpp:33

References _, COL_NAME, COL_SHAPE, and COL_TYPE.

◆ GetNumberCols()

int ALT_PIN_DATA_MODEL::GetNumberCols ( )
inlineoverride

Definition at line 44 of file dialog_pin_properties.cpp.

References COL_COUNT.

◆ GetNumberRows()

int ALT_PIN_DATA_MODEL::GetNumberRows ( )
inlineoverride

Definition at line 43 of file dialog_pin_properties.cpp.

43 { return (int) size(); }

◆ GetValue()

wxString ALT_PIN_DATA_MODEL::GetValue ( int  aRow,
int  aCol 
)
inlineoverride

Definition at line 62 of file dialog_pin_properties.cpp.

63  {
64  switch( aCol )
65  {
66  case COL_NAME: return at( aRow ).m_Name;
67  case COL_TYPE: return PinTypeNames()[static_cast<int>( at( aRow ).m_Type )];
68  case COL_SHAPE: return PinShapeNames()[static_cast<int>( at( aRow ).m_Shape )];
69  default: wxFAIL; return wxEmptyString;
70  }
71  }
const wxArrayString & PinShapeNames()
Definition: pin_type.cpp:200
const wxArrayString & PinTypeNames()
Definition: pin_type.cpp:182

References COL_NAME, COL_SHAPE, COL_TYPE, PinShapeNames(), and PinTypeNames().

◆ IsEmptyCell()

bool ALT_PIN_DATA_MODEL::IsEmptyCell ( int  row,
int  col 
)
inlineoverride

Definition at line 57 of file dialog_pin_properties.cpp.

58  {
59  return false; // don't allow adjacent cell overflow, even if we are actually empty
60  }

◆ RemoveRow()

void ALT_PIN_DATA_MODEL::RemoveRow ( int  aRow)
inline

Definition at line 110 of file dialog_pin_properties.cpp.

111  {
112  erase( begin() + aRow );
113 
114  if ( GetView() )
115  {
116  wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
117  GetView()->ProcessTableMessage( msg );
118  }
119  }

Referenced by DIALOG_PIN_PROPERTIES::OnDeleteAlternate().

◆ SetValue()

void ALT_PIN_DATA_MODEL::SetValue ( int  aRow,
int  aCol,
const wxString &  aValue 
)
inlineoverride

Definition at line 73 of file dialog_pin_properties.cpp.

74  {
75  switch( aCol )
76  {
77  case COL_NAME:
78  at( aRow ).m_Name = aValue;
79  break;
80 
81  case COL_TYPE:
82  if( PinTypeNames().Index( aValue ) != wxNOT_FOUND )
83  at( aRow ).m_Type = (ELECTRICAL_PINTYPE) PinTypeNames().Index( aValue );
84 
85  break;
86 
87  case COL_SHAPE:
88  if( PinShapeNames().Index( aValue ) != wxNOT_FOUND )
89  at( aRow ).m_Shape = (GRAPHIC_PINSHAPE) PinShapeNames().Index( aValue );
90 
91  break;
92 
93  default:
94  wxFAIL;
95  break;
96  }
97  }
GRAPHIC_PINSHAPE
Definition: pin_type.h:55
const wxArrayString & PinShapeNames()
Definition: pin_type.cpp:200
const wxArrayString & PinTypeNames()
Definition: pin_type.cpp:182
ELECTRICAL_PINTYPE
The component library pin object electrical types used in ERC tests.
Definition: pin_type.h:35

References COL_NAME, COL_SHAPE, COL_TYPE, PinShapeNames(), and PinTypeNames().


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