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 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 <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( m_frame->IsClosing() )
43 return wxEmptyString;
44
45 if( aRow >= static_cast<int>(m_hitlist.size() ) )
46 return wxEmptyString;
47
48 BOARD_ITEM* item = m_hitlist[aRow];
49
50 if( !item )
51 return wxEmptyString;
52
53 return getResultCell( item, aCol );
54 }
55
56 void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) override;
57
58 void SelectItems( std::vector<long>& aItemRows ) override;
59 void ActivateItem( long aItemRow ) override;
60
61protected:
62 virtual wxString getResultCell( BOARD_ITEM* aItem, int aCol ) = 0;
63
64protected:
66 std::vector<BOARD_ITEM*> m_hitlist;
67};
68
69
71{
72public:
74
75 int Search( const wxString& aQuery ) override;
76
77private:
78 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
79};
80
81
83{
84public:
86
87 int Search( const wxString& aQuery ) override;
88
89private:
90 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
91};
92
93
95{
96public:
98
99 int Search( const wxString& aQuery ) override;
100
101private:
102 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
103};
104
105
107{
108public:
110
111 int Search( const wxString& aQuery ) override;
112
113private:
114 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
115};
116
117
119{
120public:
122
123 int Search( const wxString& aQuery ) override;
124 void SelectItems( std::vector<long>& aItemRows ) override;
125 void ActivateItem( long aItemRow ) override;
126
127private:
128 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
129};
130
131
133{
134public:
136
137 int Search( const wxString& aQuery ) override;
138 void SelectItems( std::vector<long>& aItemRows ) override;
139 void ActivateItem( long aItemRow ) override;
140
141private:
142 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
143};
144
145#endif
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
bool IsClosing() const
int Search(const wxString &aQuery) override
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) 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 Sort(int aCol, bool aAscending, std::vector< long > *aSelection) override
void SelectItems(std::vector< long > &aItemRows) 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