diff options
Diffstat (limited to 'src/achievements_pane.cpp')
-rw-r--r-- | src/achievements_pane.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/achievements_pane.cpp b/src/achievements_pane.cpp new file mode 100644 index 0000000..8ec3727 --- /dev/null +++ b/src/achievements_pane.cpp | |||
@@ -0,0 +1,33 @@ | |||
1 | #include "achievements_pane.h" | ||
2 | |||
3 | #include "ap_state.h" | ||
4 | #include "game_data.h" | ||
5 | |||
6 | AchievementsPane::AchievementsPane(wxWindow* parent) | ||
7 | : wxListView(parent, wxID_ANY) { | ||
8 | AppendColumn("Achievement"); | ||
9 | |||
10 | for (int panel_id : GD_GetAchievementPanels()) { | ||
11 | achievement_names_.push_back(GD_GetPanel(panel_id).achievement_name); | ||
12 | } | ||
13 | |||
14 | std::sort(std::begin(achievement_names_), std::end(achievement_names_)); | ||
15 | |||
16 | for (int i = 0; i < achievement_names_.size(); i++) { | ||
17 | InsertItem(i, achievement_names_.at(i)); | ||
18 | } | ||
19 | |||
20 | SetColumnWidth(0, wxLIST_AUTOSIZE); | ||
21 | |||
22 | UpdateIndicators(); | ||
23 | } | ||
24 | |||
25 | void AchievementsPane::UpdateIndicators() { | ||
26 | for (int i = 0; i < achievement_names_.size(); i++) { | ||
27 | if (AP_HasAchievement(achievement_names_.at(i))) { | ||
28 | SetItemTextColour(i, *wxBLACK); | ||
29 | } else { | ||
30 | SetItemTextColour(i, *wxRED); | ||
31 | } | ||
32 | } | ||
33 | } | ||