The Battle for Wesnoth  1.15.1+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
22 {
23 namespace dialogs
24 {
25 
26 class modeless_dialog;
27 
28 /** Do we wish to show the button for the debug clock. */
29 extern bool show_debug_clock_button;
30 
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 class title_screen : public modal_dialog
38 {
39 public:
41 
42  ~title_screen();
43 
44  /**
45  * Values for actions which leave the title screen.
46  * Actions that merely show a dialog are not included here.
47  */
48  enum result {
49  // Window was resized, so needs redrawing
50  REDRAW_BACKGROUND = 0, // Needs to be 0, the value of gui2::retval::NONE
51  // Start playing a single-player game, such as the tutorial or a campaign
53  // Connect to an MP server
55  // Host an MP game
57  // Start a local MP game
59  // Start the map/scenario editor
61  // Show credits
63  // Exit to desktop
65  // Used to reload all game data
67  };
68 
69 private:
70  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
71  virtual const std::string& window_id() const override;
72 
73  /** Inherited from modal_dialog. */
74  virtual void pre_show(window& window) override;
75 
76  /***** ***** ***** ***** Callbacks ***** ***** ****** *****/
77 
78  void on_resize(window& window);
79 
80  /**
81  * Updates the tip of day widget.
82  *
83  * @param window The window being shown.
84  * @param previous Show the previous tip, else shows the next one.
85  */
86  void update_tip(window& window, const bool previous);
87 
88  /** Shows the debug clock. */
90 
92 
94 
95  void button_callback_cores();
96 
97  /** Holds the debug clock dialog. */
98  std::unique_ptr<modeless_dialog> debug_clock_;
99 
101 
102 };
103 
104 } // namespace dialogs
105 } // namespace gui2
void update_tip(window &window, const bool previous)
Updates the tip of day widget.
void show_debug_clock_window()
Shows the debug clock.
This class implements the title screen.
result
Values for actions which leave the title screen.
void hotkey_callback_select_tests(window &window)
Generic file dialog.
Definition: field-fwd.hpp:22
title_screen(game_launcher &game)
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Various uncategorised dialogs.
void on_resize(window &window)
Abstract base class for all modal dialogs.
void button_callback_multiplayer(window &window)
std::unique_ptr< modeless_dialog > debug_clock_
Holds the debug clock dialog.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63
bool show_debug_clock_button
Do we wish to show the button for the debug clock.