KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_select_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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef FOOTPRINT_SELECT_WIDGET_H
21#define FOOTPRINT_SELECT_WIDGET_H
22
23#include <wx/arrstr.h>
24#include <wx/panel.h>
25
26#include <vector>
27
28#include <lib_id.h>
29
30class KIWAY;
31class PROJECT;
33class wxWindow;
34class EDA_DRAW_FRAME;
35
40wxDECLARE_EVENT( EVT_FOOTPRINT_SELECTED, wxCommandEvent );
41
42class FOOTPRINT_SELECT_WIDGET : public wxPanel
43{
44public:
52 FOOTPRINT_SELECT_WIDGET( EDA_DRAW_FRAME* aFrame, wxWindow* aParent, int aMaxItems = 400 );
53
55 {
56 }
57
64 void Load( KIWAY& aKiway, PROJECT& aProject );
65
69 void ClearFilters();
70
79 void AddAlwaysIncludedFootprint( const LIB_ID& aFootprintId );
80
84 void FilterByPinCount( int aPinCount );
85
96 void FilterByFootprintFilters( const wxArrayString& aFilters, bool aZeroFilters );
97
102 void SetDefaultFootprint( const wxString& aFp );
103
110 bool UpdateList();
111
115 void SelectDefault();
116
120 virtual bool Enable( bool aEnable = true ) override;
121
122private:
124 wxSizer* m_sizer;
125
128
129 // Filter parameters
131 wxArrayString m_filters;
133 std::vector<LIB_ID> m_always_included;
134
136
137 void OnComboBox( wxCommandEvent& aEvent );
138};
139
140
141#endif // FOOTPRINT_SELECT_WIDGET
The base class for create windows for drawing purpose.
Customized combo box for footprint selection.
virtual bool Enable(bool aEnable=true) override
Enable or disable the control for input.
std::vector< LIB_ID > m_always_included
void OnComboBox(wxCommandEvent &aEvent)
void AddAlwaysIncludedFootprint(const LIB_ID &aFootprintId)
Add a footprint that is always listed regardless of the pin-count and glob filters (issue #2282).
void FilterByFootprintFilters(const wxArrayString &aFilters, bool aZeroFilters)
Filter by footprint filter list.
void SetDefaultFootprint(const wxString &aFp)
Set the default footprint for a part.
FOOTPRINT_SELECT_WIDGET(EDA_DRAW_FRAME *aFrame, wxWindow *aParent, int aMaxItems=400)
Construct a footprint selector widget.
void FilterByPinCount(int aPinCount)
Filter by pin count.
void SelectDefault()
Set current selection to the default footprint.
bool UpdateList()
Update the contents of the list by fetching filtered footprints from pcbnew.
void ClearFilters()
Clear all filters.
void Load(KIWAY &aKiway, PROJECT &aProject)
Initialize the widget with a KIWAY for cross-module communication.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Container for project specific data.
Definition project.h:62
wxDECLARE_EVENT(EVT_FOOTPRINT_SELECTED, wxCommandEvent)
This event is fired when a footprint is selected.