KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema/widgets/search_handlers.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 SEARCH_HANDLERS_H
25#define SEARCH_HANDLERS_H
26
27#include <functional>
28#include <widgets/search_pane.h>
29
30class SCH_ITEM;
31class SCH_EDIT_FRAME;
32
34{
37};
38
40{
41public:
42 SCH_SEARCH_HANDLER( const wxString& aName, SCH_EDIT_FRAME* aFrame ) :
43 SEARCH_HANDLER( aName ),
44 m_frame( aFrame )
45 {}
46
47 void ActivateItem( long aItemRow ) override;
48
49 wxString GetResultCell( int aRow, int aCol ) override
50 {
51 if( m_frame->IsClosing() )
52 return wxEmptyString;
53
54 if( aRow >= static_cast<int>( m_hitlist.size() ) )
55 return wxEmptyString;
56
57 const SCH_SEARCH_HIT& hit = m_hitlist[aRow];
58
59 if( !hit.item )
60 return wxEmptyString;
61
62 return getResultCell( hit, aCol );
63 }
64
65 void FindAll( const std::function<bool( SCH_ITEM*, SCH_SHEET_PATH* )>& aCollector );
66 void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) override;
67 void SelectItems( std::vector<long>& aItemRows ) override;
68
69protected:
70 virtual wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) = 0;
71
72protected:
74 std::vector<SCH_SEARCH_HIT> m_hitlist;
75};
76
78{
79public:
81
82 int Search( const wxString& aQuery ) override;
83
84protected:
85 wxString getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) override;
86};
87
89{
90public:
92
93 int Search( const wxString& aQuery ) override;
94
95protected:
96 wxString getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) override;
97};
98
100{
101public:
103
104 int Search( const wxString& aQuery ) override;
105
106protected:
107 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
108};
109
111{
112public:
114
115 int Search( const wxString& aQuery ) override;
116
117protected:
118 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
119};
120
122{
123public:
125
126 int Search( const wxString& aQuery ) override;
127
128protected:
129 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
130};
131
132#endif
bool IsClosing() const
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) override
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &aHit, int aCol) override
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
virtual wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol)=0
std::vector< SCH_SEARCH_HIT > m_hitlist
void SelectItems(std::vector< long > &aItemRows) override
void FindAll(const std::function< bool(SCH_ITEM *, SCH_SHEET_PATH *)> &aCollector)
void Sort(int aCol, bool aAscending, std::vector< long > *aSelection) override
void ActivateItem(long aItemRow) override
wxString GetResultCell(int aRow, int aCol) override
SCH_SEARCH_HANDLER(const wxString &aName, SCH_EDIT_FRAME *aFrame)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString getResultCell(const SCH_SEARCH_HIT &aHit, int aCol) override
int Search(const wxString &aQuery) override
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override