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 ( 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  {
200  m_list = 0;
201  }
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
DRCLISTBOX::~DRCLISTBOX ( )
inline

Definition at line 204 of file dialog_drclistbox.h.

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

Member Function Documentation

void DRCLISTBOX::DeleteAllItems ( )
inline

Function DeleteAllItems deletes all items in the list.

Definition at line 305 of file dialog_drclistbox.h.

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

Referenced by DIALOG_DRC_CONTROL::DelDRCMarkers().

306  {
307  if( m_list )
308  {
310  SetItemCount(0);
311  SetSelection( -1 ); // -1 is no selection
312  Refresh();
313  }
314  }
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.
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 283 of file dialog_drclistbox.h.

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

Referenced by DIALOG_DRC_CONTROL::OnDeleteOneClick().

284  {
285  if( m_list )
286  {
287  int selection = GetSelection();
288 
289  m_list->DeleteItem( aIndex );
290  int count = m_list->GetCount();
291  SetItemCount( count );
292 
293  // if old selection >= new count
294  if( selection >= count )
295  SetSelection( count-1 ); // -1 is "no selection"
296  Refresh();
297  }
298  }
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.
const DRC_ITEM* DRCLISTBOX::GetItem ( int  aIndex)
inline

Function GetItem returns a requested DRC_ITEM* or NULL.

Definition at line 232 of file dialog_drclistbox.h.

References DRC_ITEM_LIST::GetItem().

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

233  {
234  if( m_list )
235  {
236  return m_list->GetItem( aIndex );
237  }
238  return NULL;
239  }
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
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 248 of file dialog_drclistbox.h.

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

249  {
250  if( m_list )
251  {
252  const DRC_ITEM* item = m_list->GetItem( (int) n );
253  if( item )
254  {
255  wxColour color = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
256 
257  return wxString::Format( wxT( "<font color='%s'>%s</font>" ),
258  color.GetAsString( wxC2S_HTML_SYNTAX ),
259  item->ShowHtml( m_units ) );
260  }
261  }
262  return wxString();
263  }
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
wxString ShowHtml(EDA_UNITS_T aUnits) const
Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget&#39;s wxHtmlLi...
Definition: drc_item.cpp:156
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 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 272 of file dialog_drclistbox.h.

273  {
274  return OnGetItem( n );
275  }
wxString OnGetItem(size_t n) const override
Function OnGetItem returns the html text associated with the DRC_ITEM given by index &#39;n&#39;...
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 217 of file dialog_drclistbox.h.

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

Referenced by DRC::updatePointers().

218  {
219  delete m_list;
220 
221  m_units = aUnits;
222  m_list = aList;
223  SetItemCount( aList->GetCount() );
224  Refresh();
225  }
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.

Member Data Documentation

DRC_ITEM_LIST* DRCLISTBOX::m_list
private

wxHtmlListBox does not own the list, I do

Definition at line 192 of file dialog_drclistbox.h.

EDA_UNITS_T DRCLISTBOX::m_units
private

Definition at line 191 of file dialog_drclistbox.h.


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