Adonthell  0.4
data_screen.h
Go to the documentation of this file.
1 /*
2  $Id: data_screen.h,v 1.12 2003/02/23 23:14:34 ksterker Exp $
3 
4  Copyright (C) 2001 by Kai Sterker <kaisterker@linuxgames.com>
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
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 
16 /**
17  * @file data_screen.h
18  * @author Kai Sterker <kaisterker@linuxgames.com>
19  *
20  * @brief Declares the data_screen class.
21  *
22  *
23  */
24 
25 
26 
27 #ifndef DATA_SCREEN_H__
28 #define DATA_SCREEN_H__
29 
30 #include "win_select.h"
31 #include "win_theme.h"
32 #include "win_write.h"
33 
34 /**
35  * Whether the data screen should load or save games.
36  *
37  */
38 enum
39 {
40  LOAD_SCREEN = 0,
41  SAVE_SCREEN = 1
42 };
43 
44 /**
45  * The gui for loading/saving games.
46  *
47  */
48 class data_screen : public win_container
49 {
50 public:
51  /**
52  * Constructor.
53  *
54  * @param m LOAD_SCREEN or SAVE_SCREEN, depending on whether
55  * you want to save or load a game.
56  *
57  */
58  data_screen (int m);
59 
60  /**
61  * Destructor.
62  *
63  */
64  ~data_screen ();
65 
66  /**
67  * React to input.
68  *
69  */
70  bool update ();
71 
72  /**
73  * Returns the player's action
74  *
75  * @return
76  * @li true if a game has been loaded/saved
77  * @li false if the action has been cancelled
78  */
79  bool get_result ()
80  {
81  return !aborted;
82  }
83 
84 private:
85  /**
86  * GUI initialisation.
87  *
88  */
89  void init ();
90 
91  /**
92  * Callback for selecting a game.
93  *
94  */
95  void on_select ();
96 
97  /**
98  * Callback for entering a description.
99  *
100  */
101  void on_save ();
102 
103  /**
104  * Write the thumbnail to disk.
105  *
106  */
107  void save_preview (string);
108 
109  win_font *font; // the font
110  win_theme *theme; // the theme
111  win_write *entry; // for entering a description of the game
112  win_select *image_list; // list of thumbnails
113 
114  vector<win_write*> entry_list; // list of game descriptions
115  int mode; // Whether we're saving or loading
116  bool aborted; // Indicates whether action has been cancelled
117  char gametime[20]; // time when saving the game
118 };
119 
120 #endif // DATA_SCREEN_H__
The gui for loading/saving games.
Definition: data_screen.h:48
~data_screen()
Destructor.
Definition: data_screen.cc:95
Tehe gametime class makes the speed of the game independent of the machine it runs on...
Definition: gametime.h:61
data_screen(int m)
Constructor.
Definition: data_screen.cc:38
bool update()
React to input.
Definition: data_screen.cc:242
bool get_result()
Returns the player's action.
Definition: data_screen.h:79