Adonthell  0.4
data_screen.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001 by Kai Sterker <kai.sterker@gmail.com>
3  Part of the Adonthell Project <http://adonthell.nongnu.org>
4 
5  Adonthell 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 
10  Adonthell is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Adonthell. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 /**
21  * @file data_screen.h
22  * @author Kai Sterker <kai.sterker@gmail.com>
23  *
24  * @brief Declares the data_screen class.
25  *
26  *
27  */
28 
29 
30 
31 #ifndef DATA_SCREEN_H__
32 #define DATA_SCREEN_H__
33 
34 #include "win_select.h"
35 #include "win_theme.h"
36 #include "win_write.h"
37 
38 /**
39  * Whether the data screen should load or save games.
40  *
41  */
42 enum
43 {
44  LOAD_SCREEN = 0,
45  SAVE_SCREEN = 1
46 };
47 
48 /**
49  * The gui for loading/saving games.
50  *
51  */
52 class data_screen : public win_container
53 {
54 public:
55  /**
56  * Constructor.
57  *
58  * @param m LOAD_SCREEN or SAVE_SCREEN, depending on whether
59  * you want to save or load a game.
60  *
61  */
62  data_screen (int m);
63 
64  /**
65  * Destructor.
66  *
67  */
68  ~data_screen ();
69 
70  /**
71  * React to input.
72  *
73  */
74  bool update ();
75 
76  /**
77  * Returns the player's action
78  *
79  * @return
80  * @li true if a game has been loaded/saved
81  * @li false if the action has been cancelled
82  */
83  bool get_result ()
84  {
85  return !aborted;
86  }
87 
88 private:
89  /**
90  * GUI initialisation.
91  *
92  */
93  void init ();
94 
95  /**
96  * Callback for selecting a game.
97  *
98  */
99  void on_select ();
100 
101  /**
102  * Callback for entering a description.
103  *
104  */
105  void on_save ();
106 
107  /**
108  * Write the thumbnail to disk.
109  *
110  */
111  void save_preview (string);
112 
113  win_font *font; // the font
114  win_theme *theme; // the theme
115  win_write *entry; // for entering a description of the game
116  win_select *image_list; // list of thumbnails
117 
118  vector<win_write*> entry_list; // list of game descriptions
119  int mode; // Whether we're saving or loading
120  bool aborted; // Indicates whether action has been cancelled
121  char gametime[20]; // time when saving the game
122 };
123 
124 #endif // DATA_SCREEN_H__
The gui for loading/saving games.
Definition: data_screen.h:52
~data_screen()
Destructor.
Definition: data_screen.cc:99
Tehe gametime class makes the speed of the game independent of the machine it runs on...
Definition: gametime.h:65
data_screen(int m)
Constructor.
Definition: data_screen.cc:42
bool update()
React to input.
Definition: data_screen.cc:246
bool get_result()
Returns the player&#39;s action.
Definition: data_screen.h:83