KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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( bool aAllowExtraText, int aDepth = 0 ) const override;
59
60 void MirrorHorizontally( const VECTOR2I& center );
61 void MirrorVertically( const VECTOR2I& center );
62 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
63
64 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
65
66 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
67
68 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
69 {
70 return LIB_ITEM::Matches( GetText(), aSearchData );
71 }
72
73 bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override
74 {
75 return EDA_TEXT::Replace( aSearchData );
76 }
77
78 virtual bool IsReplaceable() const override { return true; }
79
80 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
81
82 BITMAPS GetMenuImage() const override;
83
84 void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& offset,
85 const TRANSFORM& aTransform, bool aDimmed ) const override;
86
87 EDA_ITEM* Clone() const override
88 {
89 return new LIB_TEXTBOX( *this );
90 }
91
92 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
93
94 void ViewGetLayers( int aLayers[], int& aCount ) const override;
95
96protected:
97 KIFONT::FONT* getDrawFont() const override;
98
99private:
100 int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
101
102 void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
103 const TRANSFORM& aTransform, bool aDimmed ) override;
104};
105
106
107#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:372
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:326
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:130
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:68
Define a library symbol object.
Definition: lib_symbol.h:99
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:73
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
virtual bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: lib_textbox.h:78
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
int GetTextMargin() const
Definition: lib_textbox.cpp:64
void MirrorHorizontally(const VECTOR2I &center)
Definition: lib_textbox.cpp:70
virtual wxString GetClass() const override
Return the class name.
Definition: lib_textbox.h:49
KIFONT::FONT * getDrawFont() const override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: lib_textbox.h:68
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:87
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.
static bool ClassOf(const EDA_ITEM *aItem)
Definition: lib_textbox.h:44
void MirrorVertically(const VECTOR2I &center)
Definition: lib_textbox.cpp:85
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Base plotter engine class.
Definition: plotter.h:104
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
FILL_T
Definition: eda_shape.h:55
@ LIB_TEXTBOX_T
Definition: typeinfo.h:200