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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SEARCH_HANDLERS_H
21#define SEARCH_HANDLERS_H
22
23#include <functional>
24#include <widgets/search_pane.h>
25
26class SCH_ITEM;
27class SCH_EDIT_FRAME;
28
34
36{
37public:
38 SCH_SEARCH_HANDLER( const wxString& aName, SCH_EDIT_FRAME* aFrame ) :
39 SEARCH_HANDLER( aName ),
40 m_frame( aFrame )
41 {}
42
43 void ActivateItem( long aItemRow ) override;
44
45 wxString GetResultCell( int aRow, int aCol ) override
46 {
47 if( m_frame->IsClosing() )
48 return wxEmptyString;
49
50 if( aRow >= static_cast<int>( m_hitlist.size() ) )
51 return wxEmptyString;
52
53 const SCH_SEARCH_HIT& hit = m_hitlist[aRow];
54
55 if( !hit.item )
56 return wxEmptyString;
57
58 return getResultCell( hit, aCol );
59 }
60
61 void FindAll( const std::function<bool( SCH_ITEM*, SCH_SHEET_PATH* )>& aCollector );
62 void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) override;
63 void SelectItems( std::vector<long>& aItemRows ) override;
64
65protected:
66 virtual wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) = 0;
67
68protected:
70 std::vector<SCH_SEARCH_HIT> m_hitlist;
71};
72
74{
75public:
77
78 int Search( const wxString& aQuery ) override;
79
80protected:
81 wxString getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) override;
82};
83
85{
86public:
88
89 int Search( const wxString& aQuery ) override;
90
91protected:
92 wxString getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) override;
93};
94
96{
97public:
99
100 int Search( const wxString& aQuery ) override;
101
102protected:
103 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
104};
105
107{
108public:
110
111 int Search( const wxString& aQuery ) override;
112
113protected:
114 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
115};
116
118{
119public:
121
122 int Search( const wxString& aQuery ) override;
123
124protected:
125 wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override;
126};
127
128#endif
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) override
GROUP_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
LABEL_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) override
POWER_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
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:162
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...
SEARCH_HANDLER(const wxString &aName)
Definition search_pane.h:38
wxString getResultCell(const SCH_SEARCH_HIT &aHit, int aCol) override
SYMBOL_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
TEXT_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override