mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-06 01:56:28 +02:00
Update game list
This commit is contained in:
parent
060ed65712
commit
b9fd97c2ac
2 changed files with 30 additions and 10 deletions
|
@ -11,18 +11,26 @@ GameListManager::GameListManager(wxListCtrl *game_list): game_list(game_list), g
|
|||
game_list->InsertColumn(6, L"ECO", wxLIST_FORMAT_LEFT, 200);
|
||||
}
|
||||
|
||||
void GameListManager::AddGame(CType W,CType B,CType Evt,CType Rnd, CType Res, CType Eco){
|
||||
long index =
|
||||
game_list->InsertItem(game_counter, std::to_string(game_counter)); // want this for col. 1
|
||||
game_list->SetItem(index, 1, W);
|
||||
game_list->SetItem(index, 2, B);
|
||||
game_list->SetItem(index, 3, Evt);
|
||||
game_list->SetItem(index, 4, Rnd);
|
||||
game_list->SetItem(index, 5, Res);
|
||||
game_list->SetItem(index, 6, Eco);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -2,11 +2,23 @@
|
|||
|
||||
typedef std::string CType;
|
||||
|
||||
typedef struct Item {
|
||||
CType White;
|
||||
CType Black;
|
||||
CType Event;
|
||||
CType Round;
|
||||
CType Result;
|
||||
CType Eco;
|
||||
} RType;
|
||||
|
||||
class GameListManager {
|
||||
wxListCtrl *game_list;
|
||||
long game_counter;
|
||||
std::vector<RType> rows;
|
||||
|
||||
void DisplayRow(long id);
|
||||
public:
|
||||
GameListManager(wxListCtrl *game_list);
|
||||
void AddGame(CType W,CType B,CType Evt,CType Rnd, CType Res, CType Eco);
|
||||
void AddGame(CType White,CType Black,CType Event,CType Round, CType Result, CType Eco);
|
||||
void Clear();
|
||||
};
|
Loading…
Add table
Reference in a new issue