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
23#include <memory>
24#include <vector>
25
27#include <wx/listbase.h>
28
29
30class ACTION_MENU;
31class EDA_DRAW_FRAME;
32class SEARCH_PANE_TAB;
33
35{
36public:
37 SEARCH_HANDLER( const wxString& aName ) :
38 m_name( aName )
39 {}
40
41 wxString GetName() const { return m_name; }
42
43 std::vector<std::tuple<wxString, int, wxListColumnFormat>> GetColumns() const
44 {
45 return m_columns;
46 }
47
48 virtual int Search( const wxString& string ) = 0;
49 virtual wxString GetResultCell( int row, int col ) = 0;
50 virtual void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) = 0;
51
52 virtual void SelectItems( std::vector<long>& aItemRows ) {}
53 virtual void ActivateItem( long aItemRow ) {}
54
55protected:
56 wxString m_name;
57 std::vector<std::tuple<wxString, int, wxListColumnFormat>> m_columns;
58};
59
60
62{
63 bool m_ZoomToSelection = false;
64};
65
66
68{
69public:
70 SEARCH_PANE( EDA_DRAW_FRAME* aFrame );
71 virtual ~SEARCH_PANE();
72
73 void AddSearcher( SEARCH_HANDLER* aHandler );
74 void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
75 void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
76
77 void RefreshSearch();
78 void FocusSearch();
79 void ClearAllResults();
80
81protected:
82 void OnLanguageChange( wxCommandEvent& aEvent );
84
85private:
86 std::vector<SEARCH_HANDLER*> m_handlers;
87 std::vector<SEARCH_PANE_TAB*> m_tabs;
88 wxString m_lastQuery;
91};
92
93#endif
Defines 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:37
std::vector< std::tuple< wxString, int, wxListColumnFormat > > GetColumns() const
Definition: search_pane.h:43
virtual wxString GetResultCell(int row, int col)=0
virtual void Sort(int aCol, bool aAscending, std::vector< long > *aSelection)=0
virtual void SelectItems(std::vector< long > &aItemRows)
Definition: search_pane.h:52
wxString m_name
Definition: search_pane.h:56
std::vector< std::tuple< wxString, int, wxListColumnFormat > > m_columns
Definition: search_pane.h:57
wxString GetName() const
Definition: search_pane.h:41
virtual void ActivateItem(long aItemRow)
Definition: search_pane.h:53
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:87
void OnLanguageChange(wxCommandEvent &aEvent)
EDA_DRAW_FRAME * m_frame
Definition: search_pane.h:89
SEARCH_PANE_TAB * GetCurrentTab() const
ACTION_MENU * m_menu
Definition: search_pane.h:90
virtual ~SEARCH_PANE()
std::vector< SEARCH_HANDLER * > m_handlers
Definition: search_pane.h:86
void ClearAllResults()
void FocusSearch()
wxString m_lastQuery
Definition: search_pane.h:88
bool m_ZoomToSelection
Definition: search_pane.h:63