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

#include <listboxes.h>

Inheritance diagram for LIBRARY_LISTBOX:
ITEMS_LISTBOX_BASE

Public Member Functions

 LIBRARY_LISTBOX (CVPCB_MAINFRAME *parent, wxWindowID id)
 
 ~LIBRARY_LISTBOX ()
 
int GetCount ()
 
void SetSelection (int index, bool State=true)
 
void SetString (unsigned linecount, const wxString &text)
 
void AppendLine (const wxString &text)
 
void Finish ()
 
void ClearList ()
 
wxString GetSelectedLibrary ()
 
wxString OnGetItemText (long item, long column) const override
 
void OnSelectLibrary (wxListEvent &event)
 
void OnChar (wxKeyEvent &event)
 Called on a key press.
 
 DECLARE_EVENT_TABLE ()
 
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

wxArrayString m_libraryList
 
int columnWidth
 

Detailed Description

Definition at line 143 of file listboxes.h.

Constructor & Destructor Documentation

◆ LIBRARY_LISTBOX()

LIBRARY_LISTBOX::LIBRARY_LISTBOX ( CVPCB_MAINFRAME parent,
wxWindowID  id 
)

Definition at line 42 of file library_listbox.cpp.

◆ ~LIBRARY_LISTBOX()

LIBRARY_LISTBOX::~LIBRARY_LISTBOX ( )

Definition at line 48 of file library_listbox.cpp.

Member Function Documentation

◆ AppendLine()

void LIBRARY_LISTBOX::AppendLine ( const wxString &  text)

Definition at line 91 of file library_listbox.cpp.

References m_libraryList, and text.

Referenced by CVPCB_MAINFRAME::BuildLibrariesList().

◆ ClearList()

void LIBRARY_LISTBOX::ClearList ( )

Definition at line 132 of file library_listbox.cpp.

References m_libraryList.

Referenced by CVPCB_MAINFRAME::BuildLibrariesList().

◆ DECLARE_EVENT_TABLE()

LIBRARY_LISTBOX::DECLARE_EVENT_TABLE ( )

◆ DeselectAll()

void ITEMS_LISTBOX_BASE::DeselectAll ( )
inherited

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

◆ Finish()

void LIBRARY_LISTBOX::Finish ( )

◆ GetCount()

int LIBRARY_LISTBOX::GetCount ( )

Definition at line 53 of file library_listbox.cpp.

References m_libraryList.

Referenced by SetSelection().

◆ GetParent()

CVPCB_MAINFRAME * ITEMS_LISTBOX_BASE::GetParent ( ) const
virtualinherited

◆ GetSelectedLibrary()

◆ GetSelection()

int ITEMS_LISTBOX_BASE::GetSelection ( )
inherited
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().

◆ OnChar()

void LIBRARY_LISTBOX::OnChar ( wxKeyEvent &  event)

Called on a key press.

Call default handler for some special keys, and for "ASCII" keys, select the first footprint that the name starts by the letter.

This is the default behavior of a listbox, but because we use virtual lists, the listbox does not know anything to what is displayed, we must handle this behavior here. Furthermore the footprint name is not at the beginning of displayed lines (the first word is the line number).

Definition at line 143 of file library_listbox.cpp.

References dump(), kicadTraceKeyEvent, and text.

◆ OnGetItemText()

wxString LIBRARY_LISTBOX::OnGetItemText ( long  item,
long  column 
) const
override

Definition at line 99 of file library_listbox.cpp.

References m_libraryList.

◆ OnSelectLibrary()

◆ SetSelection()

void LIBRARY_LISTBOX::SetSelection ( int  index,
bool  State = true 
)

Definition at line 105 of file library_listbox.cpp.

References GetCount(), and Refresh().

◆ SetString()

void LIBRARY_LISTBOX::SetString ( unsigned  linecount,
const wxString &  text 
)

Definition at line 59 of file library_listbox.cpp.

References m_libraryList, text, and ITEMS_LISTBOX_BASE::UpdateWidth().

◆ UpdateLineWidth()

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

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 ITEMS_LISTBOX_BASE::columnWidth.

Referenced by ITEMS_LISTBOX_BASE::UpdateWidth().

◆ UpdateWidth()

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

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 ITEMS_LISTBOX_BASE::columnWidth, and ITEMS_LISTBOX_BASE::UpdateLineWidth().

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

Member Data Documentation

◆ columnWidth

int ITEMS_LISTBOX_BASE::columnWidth
privateinherited

◆ m_libraryList

wxArrayString LIBRARY_LISTBOX::m_libraryList
private

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