KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_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 The KiCad Developers, see AUTHORS.txt for contributors.
5 * Copyright (C) 2017 Chris Pavlina <[email protected]>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef FOOTPRINT_PREVIEW_WIDGET_H
22#define FOOTPRINT_PREVIEW_WIDGET_H
23
24#include <wx/panel.h>
25#include <functional>
26#include <import_export.h>
27#include <lib_id.h>
28#include <eda_units.h>
29#include <gal/color4d.h>
30
32class BOARD;
33class FOOTPRINT;
34class KIWAY;
35class TOOL_DISPATCHER;
37class wxStaticText;
38class wxSizer;
39
40
41class FOOTPRINT_PREVIEW_WIDGET: public wxPanel
42{
43public:
44
51 FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway );
52
57 bool IsInitialized() const { return m_prev_panel != nullptr; }
58
62 void SetStatusText( const wxString& aText );
63
67 void ClearStatus();
68
72 void SetUserUnits( EDA_UNITS aUnits );
73
79 void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions );
80
85 void DisplayFootprint( const LIB_ID& aFPID );
86
90 void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
91 std::shared_ptr<FOOTPRINT> aFootprintB );
92
96 void RefreshAll();
97
99
100protected:
102
103 wxStaticText* m_status;
106 wxSizer* m_outerSizer;
108};
109
110
116{
117public:
119
120 virtual void SetUserUnits( EDA_UNITS aUnits ) = 0;
121
127 virtual void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions ) = 0;
128
133 virtual bool DisplayFootprint( LIB_ID const& aFPID ) = 0;
134
138 virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
139 std::shared_ptr<FOOTPRINT> aFootprintB ) = 0;
140
144 virtual void RefreshAll() = 0;
145
150
151 virtual BOARD* GetBoard() = 0;
152
156 virtual const KIGFX::COLOR4D& GetBackgroundColor() const = 0;
157 virtual const KIGFX::COLOR4D& GetForegroundColor() const = 0;
158
163 static FOOTPRINT_PREVIEW_PANEL_BASE* Create( wxWindow* aParent, KIWAY& aKiway );
164};
165
166
167#endif // FOOTPRINT_PREVIEW_WIDGET_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
Base class for the actual viewer panel.
virtual bool DisplayFootprint(LIB_ID const &aFPID)=0
Set the currently displayed footprint.
virtual void SetPinFunctions(const std::map< wxString, wxString > &aPinFunctions)=0
Set the pin functions from the symbol's netlist.
virtual const KIGFX::COLOR4D & GetForegroundColor() const =0
virtual void RefreshAll()=0
Force the redrawing of all contents.
virtual BOARD * GetBoard()=0
virtual void SetUserUnits(EDA_UNITS aUnits)=0
virtual const KIGFX::COLOR4D & GetBackgroundColor() const =0
Get the colors to use in a preview widget to match the preview panel.
virtual void DisplayFootprints(std::shared_ptr< FOOTPRINT > aFootprintA, std::shared_ptr< FOOTPRINT > aFootprintB)=0
Display a pair of footprints.
virtual EDA_DRAW_PANEL_GAL * GetCanvas()=0
Get the GAL canvas.
void SetPinFunctions(const std::map< wxString, wxString > &aPinFunctions)
Set the pin functions from the symbol's netlist.
FOOTPRINT_PREVIEW_PANEL_BASE * m_prev_panel
FOOTPRINT_PREVIEW_PANEL_BASE * GetPreviewPanel()
void RefreshAll()
Force the redrawing of all contents.
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
void DisplayFootprints(std::shared_ptr< FOOTPRINT > aFootprintA, std::shared_ptr< FOOTPRINT > aFootprintB)
Display a pair of footprints.
void SetUserUnits(EDA_UNITS aUnits)
Set the units for the preview.
bool IsInitialized() const
Return whether the widget initialized properly.
void SetStatusText(const wxString &aText)
Set the contents of the status label and display it.
void ClearStatus()
Clear the contents of the status label and hide it.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:286
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
EDA_UNITS
Definition: eda_units.h:48
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:42