39 const wxArrayString& aItemHeaders,
40 const std::vector<wxArrayString>& aItemList,
41 const wxString& aSelection ) :
59 GetSizer()->Fit(
this );
67 for(
unsigned i = 0; i < aItemHeaders.Count(); i++ )
69 m_listBox->InsertColumn( i, aItemHeaders.Item( i ),
75 if( !aSelection.IsEmpty() )
77 long sel =
m_listBox->FindItem( -1, aSelection );
79 if( sel != wxNOT_FOUND )
81 m_listBox->SetItemState( sel, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
95 m_listBox->SetSingleStyle( wxLC_NO_HEADER,
true );
110 filter = wxT(
"*" ) +
m_filterBox->GetLineText( 0 ).MakeLower() + wxT(
"*" );
116 itemName = row.Item( 0 );
118 if( itemName.MakeLower().Matches( filter ) )
128 wxCHECK_MSG(
unsigned( aColumn ) <
unsigned(
m_listBox->GetColumnCount() ), wxEmptyString,
129 wxT(
"Invalid list control column." ) );
131 long item =
m_listBox->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
137 info.m_mask = wxLIST_MASK_TEXT;
138 info.m_itemId = item;
139 info.m_col = aColumn;
145 return wxEmptyString;
153 m_listBox->SetItemPtrData( itemIndex, wxUIntPtr( &itemList[0] ) );
156 for(
unsigned i = 1; i < itemList.size(); i++ )
157 m_listBox->SetItem( itemIndex, i, itemList[i] );
163 for(
unsigned row = 0; row < itemList.size(); row++ )
165 wxASSERT( (
int) itemList[row].GetCount() ==
m_listBox->GetColumnCount() );
167 for(
unsigned col = 0; col < itemList[row].GetCount(); col++ )
170 info.m_itemId = row + position;
172 info.m_text = itemList[row].Item( col );
174 info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH;
178 info.m_data = wxUIntPtr( &itemList[row].Item( col ) );
179 info.m_mask |= wxLIST_MASK_DATA;
203 wxIntPtr WXUNUSED( aSortData ) )
205 wxString* component1Name = (wxString*) aItem1;
206 wxString* component2Name = (wxString*) aItem2;
208 return StrNumCmp( *component1Name, *component2Name,
true );
void initDialog(const wxArrayString &aItemHeaders, const wxString &aSelection)
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
void textChangeInFilterBox(wxCommandEvent &event) override
void SetOKLabel(const wxString &aLabel)
EDA_LIST_DIALOG(EDA_DRAW_FRAME *aParent, const wxString &aTitle, const wxArrayString &aItemHeaders, const std::vector< wxArrayString > &aItemList, const wxString &aRefText)
void Append(const wxArrayString &aItemStr)
The base class for create windows for drawing purpose.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static int wxCALLBACK myCompareFunction(wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED(aSortData))
Helper dialog and control classes.
Class EDA_LIST_DIALOG_BASE.
wxStaticText * m_listLabel
const std::vector< wxArrayString > * m_itemsList
static int DEFAULT_COL_WIDTHS[]
void InsertItems(const std::vector< wxArrayString > &aItemList, int aPosition=0)
void onListItemActivated(wxListEvent &event) override
void SetListLabel(const wxString &aLabel)