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 (C) 2017-2023 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 FOOTPRINT;
33class KIWAY;
34class wxStaticText;
35class wxSizer;
36
37
38class FOOTPRINT_PREVIEW_WIDGET: public wxPanel
39{
40public:
41
48 FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway );
49
54 bool IsInitialized() const { return m_prev_panel != nullptr; }
55
59 void SetStatusText( const wxString& aText );
60
64 void ClearStatus();
65
69 void SetUserUnits( EDA_UNITS aUnits );
70
76 void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions );
77
82 void DisplayFootprint( const LIB_ID& aFPID );
83
87 void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
88 std::shared_ptr<FOOTPRINT> aFootprintB );
89
93 void RefreshAll();
94
96
97protected:
99
100 wxStaticText* m_status;
103 wxSizer* m_outerSizer;
105};
106
107
113{
114public:
116
117 virtual void SetUserUnits( EDA_UNITS aUnits ) = 0;
118
124 virtual void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions ) = 0;
125
130 virtual bool DisplayFootprint( LIB_ID const& aFPID ) = 0;
131
135 virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
136 std::shared_ptr<FOOTPRINT> aFootprintB ) = 0;
137
141 virtual void RefreshAll() = 0;
142
146 virtual wxWindow* GetWindow() = 0;
147
151 virtual const KIGFX::COLOR4D& GetBackgroundColor() const = 0;
152 virtual const KIGFX::COLOR4D& GetForegroundColor() const = 0;
153
158 static FOOTPRINT_PREVIEW_PANEL_BASE* Create( wxWindow* aParent, KIWAY& aKiway );
159};
160
161
162#endif // FOOTPRINT_PREVIEW_WIDGET_H
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 wxWindow * GetWindow()=0
Get the underlying wxWindow.
virtual const KIGFX::COLOR4D & GetForegroundColor() const =0
virtual void RefreshAll()=0
Force the redrawing of all contents.
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.
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:279
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:46
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:42