KiCad PCB EDA Suite
NETS_LIST_CTRL Class Reference

Class NETS_LIST_CTRL is a helper to display lists of nets and associated netclasses used in dialog design rules. More...

#include <dialog_design_rules_aux_helper_class.h>

Inheritance diagram for NETS_LIST_CTRL:

Public Member Functions

 NETS_LIST_CTRL (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_ICON)
 
void ClearList ()
 
virtual wxString OnGetItemText (long item, long column) const override
 Function OnGetItemText is an overloaded method needed by wxListCtrl with wxLC_VIRTUAL options. More...
 
void SetRowItems (unsigned aRow, const wxString &aNetname, const wxString &aNetclassName)
 Function SetRowItems sets the net name and the net class name at aRow. More...
 

Private Attributes

wxArrayString m_Netnames
 column 0: nets More...
 
wxArrayString m_Classnames
 column 1: netclasses More...
 

Detailed Description

Class NETS_LIST_CTRL is a helper to display lists of nets and associated netclasses used in dialog design rules.

It's needed because the 2 "wxListCtl"s used to display lists of nets uses the wxLC_VIRTUAL option. The method:

virtual wxString OnGetItemText( long item, long column ) const

must be overloaded.

Definition at line 41 of file dialog_design_rules_aux_helper_class.h.

Constructor & Destructor Documentation

NETS_LIST_CTRL::NETS_LIST_CTRL ( wxWindow *  parent,
wxWindowID  id,
const wxPoint pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxLC_ICON 
)
inline

Definition at line 44 of file dialog_design_rules_aux_helper_class.h.

45  :
46  wxListCtrl( parent, id, pos, size, style )
47  {
48  };

Member Function Documentation

void NETS_LIST_CTRL::ClearList ( )
inline

Definition at line 50 of file dialog_design_rules_aux_helper_class.h.

References m_Classnames, and m_Netnames.

Referenced by DIALOG_DESIGN_RULES::FillListBoxWithNetNames().

51  {
52  SetItemCount( 0 );
53  m_Netnames.Clear();
54  m_Classnames.Clear();
55  }
wxArrayString m_Classnames
column 1: netclasses
wxArrayString m_Netnames
column 0: nets
wxString NETS_LIST_CTRL::OnGetItemText ( long  item,
long  column 
) const
overridevirtual

Function OnGetItemText is an overloaded method needed by wxListCtrl with wxLC_VIRTUAL options.

Definition at line 73 of file dialog_design_rules.cpp.

References m_Classnames, and m_Netnames.

74 {
75  if( column == 0 )
76  {
77  if( item < (long) m_Netnames.GetCount() )
78  return m_Netnames[item];
79  else
80  return wxEmptyString;
81  }
82  else if( item < (long) m_Classnames.GetCount() )
83  return m_Classnames[item];
84 
85  return wxEmptyString;
86 }
wxArrayString m_Classnames
column 1: netclasses
wxArrayString m_Netnames
column 0: nets
void NETS_LIST_CTRL::SetRowItems ( unsigned  aRow,
const wxString &  aNetname,
const wxString &  aNetclassName 
)

Function SetRowItems sets the net name and the net class name at aRow.

Parameters
aRow= row index (if aRow > number of stored row, empty rows will be created)
aNetname= the string to display in row aRow, column 0
aNetclassName= the string to display in row aRow, column 1

Definition at line 89 of file dialog_design_rules.cpp.

References m_Classnames, and m_Netnames.

Referenced by DIALOG_DESIGN_RULES::FillListBoxWithNetNames().

92 {
93  // insert blanks if aRow is larger than existing row count
94  unsigned cnt = m_Netnames.GetCount();
95 
96  if( cnt <= aRow )
97  m_Netnames.Add( wxEmptyString, aRow - cnt + 1 );
98 
99  cnt = m_Classnames.GetCount();
100 
101  if( cnt <= aRow )
102  m_Classnames.Add( wxEmptyString, aRow - cnt + 1 );
103 
104  if( (int)aRow <= GetItemCount() )
105  SetItemCount( aRow + 1 );
106 
107  m_Netnames[aRow] = aNetname;
108  m_Classnames[aRow] = aNetclassName;
109 }
wxArrayString m_Classnames
column 1: netclasses
wxArrayString m_Netnames
column 0: nets

Member Data Documentation

wxArrayString NETS_LIST_CTRL::m_Classnames
private

column 1: netclasses

Definition at line 74 of file dialog_design_rules_aux_helper_class.h.

Referenced by ClearList(), OnGetItemText(), and SetRowItems().

wxArrayString NETS_LIST_CTRL::m_Netnames
private

column 0: nets

Definition at line 73 of file dialog_design_rules_aux_helper_class.h.

Referenced by ClearList(), OnGetItemText(), and SetRowItems().


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