The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
custom_tod.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[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_CUSTOM_TOD_HPP_INCLUDED
16 #define GUI_DIALOGS_CUSTOM_TOD_HPP_INCLUDED
17 
18 #include "filechooser.hpp"
19 #include "time_of_day.hpp"
20 #include "gui/widgets/image.hpp"
21 #include "gui/widgets/text_box.hpp"
22 #include "gui/dialogs/dialog.hpp"
24 
25 #include <vector>
26 
27 namespace editor
28 {
29 
30 class editor_display;
31 
32 } // namespace editor
33 
34 namespace gui2
35 {
36 
37 class tlabel;
38 class timage;
39 class tslider;
40 class ttext_box;
41 
42 class tcustom_tod : public tdialog
43 {
44 public:
46  const std::vector<time_of_day>& tods);
47 
48  static bool execute(editor::editor_display* display,
49  const std::vector<time_of_day>& tods,
50  CVideo& video)
51  {
52  return tcustom_tod(display, tods).show(video);
53  }
54 
55 private:
56  /** Available time_of_days */
57  std::vector<time_of_day> tods_;
58 
59  /** Callback for the next tod button */
60  void do_next_tod(twindow& window);
61  void do_prev_tod(twindow& window);
62 
63  void do_new_tod(twindow& window);
64  void do_delete_tod(twindow& window);
65 
66  void select_file(const std::string& filename,
67  const std::string& default_dir,
68  const std::string& attribute,
69  twindow& window);
70 
71  void update_tod_display(twindow& window);
72 
73  void update_lawful_bonus(twindow& window);
74 
75  void set_selected_tod(time_of_day tod);
76  const time_of_day& get_selected_tod() const;
77 
78  void update_selected_tod_info(twindow& window);
79 
80  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
81  virtual const std::string& window_id() const;
82 
83  /** Inherited from tdialog. */
84  void pre_show(twindow& window);
85 
86  /** Inherited from tdialog. */
87  void post_show(twindow& window);
88 
89  /** Current map generator index */
91 
92  /** Text boxes for name and id*/
95 
96  /** Images for the current tod*/
99 
100  /** Labels for the current tod*/
103 
108 
109  /**
110  * The display to update when the ToD changes.
111  *
112  * The pointer may be nullptr, in the unit tests, but normally it should be a
113  * pointer to a valid object.
114  */
116 };
117 
118 } // namespace gui2
119 
120 #endif
ttext_box * current_tod_name_
Text boxes for name and id.
Definition: custom_tod.hpp:93
tlabel * current_tod_number_
Definition: custom_tod.hpp:102
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
void update_selected_tod_info(twindow &window)
Definition: custom_tod.cpp:209
void update_tod_display(twindow &window)
Definition: custom_tod.cpp:170
Template class to implement the generic field implementation.
Definition: field-fwd.hpp:36
Definition: video.hpp:58
tcustom_tod(editor::editor_display *display, const std::vector< time_of_day > &tods)
Definition: custom_tod.cpp:88
Class for a single line text area.
Definition: text_box.hpp:118
Label showing a text.
Definition: label.hpp:29
const time_of_day & get_selected_tod() const
Definition: custom_tod.cpp:164
timage * current_tod_image_
Images for the current tod.
Definition: custom_tod.hpp:97
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
editor::editor_display * display_
The display to update when the ToD changes.
Definition: custom_tod.hpp:115
Object which defines a time of day with associated bonuses, image, sounds etc.
Definition: time_of_day.hpp:48
void set_selected_tod(time_of_day tod)
Abstract base class for all dialogs.
Definition: dialog.hpp:121
ttext_box * current_tod_id_
Definition: custom_tod.hpp:94
void pre_show(twindow &window)
Inherited from tdialog.
Definition: custom_tod.cpp:230
Manage the empty-palette in the editor.
Definition: action.cpp:28
void select_file(const std::string &filename, const std::string &default_dir, const std::string &attribute, twindow &window)
Definition: custom_tod.cpp:106
void update_lawful_bonus(twindow &window)
Definition: custom_tod.cpp:203
tslider * tod_blue_field_
Definition: custom_tod.hpp:107
void do_delete_tod(twindow &window)
Definition: custom_tod.cpp:149
tlabel * current_tod_sound_
Labels for the current tod.
Definition: custom_tod.hpp:101
std::vector< time_of_day > tods_
Available time_of_days.
Definition: custom_tod.hpp:57
int current_tod_
Current map generator index.
Definition: custom_tod.hpp:90
static bool execute(editor::editor_display *display, const std::vector< time_of_day > &tods, CVideo &video)
Definition: custom_tod.hpp:48
void do_new_tod(twindow &window)
Definition: custom_tod.cpp:143
tfield_integer * lawful_bonus_field_
Definition: custom_tod.hpp:104
timage * current_tod_mask_
Definition: custom_tod.hpp:98
tslider * tod_red_field_
Definition: custom_tod.hpp:105
A slider.
Definition: slider.hpp:30
void do_next_tod(twindow &window)
Callback for the next tod button.
Definition: custom_tod.cpp:131
void do_prev_tod(twindow &window)
Definition: custom_tod.cpp:137
GLsizei const GLcharARB ** string
Definition: glew.h:4503
void post_show(twindow &window)
Inherited from tdialog.
Definition: custom_tod.cpp:339
tslider * tod_green_field_
Definition: custom_tod.hpp:106