The Battle for Wesnoth  1.17.23+dev
achievements_dialog.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2023
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #include "achievements.hpp"
18 #include "gui/widgets/listbox.hpp"
20 
21 #pragma once
22 
23 namespace gui2::dialogs
24 {
25 
26 /**
27  * @ingroup GUIWindowDefinitionWML
28  *
29  * This shows a dialog displaying achievements.
30  *
31  * Key |Type |Mandatory|Description
32  * --------------------------|-------------|---------|-----------
33  * selected_achievements_list|menu_button |yes |Allows selecting achievements by what content they're for.
34  * name |label |yes |The user displayed name of the achievement.
35  * description |label |yes |The achievement's longer description.
36  * icon |image |yes |An icon to display to the left of the achievement.
37  */
39 {
40 public:
42 
44 
45 private:
47  std::string last_selected_;
50 
51  void set_sub_achievements(grid& newrow, const achievement& ach);
52 
53  void set_achievements_row();
54 
55  virtual const std::string& window_id() const override;
56 
57  virtual void pre_show(window& window) override;
58 
59  virtual void post_show(window& window) override;
60 };
61 
62 } // namespace gui2::dialogs
This class is responsible for reading all available achievements from mainline's and any add-ons' ach...
This shows a dialog displaying achievements.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
virtual const std::string & window_id() const override
The ID of the window to build.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
void set_sub_achievements(grid &newrow, const achievement &ach)
Abstract base class for all modal dialogs.
Base container class.
Definition: grid.hpp:32
The listbox class.
Definition: listbox.hpp:46
A menu_button is a styled_widget to choose an element from a list of elements.
Definition: menu_button.hpp:62
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:67
#define DEFINE_SIMPLE_EXECUTE_WRAPPER(dialog)
Adds a bare-bonesstatic execute function to a dialog class that immediately invokes and return the re...
Represents a single achievement and its data.