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-2021 KiCad Developers, see AUTHORS.txt for contributors.
5  * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
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 
29 #include <gal/color4d.h>
30 
31 class FOOTPRINT_LOAD_EVENT;
33 class KIWAY;
34 class wxStaticText;
35 class wxSizer;
36 
37 
38 class FOOTPRINT_PREVIEW_WIDGET: public wxPanel
39 {
40 public:
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 
71  void DisplayFootprint( const LIB_ID& aFPID );
72 
73 private:
75 
76  wxStaticText* m_status;
77  wxPanel* m_statusPanel;
78  wxSizer* m_statusSizer;
79  wxSizer* m_outerSizer;
81 
82 };
83 
84 
90 {
91 public:
93 
98  virtual bool DisplayFootprint( LIB_ID const& aFPID ) = 0;
99 
103  virtual wxWindow* GetWindow() = 0;
104 
108  virtual const KIGFX::COLOR4D& GetBackgroundColor() = 0;
109  virtual const KIGFX::COLOR4D& GetForegroundColor() = 0;
110 
115  static FOOTPRINT_PREVIEW_PANEL_BASE* Create( wxWindow* aParent, KIWAY& aKiway );
116 };
117 
118 
119 #endif // FOOTPRINT_PREVIEW_WIDGET_H
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:44
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
FOOTPRINT_PREVIEW_PANEL_BASE * m_prev_panel
void ClearStatus()
Clear the contents of the status label and hide it.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
void SetStatusText(const wxString &aText)
Set the contents of the status label and display it.
Base class for the actual viewer panel.
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
FOOTPRINT_PREVIEW_WIDGET(wxWindow *aParent, KIWAY &aKiway)
Construct a footprint preview widget.
bool IsInitialized() const
Return whether the widget initialized properly.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103