From f060f9e047afcbfcfcf8552248532f324d1f3d13 Mon Sep 17 00:00:00 2001 From: Blaypeg Date: Sun, 25 May 2014 21:59:26 +0100 Subject: [PATCH] Set Game List columns as sortable --- rpcs3/Gui/GameViewer.cpp | 7 ++++--- rpcs3/Gui/GameViewer.h | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index c57efd12c8..7f79afc6cf 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -26,14 +26,14 @@ void GameViewer::DoResize(wxSize size) SetSize(size); } -int wxCALLBACK ListItemCompare(long item1, long item2, long sortinfo) +int wxCALLBACK ListItemCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortinfo) { ListSortInfo *SortInfo = (ListSortInfo *)sortinfo; int Column = SortInfo->Column; GameViewer *pGameViewer = SortInfo->GameViewerCtrl; bool SortAscending = SortInfo->SortAscending; - long index1 = pGameViewer->FindItem(0, item1); - long index2 = pGameViewer->FindItem(0, item2); + long index1 = pGameViewer->FindItem(-1, item1); + long index2 = pGameViewer->FindItem(-1, item2); wxString string1 = pGameViewer->GetItemText(index1, Column); wxString string2 = pGameViewer->GetItemText(index2, Column); @@ -65,6 +65,7 @@ void GameViewer::OnColClick(wxListEvent& event) SortInfo.Column = event.GetColumn(); SortInfo.GameViewerCtrl = this; SortItems(ListItemCompare, (long)&SortInfo); + } diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index e14d5b4f1e..85457bdc6b 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -140,8 +140,13 @@ public: for(u32 i=0; idata.size(); ++i) { - if(list->GetItemCount() <= (int)i) list->InsertItem(i, wxEmptyString); + if (list->GetItemCount() <= (int)i) + { + list->InsertItem(i, wxEmptyString); + list->SetItemData(i, i); + } list->SetItem(i, c, fmt::FromUTF8(col->data[i])); + } } }