KiCad PCB EDA Suite
Loading...
Searching...
No Matches
search_pane_tab.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_TAB_H
21#define SEARCH_PANE_TAB_H
22
23#include <vector>
24#include <memory>
25#include <wx/event.h>
26#include <wx/listctrl.h>
27#include <wx/sizer.h>
28#include <wx/panel.h>
29
30class SEARCH_HANDLER;
31
32
33class SEARCH_PANE_LISTVIEW : public wxListView
34{
35public:
36 SEARCH_PANE_LISTVIEW( const std::shared_ptr<SEARCH_HANDLER>& aHandler, wxWindow* parent,
37 wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize );
39
40 virtual ~SEARCH_PANE_LISTVIEW();
41
42 void RefreshColumnNames();
43
44 std::vector<long> Sort();
45
46protected:
47 wxString OnGetItemText( long item, long column ) const override;
48 void OnItemSelected( wxListEvent& aEvent );
49 void OnItemActivated( wxListEvent& aEvent );
50 void OnItemDeselected( wxListEvent& aEvent );
51 void OnColClicked( wxListEvent& aEvent );
52 void OnUpdateUI( wxUpdateUIEvent& aEvent );
53 void OnChar( wxKeyEvent& aEvent );
54 void OnContextMenu( wxContextMenuEvent& aEvent );
55 void OnCopyMenu( wxCommandEvent& aEvent );
56
57 void GetSelectRowsList( std::vector<long>& aSelectedList );
59
60private:
61 std::shared_ptr<SEARCH_HANDLER> m_handler;
65};
66
67
68class SEARCH_PANE_TAB : public wxPanel
69{
70public:
71 SEARCH_PANE_TAB( const std::shared_ptr<SEARCH_HANDLER>& aHandler, wxWindow* parent, wxWindowID aId = wxID_ANY,
72 const wxPoint& aLocation = wxDefaultPosition, const wxSize& aSize = wxDefaultSize );
73
74 void Search( wxString& query );
75 void Clear();
76 void RefreshColumnNames();
77
78 std::shared_ptr<SEARCH_HANDLER> GetSearchHandler() const { return m_handler; }
79
80private:
82 std::shared_ptr<SEARCH_HANDLER> m_handler;
83};
84
85#endif
void OnItemDeselected(wxListEvent &aEvent)
void GetSelectRowsList(std::vector< long > &aSelectedList)
void OnColClicked(wxListEvent &aEvent)
void OnChar(wxKeyEvent &aEvent)
SEARCH_PANE_LISTVIEW(const std::shared_ptr< SEARCH_HANDLER > &aHandler, wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void OnCopyMenu(wxCommandEvent &aEvent)
void OnContextMenu(wxContextMenuEvent &aEvent)
std::shared_ptr< SEARCH_HANDLER > m_handler
void OnItemSelected(wxListEvent &aEvent)
void OnItemActivated(wxListEvent &aEvent)
std::vector< long > Sort()
void OnUpdateUI(wxUpdateUIEvent &aEvent)
wxString OnGetItemText(long item, long column) const override
std::shared_ptr< SEARCH_HANDLER > m_handler
void Search(wxString &query)
SEARCH_PANE_TAB(const std::shared_ptr< SEARCH_HANDLER > &aHandler, wxWindow *parent, wxWindowID aId=wxID_ANY, const wxPoint &aLocation=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
SEARCH_PANE_LISTVIEW * m_listView
std::shared_ptr< SEARCH_HANDLER > GetSearchHandler() const