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
55 bool IsInitialized() const { return m_prev_panel != nullptr; }
56
60 void SetStatusText( const wxString& aText );
61
65 void ClearStatus();
66
70 void SetUserUnits( EDA_UNITS aUnits );
71
76 void DisplayFootprint( const LIB_ID& aFPID );
77
81 void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
82 std::shared_ptr<FOOTPRINT> aFootprintB );
83
87 void RefreshAll();
88
89protected:
91
92 wxStaticText* m_status;
93 wxPanel* m_statusPanel;
94 wxSizer* m_statusSizer;
95 wxSizer* m_outerSizer;
97};
98
99
105{
106public:
108
109 virtual void SetUserUnits( EDA_UNITS aUnits ) = 0;
110
115 virtual bool DisplayFootprint( LIB_ID const& aFPID ) = 0;
116
120 virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
121 std::shared_ptr<FOOTPRINT> aFootprintB ) = 0;
122
126 virtual void RefreshAll() = 0;
127
131 virtual wxWindow* GetWindow() = 0;
132
136 virtual const KIGFX::COLOR4D& GetBackgroundColor() const = 0;
137 virtual const KIGFX::COLOR4D& GetForegroundColor() const = 0;
138
143 static FOOTPRINT_PREVIEW_PANEL_BASE* Create( wxWindow* aParent, KIWAY& aKiway );
144};
145
146
147#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 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.
FOOTPRINT_PREVIEW_PANEL_BASE * m_prev_panel
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:44
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:42