KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 The 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
23#include <memory>
24#include <vector>
25
27#include <wx/listbase.h>
28
29
30class wxAuiManagerEvent;
31class ACTION_MENU;
32class EDA_DRAW_FRAME;
33class SEARCH_PANE_TAB;
34
36{
37public:
38 SEARCH_HANDLER( const wxString& aName ) :
39 m_name( aName )
40 {}
41
43 {}
44
45 wxString GetName() const { return m_name; }
46
47 std::vector<std::tuple<wxString, int, wxListColumnFormat>> GetColumns() const
48 {
49 return m_columns;
50 }
51
52 virtual int Search( const wxString& string ) = 0;
53 virtual wxString GetResultCell( int row, int col ) = 0;
54 virtual void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) = 0;
55
56 virtual void SelectItems( std::vector<long>& aItemRows ) {}
57 virtual void ActivateItem( long aItemRow ) {}
58
59protected:
60 wxString m_name;
61 std::vector<std::tuple<wxString, int, wxListColumnFormat>> m_columns;
62};
63
64
66{
67public:
68 SEARCH_PANE( EDA_DRAW_FRAME* aFrame );
69 virtual ~SEARCH_PANE();
70
71 void AddSearcher( SEARCH_HANDLER* aHandler );
72 void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
73 void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
74
75 void RefreshSearch();
76 void FocusSearch();
77 void ClearAllResults();
78
79protected:
80 void OnLanguageChange( wxCommandEvent& aEvent );
82 void OnClosed( wxAuiManagerEvent& aEvent );
83
84private:
85 std::vector<SEARCH_HANDLER*> m_handlers;
86 std::vector<SEARCH_PANE_TAB*> m_tabs;
87 wxString m_lastQuery;
90};
91
92#endif
Define the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
The base class for create windows for drawing purpose.
SEARCH_HANDLER(const wxString &aName)
Definition: search_pane.h:38
std::vector< std::tuple< wxString, int, wxListColumnFormat > > GetColumns() const
Definition: search_pane.h:47
virtual wxString GetResultCell(int row, int col)=0
virtual ~SEARCH_HANDLER()
Definition: search_pane.h:42
virtual void Sort(int aCol, bool aAscending, std::vector< long > *aSelection)=0
virtual void SelectItems(std::vector< long > &aItemRows)
Definition: search_pane.h:56
wxString m_name
Definition: search_pane.h:60
std::vector< std::tuple< wxString, int, wxListColumnFormat > > m_columns
Definition: search_pane.h:61
wxString GetName() const
Definition: search_pane.h:45
virtual void ActivateItem(long aItemRow)
Definition: search_pane.h:57
virtual int Search(const wxString &string)=0
Class SEARCH_PANE_BASE.
void RefreshSearch()
void AddSearcher(SEARCH_HANDLER *aHandler)
void OnSearchTextEntry(wxCommandEvent &aEvent) override
void OnNotebookPageChanged(wxBookCtrlEvent &aEvent) override
std::vector< SEARCH_PANE_TAB * > m_tabs
Definition: search_pane.h:86
void OnLanguageChange(wxCommandEvent &aEvent)
EDA_DRAW_FRAME * m_frame
Definition: search_pane.h:88
SEARCH_PANE_TAB * GetCurrentTab() const
ACTION_MENU * m_menu
Definition: search_pane.h:89
virtual ~SEARCH_PANE()
std::vector< SEARCH_HANDLER * > m_handlers
Definition: search_pane.h:85
void ClearAllResults()
void FocusSearch()
wxString m_lastQuery
Definition: search_pane.h:87
void OnClosed(wxAuiManagerEvent &aEvent)