Debug GameListManager

This commit is contained in:
Loic Guegan 2022-12-26 06:48:11 +01:00
parent 723f7cc91b
commit 54cb4dc6c6
2 changed files with 12 additions and 0 deletions

View file

@ -29,10 +29,17 @@ void GameListManager::DisplayRow(long id){
game_list->SetItem(index, 4, row.Round);
game_list->SetItem(index, 5, row.Result);
game_list->SetItem(index, 6, row.Eco);
if(std::find(opened_items.begin(), opened_items.end(), index) != opened_items.end())
MarkItemAsOpen(index);
if(std::find(deleted_items.begin(), deleted_items.end(), index) != deleted_items.end())
MarkItemAsDeleted(index);
}
void GameListManager::Clear(){
game_list->DeleteAllItems();
deleted_items.clear();
opened_items.clear();
rows.clear();
}
@ -41,10 +48,12 @@ void GameListManager::ClearDisplayedRow(){
}
void GameListManager::MarkItemAsOpen(long item){
opened_items.push_back(item);
game_list->SetItemBackgroundColour(item, *wxGREEN);
}
void GameListManager::MarkItemAsDeleted(long item){
deleted_items.push_back(item);
game_list->SetItemBackgroundColour(item, *wxRED);
}

View file

@ -1,6 +1,8 @@
#pragma once
#include "ochess.hpp"
#include <algorithm>
#include <vector>
#define TERMS_IN(COL) (row.COL.find(terms) != std::string::npos)
@ -19,6 +21,7 @@ class GameListManager {
wxListCtrl *game_list;
long game_counter;
std::vector<RType> rows;
std::vector<long> deleted_items, opened_items;
void DisplayRow(long id);
void ClearDisplayedRow();