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

Public Member Functions

 TEXT_ITEMS_GRID_TABLE ()
 
int GetNumberRows () override
 
int GetNumberCols () override
 
wxString GetColLabelValue (int aCol) override
 
wxString GetRowLabelValue (int aRow) override
 
bool CanGetValueAs (int aRow, int aCol, const wxString &aTypeName) override
 
bool CanSetValueAs (int aRow, int aCol, const wxString &aTypeName) override
 
wxString GetValue (int row, int col) override
 
void SetValue (int row, int col, const wxString &value) override
 
bool GetValueAsBool (int row, int col) override
 
void SetValueAsBool (int row, int col, bool value) override
 
long GetValueAsLong (int row, int col) override
 
void SetValueAsLong (int row, int col, long value) override
 
bool AppendRows (size_t aNumRows=1) override
 
bool DeleteRows (size_t aPos, size_t aNumRows) override
 

Private Attributes

std::vector< TEXT_ITEM_INFOm_items
 

Detailed Description

Definition at line 37 of file panel_fp_editor_defaults.cpp.

Constructor & Destructor Documentation

◆ TEXT_ITEMS_GRID_TABLE()

TEXT_ITEMS_GRID_TABLE::TEXT_ITEMS_GRID_TABLE ( )
inline

Definition at line 42 of file panel_fp_editor_defaults.cpp.

43  { }

Member Function Documentation

◆ AppendRows()

bool TEXT_ITEMS_GRID_TABLE::AppendRows ( size_t  aNumRows = 1)
inlineoverride

Definition at line 115 of file panel_fp_editor_defaults.cpp.

116  {
117  for( size_t i = 0; i < aNumRows; ++i )
118  m_items.emplace_back( wxEmptyString, true, F_SilkS );
119 
120  if( GetView() )
121  {
122  wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
123  GetView()->ProcessTableMessage( msg );
124  }
125 
126  return true;
127  }
std::vector< TEXT_ITEM_INFO > m_items

References F_SilkS, and m_items.

◆ CanGetValueAs()

bool TEXT_ITEMS_GRID_TABLE::CanGetValueAs ( int  aRow,
int  aCol,
const wxString &  aTypeName 
)
inlineoverride

Definition at line 69 of file panel_fp_editor_defaults.cpp.

70  {
71  switch( aCol )
72  {
73  case 0: return aTypeName == wxGRID_VALUE_STRING;
74  case 1: return aTypeName == wxGRID_VALUE_BOOL;
75  case 2: return aTypeName == wxGRID_VALUE_NUMBER;
76  default: wxFAIL; return false;
77  }
78  }

Referenced by CanSetValueAs().

◆ CanSetValueAs()

bool TEXT_ITEMS_GRID_TABLE::CanSetValueAs ( int  aRow,
int  aCol,
const wxString &  aTypeName 
)
inlineoverride

Definition at line 80 of file panel_fp_editor_defaults.cpp.

81  {
82  return CanGetValueAs( aRow, aCol, aTypeName );
83  }
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override

References CanGetValueAs().

◆ DeleteRows()

bool TEXT_ITEMS_GRID_TABLE::DeleteRows ( size_t  aPos,
size_t  aNumRows 
)
inlineoverride

Definition at line 129 of file panel_fp_editor_defaults.cpp.

130  {
131  // aPos may be a large positive, e.g. size_t(-1), and the sum of
132  // aPos+aNumRows may wrap here, so both ends of the range are tested.
133  if( aPos < m_items.size() && aPos + aNumRows <= m_items.size() )
134  {
135  m_items.erase( m_items.begin() + aPos, m_items.begin() + aPos + aNumRows );
136 
137  if( GetView() )
138  {
139  wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
140  GetView()->ProcessTableMessage( msg );
141  }
142  return true;
143  }
144 
145  return false;
146  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ GetColLabelValue()

wxString TEXT_ITEMS_GRID_TABLE::GetColLabelValue ( int  aCol)
inlineoverride

Definition at line 48 of file panel_fp_editor_defaults.cpp.

49  {
50  switch( aCol )
51  {
52  case 0: return _( "Text Items" );
53  case 1: return _( "Show" );
54  case 2: return _( "Layer" );
55  default: return wxEmptyString;
56  }
57  }
#define _(s)

References _.

◆ GetNumberCols()

int TEXT_ITEMS_GRID_TABLE::GetNumberCols ( )
inlineoverride

Definition at line 46 of file panel_fp_editor_defaults.cpp.

46 { return 3; }

◆ GetNumberRows()

int TEXT_ITEMS_GRID_TABLE::GetNumberRows ( )
inlineoverride

Definition at line 45 of file panel_fp_editor_defaults.cpp.

45 { return m_items.size(); }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ GetRowLabelValue()

wxString TEXT_ITEMS_GRID_TABLE::GetRowLabelValue ( int  aRow)
inlineoverride

Definition at line 59 of file panel_fp_editor_defaults.cpp.

60  {
61  switch( aRow )
62  {
63  case 0: return _( "Reference designator" );
64  case 1: return _( "Value" );
65  default: return wxEmptyString;
66  }
67  }
#define _(s)

References _.

◆ GetValue()

wxString TEXT_ITEMS_GRID_TABLE::GetValue ( int  row,
int  col 
)
inlineoverride

Definition at line 85 of file panel_fp_editor_defaults.cpp.

86  {
87  return m_items[row].m_Text;
88  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ GetValueAsBool()

bool TEXT_ITEMS_GRID_TABLE::GetValueAsBool ( int  row,
int  col 
)
inlineoverride

Definition at line 95 of file panel_fp_editor_defaults.cpp.

96  {
97  return m_items[row].m_Visible;
98  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ GetValueAsLong()

long TEXT_ITEMS_GRID_TABLE::GetValueAsLong ( int  row,
int  col 
)
inlineoverride

Definition at line 105 of file panel_fp_editor_defaults.cpp.

106  {
107  return m_items[row].m_Layer;
108  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ SetValue()

void TEXT_ITEMS_GRID_TABLE::SetValue ( int  row,
int  col,
const wxString &  value 
)
inlineoverride

Definition at line 89 of file panel_fp_editor_defaults.cpp.

90  {
91  if( col == 0 )
92  m_items[row].m_Text = value;
93  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ SetValueAsBool()

void TEXT_ITEMS_GRID_TABLE::SetValueAsBool ( int  row,
int  col,
bool  value 
)
inlineoverride

Definition at line 99 of file panel_fp_editor_defaults.cpp.

100  {
101  if( col == 1 )
102  m_items[row].m_Visible = value;
103  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

◆ SetValueAsLong()

void TEXT_ITEMS_GRID_TABLE::SetValueAsLong ( int  row,
int  col,
long  value 
)
inlineoverride

Definition at line 109 of file panel_fp_editor_defaults.cpp.

110  {
111  if( col == 2 )
112  m_items[row].m_Layer = (int) value;
113  }
std::vector< TEXT_ITEM_INFO > m_items

References m_items.

Member Data Documentation

◆ m_items

std::vector<TEXT_ITEM_INFO> TEXT_ITEMS_GRID_TABLE::m_items
private

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