2022-09-14 02:59:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-08-09 17:30:58 +00:00
|
|
|
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-09-14 02:59:57 +00:00
|
|
|
*
|
|
|
|
* 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_H
|
|
|
|
#define SEARCH_PANE_H
|
|
|
|
|
|
|
|
#include <widgets/search_pane_base.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class EDA_DRAW_FRAME;
|
|
|
|
class SEARCH_PANE_TAB;
|
|
|
|
|
|
|
|
class SEARCH_HANDLER
|
|
|
|
{
|
|
|
|
public:
|
2023-08-09 17:30:58 +00:00
|
|
|
SEARCH_HANDLER( const wxString& aName ) :
|
|
|
|
m_name( aName )
|
|
|
|
{}
|
2022-09-14 02:59:57 +00:00
|
|
|
|
|
|
|
wxString GetName() const { return m_name; }
|
|
|
|
|
2022-12-10 23:37:23 +00:00
|
|
|
std::vector<std::pair<wxString, int>> GetColumns() const { return m_columns; }
|
2022-09-14 02:59:57 +00:00
|
|
|
|
|
|
|
virtual int Search( const wxString& string ) = 0;
|
|
|
|
virtual wxString GetResultCell( int row, int col ) = 0;
|
2023-08-09 17:30:58 +00:00
|
|
|
virtual void Sort( int aCol, bool aAscending ) = 0;
|
2022-09-14 02:59:57 +00:00
|
|
|
|
2022-09-21 03:58:49 +00:00
|
|
|
virtual void SelectItems( std::vector<long>& aItemRows ) {}
|
2023-01-25 16:09:23 +00:00
|
|
|
virtual void ActivateItem( long aItemRow ) {}
|
2022-09-14 02:59:57 +00:00
|
|
|
|
|
|
|
protected:
|
2022-12-10 23:37:23 +00:00
|
|
|
wxString m_name;
|
|
|
|
std::vector<std::pair<wxString, int>> m_columns;
|
2022-09-14 02:59:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SEARCH_PANE : public SEARCH_PANE_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SEARCH_PANE( EDA_DRAW_FRAME* aFrame );
|
|
|
|
virtual ~SEARCH_PANE();
|
|
|
|
|
|
|
|
void AddSearcher( SEARCH_HANDLER* aHandler );
|
|
|
|
void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
|
2022-09-21 03:38:06 +00:00
|
|
|
void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
|
2022-09-14 02:59:57 +00:00
|
|
|
|
|
|
|
void RefreshSearch();
|
|
|
|
void OnLanguageChange();
|
|
|
|
void FocusSearch();
|
2022-09-21 03:38:06 +00:00
|
|
|
void ClearAllResults();
|
2022-09-14 02:59:57 +00:00
|
|
|
|
2022-09-21 03:38:06 +00:00
|
|
|
protected:
|
|
|
|
SEARCH_PANE_TAB* GetCurrentTab() const;
|
2022-09-14 02:59:57 +00:00
|
|
|
|
2022-09-21 03:38:06 +00:00
|
|
|
private:
|
2022-09-14 02:59:57 +00:00
|
|
|
std::vector<SEARCH_HANDLER*> m_handlers;
|
|
|
|
std::vector<SEARCH_PANE_TAB*> m_tabs;
|
|
|
|
wxString m_lastQuery;
|
|
|
|
};
|
|
|
|
|
2023-01-25 16:09:23 +00:00
|
|
|
#endif
|