KiCad PCB EDA Suite
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 (C) 2017 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 along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef FOOTPRINT_SELECT_WIDGET_H
21 #define FOOTPRINT_SELECT_WIDGET_H
22 
23 #include <footprint_filter.h>
24 #include <footprint_info.h>
25 #include <vector>
26 #include <wx/panel.h>
27 
28 class KIWAY;
29 class PROJECT;
30 class FOOTPRINT_CHOICE;
31 class wxWindow;
32 
37 wxDECLARE_EVENT( EVT_FOOTPRINT_SELECTED, wxCommandEvent );
38 
39 class FOOTPRINT_SELECT_WIDGET : public wxPanel
40 {
41 public:
61  FOOTPRINT_SELECT_WIDGET( EDA_DRAW_FRAME* aFrame, wxWindow* aParent, FOOTPRINT_LIST* aFpList,
62  bool aUpdate = true, int aMaxItems = 400 );
63 
65  {
66  }
67 
76  void Load( KIWAY& aKiway, PROJECT& aProject );
77 
81  void ClearFilters();
82 
86  void FilterByPinCount( int aPinCount );
87 
98  void FilterByFootprintFilters( wxArrayString const& aFilters, bool aZeroFilters );
99 
104  void SetDefaultFootprint( wxString const& aFp );
105 
113  bool UpdateList();
114 
118  void SelectDefault();
119 
123  virtual bool Enable( bool aEnable = true ) override;
124 
125 private:
128  wxSizer* m_sizer;
129 
130  bool m_update;
133 
137 
138  void OnComboBox( wxCommandEvent& aEvent );
139 };
140 
141 
142 #endif // FOOTPRINT_SELECT_WIDGET
wxDECLARE_EVENT(EVT_FOOTPRINT_SELECTED, wxCommandEvent)
This event is fired when a footprint is selected.
Container for project specific data.
Definition: project.h:62
void FilterByFootprintFilters(wxArrayString const &aFilters, bool aZeroFilters)
Filter by footprint filter list.
void SetDefaultFootprint(wxString const &aFp)
Set the default footprint for a part.
Customized combo box for footprint selection.
The base class for create windows for drawing purpose.
void ClearFilters()
Clear all filters.
bool UpdateList()
Update the contents of the list to match the filters.
void OnComboBox(wxCommandEvent &aEvent)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
virtual bool Enable(bool aEnable=true) override
Enable or disable the control for input.
Footprint display filter.
void SelectDefault()
Set current selection to the default footprint.
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
FOOTPRINT_SELECT_WIDGET(EDA_DRAW_FRAME *aFrame, wxWindow *aParent, FOOTPRINT_LIST *aFpList, bool aUpdate=true, int aMaxItems=400)
Construct a footprint selector widget.
void Load(KIWAY &aKiway, PROJECT &aProject)
Start loading.
void FilterByPinCount(int aPinCount)
Filter by pin count.