KiCad PCB EDA Suite
Loading...
Searching...
No Matches
search_pane.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 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef SEARCH_PANE_H
21#define SEARCH_PANE_H
22
24#include <vector>
25
26class EDA_DRAW_FRAME;
27class SEARCH_PANE_TAB;
28
30{
31public:
32 SEARCH_HANDLER( wxString aName ) :
33 m_name( aName ) {}
34
35 wxString GetName() const { return m_name; }
36
37 std::vector<std::pair<wxString, int>> GetColumns() const { return m_columns; }
38
39 virtual int Search( const wxString& string ) = 0;
40 virtual wxString GetResultCell( int row, int col ) = 0;
41
42 virtual void SelectItems( std::vector<long>& aItemRows ) {}
43 virtual void ActivateItem( long aItemRow ) {}
44
45protected:
46 wxString m_name;
47 std::vector<std::pair<wxString, int>> m_columns;
48};
49
51{
52public:
53 SEARCH_PANE( EDA_DRAW_FRAME* aFrame );
54 virtual ~SEARCH_PANE();
55
56 void AddSearcher( SEARCH_HANDLER* aHandler );
57 void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
58 void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
59
60 void RefreshSearch();
61 void OnLanguageChange();
62 void FocusSearch();
63 void ClearAllResults();
64
65protected:
67
68private:
69 std::vector<SEARCH_HANDLER*> m_handlers;
70 std::vector<SEARCH_PANE_TAB*> m_tabs;
71 wxString m_lastQuery;
72};
73
74#endif
The base class for create windows for drawing purpose.
std::vector< std::pair< wxString, int > > m_columns
Definition: search_pane.h:47
SEARCH_HANDLER(wxString aName)
Definition: search_pane.h:32
virtual wxString GetResultCell(int row, int col)=0
std::vector< std::pair< wxString, int > > GetColumns() const
Definition: search_pane.h:37
virtual void SelectItems(std::vector< long > &aItemRows)
Definition: search_pane.h:42
wxString m_name
Definition: search_pane.h:46
wxString GetName() const
Definition: search_pane.h:35
virtual void ActivateItem(long aItemRow)
Definition: search_pane.h:43
virtual int Search(const wxString &string)=0
Class SEARCH_PANE_BASE.
void RefreshSearch()
Definition: search_pane.cpp:62
void OnLanguageChange()
Definition: search_pane.cpp:37
void AddSearcher(SEARCH_HANDLER *aHandler)
Definition: search_pane.cpp:52
void OnSearchTextEntry(wxCommandEvent &aEvent) override
Definition: search_pane.cpp:80
void OnNotebookPageChanged(wxBookCtrlEvent &aEvent) override
Definition: search_pane.cpp:95
std::vector< SEARCH_PANE_TAB * > m_tabs
Definition: search_pane.h:70
SEARCH_PANE_TAB * GetCurrentTab() const
virtual ~SEARCH_PANE()
Definition: search_pane.cpp:32
std::vector< SEARCH_HANDLER * > m_handlers
Definition: search_pane.h:69
void ClearAllResults()
Definition: search_pane.cpp:71
void FocusSearch()
Definition: search_pane.cpp:89
wxString m_lastQuery
Definition: search_pane.h:71