kicad/include/widgets/search_pane_tab.h

83 lines
2.5 KiB
C
Raw Normal View History

2022-09-14 02:59:57 +00:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEARCH_PANE_TAB_H
#define SEARCH_PANE_TAB_H
2022-09-21 07:18:34 +00:00
#include <vector>
2022-09-14 02:59:57 +00:00
#include <wx/listctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
class SEARCH_HANDLER;
class SEARCH_PANE_LISTVIEW : public wxListView
{
public:
SEARCH_PANE_LISTVIEW( SEARCH_HANDLER* handler,
wxWindow* parent, wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize );
virtual ~SEARCH_PANE_LISTVIEW();
2022-09-14 02:59:57 +00:00
void RefreshColumnNames();
std::vector<long> Sort();
2022-09-14 02:59:57 +00:00
protected:
wxString OnGetItemText( long item, long column ) const override;
2022-09-21 03:38:06 +00:00
void OnItemSelected( wxListEvent& aEvent );
void OnItemActivated( wxListEvent& aEvent );
void OnItemDeselected( wxListEvent& aEvent );
void OnColClicked( wxListEvent& aEvent );
void OnUpdateUI( wxUpdateUIEvent& aEvent );
void OnChar( wxKeyEvent& aEvent );
2022-09-21 07:04:31 +00:00
void GetSelectRowsList( std::vector<long>& aSelectedList );
2022-09-14 02:59:57 +00:00
private:
SEARCH_HANDLER* m_handler;
int m_sortCol;
bool m_sortAscending;
bool m_selectionDirty;
2022-09-14 02:59:57 +00:00
};
class SEARCH_PANE_TAB : public wxPanel
{
public:
SEARCH_PANE_TAB( SEARCH_HANDLER* handler, wxWindow* parent, wxWindowID aId = wxID_ANY,
const wxPoint& aLocation = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize );
void Search( wxString& query );
2022-09-21 03:38:06 +00:00
void Clear();
2022-09-14 02:59:57 +00:00
void RefreshColumnNames();
SEARCH_HANDLER* GetSearchHandler() const { return m_handler; }
private:
SEARCH_PANE_LISTVIEW* m_listView;
SEARCH_HANDLER* m_handler;
};
#endif