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

Base class to display symbol and footprint lists. More...

#include <listboxes.h>

Inheritance diagram for ITEMS_LISTBOX_BASE:
FOOTPRINTS_LISTBOX LIBRARY_LISTBOX SYMBOLS_LISTBOX

Public Member Functions

 ITEMS_LISTBOX_BASE (CVPCB_MAINFRAME *aParent, wxWindowID aId, const wxPoint &aLocation=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, long aStyle=0)
 
 ~ITEMS_LISTBOX_BASE ()
 
int GetSelection ()
 
void DeselectAll ()
 Remove all selection in lists which can have more than one item selected.
 
virtual CVPCB_MAINFRAMEGetParent () const
 
void UpdateWidth (int aLine=-1)
 Update the width of the column based on its contents.
 

Private Member Functions

void UpdateLineWidth (unsigned aLine, wxClientDC &dc)
 Calculate the width of the given line, and increase the column width if needed.
 

Private Attributes

int columnWidth
 

Detailed Description

Base class to display symbol and footprint lists.

Definition at line 42 of file listboxes.h.

Constructor & Destructor Documentation

◆ ITEMS_LISTBOX_BASE()

ITEMS_LISTBOX_BASE::ITEMS_LISTBOX_BASE ( CVPCB_MAINFRAME aParent,
wxWindowID  aId,
const wxPoint &  aLocation = wxDefaultPosition,
const wxSize &  aSize = wxDefaultSize,
long  aStyle = 0 
)

Definition at line 34 of file listbox_base.cpp.

◆ ~ITEMS_LISTBOX_BASE()

ITEMS_LISTBOX_BASE::~ITEMS_LISTBOX_BASE ( )

Definition at line 44 of file listbox_base.cpp.

Member Function Documentation

◆ DeselectAll()

void ITEMS_LISTBOX_BASE::DeselectAll ( )

Remove all selection in lists which can have more than one item selected.

Definition at line 104 of file listbox_base.cpp.

Referenced by FOOTPRINTS_LISTBOX::SetFootprints(), and CVPCB_MAINFRAME::SetSelectedComponent().

◆ GetParent()

CVPCB_MAINFRAME * ITEMS_LISTBOX_BASE::GetParent ( ) const
virtual

◆ GetSelection()

int ITEMS_LISTBOX_BASE::GetSelection ( )
Returns
the index of the selected item in lists allowing only one item selected and the index of the first selected item in lists allowing many selection

Definition at line 98 of file listbox_base.cpp.

Referenced by CVPCB_MAINFRAME::GetSelectedComponent(), CVPCB_MAINFRAME::OnSelectComponent(), CVPCB_MAINFRAME::onTextFilterChangedTimer(), CVPCB_MAINFRAME::refreshAfterSymbolSearch(), CVPCB_MAINFRAME::SendComponentSelectionToSch(), and FOOTPRINTS_LISTBOX::SetFootprints().

◆ UpdateLineWidth()

void ITEMS_LISTBOX_BASE::UpdateLineWidth ( unsigned  aLine,
wxClientDC &  dc 
)
private

Calculate the width of the given line, and increase the column width if needed.

This is effectively the wxListCtrl code for autosizing. NB. it relies on the caller checking the given line number is valid.

Definition at line 73 of file listbox_base.cpp.

References columnWidth.

Referenced by UpdateWidth().

◆ UpdateWidth()

void ITEMS_LISTBOX_BASE::UpdateWidth ( int  aLine = -1)

Update the width of the column based on its contents.

Parameters
aLineis the line to calculate the width from. If positive, the width will only be increased if needed. If negative, we start from scratch and all lines are considered, i.e., the column may be shrunk.

Definition at line 49 of file listbox_base.cpp.

References columnWidth, and UpdateLineWidth().

Referenced by SYMBOLS_LISTBOX::AppendLine(), LIBRARY_LISTBOX::Finish(), FOOTPRINTS_LISTBOX::SetFootprints(), FOOTPRINTS_LISTBOX::SetString(), LIBRARY_LISTBOX::SetString(), and SYMBOLS_LISTBOX::SetString().

Member Data Documentation

◆ columnWidth

int ITEMS_LISTBOX_BASE::columnWidth
private

Definition at line 81 of file listboxes.h.

Referenced by UpdateLineWidth(), and UpdateWidth().


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