KiCad PCB EDA Suite
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 KIWAY;
33class wxStaticText;
34class wxSizer;
35
36
37class FOOTPRINT_PREVIEW_WIDGET: public wxPanel
38{
39public:
40
47 FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway );
48
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
75 void DisplayFootprint( const LIB_ID& aFPID );
76
77private:
79
80 wxStaticText* m_status;
81 wxPanel* m_statusPanel;
82 wxSizer* m_statusSizer;
83 wxSizer* m_outerSizer;
85};
86
87
93{
94public:
96
97 virtual void SetUserUnits( EDA_UNITS aUnits ) = 0;
98
103 virtual bool DisplayFootprint( LIB_ID const& aFPID ) = 0;
104
108 virtual wxWindow* GetWindow() = 0;
109
113 virtual const KIGFX::COLOR4D& GetBackgroundColor() const = 0;
114 virtual const KIGFX::COLOR4D& GetForegroundColor() const = 0;
115
120 static FOOTPRINT_PREVIEW_PANEL_BASE* Create( wxWindow* aParent, KIWAY& aKiway );
121};
122
123
124#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 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.
FOOTPRINT_PREVIEW_PANEL_BASE * m_prev_panel
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
FOOTPRINT_PREVIEW_WIDGET(wxWindow *aParent, KIWAY &aKiway)
Construct a footprint preview widget.
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:274
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:43
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:44