KiCad PCB EDA Suite
symbol_preview_widget.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 modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef SYMBOL_PREVIEW_WIDGET_H
21 #define SYMBOL_PREVIEW_WIDGET_H
22 
23 #include <wx/panel.h>
24 #include <kiway.h>
26 #include <class_draw_panel_gal.h>
27 
28 
29 class EDA_ITEM;
30 class LIB_ID;
31 class LIB_ALIAS;
32 class LIB_PART;
33 class wxStaticText;
34 class wxSizer;
35 
36 
37 class SYMBOL_PREVIEW_WIDGET: public wxPanel
38 {
39 public:
40 
48  SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
49  EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
50 
51  ~SYMBOL_PREVIEW_WIDGET() override;
52 
56  void SetStatusText( wxString const& aText );
57 
61  void DisplaySymbol( const LIB_ID& aSymbolID, int aUnit );
62 
63  void DisplayPart( LIB_PART* aPart, int aUnit );
64 
65 private:
66  void onSize( wxSizeEvent& aEvent );
67 
68  void fitOnDrawArea(); // set the view scale to fit the item on screen and center
69 
71 
74 
75  wxStaticText* m_status;
76  wxSizer* m_statusSizer;
77 
81 
84 };
85 
86 
87 #endif // SYMBOL_PREVIEW_WIDGET_H
SYMBOL_PREVIEW_WIDGET(wxWindow *aParent, KIWAY &aKiway, EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Construct a symbol preview widget.
Part library alias object definition.
void onSize(wxSizeEvent &aEvent)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SetStatusText(wxString const &aText)
Set the contents of the status label and display it.
void DisplaySymbol(const LIB_ID &aSymbolID, int aUnit)
Set the currently displayed symbol.
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
void DisplayPart(LIB_PART *aPart, int aUnit)
EDA_DRAW_PANEL_GAL * m_preview
Define a library symbol object.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
EDA_ITEM * m_previewItem
a local copy of the LIB_ALIAS or the LIB_PART to display on the canvas
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
BOX2I m_itemBBox
The bounding box of the current item.