forked from ennorehling/csmapfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistics.h
101 lines (74 loc) · 2.03 KB
/
statistics.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef _CSMAP_STATISTICS
#define _CSMAP_STATISTICS
#include <fx.h>
#include <list>
#include <vector>
#include <map>
#include <set>
#include "datafile.h"
class FXStatistics : public FXVerticalFrame
{
FXDECLARE(FXStatistics)
public:
FXStatistics(FXComposite* p, FXObject* tgt=NULL,FXSelector sel=0, FXuint opts=0, FXint x=0,FXint y=0,FXint w=0,FXint h=0);
void create();
virtual ~FXStatistics();
void mapfiles(std::list<datafile> *f);
void loadState(FXRegistry& reg);
void saveState(FXRegistry& reg);
public:
long onChangeFaction(FXObject*,FXSelector,void*);
long onChangeFilter(FXObject*,FXSelector,void*);
long updChangeFilter(FXObject*,FXSelector,void*);
long onPopup(FXObject*,FXSelector,void*);
long onPopupClicked(FXObject*,FXSelector,void*);
long onMapChange(FXObject*,FXSelector,void*);
long onQueryHelp(FXObject*,FXSelector,void*);
public:
enum
{
ID_FACTIONBOX = FXVerticalFrame::ID_LAST,
ID_FILTERBOX,
ID_LIST,
ID_POPUP_CLICKED,
ID_LAST
};
protected:
datafile::SelectionState selection;
std::list<datafile> *files;
// control box
FXComboBox *factionBox;
FXToolBarTab *opTab;
// the list
FXList *list;
struct
{
// ID of selected faction (in box)
int faction;
// selected filter
int filter;
enum
{
FILTER_PERSONS = (1<<0),
FILTER_ITEMS = (1<<1),
FILTER_TALENTS = (1<<2),
FILTER_SHIPS = (1<<3),
FILTER_BUILDINGS= (1<<4)
};
} select;
struct entry
{
std::vector<std::pair<int, int> > list; // saves: (UnitID, Number) or (shipId, Number)
};
std::map<int, entry> entries; // maps ListItem-Idx to entry
protected:
void updateList();
void collectFactionList(std::set<int> &factions, datablock::itor region);
void collectData(std::map<FXString, entry> &persons, std::map<FXString, entry> &items,
std::map<std::pair<FXString,int>, entry> &talents, std::map<FXString, entry> &ships,
std::map<FXString, entry> &buildings, datablock::itor region);
protected:
FXStatistics(){}
FXStatistics(const FXStatistics&) {}
};
#endif //_CSMAP_STATISTICS