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 );
101 ~FOOTPRINTS_LISTBOX() override {};
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
119 void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent,
120 const wxString& aFootPrintFilterPattern, int aFilterType );
121
122 wxString GetSelectedFootprint();
123
128 wxString OnGetItemText( long item, long column ) const override;
129
130 // Events functions:
131 void OnLeftClick( wxListEvent& event );
132 void OnLeftDClick( wxListEvent& event );
133 void OnChar( wxKeyEvent& event );
134
136
137private:
138 wxArrayString m_footprintList;
139};
140
141
143{
144public:
145 LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
146 ~LIBRARY_LISTBOX() override {};
147
148 int GetCount();
149 void SetSelection( int index, bool State = true );
150 void SetString( unsigned linecount, const wxString& text );
151 void AppendLine( const wxString& text );
152 void Finish();
153 void ClearList();
154
155 wxString GetSelectedLibrary();
156 wxString OnGetItemText( long item, long column ) const override;
157
158 void OnSelectLibrary( wxListEvent& event );
159
171 void OnChar( wxKeyEvent& event );
172
174
175private:
176 wxArrayString m_libraryList;
177};
178
179
181{
182public:
183 SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
184
186
187 void Clear();
188 int GetCount();
189
194 wxString OnGetItemText( long item, long column ) const override;
195 wxListItemAttr* OnGetItemAttr( long item) const override;
196
197 /*
198 * Enable or disable an item
199 */
200 void SetSelection( int index, bool State = true );
201 void SetString( unsigned linecount, const wxString& text );
202 void AppendLine( const wxString& text );
203 void AppendWarning( int index );
204 void RemoveWarning( int index );
205
206 // Events functions:
207
219 void OnChar( wxKeyEvent& event );
220
221 void OnSelectComponent( wxListEvent& event );
222
224
225public:
226 wxArrayString m_SymbolList;
227
228private:
229 std::vector<long> m_symbolWarning;
230 std::unique_ptr<wxListItemAttr> m_warningAttr;
231};
232
233
234#endif //#ifndef LISTBOXES_H
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
The CvPcb application main window.
wxArrayString m_footprintList
Definition: listboxes.h:138
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...
~FOOTPRINTS_LISTBOX() override
Definition: listboxes.h:101
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:176
wxString OnGetItemText(long item, long column) const override
~LIBRARY_LISTBOX() override
Definition: listboxes.h:146
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:229
void OnChar(wxKeyEvent &event)
Called on a key press.
wxListItemAttr * OnGetItemAttr(long item) const override
wxArrayString m_SymbolList
Definition: listboxes.h:226
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:230
void RemoveWarning(int index)
void AppendLine(const wxString &text)