KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/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 (C) 2022-2023 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 <widgets/search_pane.h>
28
29class PCB_EDIT_FRAME;
30
31
33{
34public:
35 PCB_SEARCH_HANDLER( const wxString& aName, PCB_EDIT_FRAME* aFrame ) :
36 SEARCH_HANDLER( aName ),
37 m_frame( aFrame )
38 {}
39
40 wxString GetResultCell( int aRow, int aCol ) override
41 {
42 if( aRow >= static_cast<int>(m_hitlist.size() ) )
43 return wxEmptyString;
44
45 BOARD_ITEM* item = m_hitlist[aRow];
46
47 if( !item )
48 return wxEmptyString;
49
50 return getResultCell( item, aCol );
51 }
52
53 void Sort( int aCol, bool aAscending ) override;
54
55 void SelectItems( std::vector<long>& aItemRows ) override;
56 void ActivateItem( long aItemRow ) override;
57
58protected:
59 virtual wxString getResultCell( BOARD_ITEM* aItem, int aCol ) = 0;
60
61protected:
63 std::vector<BOARD_ITEM*> m_hitlist;
64};
65
66
68{
69public:
71
72 int Search( const wxString& aQuery ) override;
73
74private:
75 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
76};
77
78
80{
81public:
83
84 int Search( const wxString& aQuery ) override;
85
86private:
87 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
88};
89
90
92{
93public:
95
96 int Search( const wxString& aQuery ) override;
97
98private:
99 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
100};
101
102
104{
105public:
107
108 int Search( const wxString& aQuery ) override;
109 void SelectItems( std::vector<long>& aItemRows ) override;
110 void ActivateItem( long aItemRow ) override;
111
112private:
113 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
114};
115
116
118{
119public:
121
122 int Search( const wxString& aQuery ) override;
123 void SelectItems( std::vector<long>& aItemRows ) override;
124 void ActivateItem( long aItemRow ) override;
125
126private:
127 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
128};
129
130#endif
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
int Search(const wxString &aQuery) override
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
void ActivateItem(long aItemRow) override
int Search(const wxString &aQuery) override
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
void SelectItems(std::vector< long > &aItemRows) override
The main frame for Pcbnew.
void ActivateItem(long aItemRow) override
PCB_SEARCH_HANDLER(const wxString &aName, PCB_EDIT_FRAME *aFrame)
wxString GetResultCell(int aRow, int aCol) override
void SelectItems(std::vector< long > &aItemRows) override
void Sort(int aCol, bool aAscending) override
std::vector< BOARD_ITEM * > m_hitlist
virtual wxString getResultCell(BOARD_ITEM *aItem, int aCol)=0
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
int Search(const wxString &aQuery) override
void SelectItems(std::vector< long > &aItemRows) override
void ActivateItem(long aItemRow) override
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
int Search(const wxString &aQuery) override