The Battle for Wesnoth  1.15.13+dev
mp_join_game.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by the Battle for Wesnoth Project https://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #define GETTEXT_DOMAIN "wesnoth-lib"
15 
17 
18 #include "chat_log.hpp"
19 #include "font/text_formatting.hpp"
20 #include "formatter.hpp"
21 #include "formula/string_utils.hpp"
22 #include "game_config.hpp"
23 #include "game_config_manager.hpp"
25 #include "gettext.hpp"
27 #include "gui/core/timer.hpp"
32 #include "gui/widgets/button.hpp"
33 #include "gui/widgets/chatbox.hpp"
34 #include "gui/widgets/image.hpp"
35 #include "gui/widgets/label.hpp"
36 #include "gui/widgets/listbox.hpp"
40 #include "log.hpp"
41 #include "mp_ui_alerts.hpp"
43 #include "saved_game.hpp"
44 #include "statistics.hpp"
45 #include "units/types.hpp"
46 #include "utils/scope_exit.hpp"
47 #include "wesnothd_connection.hpp"
48 
49 static lg::log_domain log_mp_connect_engine("mp/connect/engine");
50 #define DBG_MP LOG_STREAM(debug, log_mp_connect_engine)
51 #define LOG_MP LOG_STREAM(info, log_mp_connect_engine)
52 #define WRN_MP LOG_STREAM(warn, log_mp_connect_engine)
53 #define ERR_MP LOG_STREAM(err, log_mp_connect_engine)
54 
55 namespace gui2::dialogs
56 {
57 
58 REGISTER_DIALOG(mp_join_game)
59 
60 mp_join_game::mp_join_game(saved_game& state, wesnothd_connection& connection, const bool first_scenario, const bool observe_game)
61  : level_()
62  , state_(state)
63  , network_connection_(connection)
64  , update_timer_(0)
65  , first_scenario_(first_scenario)
66  , observe_game_(observe_game)
67  , stop_updates_(false)
68  , player_list_(nullptr)
69  , flg_dialog_(nullptr)
70 {
71  set_show_even_without_video(true);
72 }
73 
75 {
76  if(update_timer_ != 0) {
78  update_timer_ = 0;
79  }
80 }
81 
82 /*
83  * Fetch the selected game's config from the server and prompts an initial faction selection.
84  */
86 {
87  // Ask for the next scenario data, if applicable
88  if(!first_scenario_) {
89  network_connection_.send_data(config("load_next_scenario"));
90  }
91 
92  bool has_scenario_and_controllers = false;
93  while(!has_scenario_and_controllers) {
94  config revc;
95 
98 
100  });
101 
102  if(const config& err = revc.child("error")) {
103  throw wesnothd_error(err["message"]);
104  } else if(revc.child("leave_game")) {
105  return false;
106  } else if(config& next_scenario = revc.child("next_scenario")) {
108  } else if(revc.has_attribute("version")) {
109  level_.swap(revc);
110 
111  has_scenario_and_controllers = true;
112  } else if(config& controllers = revc.child("controllers")) {
113  int index = 0;
114  for(const config& controller : controllers.child_range("controller")) {
115  if(config& side = get_scenario().child("side", index)) {
116  side["is_local"] = controller["is_local"];
117  }
118  ++index;
119  }
120 
121  has_scenario_and_controllers = true;
122  }
123  }
124 
125  if(level_["started"].to_bool()) {
127  return true;
128  }
129 
130  if(first_scenario_) {
131  state_.clear();
133 
134  // Make sure that we have the same config as host, if possible.
136  }
137 
139 
140  // If we're just an observer, we don't need to find an appropriate side and set faction selection
141  if(observe_game_) {
142  return true;
143  }
144 
145  // Search for an appropriate vacant slot. If a description is set (i.e. we're loading from a saved game),
146  // then prefer to get the side with the same description as our login. Otherwise just choose the first
147  // available side.
148  const config* side_choice = nullptr;
149 
150  int side_num_choice = 1, side_num_counter = 1;
151  for(const config& side : get_scenario().child_range("side")) {
152  // TODO: it can happen that the scenario specifies that the controller
153  // of a side should also gain control of another side.
154  if(side["controller"] == "reserved" && side["current_player"] == preferences::login()) {
155  side_choice = &side;
156  side_num_choice = side_num_counter;
157  break;
158  }
159 
160  if(side["controller"] == "human" && side["player_id"].empty()) {
161  if(!side_choice) { // Found the first empty side
162  side_choice = &side;
163  side_num_choice = side_num_counter;
164  }
165 
166  if(side["current_player"] == preferences::login()) {
167  side_choice = &side;
168  side_num_choice = side_num_counter;
169  break; // Found the preferred one
170  }
171  }
172 
173  if(side["player_id"] == preferences::login()) {
174  // We already own a side in this game
175  return true;
176  }
177 
178  ++side_num_counter;
179  }
180 
181  if(!side_choice) {
182  observe_game_ = true;
183  return true;
184  }
185 
186  // If the client is allowed to choose their team, do that here instead of having it set by the server
187  if((*side_choice)["allow_changes"].to_bool(true)) {
188  if(!show_flg_select(side_num_choice, true)) {
189  return false;
190  }
191  }
192 
193  return true;
194 }
195 
196 static std::string generate_user_description(const config& side)
197 {
198  // Allow the host to override, since only the host knows the ai_algorithm.
199  if(const config::attribute_value* desc = side.get("user_description")) {
200  return desc->str();
201  }
202 
203  const std::string controller_type = side["controller"].str();
204  const std::string reservation = side["current_player"].str();
205  const std::string owner = side["player_id"].str();
206 
207  if(controller_type == "ai") {
208  return _("Computer Player");
209  } else if(controller_type == "null") {
210  return _("Empty slot");
211  } else if(controller_type == "reserved") {
212  return VGETTEXT("Reserved for $playername", {{"playername", reservation}});
213  } else if(owner.empty()) {
214  return _("Vacant slot");
215  } else if(controller_type == "human" || controller_type == "network") {
216  return owner;
217  } else {
218  return _("empty");
219  }
220 }
221 
223 {
224  window.set_enter_disabled(true);
225  window.set_escape_disabled(true);
226 
227  //
228  // Set title
229  //
230  label& title = find_widget<label>(&window, "title", false);
231  // FIXME: very hacky way to get the game name...
232  title.set_label((formatter() << level_.child("multiplayer")["scenario"] << " " << font::unicode_em_dash << " " << get_scenario()["name"].t_str()).str());
233 
234  //
235  // Set up sides list
236  //
238 
239  //
240  // Initialize chatbox and game rooms
241  //
242  chatbox& chat = find_widget<chatbox>(&window, "chat", false);
243 
245 
246  chat.room_window_open(N_("this game"), true, false);
247  chat.active_window_changed();
248  chat.load_log(default_chat_log, false);
249 
250  //
251  // Set up player list
252  //
253  player_list_.reset(new player_list_helper(&window));
254 
255  //
256  // Set up the network handling
257  //
259 
260  //
261  // Set up the Lua plugin context
262  //
263  plugins_context_.reset(new plugins_context("Multiplayer Join"));
264 
265  plugins_context_->set_callback("launch", [&window](const config&) { window.set_retval(retval::OK); }, false);
266  plugins_context_->set_callback("quit", [&window](const config&) { window.set_retval(retval::CANCEL); }, false);
267  plugins_context_->set_callback("chat", [&chat](const config& cfg) { chat.send_chat_message(cfg["message"], false); }, true);
268 }
269 
270 bool mp_join_game::show_flg_select(int side_num, bool first_time)
271 {
272  if(const config& side_choice = get_scenario().child("side", side_num - 1)) {
273  if(!side_choice["allow_changes"].to_bool(true)) {
274  return true;
275  }
276 
277  const config& era = level_.child("era");
278  if(!era) {
279  ERR_MP << "no era information\n";
280  return false;
281  }
282 
283  config::const_child_itors possible_sides = era.child_range("multiplayer_side");
284  if(possible_sides.empty()) {
285  WRN_MP << "no [multiplayer_side] found in era '" << era["id"] << "'.\n";
286  return false;
287  }
288 
289  const std::string color = side_choice["color"].str();
290 
291  std::vector<const config*> era_factions;
292  //make this safe against changes to level_ that might make possible_sides invalid pointers.
293  config era_copy;
294  for(const config& side : possible_sides) {
295  config& side_new = era_copy.add_child("multiplayer_side", side);
296  era_factions.push_back(&side_new);
297  }
298 
299  const bool is_mp = state_.classification().is_normal_mp_game();
300  const bool lock_settings = get_scenario()["force_lock_settings"].to_bool(!is_mp);
301  const bool use_map_settings = level_.child("multiplayer")["mp_use_map_settings"].to_bool();
302  const mp_game_settings::SAVED_GAME_MODE saved_game = level_.child("multiplayer")["savegame"].to_enum<mp_game_settings::SAVED_GAME_MODE>(mp_game_settings::SAVED_GAME_MODE::NONE);
303 
304  ng::flg_manager flg(era_factions, side_choice, lock_settings, use_map_settings, saved_game == mp_game_settings::SAVED_GAME_MODE::MIDGAME);
305 
306  {
307  gui2::dialogs::faction_select flg_dialog(flg, color, side_num);
308  flg_dialog_ = &flg_dialog;
309  ON_SCOPE_EXIT(this) {
310  flg_dialog_ = nullptr;
311  };
312 
313  if(!flg_dialog.show() && !first_time) {
314  return true;
315  }
316  }
317 
318  config faction;
319  config& change = faction.add_child("change_faction");
320  change["change_faction"] = true;
321  change["name"] = preferences::login();
322  change["faction"] = flg.current_faction()["id"];
323  change["leader"] = flg.current_leader();
324  change["gender"] = flg.current_gender();
325  // TODO: the host cannot yet handle this and always uses the first side owned by that player.
326  change["side_num"] = side_num;
327 
329  }
330 
331  return true;
332 }
333 
335 {
336  if(stop_updates_) {
337  return;
338  }
339 
340  tree_view& tree = find_widget<tree_view>(get_window(), "side_list", false);
341 
342  tree.clear();
343  team_tree_map_.clear();
344  const std::map<std::string, string_map> empty_map;
345 
346  int side_num = 0;
347  for(const auto& side : get_scenario().child_range("side")) {
348  ++side_num;
349  if(!side["allow_player"].to_bool(true)) {
350  continue;
351  }
352 
353  // Check to see whether we've added a toplevel tree node for this team. If not, add one
354  if(team_tree_map_.find(side["team_name"].str()) == team_tree_map_.end()) {
355  std::map<std::string, string_map> data;
357 
358  item["label"] = (formatter() << _("Team:") << " " << t_string::from_serialized(side["user_team_name"])).str();
359  data.emplace("tree_view_node_label", item);
360 
361  tree_view_node& team_node = tree.add_node("team_header", data);
362  team_node.add_sibling("side_spacer", empty_map);
363 
364  team_tree_map_[side["team_name"].str()] = &team_node;
365  }
366 
367  std::map<std::string, string_map> data;
369 
370  const std::string color = !side["color"].empty() ? side["color"] : side["side"].str();
371 
372  item["label"] = (formatter() << "<span color='" << font::get_pango_color_from_id(color) << "'>" << side["side"] << "</span>").str();
373  data.emplace("side_number", item);
374 
375  std::string leader_image = ng::random_enemy_picture;
376  std::string leader_type = side["type"];
377  std::string leader_gender = side["gender"];
378  std::string leader_name;
379 
380  // If there is a unit which can recruit, use it as a leader.
381  // Necessary to display leader information when loading saves.
382  for(const config& side_unit : side.child_range("unit")) {
383  if(side_unit["canrecruit"].to_bool()) {
384  leader_type = side_unit["type"].str();
385  leader_gender = side_unit["gender"].str();
386  break;
387  }
388  }
389 
390  if(const unit_type* ut = unit_types.find(leader_type)) {
391  const unit_type& type = ut->get_gender_unit_type(leader_gender);
392 
393  leader_image = formatter() << type.image() << "~RC(" << type.flag_rgb() << ">" << color << ")";
394  leader_name = type.type_name();
395  }
396 
397  item["label"] = leader_image;
398  data.emplace("leader_image", item);
399 
400  std::string description = generate_user_description(side);
401  if(!leader_name.empty()) {
402  description += formatter() << " (<i>" << leader_name << "</i>)";
403  }
404 
405  item["label"] = description;
406  data.emplace("leader_type", item);
407 
408  item["label"] = (formatter() << "<span color='#a69275'>" << side["faction_name"] << "</span>").str();
409  data.emplace("leader_faction", item);
410 
411  std::string gender_icon = "icons/icon-random.png";
412  if(leader_gender != "null") {
413  gender_icon = formatter() << "icons/icon-" << leader_gender << ".png";
414  item["tooltip"] = leader_gender;
415  }
416 
417  item["label"] = gender_icon;
418  data.emplace("leader_gender", item);
419 
420  item.clear();
421 
422  // Don't show gold for saved games
423  // TODO: gold icon
424  if(side["allow_changes"].to_bool()) {
425  item["label"] = side["gold"].str() + " " + _("Gold");
426  data.emplace("side_gold", item);
427  }
428 
429  const int income_amt = side["income"];
430  if(income_amt != 0) {
431  const std::string income_string = formatter() << (income_amt > 0 ? "+" : "") << income_amt << " " << _("Income");
432 
433  item["label"] = income_string;
434  data.emplace("side_income", item);
435  }
436 
437  tree_view_node& node = team_tree_map_[side["team_name"].str()]->add_child("side_panel", data);
438 
439  grid& row_grid = node.get_grid();
440 
441  auto* select_leader_button = find_widget<button>(&row_grid, "select_leader", false, false);
442  if(select_leader_button) {
443  if(side["player_id"] == preferences::login() && side["allow_changes"].to_bool(true)) {
444  //
445  // Small wrapper function in order to set the handled and halt parameters and prevent
446  // crashes in case the dialog closes and the original button to which the callback was
447  // bound had already been destroyed. The other use of show_flg_select doesn't need these
448  // parameters, so it's easier not to declare them as function arguments.
449  //
450  const auto handler = [this, side_num](bool& handled, bool& halt) {
451  show_flg_select(side_num);
452  // note: this function is called from a std::function object stored in the widget
453  // and show_flg_select which internally calls
454  // show_dialog -> pump -> ... -> network_handler -> ... -> generate_side_list
455  // might destroy that std::function object while it is executed, this means that
456  // using the captured variables 'this' and 'side_num' after this will result in
457  // unexpected behaviour or crashes.
458  handled = halt = true;
459  };
460 
461  connect_signal_mouse_left_click(*select_leader_button, std::bind(handler, std::placeholders::_3, std::placeholders::_4));
462  } else {
463  select_leader_button->set_visible(widget::visibility::hidden);
464  }
465  }
466 
467  if(income_amt == 0) {
468  find_widget<image>(&row_grid, "income_icon", false).set_visible(widget::visibility::invisible);
469  find_widget<label>(&row_grid, "side_income", false).set_visible(widget::visibility::invisible);
470  }
471  }
472 }
473 
475 {
476  if(flg_dialog_) {
477  if(window* w = flg_dialog_->get_window()) {
478  w->set_retval(retval::CANCEL);
479  }
480  }
481 }
482 
484 {
485  // If the game has already started, close the dialog immediately.
486  if(level_["started"].to_bool()) {
488  return;
489  }
490 
491  config data;
492  if(!network_connection_.receive_data(data)) {
493  return;
494  }
495 
496  // Update chat
497  find_widget<chatbox>(get_window(), "chat", false).process_network_data(data);
498 
499  if(!data["message"].empty()) {
500  gui2::show_transient_message(_("Response") , data["message"]);
501  }
502 
503  if(data["failed"].to_bool()) {
505 
507  } else if(data.child("start_game")) {
509 
510  level_["started"] = true;
512  } else if(data.child("leave_game")) {
514 
516  }
517 
518  if(data.child("stop_updates")) {
519  stop_updates_ = true;
520  } else if(const config& c = data.child("scenario_diff")) {
521  // TODO: We should catch config::error and then leave the game.
523 
525  } else if(const config& change = data.child("change_controller")) {
526  if(config& side_to_change = get_scenario().find_child("side", "side", change["side"])) {
527  side_to_change.merge_with(change);
528  }
529 
530  if(flg_dialog_ && flg_dialog_->get_side_num() == change["side"].to_int()) {
532  }
533  } else if(data.has_child("scenario") || data.has_child("snapshot") || data.child("next_scenario")) {
534  level_ = first_scenario_ ? data : data.child("next_scenario");
535 
537  }
538 
539  if(data.has_child("turn")) {
540  ERR_MP << "received replay data\n" << data << "\n in mp join\n";
541  }
542 
543  // Update player list
544  if(data.has_child("user")) {
545  player_list_->update_list(data.child_range("user"));
546  }
547 }
548 
550 {
551  if(config& scenario = level_.child("scenario")) {
552  return scenario;
553  } else if(config& snapshot = level_.child("snapshot")) {
554  return snapshot;
555  }
556 
557  return level_;
558 }
559 
561 {
562  if(update_timer_ != 0) {
564  update_timer_ = 0;
565  }
566 
567  if(window.get_retval() == retval::OK) {
568  if(const config& stats = level_.child("statistics")) {
570  statistics::read_stats(stats);
571  }
572 
574 
576  } else if(observe_game_) {
577  network_connection_.send_data(config("observer_quit", config { "name", preferences::login() }));
578  } else {
579  network_connection_.send_data(config("leave_game"));
580  }
581 }
582 
583 } // namespace dialogs
void send_data(const configr_of &request)
Queues the given data to be sent to the server.
void active_window_changed()
Definition: chatbox.cpp:110
An error occurred during when trying to communicate with the wesnothd server.
Dialog was closed with the CANCEL button.
Definition: retval.hpp:37
config & child(config_key_type key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Definition: config.cpp:414
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
Definition: types.cpp:1261
std::string era()
Definition: game.cpp:689
config & find_child(config_key_type key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
Definition: config.cpp:860
Variant for storing WML attributes.
static game_config_view wrap(const config &cfg)
bool has_attribute(config_key_type key) const
Definition: config.cpp:207
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
Definition: config.cpp:406
const std::string & flag_rgb() const
Definition: types.cpp:722
void game_has_begun()
child_itors child_range(config_key_type key)
Definition: config.cpp:356
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
static void progress(loading_stage stage=loading_stage::none)
void load_game_config_for_game(const game_classification &classification, const std::string &scenario_id)
const attribute_value * get(config_key_type key) const
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
Definition: config.cpp:766
void fresh_stats()
Definition: statistics.cpp:782
unit_type_data unit_types
Definition: types.cpp:1480
void clear()
Definition: saved_game.cpp:791
faction_select * flg_dialog_
static lg::log_domain log_mp_connect_engine("mp/connect/engine")
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
Definition: window.hpp:298
window * get_window() const
Returns a pointer to the dialog&#39;s window.
A label displays a text, the text can be wrapped but no scrollbars are provided.
Definition: label.hpp:56
bool receive_data(config &result)
Receives the next pending data pack from the server, if available.
void level_to_gamestate(const config &level, saved_game &state)
static std::string _(const char *str)
Definition: gettext.hpp:92
FLG stands for faction, leader and gender.
Definition: flg_manager.hpp:28
bool show(const unsigned auto_close_time=0)
Shows the window.
wesnothd_connection & network_connection_
A single unit type that the player may recruit.
Definition: types.hpp:44
std::string get_scenario_id() const
Definition: saved_game.cpp:647
virtual void set_label(const t_string &label)
Base container class.
Definition: grid.hpp:30
static game_config_manager * get()
void swap(config &cfg)
Definition: config.cpp:1422
std::string get_pango_color_from_id(const std::string &id)
Returns a hex color string from a color range.
std::ostringstream wrapper.
Definition: formatter.hpp:38
const t_string & type_name() const
The name of the unit in the current language setting.
Definition: types.hpp:140
std::unique_ptr< plugins_context > plugins_context_
unsigned lobby_network_timer
Definition: game_config.cpp:86
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal_function &signal)
Connects a signal handler for a left mouse button click.
Definition: dispatcher.cpp:171
A class that represents a TCP/IP connection to the wesnothd server.
bool show_flg_select(int side_num, bool first_time=false)
virtual void send_chat_message(const std::string &message, bool allies_only) override
Inherited form chat_handler.
Definition: chatbox.cpp:245
void load_log(std::map< std::string, chatroom_log > &log, bool show_lobby)
Definition: chatbox.cpp:95
void read_stats(const config &cfg)
Definition: statistics.cpp:772
A tree view is a control that holds several items of the same or different types. ...
Definition: tree_view.hpp:59
void close_faction_select_dialog_if_open()
Will close the Faction Select dialog if it&#39;s open.
void apply_diff(const config &diff, bool track=false)
A function to apply a diff config onto this config object.
Definition: config.cpp:1100
static void add_color_info(const game_config_view &v, bool build_defaults)
int get_retval()
Definition: window.hpp:364
boost::iterator_range< const_child_iterator > const_child_itors
Definition: config.hpp:204
std::string login()
std::unique_ptr< player_list_helper > player_list_
logger & err()
Definition: log.cpp:76
Default, unset return value.
Definition: retval.hpp:31
The user set the widget invisible, that means:
bool use_map_settings()
Definition: game.cpp:489
Contains the gui2 timer routines.
std::map< std::string, t_string > string_map
Definition: widget.hpp:26
std::size_t add_timer(const uint32_t interval, const std::function< void(std::size_t id)> &callback, const bool repeat)
Adds a new timer.
Definition: timer.cpp:126
static t_string from_serialized(const std::string &string)
Definition: tstring.hpp:153
int w
#define N_(String)
Definition: gettext.hpp:100
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:71
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.
config & add_child(config_key_type key)
Definition: config.cpp:500
const std::string random_enemy_picture("units/random-dice.png")
const std::string & image() const
Definition: types.hpp:178
static void display(std::function< void()> f)
#define ON_SCOPE_EXIT(...)
Run some arbitrary code (a lambda) when the current scope exits The lambda body follows this header...
Definition: scope_exit.hpp:42
std::map< std::string, tree_view_node * > team_tree_map_
The user sets the widget hidden, that means:
game_classification & classification()
Definition: saved_game.hpp:54
const std::string unicode_em_dash
Definition: constants.cpp:43
std::map< std::string, chatroom_log > default_chat_log
Definition: chat_log.cpp:16
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
void set_wesnothd_connection(wesnothd_connection &c)
Definition: chatbox.hpp:87
Standard logging facilities (interface).
tree_view_node & add_sibling(const std::string &id, const std::map< std::string, string_map > &data)
Adds a sibbling for a node at the end of the list.
#define ERR_MP
bool wait_and_receive_data(config &data)
Unlike receive_data, waits until data is available instead of returning immediately.
#define WRN_MP
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
static std::string generate_user_description(const config &side)
Dialog was closed with the OK button.
Definition: retval.hpp:34
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:59
mock_char c
void set_retval(int retval)
Convenience wrapper to set the window&#39;s exit code.
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:64
lobby_chat_window * room_window_open(const std::string &room, const bool open_new, const bool allow_close=true)
Check if a room window for "room" is open, if open_new is true then it will be created if not found...
Definition: chatbox.cpp:385
tree_view_node & add_node(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Definition: tree_view.cpp:56
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:409
bool remove_timer(const std::size_t id)
Removes a timer.
Definition: timer.cpp:167
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
Definition: window.hpp:285