The Battle for Wesnoth  1.15.12+dev
title_screen.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
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 #pragma once
16 
18 
19 class game_launcher;
20 
21 namespace gui2::dialogs
22 {
23 
24 class modeless_dialog;
25 
26 /** Do we wish to show the button for the debug clock. */
27 extern bool show_debug_clock_button;
28 
29 /**
30  * @ingroup GUIWindowDefinitionWML
31  *
32  * This class implements the title screen.
33  *
34  * The menu buttons return a result back to the caller with the button pressed.
35  * So at the moment it only handles the tips itself.
36  *
37  * Key |Type |Mandatory|Description
38  * ------------------|--------------|---------|-----------
39  * tutorial | @ref button |yes |The button to start the tutorial.
40  * campaign | @ref button |yes |The button to start a campaign.
41  * multiplayer | @ref button |yes |The button to start multiplayer mode.
42  * load | @ref button |yes |The button to load a saved game.
43  * editor | @ref button |yes |The button to start the editor.
44  * addons | @ref button |yes |The button to start managing the addons.
45  * cores | @ref button |yes |The button to start managing the cores.
46  * language | @ref button |yes |The button to select the game language.
47  * credits | @ref button |yes |The button to show Wesnoth's contributors.
48  * quit | @ref button |yes |The button to quit Wesnoth.
49  * tips | multi_page |yes |A multi_page to hold all tips, when this widget is used the area of the tips doesn't need to be resized when the next or previous button is pressed.
50  * tip | @ref label |no |Shows the text of the current tip.
51  * source | @ref label |no |The source (the one who's quoted or the book referenced) of the current tip.
52  * next_tip | @ref button |yes |The button show the next tip of the day.
53  * previous_tip | @ref button |yes |The button show the previous tip of the day.
54  * logo | progress_bar |no |A progress bar to "animate" the Wesnoth logo.
55  * revision_number | control |no |A widget to show the version number when the version number is known.
56  */
57 class title_screen : public modal_dialog
58 {
59 public:
61 
62  ~title_screen();
63 
64  /**
65  * Values for actions which leave the title screen.
66  * Actions that merely show a dialog are not included here.
67  */
68  enum result {
69  // Window was resized, so needs redrawing
70  REDRAW_BACKGROUND = 0, // Needs to be 0, the value of gui2::retval::NONE
71  // Start playing a single-player game, such as the tutorial or a campaign
73  // Connect to an MP server
75  // Host an MP game
77  // Start a local MP game
79  // Start the map/scenario editor
81  // Show credits
83  // Exit to desktop
85  // Used to reload all game data
87  };
88 
89 private:
90  virtual const std::string& window_id() const override;
91 
92  virtual void pre_show(window& window) override;
93 
94  /***** ***** ***** ***** Callbacks ***** ***** ****** *****/
95 
96  void on_resize();
97 
98  /**
99  * Updates the tip of day widget.
100  *
101  * @param previous Show the previous tip, else shows the next one.
102  */
103  void update_tip(const bool previous);
104 
105  /** Shows the debug clock. */
107 
109 
111 
112  void button_callback_cores();
113 
114  /** Holds the debug clock dialog. */
115  std::unique_ptr<modeless_dialog> debug_clock_;
116 
118 
119 };
120 
121 } // namespace dialogs
void show_debug_clock_window()
Shows the debug clock.
This class implements the title screen.
result
Values for actions which leave the title screen.
title_screen(game_launcher &game)
virtual const std::string & window_id() const override
The id of the window to build.
void update_tip(const bool previous)
Updates the tip of day widget.
Abstract base class for all modal dialogs.
std::unique_ptr< modeless_dialog > debug_clock_
Holds the debug clock dialog.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:64
bool show_debug_clock_button
Do we wish to show the button for the debug clock.