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 34 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 39 of file panel_fp_editor_defaults.cpp.

40  { }

Member Function Documentation

◆ AppendRows()

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

Definition at line 112 of file panel_fp_editor_defaults.cpp.

113  {
114  for( size_t i = 0; i < aNumRows; ++i )
115  m_items.emplace_back( wxT( "" ), true, F_SilkS );
116 
117  if( GetView() )
118  {
119  wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
120  GetView()->ProcessTableMessage( msg );
121  }
122 
123  return true;
124  }
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 66 of file panel_fp_editor_defaults.cpp.

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

Referenced by CanSetValueAs().

◆ CanSetValueAs()

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

Definition at line 77 of file panel_fp_editor_defaults.cpp.

78  {
79  return CanGetValueAs( aRow, aCol, aTypeName );
80  }
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 126 of file panel_fp_editor_defaults.cpp.

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

References m_items.

◆ GetColLabelValue()

wxString TEXT_ITEMS_GRID_TABLE::GetColLabelValue ( int  aCol)
inlineoverride

Definition at line 45 of file panel_fp_editor_defaults.cpp.

46  {
47  switch( aCol )
48  {
49  case 0: return _( "Text Items" );
50  case 1: return _( "Show" );
51  case 2: return _( "Layer" );
52  default: return wxEmptyString;
53  }
54  }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

◆ GetNumberCols()

int TEXT_ITEMS_GRID_TABLE::GetNumberCols ( )
inlineoverride

Definition at line 43 of file panel_fp_editor_defaults.cpp.

43 { return 3; }

◆ GetNumberRows()

int TEXT_ITEMS_GRID_TABLE::GetNumberRows ( )
inlineoverride

Definition at line 42 of file panel_fp_editor_defaults.cpp.

42 { 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 56 of file panel_fp_editor_defaults.cpp.

57  {
58  switch( aRow )
59  {
60  case 0: return _( "Reference designator" );
61  case 1: return _( "Value" );
62  default: return wxEmptyString;
63  }
64  }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

◆ GetValue()

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

Definition at line 82 of file panel_fp_editor_defaults.cpp.

83  {
84  return m_items[row].m_Text;
85  }
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 92 of file panel_fp_editor_defaults.cpp.

93  {
94  return m_items[row].m_Visible;
95  }
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 102 of file panel_fp_editor_defaults.cpp.

103  {
104  return m_items[row].m_Layer;
105  }
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 86 of file panel_fp_editor_defaults.cpp.

87  {
88  if( col == 0 )
89  m_items[row].m_Text = value;
90  }
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 96 of file panel_fp_editor_defaults.cpp.

97  {
98  if( col == 1 )
99  m_items[row].m_Visible = value;
100  }
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 106 of file panel_fp_editor_defaults.cpp.

107  {
108  if( col == 2 )
109  m_items[row].m_Layer = (int) value;
110  }
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: