The Battle for Wesnoth  1.17.21+dev
sp_options_configure.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2023
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
19 #include "gui/widgets/settings.hpp"
20 
21 namespace gui2::dialogs
22 {
23 
24 REGISTER_DIALOG(sp_options_configure)
25 
26 sp_options_configure::sp_options_configure(ng::create_engine& create_engine, ng::configure_engine& config_engine)
27  : modal_dialog(window_id())
28  , create_engine_(create_engine)
29  , config_engine_(config_engine)
30  , options_manager_()
31 {
32 }
33 
35 {
37  options_manager_->update_all_options();
38 }
39 
41 {
42  if(window.get_retval() == retval::OK) {
43  config_engine_.set_options(options_manager_->get_options_config());
44  }
45 }
46 
47 } // namespace dialogs
Abstract base class for all modal dialogs.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
std::unique_ptr< mp_options_helper > options_manager_
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:67
int get_retval()
Definition: window.hpp:365
void set_options(const config &cfg)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
@ OK
Dialog was closed with the OK button.
Definition: retval.hpp:35
This file contains the settings handling of the widget library.