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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef LISTBOXES_H
21#define LISTBOXES_H
22
23#include <wx/listctrl.h>
24#include <footprint_filter.h>
25#include <memory>
26
27/* Forward declarations of all top-level window classes. */
28class CVPCB_MAINFRAME;
29class COMPONENT;
30class FOOTPRINT_LIST;
31
32#define LISTBOX_STYLE ( wxBORDER_NONE | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
33 wxVSCROLL | wxHSCROLL )
34
38class ITEMS_LISTBOX_BASE : public wxListView
39{
40public:
41 ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
42 const wxPoint& aLocation = wxDefaultPosition,
43 const wxSize& aSize = wxDefaultSize, long aStyle = 0 );
44
45 virtual ~ITEMS_LISTBOX_BASE() = default;
46
51 int GetSelection();
52
56 void DeselectAll();
57
58 virtual CVPCB_MAINFRAME* GetParent() const;
59
67 void UpdateWidth( int aLine = -1 );
68
69 void Shutdown() { m_isClosing = true; }
70
71private:
77 void UpdateLineWidth( unsigned aLine, wxClientDC& dc );
78
79protected:
81
82private:
84};
85
86
88{
89public:
101
102 FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
103 virtual ~FOOTPRINTS_LISTBOX() = default;
104
105 int GetCount();
106 void SetSelection( int aIndex, bool aState = true );
107 void SetSelectedFootprint( const LIB_ID& aFPID );
108 void SetString( unsigned linecount, const wxString& text );
109
121 void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent,
122 const wxString& aFootPrintFilterPattern, int aFilterType );
123
124 wxString GetSelectedFootprint();
125
130 wxString OnGetItemText( long item, long column ) const override;
131
132 // Events functions:
133 void OnLeftClick( wxListEvent& event );
134 void OnLeftDClick( wxListEvent& event );
135 void OnChar( wxKeyEvent& event );
136
138
139private:
140 wxArrayString m_footprintList;
141};
142
143
145{
146public:
147 LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
148 virtual ~LIBRARY_LISTBOX() = default;
149
150 int GetCount();
151 void SetSelection( int index, bool State = true );
152 void SetString( unsigned linecount, const wxString& text );
153 void AppendLine( const wxString& text );
154 void Finish();
155 void ClearList();
156
157 wxString GetSelectedLibrary();
158 wxString OnGetItemText( long item, long column ) const override;
159
160 void OnSelectLibrary( wxListEvent& event );
161
173 void OnChar( wxKeyEvent& event );
174
176
177private:
178 wxArrayString m_libraryList;
179};
180
181
183{
184public:
185 SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
186 virtual ~SYMBOLS_LISTBOX() = default;
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
int index
Store all of the related component information found in a netlist.
The CvPcb application main window.
FOOTPRINTS_LISTBOX(CVPCB_MAINFRAME *parent, wxWindowID id)
wxArrayString m_footprintList
Definition listboxes.h:140
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:95
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition listboxes.h:97
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...
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.
ITEMS_LISTBOX_BASE(CVPCB_MAINFRAME *aParent, wxWindowID aId, const wxPoint &aLocation=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, long aStyle=0)
virtual CVPCB_MAINFRAME * GetParent() const
virtual ~ITEMS_LISTBOX_BASE()=default
void SetString(unsigned linecount, const wxString &text)
wxArrayString m_libraryList
Definition listboxes.h:178
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)
LIBRARY_LISTBOX(CVPCB_MAINFRAME *parent, wxWindowID id)
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:45
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: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)
SYMBOLS_LISTBOX(CVPCB_MAINFRAME *parent, wxWindowID id)
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)