KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FOOTPRINT_SELECT_WIDGET Class Reference

#include <footprint_select_widget.h>

Inheritance diagram for FOOTPRINT_SELECT_WIDGET:

Public Member Functions

 FOOTPRINT_SELECT_WIDGET (EDA_DRAW_FRAME *aFrame, wxWindow *aParent, int aMaxItems=400)
 Construct a footprint selector widget.
 
virtual ~FOOTPRINT_SELECT_WIDGET ()
 
void Load (KIWAY &aKiway, PROJECT &aProject)
 Initialize the widget with a KIWAY for cross-module communication.
 
void ClearFilters ()
 Clear all filters.
 
void FilterByPinCount (int aPinCount)
 Filter by pin count.
 
void FilterByFootprintFilters (const wxArrayString &aFilters, bool aZeroFilters)
 Filter by footprint filter list.
 
void SetDefaultFootprint (const wxString &aFp)
 Set the default footprint for a part.
 
bool UpdateList ()
 Update the contents of the list by fetching filtered footprints from pcbnew.
 
void SelectDefault ()
 Set current selection to the default footprint.
 
virtual bool Enable (bool aEnable=true) override
 Enable or disable the control for input.
 

Private Member Functions

void OnComboBox (wxCommandEvent &aEvent)
 

Private Attributes

FOOTPRINT_CHOICEm_fp_sel_ctrl
 
wxSizer * m_sizer
 
int m_max_items
 
wxString m_default_footprint
 
int m_pin_count
 
wxArrayString m_filters
 
bool m_zero_filter
 
KIWAYm_kiway
 

Detailed Description

Definition at line 38 of file footprint_select_widget.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_SELECT_WIDGET()

FOOTPRINT_SELECT_WIDGET::FOOTPRINT_SELECT_WIDGET ( EDA_DRAW_FRAME * aFrame,
wxWindow * aParent,
int aMaxItems = 400 )

Construct a footprint selector widget.

Parameters
aFrame- parent frame for context
aParent- parent window
aMaxItems- maximum number of filter items to display

Definition at line 31 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl, m_kiway, m_max_items, m_pin_count, m_sizer, m_zero_filter, and OnComboBox().

◆ ~FOOTPRINT_SELECT_WIDGET()

virtual FOOTPRINT_SELECT_WIDGET::~FOOTPRINT_SELECT_WIDGET ( )
inlinevirtual

Definition at line 50 of file footprint_select_widget.h.

Member Function Documentation

◆ ClearFilters()

void FOOTPRINT_SELECT_WIDGET::ClearFilters ( )

Clear all filters.

Does not update the list.

Definition at line 74 of file footprint_select_widget.cpp.

References m_default_footprint, m_filters, m_pin_count, and m_zero_filter.

◆ Enable()

bool FOOTPRINT_SELECT_WIDGET::Enable ( bool aEnable = true)
overridevirtual

Enable or disable the control for input.

Definition at line 196 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

◆ FilterByFootprintFilters()

void FOOTPRINT_SELECT_WIDGET::FilterByFootprintFilters ( const wxArrayString & aFilters,
bool aZeroFilters )

Filter by footprint filter list.

Does not update the list.

Parameters
aFiltersis a wxArrayString of strings used to filter the list of available footprints (can be empty). The final fp list is the list of footprint names matching at least one filtering string. A filtering string is something like sm0402 or DIP*
aZeroFilters- if true, zero filters = zero footprints. If false, zero filters = not filtering.

Definition at line 89 of file footprint_select_widget.cpp.

References m_filters, and m_zero_filter.

◆ FilterByPinCount()

void FOOTPRINT_SELECT_WIDGET::FilterByPinCount ( int aPinCount)

Filter by pin count.

Does not update the list.

Definition at line 83 of file footprint_select_widget.cpp.

References m_pin_count.

◆ Load()

void FOOTPRINT_SELECT_WIDGET::Load ( KIWAY & aKiway,
PROJECT & aProject )

Initialize the widget with a KIWAY for cross-module communication.

Parameters
aKiway- active kiway instance used to fetch filtered footprints from pcbnew
aProject- current project (unused, kept for API compatibility)

Definition at line 51 of file footprint_select_widget.cpp.

References m_kiway.

◆ OnComboBox()

void FOOTPRINT_SELECT_WIDGET::OnComboBox ( wxCommandEvent & aEvent)
private

Definition at line 57 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

Referenced by FOOTPRINT_SELECT_WIDGET().

◆ SelectDefault()

void FOOTPRINT_SELECT_WIDGET::SelectDefault ( )

Set current selection to the default footprint.

Definition at line 190 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

Referenced by UpdateList().

◆ SetDefaultFootprint()

void FOOTPRINT_SELECT_WIDGET::SetDefaultFootprint ( const wxString & aFp)

Set the default footprint for a part.

This will be listed at the top. May be an empty string.

Definition at line 97 of file footprint_select_widget.cpp.

References m_default_footprint.

◆ UpdateList()

bool FOOTPRINT_SELECT_WIDGET::UpdateList ( )

Update the contents of the list by fetching filtered footprints from pcbnew.

The "default" footprint will be selected.

Returns
true if the list was updated successfully

Definition at line 103 of file footprint_select_widget.cpp.

References _, KIWAY::FACE_PCB, filter, filterFootprints(), kiface(), KIFACE_FILTER_FOOTPRINTS, m_default_footprint, m_filters, m_fp_sel_ctrl, m_kiway, m_max_items, m_pin_count, m_zero_filter, and SelectDefault().

Member Data Documentation

◆ m_default_footprint

wxString FOOTPRINT_SELECT_WIDGET::m_default_footprint
private

Definition at line 113 of file footprint_select_widget.h.

Referenced by ClearFilters(), SetDefaultFootprint(), and UpdateList().

◆ m_filters

wxArrayString FOOTPRINT_SELECT_WIDGET::m_filters
private

Definition at line 117 of file footprint_select_widget.h.

Referenced by ClearFilters(), FilterByFootprintFilters(), and UpdateList().

◆ m_fp_sel_ctrl

FOOTPRINT_CHOICE* FOOTPRINT_SELECT_WIDGET::m_fp_sel_ctrl
private

◆ m_kiway

KIWAY* FOOTPRINT_SELECT_WIDGET::m_kiway
private

Definition at line 120 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET(), Load(), and UpdateList().

◆ m_max_items

int FOOTPRINT_SELECT_WIDGET::m_max_items
private

Definition at line 112 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET(), and UpdateList().

◆ m_pin_count

int FOOTPRINT_SELECT_WIDGET::m_pin_count
private

◆ m_sizer

wxSizer* FOOTPRINT_SELECT_WIDGET::m_sizer
private

Definition at line 110 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET().

◆ m_zero_filter

bool FOOTPRINT_SELECT_WIDGET::m_zero_filter
private

The documentation for this class was generated from the following files: