KiCad PCB EDA Suite
DRCLISTBOX Class Reference

Class DRCLISTBOX is used to display a DRC_ITEM_LIST. More...

#include <dialog_drclistbox.h>

Inheritance diagram for DRCLISTBOX:

Public Member Functions

 DRCLISTBOX (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString choices[]=NULL, int unused=0)
 
 ~DRCLISTBOX ()
 
void SetList (EDA_UNITS_T aUnits, DRC_ITEM_LIST *aList)
 Function SetList sets the DRC_ITEM_LIST for this listbox. More...
 
const DRC_ITEMGetItem (int aIndex)
 Function GetItem returns a requested DRC_ITEM* or NULL. More...
 
wxString OnGetItem (size_t n) const override
 Function OnGetItem returns the html text associated with the DRC_ITEM given by index 'n'. More...
 
wxString OnGetItemMarkup (size_t n) const override
 Function OnGetItem returns the html text associated with the given index 'n'. More...
 
void DeleteItem (int aIndex)
 Function DeleteElement will delete one of the items in the list. More...
 
void DeleteAllItems ()
 Function DeleteAllItems deletes all items in the list. More...
 

Private Attributes

EDA_UNITS_T m_units
 
DRC_ITEM_LISTm_list
 wxHtmlListBox does not own the list, I do More...
 

Detailed Description

Class DRCLISTBOX is used to display a DRC_ITEM_LIST.

Definition at line 188 of file dialog_drclistbox.h.

Constructor & Destructor Documentation

◆ DRCLISTBOX()

DRCLISTBOX::DRCLISTBOX ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = 0,
const wxString  choices[] = NULL,
int  unused = 0 
)
inline

Definition at line 195 of file dialog_drclistbox.h.

198  : wxHtmlListBox( parent, id, pos, size, style )
199  {
201  m_list = 0;
202  }
EDA_UNITS_T m_units
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do

References m_list, m_units, and MILLIMETRES.

◆ ~DRCLISTBOX()

DRCLISTBOX::~DRCLISTBOX ( )
inline

Definition at line 205 of file dialog_drclistbox.h.

206  {
207  delete m_list; // I own it, I destroy it.
208  }
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do

References m_list.

Member Function Documentation

◆ DeleteAllItems()

void DRCLISTBOX::DeleteAllItems ( )
inline

Function DeleteAllItems deletes all items in the list.

Definition at line 306 of file dialog_drclistbox.h.

307  {
308  if( m_list )
309  {
311  SetItemCount(0);
312  SetSelection( -1 ); // -1 is no selection
313  Refresh();
314  }
315  }
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
virtual void DeleteAllItems()=0
Function DeleteAllItems removes and deletes all the items in the list.

References DRC_ITEM_LIST::DeleteAllItems(), m_list, and Refresh().

Referenced by DIALOG_DRC_CONTROL::DelDRCMarkers().

◆ DeleteItem()

void DRCLISTBOX::DeleteItem ( int  aIndex)
inline

Function DeleteElement will delete one of the items in the list.

Parameters
aIndexThe index into the list to delete.

Definition at line 284 of file dialog_drclistbox.h.

285  {
286  if( m_list )
287  {
288  int selection = GetSelection();
289 
290  m_list->DeleteItem( aIndex );
291  int count = m_list->GetCount();
292  SetItemCount( count );
293 
294  // if old selection >= new count
295  if( selection >= count )
296  SetSelection( count-1 ); // -1 is "no selection"
297  Refresh();
298  }
299  }
virtual void DeleteItem(int aIndex)=0
Function DeleteAllItems removes and deletes desired item from the list.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
virtual int GetCount()=0
Function GetCount returns the number of items in the list.

References DRC_ITEM_LIST::DeleteItem(), DRC_ITEM_LIST::GetCount(), m_list, and Refresh().

Referenced by DIALOG_DRC_CONTROL::OnDeleteOneClick().

◆ GetItem()

const DRC_ITEM* DRCLISTBOX::GetItem ( int  aIndex)
inline

