KiCad PCB EDA Suite
text_mod_grid_table.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef TEXT_MOD_GRID_TABLE_H
25 #define TEXT_MOD_GRID_TABLE_H
26 
27 #include <base_units.h>
28 #include <wx/grid.h>
29 #include <grid_tricks.h>
30 #include <class_text_mod.h>
31 
32 
33 class MODULE;
34 class PCB_BASE_FRAME;
35 
37 {
46  TMC_UPRIGHT, // keep text upright when viewed from bottom or right of board
49 
50  TMC_COUNT // keep as last
51 };
52 
53 
54 class TEXT_MOD_GRID_TABLE : public wxGridTableBase, public std::vector<TEXTE_MODULE>
55 {
56 public:
57  TEXT_MOD_GRID_TABLE( EDA_UNITS_T userUnits, PCB_BASE_FRAME* aFrame );
59 
60  int GetNumberRows() override { return (int) size(); }
61  int GetNumberCols() override { return TMC_COUNT; }
62 
63  wxString GetColLabelValue( int aCol ) override;
64  wxString GetRowLabelValue( int aRow ) override;
65 
66  bool IsEmptyCell( int row, int col ) override
67  {
68  return false; // don't allow adjacent cell overflow, even if we are actually empty
69  }
70 
71  bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
72  bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
73  wxGridCellAttr* GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ) override;
74 
75  wxString GetValue( int aRow, int aCol ) override;
76  bool GetValueAsBool( int aRow, int aCol ) override;
77  long GetValueAsLong( int aRow, int aCol ) override;
78 
79  void SetValue( int aRow, int aCol, const wxString &aValue ) override;
80  void SetValueAsBool( int aRow, int aCol, bool aValue ) override;
81  void SetValueAsLong( int aRow, int aCol, long aValue ) override;
82 
83 private:
86 
87  wxGridCellAttr* m_readOnlyAttr;
88  wxGridCellAttr* m_boolColAttr;
89  wxGridCellAttr* m_orientationColAttr;
90  wxGridCellAttr* m_layerColAttr;
91 };
92 
93 
94 #endif // TEXT_MOD_GRID_TABLE_H
long GetValueAsLong(int aRow, int aCol) override
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) override
wxGridCellAttr * m_boolColAttr
Implementation of conversion functions that require both schematic and board internal units...
wxString GetRowLabelValue(int aRow) override
bool IsEmptyCell(int row, int col) override
bool GetValueAsBool(int aRow, int aCol) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
wxGridCellAttr * m_orientationColAttr
wxString GetValue(int aRow, int aCol) override
Footprint text class description.
wxGridCellAttr * m_readOnlyAttr
TEXT_MOD_COL_ORDER
PCB_BASE_FRAME * m_frame
wxGridCellAttr * m_layerColAttr
void SetValueAsLong(int aRow, int aCol, long aValue) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetColLabelValue(int aCol) override
int GetNumberCols() override
TEXT_MOD_GRID_TABLE(EDA_UNITS_T userUnits, PCB_BASE_FRAME *aFrame)
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
EDA_UNITS_T
Definition: common.h:159
int GetNumberRows() override