mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +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);
|
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){
|
void GameListManager::AddGame(CType White,CType Black,CType Event,CType Round, CType Result, CType Eco){
|
||||||
long index =
|
// Update rows elements
|
||||||
game_list->InsertItem(game_counter, std::to_string(game_counter)); // want this for col. 1
|
rows.push_back({White,Black,Event,Round,Result,Eco});
|
||||||
game_list->SetItem(index, 1, W);
|
// Display the row
|
||||||
game_list->SetItem(index, 2, B);
|
DisplayRow(game_counter);
|
||||||
game_list->SetItem(index, 3, Evt);
|
|
||||||
game_list->SetItem(index, 4, Rnd);
|
|
||||||
game_list->SetItem(index, 5, Res);
|
|
||||||
game_list->SetItem(index, 6, Eco);
|
|
||||||
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(){
|
void GameListManager::Clear(){
|
||||||
game_list->DeleteAllItems();
|
game_list->DeleteAllItems();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,23 @@
|
||||||
|
|
||||||
typedef std::string CType;
|
typedef std::string CType;
|
||||||
|
|
||||||
|
typedef struct Item {
|
||||||
|
CType White;
|
||||||
|
CType Black;
|
||||||
|
CType Event;
|
||||||
|
CType Round;
|
||||||
|
CType Result;
|
||||||
|
CType Eco;
|
||||||
|
} RType;
|
||||||
|
|
||||||
class GameListManager {
|
class GameListManager {
|
||||||
wxListCtrl *game_list;
|
wxListCtrl *game_list;
|
||||||
long game_counter;
|
long game_counter;
|
||||||
|
std::vector<RType> rows;
|
||||||
|
|
||||||
|
void DisplayRow(long id);
|
||||||
public:
|
public:
|
||||||
GameListManager(wxListCtrl *game_list);
|
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();
|
void Clear();
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue