KiCad PCB EDA Suite
lib_textbox.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) 2022 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 LIB_TEXTBOX_H
25#define LIB_TEXTBOX_H
26
27
28#include <eda_text.h>
29#include <lib_shape.h>
30
31
33
34class LIB_TEXTBOX : public LIB_SHAPE, public EDA_TEXT
35{
36public:
37 LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL,
38 const wxString& aText = wxEmptyString );
39
40 LIB_TEXTBOX( const LIB_TEXTBOX& aText );
41
43
44 static inline bool ClassOf( const EDA_ITEM* aItem )
45 {
46 return aItem && aItem->Type() == LIB_TEXTBOX_T;
47 }
48
49 virtual wxString GetClass() const override
50 {
51 return wxT( "LIB_TEXTBOX" );
52 }
53
54 int GetTextMargin() const;
55
56 VECTOR2I GetDrawPos() const override;
57
58 wxString GetShownText( int aDepth = 0 ) const override;
59
60 KIFONT::FONT* GetDrawFont() const override;
61
62 void MirrorHorizontally( const VECTOR2I& center );
63 void MirrorVertically( const VECTOR2I& center );
64 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
65
66 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
67
68 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
69
70 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
71 {
72 return LIB_ITEM::Matches( GetText(), aSearchData );
73 }
74
75 bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override
76 {
77 return EDA_TEXT::Replace( aSearchData );
78 }
79
80 virtual bool IsReplaceable() const override { return true; }
81
82 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
83
84 BITMAPS GetMenuImage() const override;
85
86 void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& offset,
87 const TRANSFORM& aTransform, bool aDimmed ) const override;
88
89 EDA_ITEM* Clone() const override
90 {
91 return new LIB_TEXTBOX( *this );
92 }
93
94 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
95
96 void ViewGetLayers( int aLayers[], int& aCount ) const override;
97
98private:
99 int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
100
101 void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
102 const TRANSFORM& aTransform, bool aDimmed ) override;
103};
104
105
106#endif /* LIB_TEXTBOX_H */
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:382
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:318
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
Define a library symbol object.
Definition: lib_symbol.h:98
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
VECTOR2I GetDrawPos() const override
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
Definition: lib_textbox.h:75
virtual bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: lib_textbox.h:80
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
int GetTextMargin() const
Definition: lib_textbox.cpp:63
void MirrorHorizontally(const VECTOR2I &center)
Definition: lib_textbox.cpp:69
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
virtual wxString GetClass() const override
Return the class name.
Definition: lib_textbox.h:49
KIFONT::FONT * GetDrawFont() const override
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: lib_textbox.h:70
LIB_TEXTBOX(LIB_SYMBOL *aParent, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, const wxString &aText=wxEmptyString)
Definition: lib_textbox.cpp:45
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &offset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_textbox.h:89
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the object about aCenter point.
Definition: lib_textbox.cpp:99
static bool ClassOf(const EDA_ITEM *aItem)
Definition: lib_textbox.h:44
void MirrorVertically(const VECTOR2I &center)
Definition: lib_textbox.cpp:84
Base plotter engine class.
Definition: plotter.h:110
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
FILL_T
Definition: eda_shape.h:54
@ LIB_TEXTBOX_T
Definition: typeinfo.h:201