KiCad PCB EDA Suite
footprint_preview_panel.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) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
5  * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
6  * Copyright (C) 2016 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __FOOTPRINT_PREVIEW_PANEL_H
23 #define __FOOTPRINT_PREVIEW_PANEL_H
24 
25 #include <wx/wx.h>
26 
27 #include <map>
28 #include <deque>
29 #include <functional>
30 
31 #include <pcb_draw_panel_gal.h>
32 #include <gal/color4d.h>
34 #include <lib_id.h>
35 #include <kiway_player.h>
36 #include <core/optional.h>
37 
39 
40 class FOOTPRINT;
41 class KIWAY;
42 class IO_MGR;
43 class BOARD;
44 
45 
51  public KIWAY_HOLDER,
53 {
54 public:
55 
56  virtual ~FOOTPRINT_PREVIEW_PANEL( );
57 
58  virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
59 
60  virtual const KIGFX::COLOR4D& GetBackgroundColor() override;
61  virtual const KIGFX::COLOR4D& GetForegroundColor() override;
62 
63  virtual wxWindow* GetWindow() override;
64  BOARD* GetBoard() { return m_dummyBoard.get(); }
65 
66  static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent );
67 
68 private:
77  FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent,
78  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts,
79  GAL_TYPE aGalType );
80 
81  void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
82 
83 private:
84  std::unique_ptr<BOARD> m_dummyBoard;
85  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
86  std::shared_ptr<FOOTPRINT> m_currentFootprint;
87 };
88 
89 #endif
A mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_holder.h:39
virtual const KIGFX::COLOR4D & GetBackgroundColor() override
Get the colors to use in a preview widget to match the preview panel.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
virtual bool DisplayFootprint(const LIB_ID &aFPID) override
Set the currently displayed footprint.
std::shared_ptr< FOOTPRINT > m_currentFootprint
Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface.
A factory which returns an instance of a PLUGIN.
Definition: io_mgr.h:44
void renderFootprint(std::shared_ptr< FOOTPRINT > aFootprint)
virtual wxWindow * GetWindow() override
Get the underlying wxWindow.
std::unique_ptr< BOARD > m_dummyBoard
static FOOTPRINT_PREVIEW_PANEL * New(KIWAY *aKiway, wxWindow *aParent)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
FOOTPRINT_PREVIEW_PANEL(KIWAY *aKiway, wxWindow *aParent, std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > aOpts, GAL_TYPE aGalType)
Create a new panel.
Base class for the actual viewer panel.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:189
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_displayOptions
virtual const KIGFX::COLOR4D & GetForegroundColor() override
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98