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)
 
virtual ~ITEMS_LISTBOX_BASE ()=default
 
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.
 
void Shutdown ()
 

Protected Attributes

bool m_isClosing
 

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 m_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()

virtual ITEMS_LISTBOX_BASE::~ITEMS_LISTBOX_BASE ( )
virtualdefault

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 98 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 92 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().

◆ Shutdown()

void ITEMS_LISTBOX_BASE::Shutdown ( )
inline

Definition at line 73 of file listboxes.h.

References m_isClosing.

Referenced by CVPCB_MAINFRAME::doCloseWindow().

◆ 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 67 of file listbox_base.cpp.

References m_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 45 of file listbox_base.cpp.

References m_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

◆ m_columnWidth

int ITEMS_LISTBOX_BASE::m_columnWidth
private

Definition at line 87 of file listboxes.h.

Referenced by UpdateLineWidth(), and UpdateWidth().

◆ m_isClosing

bool ITEMS_LISTBOX_BASE::m_isClosing
protected

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