KiCad PCB EDA Suite
Loading...
Searching...
No Matches
wx_listbox.cpp
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 3
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
#include <
widgets/wx_listbox.h
>
21
#include <
lib_tree_model_adapter.h
>
22
23
/*
24
* A specialization of wxListBox with support for pinned items.
25
*/
26
27
28
wxString
WX_LISTBOX::GetStringSelection
()
const
29
{
30
wxString str = wxListBox::GetStringSelection();
31
32
if
( str.StartsWith(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
() ) )
33
str = str.substr(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
().length() );
34
35
return
str;
36
}
37
38
39
bool
WX_LISTBOX::SetStringSelection
(
const
wxString& s )
40
{
41
if
( wxListBox::SetStringSelection(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
() + s ) )
42
return
true
;
43
44
return
wxListBox::SetStringSelection( s );
45
}
46
47
48
bool
WX_LISTBOX::SetStringSelection
(
const
wxString& s,
bool
select )
49
{
50
if
( wxListBox::SetStringSelection(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
() + s, select ) )
51
return
true
;
52
53
return
wxListBox::SetStringSelection( s, select );
54
}
55
56
57
wxString
WX_LISTBOX::GetBaseString
(
int
n )
const
58
{
59
wxString str = wxListBox::GetString( n );
60
61
if
( str.StartsWith(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
() ) )
62
str = str.substr(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
().length() );
63
64
return
str;
65
}
66
67
68
int
WX_LISTBOX::FindString
(
const
wxString& s,
bool
bCase )
const
69
{
70
int
retVal = wxListBox::FindString(
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
() + s, bCase );
71
72
if
( retVal == wxNOT_FOUND )
73
retVal = wxListBox::FindString( s, bCase );
74
75
return
retVal;
76
}
LIB_TREE_MODEL_ADAPTER::GetPinningSymbol
static const wxString GetPinningSymbol()
Definition
lib_tree_model_adapter.h:110
WX_LISTBOX::GetBaseString
wxString GetBaseString(int n) const
Definition
wx_listbox.cpp:57
WX_LISTBOX::FindString
int FindString(const wxString &s, bool bCase=false) const override
Definition
wx_listbox.cpp:68
WX_LISTBOX::GetStringSelection
wxString GetStringSelection() const override
Definition
wx_listbox.cpp:28
WX_LISTBOX::SetStringSelection
bool SetStringSelection(const wxString &s) override
Definition
wx_listbox.cpp:39
lib_tree_model_adapter.h
wx_listbox.h
src
common
widgets
wx_listbox.cpp
Generated on Fri Jun 26 2026 00:05:33 for KiCad PCB EDA Suite by
1.13.2