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-2023 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#include <wx/listbase.h>
26
27class EDA_DRAW_FRAME;
28class SEARCH_PANE_TAB;
29
31{
32public:
33 SEARCH_HANDLER( const wxString& aName ) :
34 m_name( aName )
35 {}
36
37 wxString GetName() const { return m_name; }
38
39 std::vector<std::tuple<wxString, int, wxListColumnFormat>> GetColumns() const
40 {
41 return m_columns;
42 }
43
44 virtual int Search( const wxString& string ) = 0;
45 virtual wxString GetResultCell( int row, int col ) = 0;
46 virtual void Sort( int aCol, bool aAscending ) = 0;
47
48 virtual void SelectItems( std::vector<long>& aItemRows ) {}
49 virtual void ActivateItem( long aItemRow ) {}
50
51protected:
52 wxString m_name;
53 std::vector<std::tuple<wxString, int, wxListColumnFormat>> m_columns;
54};
55
57{
58public:
59 SEARCH_PANE( EDA_DRAW_FRAME* aFrame );
60 virtual ~SEARCH_PANE();
61
62 void AddSearcher( SEARCH_HANDLER* aHandler );
63 void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
64 void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
65
66 void RefreshSearch();
67 void FocusSearch();
68 void ClearAllResults();
69
70protected:
71 void OnLanguageChange( wxCommandEvent& aEvent );
73
74private:
75 std::vector<SEARCH_HANDLER*> m_handlers;
76 std::vector<SEARCH_PANE_TAB*> m_tabs;
77 wxString m_lastQuery;
79};
80
81#endif
The base class for create windows for drawing purpose.
SEARCH_HANDLER(const wxString &aName)
Definition: search_pane.h:33
virtual void Sort(int aCol, bool aAscending)=0
std::vector< std::tuple< wxString, int, wxListColumnFormat > > GetColumns() const
Definition: search_pane.h:39
virtual wxString GetResultCell(int row, int col)=0
virtual void SelectItems(std::vector< long > &aItemRows)
Definition: search_pane.h:48
wxString m_name
Definition: search_pane.h:52
std::vector< std::tuple< wxString, int, wxListColumnFormat > > m_columns
Definition: search_pane.h:53
wxString GetName() const
Definition: search_pane.h:37
virtual void ActivateItem(long aItemRow)
Definition: search_pane.h:49
virtual int Search(const wxString &string)=0
Class SEARCH_PANE_BASE.
void RefreshSearch()
Definition: search_pane.cpp:69
void AddSearcher(SEARCH_HANDLER *aHandler)
Definition: search_pane.cpp:59
void OnSearchTextEntry(wxCommandEvent &aEvent) override
Definition: search_pane.cpp:87
void OnNotebookPageChanged(wxBookCtrlEvent &aEvent) override
std::vector< SEARCH_PANE_TAB * > m_tabs
Definition: search_pane.h:76
void OnLanguageChange(wxCommandEvent &aEvent)
Definition: search_pane.cpp:40
EDA_DRAW_FRAME * m_frame
Definition: search_pane.h:78
SEARCH_PANE_TAB * GetCurrentTab() const
virtual ~SEARCH_PANE()
Definition: search_pane.cpp:34
std::vector< SEARCH_HANDLER * > m_handlers
Definition: search_pane.h:75
void ClearAllResults()
Definition: search_pane.cpp:78
void FocusSearch()
Definition: search_pane.cpp:96
wxString m_lastQuery
Definition: search_pane.h:77