The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
campaign_selection.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2009 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
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#pragma once
17
19
22
23#include <boost/dynamic_bitset.hpp>
24
25namespace gui2::dialogs
26{
27
29{
31public:
32 /**
33 * RNG mode selection values.
34 *
35 * @note The contents of this enum must match the order of the options
36 * defined in the WML for the "rng_menu" widget of this dialog.
37 */
44
45 //return value for opening addon manager
46 const static int OPEN_ADDON_MANAGER = 3;
47
49
50 /***** ***** ***** setters / getters for members ***** ****** *****/
51
52 int get_choice() const
53 {
54 return choice_;
55 }
56
58 {
59 return rng_mode_;
60 }
61
62 const std::string& get_difficulty() const
63 {
65 }
66
67private:
68 /** Called when an item in the left-hand pane (the tree view) is selected. */
69 void campaign_selected();
70
71 /** Called when the difficulty selection changes. */
73
74 virtual const std::string& window_id() const override;
75
76 virtual void pre_show() override;
77 virtual void post_show() override;
78
79 void sort_campaigns(CAMPAIGN_ORDER order, bool ascending);
80
81 void add_campaign_to_tree(const config& campaign);
82
84
85 void mod_toggled();
86
87 void filter_text_changed(const std::string& text);
88
90
91 /** The chosen campaign. */
93
94 /** whether the player checked the "Deterministic" checkbox. */
96
97 boost::dynamic_bitset<> mod_states_;
98
99 std::vector<std::string> page_ids_;
100
101 std::vector<std::string> difficulties_;
102
104
106
108
109 std::vector<std::string> last_search_words_;
110
111 std::vector<std::string> mod_ids_;
112};
113
114} // namespace dialogs
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
void toggle_sorting_selection(CAMPAIGN_ORDER order)
RNG_MODE rng_mode_
whether the player checked the "Deterministic" checkbox.
const std::string & get_difficulty() const
void difficulty_selected()
Called when the difficulty selection changes.
std::vector< std::string > mod_ids_
std::vector< std::string > difficulties_
virtual void pre_show() override
Actions to be taken before showing the window.
void sort_campaigns(CAMPAIGN_ORDER order, bool ascending)
virtual void post_show() override
Actions to be taken after the window has been shown.
void add_campaign_to_tree(const config &campaign)
void filter_text_changed(const std::string &text)
virtual const std::string & window_id() const override
The ID of the window to build.
void campaign_selected()
Called when an item in the left-hand pane (the tree view) is selected.
std::vector< std::string > last_search_words_
std::vector< std::string > page_ids_
Abstract base class for all modal dialogs.