ochess/src/base_tab/GameListManager.hpp

38 lines
894 B
C++
Raw Normal View History

2022-12-25 19:43:05 +01:00
#pragma once
2022-12-25 15:26:16 +01:00
#include "ochess.hpp"
2022-12-26 06:48:11 +01:00
#include <algorithm>
#include <vector>
2022-12-25 15:26:16 +01:00
2022-12-25 18:30:56 +01:00
#define TERMS_IN(COL) (row.COL.find(terms) != std::string::npos)
2022-12-25 15:26:16 +01:00
typedef std::string CType;
2022-12-25 16:29:17 +01:00
typedef struct Item {
CType White;
CType Black;
CType Event;
CType Round;
CType Result;
CType Eco;
} RType;
2022-12-25 15:26:16 +01:00
class GameListManager {
wxListCtrl *game_list;
long game_counter;
2022-12-25 16:29:17 +01:00
std::vector<RType> rows;
2022-12-26 06:48:11 +01:00
std::vector<long> deleted_items, opened_items;
2022-12-25 16:29:17 +01:00
void DisplayRow(long id);
2022-12-25 16:39:54 +01:00
void ClearDisplayedRow();
2022-12-25 15:26:16 +01:00
public:
GameListManager(wxListCtrl *game_list);
2022-12-25 16:29:17 +01:00
void AddGame(CType White,CType Black,CType Event,CType Round, CType Result, CType Eco);
2022-12-25 15:51:00 +01:00
void Clear();
2022-12-25 17:30:22 +01:00
void MarkItemAsOpen(long item);
void MarkItemAsDeleted(long item);
std::vector<long> GetSelectedItems();
long GetItemGameId(long item);
2022-12-25 18:30:56 +01:00
void Filter(std::string terms);
void ClearFilter();
2022-12-25 15:26:16 +01:00
};