The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
connect.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 - 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#define GETTEXT_DOMAIN "wesnoth-lib"
17
19
23#include "help/help.hpp"
24
25#include <functional>
26
27namespace gui2::dialogs
28{
29
30REGISTER_DIALOG(addon_connect)
31
32addon_connect::addon_connect(std::string& host_name, bool allow_remove)
33 : modal_dialog(window_id())
34 , allow_remove_(allow_remove)
35{
36 register_text("host_name", false, host_name, true);
37}
38
40{
41 help::show_help("installing_addons");
42}
43
45{
46 find_widget<button>("remove_addons")
47 .set_active(allow_remove_);
48
49 connect_signal_mouse_left_click(
50 find_widget<button>("show_help"),
51 std::bind(&addon_connect::help_button_callback, this));
52}
53
55{
56 if(get_retval() == retval::OK) {
57 text_box& host_widget
58 = find_widget<text_box>("host_name");
59
60 host_widget.save_to_history();
61 }
62}
63
64} // namespace dialogs
virtual void pre_show() override
Actions to be taken before showing the window.
Definition connect.cpp:44
bool allow_remove_
Enable the addon remove button?
Definition connect.hpp:40
virtual void post_show() override
Actions to be taken after the window has been shown.
Definition connect.cpp:54
Abstract base class for all modal dialogs.
A widget that allows the user to input text in single line.
Definition text_box.hpp:125
void save_to_history()
Saves the text in the widget to the history.
Definition text_box.hpp:132
int get_retval()
Definition window.hpp:394
This file contains the window object, this object is a top level container which has the event manage...
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
@ OK
Dialog was closed with the OK button.
Definition retval.hpp:35
void show_help(const std::string &show_topic)
Open the help browser.
Definition help.cpp:84
STL namespace.