KiCad PCB EDA Suite
Loading...
Searching...
No Matches
listboxes.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef LISTBOXES_H
25#define LISTBOXES_H
26
27#include <wx/listctrl.h>
28#include <footprint_filter.h>
29#include <memory>
30
31/* Forward declarations of all top-level window classes. */
32class CVPCB_MAINFRAME;
33class COMPONENT;
34class FOOTPRINT_LIST;
35
36#define LISTBOX_STYLE ( wxBORDER_NONE | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
37 wxVSCROLL | wxHSCROLL )
38
42class ITEMS_LISTBOX_BASE : public wxListView
43{
44public:
45 ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
46 const wxPoint& aLocation = wxDefaultPosition,
47 const wxSize& aSize = wxDefaultSize, long aStyle = 0 );
48
50
55 int GetSelection();
56
60 void DeselectAll();
61
62 virtual CVPCB_MAINFRAME* GetParent() const;
63
71 void UpdateWidth( int aLine = -1 );
72
73private:
79 void UpdateLineWidth( unsigned aLine, wxClientDC& dc );
80
82};
83
84
86{
87public:
92 enum FP_FILTER_T: int
93 {
98 };
99
100 FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
102
103 int GetCount();
104 void SetSelection( int aIndex, bool aState = true );
105 void SetSelectedFootprint( const LIB_ID& aFPID );
106 void SetString( unsigned linecount, const wxString& text );
107 void AppendLine( const wxString& text );
108
120 void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent,
121 const wxString& aFootPrintFilterPattern, int aFilterType );
122
123 wxString GetSelectedFootprint();
124
129 wxString OnGetItemText( long item, long column ) const override;
130
131 // Events functions:
132 void OnLeftClick( wxListEvent& event );
133 void OnLeftDClick( wxListEvent& event );
134 void OnChar( wxKeyEvent& event );
135
137
138private:
139 wxArrayString m_footprintList;
140};
141
142
144{
145public:
146 LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
148
149 int GetCount();
150 void SetSelection( int index, bool State = true );
151 void SetString( unsigned linecount, const wxString& text );
152 void AppendLine( const wxString& text );
153 void Finish();
154 void ClearList();
155
156 wxString GetSelectedLibrary();
157 wxString OnGetItemText( long item, long column ) const override;
158
159 void OnSelectLibrary( wxListEvent& event );
160
172 void OnChar( wxKeyEvent& event );
173
175
176private:
177 wxArrayString m_libraryList;
178};
179
180
182{
183public:
184 SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
185
187
188 void Clear();
189 int GetCount();
190
195 wxString OnGetItemText( long item, long column ) const override;
196 wxListItemAttr* OnGetItemAttr( long item) const override;
197
198 /*
199 * Enable or disable an item
200 */
201 void SetSelection( int index, bool State = true );
202 void SetString( unsigned linecount, const wxString& text );
203 void AppendLine( const wxString& text );
204 void AppendWarning( int index );
205 void RemoveWarning( int index );
206
207 // Events functions:
208
220 void OnChar( wxKeyEvent& event );
221
222 void OnSelectComponent( wxListEvent& event );
223
225
226public:
227 wxArrayString m_SymbolList;
228
229private:
230 std::vector<long> m_symbolWarning;
231 std::unique_ptr<wxListItemAttr> m_warningAttr;
232};
233
234
235#endif //#ifndef LISTBOXES_H
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:86
The CvPcb application main window.
void AppendLine(const wxString &text)
wxArrayString m_footprintList
Definition: listboxes.h:139
void OnLeftClick(wxListEvent &event)
void OnLeftDClick(wxListEvent &event)
void SetSelectedFootprint(const LIB_ID &aFPID)
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Populate the wxListCtrl with the footprints from aList that meet the filter criteria defined by aFilt...
FP_FILTER_T
Filter setting constants.
Definition: listboxes.h:93
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition: listboxes.h:95
void SetString(unsigned linecount, const wxString &text)
void OnChar(wxKeyEvent &event)
wxString OnGetItemText(long item, long column) const override
This overloaded function MUST be provided for the wxLC_VIRTUAL mode because real data is not handled ...
void SetSelection(int aIndex, bool aState=true)
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
Base class to display symbol and footprint lists.
Definition: listboxes.h:43
void UpdateWidth(int aLine=-1)
Update the width of the column based on its contents.
void DeselectAll()
Remove all selection in lists which can have more than one item selected.
void UpdateLineWidth(unsigned aLine, wxClientDC &dc)
Calculate the width of the given line, and increase the column width if needed.
virtual CVPCB_MAINFRAME * GetParent() const
void SetString(unsigned linecount, const wxString &text)
wxArrayString m_libraryList
Definition: listboxes.h:177
wxString OnGetItemText(long item, long column) const override
void OnChar(wxKeyEvent &event)
Called on a key press.
void OnSelectLibrary(wxListEvent &event)
void AppendLine(const wxString &text)
void SetSelection(int index, bool State=true)
wxString GetSelectedLibrary()
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
wxString OnGetItemText(long item, long column) const override
This overloaded function MUST be provided for the wxLC_VIRTUAL mode because real data is not handled ...
std::vector< long > m_symbolWarning
Definition: listboxes.h:230
void OnChar(wxKeyEvent &event)
Called on a key press.
wxListItemAttr * OnGetItemAttr(long item) const override
wxArrayString m_SymbolList
Definition: listboxes.h:227
void OnSelectComponent(wxListEvent &event)
void SetString(unsigned linecount, const wxString &text)
void SetSelection(int index, bool State=true)
void AppendWarning(int index)
std::unique_ptr< wxListItemAttr > m_warningAttr
Definition: listboxes.h:231
void RemoveWarning(int index)
void AppendLine(const wxString &text)