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 <map>
26 #include <deque>
27 #include <functional>
28 
29 #include <pcb_draw_panel_gal.h>
30 #include <gal/color4d.h>
32 #include <lib_id.h>
33 #include <kiway_player.h>
34 #include <core/optional.h>
35 
37 
38 class FOOTPRINT;
39 class KIWAY;
40 class IO_MGR;
41 class BOARD;
42 
43 
49  public KIWAY_HOLDER,
51 {
52 public:
53 
54  virtual ~FOOTPRINT_PREVIEW_PANEL( );
55 
56  virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
57 
58  virtual const KIGFX::COLOR4D& GetBackgroundColor() override;
59  virtual const KIGFX::COLOR4D& GetForegroundColor() override;
60 
61  virtual wxWindow* GetWindow() override;
62  BOARD* GetBoard() { return m_dummyBoard.get(); }
63 
64  static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent );
65 
66 private:
75  FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent,
76  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts,
77  GAL_TYPE aGalType );
78 
79  void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
80 
81 private:
82  std::unique_ptr<BOARD> m_dummyBoard;
83  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
84  std::shared_ptr<FOOTPRINT> m_currentFootprint;
85 };
86 
87 #endif
A mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_holder.h:36
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:45
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:190
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:103