KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_tablecell.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PCB_TABLECELL_H
21#define PCB_TABLECELL_H
22
23
24#include <pcb_textbox.h>
26
27
28class wxPGChoices;
29
30namespace kiapi::board::types
31{
32 class TableCell;
33}
34
36{
37public:
38 PCB_TABLECELL( BOARD_ITEM* parent );
39
40 static inline bool ClassOf( const EDA_ITEM* aItem ) { return aItem && PCB_TABLECELL_T == aItem->Type(); }
41
42 wxString GetClass() const override { return wxT( "PCB_TABLECELL" ); }
43
44 virtual wxString GetFriendlyName() const override { return _( "Table Cell" ); }
45
46 EDA_ITEM* Clone() const override { return new PCB_TABLECELL( *this ); }
47
48 void CopyFrom( const BOARD_ITEM* aOther ) override;
49
50 void Serialize( google::protobuf::Any &aContainer ) const override;
51 bool Deserialize( const google::protobuf::Any &aContainer ) override;
52
53 void Serialize( kiapi::board::types::TableCell& aOutput ) const;
54 bool Deserialize( const kiapi::board::types::TableCell& aInput );
55
56 EDA_GROUP* GetParentGroup() const override
57 {
58 BOARD_ITEM* parent = GetParent();
59 return parent ? parent->GetParentGroup() : nullptr;
60 }
61
62 int GetRow() const;
63 int GetColumn() const;
64
65 // @return the spreadsheet nomenclature for the cell (ie: B3 for 2nd column, 3rd row)
66 wxString GetAddr() const;
67
68 wxString GetShownText( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
69
74 wxString GetUnwrappedShownText( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const;
75
76 int GetColSpan() const { return m_colSpan; }
77 void SetColSpan( int aSpan ) { m_colSpan = aSpan; }
78
79 int GetRowSpan() const { return m_rowSpan; }
80 void SetRowSpan( int aSpan ) { m_rowSpan = aSpan; }
81
82 int GetRowHeight() const;
83 void SetRowHeight( int aHeight );
84
85 int GetColumnWidth() const;
86 void SetColumnWidth( int aWidth );
87
88 double GetCoverageArea( int aTextMargin ) const override;
89
94 int GetFontSize() const { return GetTextHeight(); }
95 void SetFontSize( int aSize ) { SetTextSize( VECTOR2I( aSize, aSize ) ); }
96 bool HasSquareFontSize() const { return GetTextWidth() == GetTextHeight(); }
97
102 static wxPGChoices FontChoices( INSPECTABLE* aItem );
103
104 bool IsFilledForHitTesting() const override { return true; }
105
106 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
107
108 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
109
110 double Similarity( const BOARD_ITEM& aBoardItem ) const override;
111
112 bool operator==( const PCB_TABLECELL& aBoardItem ) const;
113 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
114
115protected:
116 virtual void swapData( BOARD_ITEM* aImage ) override;
117
118protected:
121};
122
123
124#endif /* PCB_TABLECELL_H */
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
BOARD_ITEM_CONTAINER * GetParent() const
Definition board_item.h:281
The base class for create windows for drawing purpose.
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:43
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual int GetTextHeight() const
Definition eda_text.h:307
virtual int GetTextWidth() const
Definition eda_text.h:304
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:39
int GetColumnWidth() const
int GetRowSpan() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
wxString GetAddr() const
double GetCoverageArea(int aTextMargin) const override
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
static bool ClassOf(const EDA_ITEM *aItem)
void SetRowHeight(int aHeight)
wxString GetShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
Return the string actually shown after processing of the base text.
virtual void swapData(BOARD_ITEM *aImage) override
void SetRowSpan(int aSpan)
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
bool operator==(const PCB_TABLECELL &aBoardItem) const
void SetFontSize(int aSize)
void SetColumnWidth(int aWidth)
bool HasSquareFontSize() const
wxString GetUnwrappedShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const
GetShownText() before it is line-broken to the cell's width, i.e.
bool IsFilledForHitTesting() const override
int GetColSpan() const
virtual wxString GetFriendlyName() const override
void SetColSpan(int aSpan)
void CopyFrom(const BOARD_ITEM *aOther) override
int GetRow() const
EDA_GROUP * GetParentGroup() const override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
int GetColumn() const
int GetRowHeight() const
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
int GetFontSize() const
The text height, which speaks for the width too only when HasSquareFontSize.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
wxString GetClass() const override
Return the class name.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
PCB_TABLECELL(BOARD_ITEM *parent)
static wxPGChoices FontChoices(INSPECTABLE *aItem)
The font names EDA_TEXT's Font property offers, for the Font Name a generated table and its cells off...
PCB_TEXTBOX(BOARD_ITEM *aParent, KICAD_T aType=PCB_TEXTBOX_T)
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
RESOLUTION_CONTEXT
Definition common.h:91
#define _(s)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:87
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708