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 189 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.

References m_list.

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

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

Referenced by DIALOG_DRC_CONTROL::DelDRCMarkers().

299  {
300  if( m_list )
301  {
303  SetItemCount(0);
304  SetSelection( -1 ); // -1 is no selection
305  Refresh();
306  }
307  }
void Refresh()
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 276 of file dialog_drclistbox.h.

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

Referenced by DIALOG_DRC_CONTROL::OnDeleteOneClick().

277  {
278  if( m_list )
279  {
280  int selection = GetSelection();
281 
282  m_list->DeleteItem( aIndex );
283  int count = m_list->GetCount();
284  SetItemCount( count );
285 
286  // if old selection >= new count
287  if( selection >= count )
288  SetSelection( count-1 ); // -1 is "no selection"
289  Refresh();
290  }
291  }
virtual void DeleteItem(int aIndex)=0
Function DeleteAllItems removes and deletes desired item from the list.
void Refresh()
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 231 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().

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

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

Referenced by OnGetItemMarkup().

248  {
249  if( m_list )
250  {
251  const DRC_ITEM* item = m_list->GetItem( (int) n );
252  if( item )
253  return item->ShowHtml();
254  }
255  return wxString();
256  }
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. ...
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's wxHtmlLi...
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 265 of file dialog_drclistbox.h.

References OnGetItem().

266  {
267  return OnGetItem( n );
268  }
wxString OnGetItem(size_t n) const override
Function OnGetItem returns the html text associated with the DRC_ITEM given by index 'n'...
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 217 of file dialog_drclistbox.h.

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

Referenced by DRC::updatePointers().

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

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


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