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

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 194 of file dialog_drclistbox.h.

197  : wxHtmlListBox( parent, id, pos, size, style )
198  {
199  m_list = 0;
200  }
DRC_ITEM_LIST * m_list
wxHtmlListBox does not own the list, I do
DRCLISTBOX::~DRCLISTBOX ( )
inline

Definition at line 203 of file dialog_drclistbox.h.

204  {
205  delete m_list; // I own it, I destroy it.
206  }
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 297 of file dialog_drclistbox.h.

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

Referenced by DIALOG_DRC_CONTROL::DelDRCMarkers().

298  {
299  if( m_list )
300  {
302  SetItemCount(0);
303  SetSelection( -1 ); // -1 is no selection
304  Refresh();
305  }
306  }
void Refresh()
Update the board display after modifying it bu 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 275 of file dialog_drclistbox.h.

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

Referenced by DIALOG_DRC_CONTROL::OnDeleteOneClick().

276  {
277  if( m_list )
278  {
279  int selection = GetSelection();
280 
281  m_list->DeleteItem( aIndex );
282  int count = m_list->GetCount();
283  SetItemCount( count );
284 
285  // if old selection >= new count
286  if( selection >= count )
287  SetSelection( count-1 ); // -1 is "no selection"
288  Refresh();
289  }
290  }
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 bu 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 230 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::OnPopupMenu(), DIALOG_DRC_CONTROL::OnRightUpClearance(), DIALOG_DRC_CONTROL::OnRightUpUnconnected(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), and DIALOG_DRC_CONTROL::writeReport().

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

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

247  {
248  if( m_list )
249  {
250  const DRC_ITEM* item = m_list->GetItem( (int) n );
251  if( item )
252  return item->ShowHtml();
253  }
254  return wxString();
255  }
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. ...
Definition: drc_item.h:43
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 ShowHtml() const
Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget&#39;s wxHtmlLi...
Definition: drc_item.h:147
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 264 of file dialog_drclistbox.h.

265  {
266  return OnGetItem( n );
267  }
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 ( 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 216 of file dialog_drclistbox.h.

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

Referenced by DRC::updatePointers().

217  {
218  delete m_list;
219 
220  m_list = aList;
221  SetItemCount( aList->GetCount() );
222  Refresh();
223  }
void Refresh()
Update the board display after modifying it bu 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.

Member Data Documentation

DRC_ITEM_LIST* DRCLISTBOX::m_list
private

wxHtmlListBox does not own the list, I do

Definition at line 191 of file dialog_drclistbox.h.


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