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 The 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
49 virtual ~ITEMS_LISTBOX_BASE() = default;
50
55 int GetSelection();
56
60 void DeselectAll();
61
62 virtual CVPCB_MAINFRAME* GetParent() const;
63
71 void UpdateWidth( int aLine = -1 );
72
73 void Shutdown() { m_isClosing = true; }
74
75private:
81 void UpdateLineWidth( unsigned aLine, wxClientDC& dc );
82
83protected:
85
86private:
88};
89
90
92{
93public:
98 enum FP_FILTER_T: int
99 {
103 FILTERING_BY_LIBRARY = 0x0004
104 };
105
106 FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
107 virtual ~FOOTPRINTS_LISTBOX() = default;
108
109 int GetCount();
110 void SetSelection( int aIndex, bool aState = true );
111 void SetSelectedFootprint( const LIB_ID& aFPID );
112 void SetString( unsigned linecount, const wxString& text );
113
125 void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent,
126 const wxString& aFootPrintFilterPattern, int aFilterType );
127
128 wxString GetSelectedFootprint();
129
134 wxString OnGetItemText( long item, long column ) const override;
135
136 // Events functions:
137 void OnLeftClick( wxListEvent& event );
138 void OnLeftDClick( wxListEvent& event );
139 void OnChar( wxKeyEvent& event );
140
142
143private:
144 wxArrayString m_footprintList;
145};
146
147
149{
150public:
151 LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
152 virtual ~LIBRARY_LISTBOX() = default;
153
154 int GetCount();
155 void SetSelection( int index, bool State = true );
156 void SetString( unsigned linecount, const wxString& text );
157 void AppendLine( const wxString& text );
158 void Finish();
159 void ClearList();
160
161 wxString GetSelectedLibrary();
162 wxString OnGetItemText( long item, long column ) const override;
163
164 void OnSelectLibrary( wxListEvent& event );
165
177 void OnChar( wxKeyEvent& event );
178
180
181private:
182 wxArrayString m_libraryList;
183};
184
185
187{
188public:
189 SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
190 virtual ~SYMBOLS_LISTBOX() = default;
191
192 void Clear();
193 int GetCount();
194
199 wxString OnGetItemText( long item, long column ) const override;
200 wxListItemAttr* OnGetItemAttr( long item) const override;
201
202 /*
203 * Enable or disable an item
204 */
205 void SetSelection( int index, bool State = true );
206 void SetString( unsigned linecount, const wxString& text );
207 void AppendLine( const wxString& text );
208 void AppendWarning( int index );
209 void RemoveWarning( int index );
210
211 // Events functions:
212
224 void OnChar( wxKeyEvent& event );
225
226 void OnSelectComponent( wxListEvent& event );
227
229
230public:
231 wxArrayString m_SymbolList;
232
233private:
234 std::vector<long> m_symbolWarning;
235 std::unique_ptr<wxListItemAttr> m_warningAttr;
236};
237
238
239#endif //#ifndef LISTBOXES_H
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:100
The CvPcb application main window.
wxArrayString m_footprintList
Definition: listboxes.h:144
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:99
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition: listboxes.h:101
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 ...
virtual ~FOOTPRINTS_LISTBOX()=default
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
virtual ~ITEMS_LISTBOX_BASE()=default
void SetString(unsigned linecount, const wxString &text)
wxArrayString m_libraryList
Definition: listboxes.h:182
wxString OnGetItemText(long item, long column) const override
void OnChar(wxKeyEvent &event)
Called on a key press.
virtual ~LIBRARY_LISTBOX()=default
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
virtual ~SYMBOLS_LISTBOX()=default
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:234
void OnChar(wxKeyEvent &event)
Called on a key press.
wxListItemAttr * OnGetItemAttr(long item) const override
wxArrayString m_SymbolList
Definition: listboxes.h:231
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:235
void RemoveWarning(int index)
void AppendLine(const wxString &text)