Function GetItem returns a requested DRC_ITEM* or NULL.

Definition at line 233 of file dialog_drclistbox.h.

234  {
235  if( m_list )
236  {
237  return m_list->GetItem( aIndex );
238  }
239  return NULL;
240  }
virtual const DRC_ITEM * GetItem(int aIndex)=0
Function GetItem retrieves a DRC_ITEM by pointer.
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do

References DRC_ITEM_LIST::GetItem(), and m_list.

Referenced by DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_DRC_CONTROL::OnRightUpClearance(), DIALOG_DRC_CONTROL::OnRightUpUnconnected(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), and DIALOG_DRC_CONTROL::writeReport().

◆ OnGetItem()

wxString DRCLISTBOX::OnGetItem ( size_t  n) const
inlineoverride

Function OnGetItem returns the html text associated with the DRC_ITEM given by index 'n'.

Parameters
nAn index into the list.
Returns
wxString - the simple html text to show in the listbox.

Definition at line 249 of file dialog_drclistbox.h.

250  {
251  if( m_list )
252  {
253  const DRC_ITEM* item = m_list->GetItem( (int) n );
254  if( item )
255  {
256  wxColour color = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
257 
258  return wxString::Format( wxT( "<font color='%s'>%s</font>" ),
259  color.GetAsString( wxC2S_HTML_SYNTAX ),
260  item->ShowHtml( m_units ) );
261  }
262  }
263  return wxString();
264  }
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: drc_item.h:48
virtual const DRC_ITEM * GetItem(int aIndex)=0
Function GetItem retrieves a DRC_ITEM by pointer.
int color
Definition: DXF_plotter.cpp:62
EDA_UNITS_T m_units
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString ShowHtml(EDA_UNITS_T aUnits) const
Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget's wxHtmlLi...
Definition: drc_item.cpp:160

References color, Format(), DRC_ITEM_LIST::GetItem(), m_list, m_units, and DRC_ITEM::ShowHtml().

Referenced by OnGetItemMarkup().

◆ OnGetItemMarkup()

wxString DRCLISTBOX::OnGetItemMarkup ( size_t  n) const
inlineoverride

Function OnGetItem returns the html text associated with the given index 'n'.

Parameters
nAn index into the list.
Returns
wxString - the simple html text to show in the listbox.

Definition at line 273 of file dialog_drclistbox.h.

274  {
275  return OnGetItem( n );
276  }
wxString OnGetItem(size_t n) const override
Function OnGetItem returns the html text associated with the DRC_ITEM given by index 'n'.

References OnGetItem().

◆ SetList()

void DRCLISTBOX::SetList ( EDA_UNITS_T  aUnits,
DRC_ITEM_LIST aList 
)
inline

Function SetList sets the DRC_ITEM_LIST for this listbox.

Ownership of the DRC_ITEM_LIST is transfered to this DRCLISTBOX.

Parameters
aListThe DRC_ITEM_LIST* containing the DRC_ITEMs which will be displayed in the wxHtmlListBox

Definition at line 218 of file dialog_drclistbox.h.

219  {
220  delete m_list;
221 
222  m_units = aUnits;
223  m_list = aList;
224  SetItemCount( aList->GetCount() );
225  Refresh();
226  }
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
EDA_UNITS_T m_units
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
virtual int GetCount()=0
Function GetCount returns the number of items in the list.

References DRC_ITEM_LIST::GetCount(), m_list, m_units, and Refresh().

Referenced by DRC::updatePointers().

Member Data Documentation

◆ m_list

DRC_ITEM_LIST* DRCLISTBOX::m_list
private

wxHtmlListBox does not own the list, I do

Definition at line 192 of file dialog_drclistbox.h.

Referenced by DeleteAllItems(), DeleteItem(), DRCLISTBOX(), GetItem(), OnGetItem(), SetList(), and ~DRCLISTBOX().

◆ m_units

EDA_UNITS_T DRCLISTBOX::m_units
private

Definition at line 191 of file dialog_drclistbox.h.

Referenced by DRCLISTBOX(), OnGetItem(), and SetList().


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