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
28namespace kiapi::board::types
29{
30 class TableCell;
31}
32
34{
35public:
36 PCB_TABLECELL( BOARD_ITEM* parent );
37
38 static inline bool ClassOf( const EDA_ITEM* aItem ) { return aItem && PCB_TABLECELL_T == aItem->Type(); }
39
40 wxString GetClass() const override { return wxT( "PCB_TABLECELL" ); }
41
42 virtual wxString GetFriendlyName() const override { return _( "Table Cell" ); }
43
44 EDA_ITEM* Clone() const override { return new PCB_TABLECELL( *this ); }
45
46 void Serialize( google::protobuf::Any &aContainer ) const override;
47 bool Deserialize( const google::protobuf::Any &aContainer ) override;
48
49 void Serialize( kiapi::board::types::TableCell& aOutput ) const;
50 bool Deserialize( const kiapi::board::types::TableCell& aInput );
51
52 EDA_GROUP* GetParentGroup() const override
53 {
54 BOARD_ITEM* parent = GetParent();
55 return parent ? parent->GetParentGroup() : nullptr;
56 }
57
58 int GetRow() const;
59 int GetColumn() const;
60
61 // @return the spreadsheet nomenclature for the cell (ie: B3 for 2nd column, 3rd row)
62 wxString GetAddr() const;
63
64 wxString GetShownText( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
65
66 int GetColSpan() const { return m_colSpan; }
67 void SetColSpan( int aSpan ) { m_colSpan = aSpan; }
68
69 int GetRowSpan() const { return m_rowSpan; }
70 void SetRowSpan( int aSpan ) { m_rowSpan = aSpan; }
71
72 int GetRowHeight() const;
73 void SetRowHeight( int aHeight );
74
75 int GetColumnWidth() const;
76 void SetColumnWidth( int aWidth );
77
78 bool IsFilledForHitTesting() const override { return true; }
79
80 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
81
82 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
83
84 double Similarity( const BOARD_ITEM& aBoardItem ) const override;
85
86 bool operator==( const PCB_TABLECELL& aBoardItem ) const;
87 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
88
89protected:
90 virtual void swapData( BOARD_ITEM* aImage ) override;
91
92protected:
95};
96
97
98#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:84
BOARD_ITEM_CONTAINER * GetParent() const
Definition board_item.h:266
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
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
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 SetColumnWidth(int aWidth)
bool IsFilledForHitTesting() const override
int GetColSpan() const
virtual wxString GetFriendlyName() const override
void SetColSpan(int aSpan)
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.
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)
PCB_TEXTBOX(BOARD_ITEM *aParent, KICAD_T aType=PCB_TEXTBOX_T)
RESOLUTION_CONTEXT
Definition common.h:87
#define _(s)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:87