diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-25 16:29:17 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-25 16:29:17 +0100 |
| commit | b9fd97c2ac56c1037ef19d2916515ee3fbbf751f (patch) | |
| tree | f24f0d14c656c9d37ebcc2bd56f1e0f14d96e4a9 /src/base_tab | |
| parent | 060ed65712242cc42aac21585b3829bca316088d (diff) | |
Update game list
Diffstat (limited to 'src/base_tab')
| -rw-r--r-- | src/base_tab/GameListManager.cpp | 26 | ||||
| -rw-r--r-- | src/base_tab/GameListManager.hpp | 14 |
2 files changed, 30 insertions, 10 deletions
diff --git a/src/base_tab/GameListManager.cpp b/src/base_tab/GameListManager.cpp index 2f43802..3b6b4a7 100644 --- a/src/base_tab/GameListManager.cpp +++ b/src/base_tab/GameListManager.cpp @@ -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(); } diff --git a/src/base_tab/GameListManager.hpp b/src/base_tab/GameListManager.hpp index de57e56..485bc87 100644 --- a/src/base_tab/GameListManager.hpp +++ b/src/base_tab/GameListManager.hpp @@ -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(); };
\ No newline at end of file |
