The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game_load.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Jörg Hinrichs <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef GUI_DIALOGS_LOAD_GAME_HPP_INCLUDED
16 #define GUI_DIALOGS_LOAD_GAME_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 #include "save_index.hpp"
20 #include "tstring.hpp"
21 
22 namespace gui2
23 {
24 
25 class tlistbox;
26 class ttext_;
27 
28 class tgame_load : public tdialog
29 {
30 public:
31  explicit tgame_load(const config& cache_config);
32 
33  const std::string& filename() const
34  {
35  return filename_;
36  }
37  bool change_difficulty() const
38  {
39  return change_difficulty_;
40  }
41  bool show_replay() const
42  {
43  return show_replay_;
44  }
45  bool cancel_orders() const
46  {
47  return cancel_orders_;
48  }
49  const config& summary()
50  {
51  return summary_;
52  }
53 
54 protected:
55  /** Inherited from tdialog. */
56  void pre_show(twindow& window);
57 
58  /** Inherited from tdialog. */
59  void post_show(twindow& window);
60 
61 private:
62  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
63  virtual const std::string& window_id() const;
64 
65  void filter_text_changed(ttext_* textbox, const std::string& text);
66  void list_item_clicked(twindow& window);
67  void delete_button_callback(twindow& window);
68 
69  void display_savegame(twindow& window);
70  void evaluate_summary_string(std::stringstream& str,
71  const config& cfg_summary);
72 
73  bool compare_name(unsigned i1, unsigned i2) const;
74  bool compare_date(unsigned i1, unsigned i2) const;
75  bool compare_name_rev(unsigned i1, unsigned i2) const;
76  bool compare_date_rev(unsigned i1, unsigned i2) const;
77 
78  void fill_game_list(twindow& window,
79  std::vector<savegame::save_info>& games);
80 
85 
90 
91  std::vector<savegame::save_info> games_;
93 
94  std::vector<std::string> last_words_;
95 
97 };
98 }
99 
100 #endif
const config & cache_config_
Definition: game_load.hpp:92
tfield_bool * chk_cancel_orders_
Definition: game_load.hpp:84
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
std::vector< savegame::save_info > games_
Definition: game_load.hpp:91
bool show_replay() const
Definition: game_load.hpp:41
bool cancel_orders() const
Definition: game_load.hpp:45
void pre_show(twindow &window)
Inherited from tdialog.
Definition: game_load.cpp:107
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
tfield_bool * chk_show_replay_
Definition: game_load.hpp:83
std::vector< std::string > last_words_
Definition: game_load.hpp:94
bool compare_date_rev(unsigned i1, unsigned i2) const
Definition: game_load.cpp:163
const std::string & filename() const
Definition: game_load.hpp:33
Abstract base class for all dialogs.
Definition: dialog.hpp:121
void delete_button_callback(twindow &window)
Definition: game_load.cpp:388
bool compare_date(unsigned i1, unsigned i2) const
Definition: game_load.cpp:153
tfield_text * txtFilter_
Definition: game_load.hpp:81
const config & summary()
Definition: game_load.hpp:49
bool compare_name_rev(unsigned i1, unsigned i2) const
Definition: game_load.cpp:158
void fill_game_list(twindow &window, std::vector< savegame::save_info > &games)
Definition: game_load.cpp:168
bool change_difficulty() const
Definition: game_load.hpp:37
void display_savegame(twindow &window)
Definition: game_load.cpp:261
void list_item_clicked(twindow &window)
Definition: game_load.cpp:198
void post_show(twindow &window)
Inherited from tdialog.
Definition: game_load.cpp:248
void filter_text_changed(ttext_ *textbox, const std::string &text)
Definition: game_load.cpp:203
bool compare_name(unsigned i1, unsigned i2) const
Definition: game_load.cpp:148
void evaluate_summary_string(std::stringstream &str, const config &cfg_summary)
Definition: game_load.cpp:311
tgame_load(const config &cache_config)
Definition: game_load.cpp:91
std::string filename_
Definition: game_load.hpp:86
tfield_bool * chk_change_difficulty_
Definition: game_load.hpp:82
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
Specialized field class for boolean.
Definition: field.hpp:547
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Abstract base class for text items.
Definition: text.hpp:43
Specialized field class for text.
Definition: field.hpp:588
bool change_difficulty_
Definition: game_load.hpp:87