1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "GameListManager.hpp"
GameListManager::GameListManager(wxListCtrl *game_list): game_list(game_list), game_counter(0) {
game_list->InsertColumn(0, L"Id", wxLIST_FORMAT_LEFT, 50);
game_list->InsertColumn(1, L"White", wxLIST_FORMAT_LEFT, 200);
game_list->InsertColumn(2, L"Black", wxLIST_FORMAT_LEFT, 200);
game_list->InsertColumn(3, L"Event", wxLIST_FORMAT_LEFT, 150);
game_list->InsertColumn(4, L"Round", wxLIST_FORMAT_LEFT, 100);
game_list->InsertColumn(5, L"Result", wxLIST_FORMAT_LEFT, 200);
game_list->InsertColumn(6, L"ECO", wxLIST_FORMAT_LEFT, 200);
}
void GameListManager::AddGame(CType White,CType Black,CType Event,CType Round, CType Result, CType Eco){
// Update rows elements
rows.push_back({White,Black,Event,Round,Result,Eco});
// Display the row
DisplayRow(game_counter);
game_counter++;
}
void GameListManager::DisplayRow(long id){
RType row=rows[id];
long index =
game_list->InsertItem(game_counter, std::to_string(id)); // want this for col. 1
game_list->SetItem(index, 1, row.White);
game_list->SetItem(index, 2, row.Black);
game_list->SetItem(index, 3, row.Event);
game_list->SetItem(index, 4, row.Round);
game_list->SetItem(index, 5, row.Result);
game_list->SetItem(index, 6, row.Eco);
}
void GameListManager::Clear(){
game_list->DeleteAllItems();
rows.clear();
}
void GameListManager::ClearDisplayedRow(){
game_list->DeleteAllItems();
}
|