25#include <wx/clipbrd.h>
28 wxWindowID winid,
const wxPoint& pos,
29 const wxSize& size ) :
30 wxListView( parent, winid, pos, size, wxLC_REPORT | wxLC_VIRTUAL ),
33 m_sortAscending( true ),
34 m_selectionDirty( false )
64 long idx = GetFirstSelected();
69 aSelectedList.emplace_back( idx );
71 idx = GetNextSelected( idx );
75 aSelectedList.emplace_back( idx );
76 idx = GetNextSelected( idx );
83 long item = aEvent.GetIndex();
116 std::vector<long> list;
144 if( aEvent.GetKeyCode() == WXK_CONTROL_A )
147 for(
int row = 0; row < GetItemCount(); row++ )
148 SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
150 else if( aEvent.GetKeyCode() == WXK_CONTROL_C )
153 if( wxTheClipboard->Open() )
156 for(
int row = 0; row < GetItemCount(); row++ )
158 if( GetItemState( row, wxLIST_STATE_SELECTED ) == wxLIST_STATE_SELECTED )
160 for(
int col = 0; col < GetColumnCount(); col++ )
162 if( GetColumnWidth( col ) > 0 )
164 txt += GetItemText( row, col );
165 if( row <= GetItemCount() - 1 )
173 wxTheClipboard->SetData(
new wxTextDataObject( txt ) );
174 wxTheClipboard->Close();
191 std::vector<std::tuple<wxString, int, wxListColumnFormat>> columns =
m_handler->
GetColumns();
193 for(
auto& [ columnName, colProportion, colAlign ] : columns )
194 AppendColumn( wxGetTranslation( columnName ), colAlign );
196 int widthUnit = GetClientSize().GetWidth() / 10;
198 for(
int ii = 0; ii < (int) columns.size(); ++ii )
199 SetColumnWidth( ii, widthUnit * std::get<1>( columns[ ii ] ) );
212 const wxPoint& aLocation,
const wxSize& aSize ) :
213 wxPanel( parent, aId, aLocation, aSize ),
216 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
219 sizer->Add(
m_listView, 5, wxRIGHT | wxBOTTOM | wxEXPAND, 1 );
virtual void Sort(int aCol, bool aAscending)=0
std::vector< std::tuple< wxString, int, wxListColumnFormat > > GetColumns() const
virtual wxString GetResultCell(int row, int col)=0
virtual void SelectItems(std::vector< long > &aItemRows)
virtual void ActivateItem(long aItemRow)
virtual int Search(const wxString &string)=0
void OnItemDeselected(wxListEvent &aEvent)
SEARCH_PANE_LISTVIEW(SEARCH_HANDLER *handler, wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void GetSelectRowsList(std::vector< long > &aSelectedList)
void OnColClicked(wxListEvent &aEvent)
void OnChar(wxKeyEvent &aEvent)
void OnItemSelected(wxListEvent &aEvent)
SEARCH_HANDLER * m_handler
void OnItemActivated(wxListEvent &aEvent)
virtual ~SEARCH_PANE_LISTVIEW()
void OnUpdateUI(wxUpdateUIEvent &aEvent)
wxString OnGetItemText(long item, long column) const override
void RefreshColumnNames()
SEARCH_HANDLER * m_handler
void Search(wxString &query)
SEARCH_PANE_LISTVIEW * m_listView
void RefreshColumnNames()
SEARCH_PANE_TAB(SEARCH_HANDLER *handler, wxWindow *parent, wxWindowID aId=wxID_ANY, const wxPoint &aLocation=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...