00001 /* 00002 $Id: data_screen.h,v 1.12 2003/02/23 23:14:34 ksterker Exp $ 00003 00004 Copyright (C) 2001 by Kai Sterker <kaisterker@linuxgames.com> 00005 Part of the Adonthell Project http://adonthell.linuxgames.com 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 00016 /** 00017 * @file data_screen.h 00018 * @author Kai Sterker <kaisterker@linuxgames.com> 00019 * 00020 * @brief Declares the data_screen class. 00021 * 00022 * 00023 */ 00024 00025 00026 00027 #ifndef DATA_SCREEN_H__ 00028 #define DATA_SCREEN_H__ 00029 00030 #include "win_select.h" 00031 #include "win_theme.h" 00032 #include "win_write.h" 00033 00034 /** 00035 * Whether the data screen should load or save games. 00036 * 00037 */ 00038 enum 00039 { 00040 LOAD_SCREEN = 0, 00041 SAVE_SCREEN = 1 00042 }; 00043 00044 /** 00045 * The gui for loading/saving games. 00046 * 00047 */ 00048 class data_screen : public win_container 00049 { 00050 public: 00051 /** 00052 * Constructor. 00053 * 00054 * @param m LOAD_SCREEN or SAVE_SCREEN, depending on whether 00055 * you want to save or load a game. 00056 * 00057 */ 00058 data_screen (int m); 00059 00060 /** 00061 * Destructor. 00062 * 00063 */ 00064 ~data_screen (); 00065 00066 /** 00067 * React to input. 00068 * 00069 */ 00070 bool update (); 00071 00072 /** 00073 * Returns the player's action 00074 * 00075 * @return 00076 * @li true if a game has been loaded/saved 00077 * @li false if the action has been cancelled 00078 */ 00079 bool get_result () 00080 { 00081 return !aborted; 00082 } 00083 00084 private: 00085 /** 00086 * GUI initialisation. 00087 * 00088 */ 00089 void init (); 00090 00091 /** 00092 * Callback for selecting a game. 00093 * 00094 */ 00095 void on_select (); 00096 00097 /** 00098 * Callback for entering a description. 00099 * 00100 */ 00101 void on_save (); 00102 00103 /** 00104 * Write the thumbnail to disk. 00105 * 00106 */ 00107 void save_preview (string); 00108 00109 win_font *font; // the font 00110 win_theme *theme; // the theme 00111 win_write *entry; // for entering a description of the game 00112 win_select *image_list; // list of thumbnails 00113 00114 vector<win_write*> entry_list; // list of game descriptions 00115 int mode; // Whether we're saving or loading 00116 bool aborted; // Indicates whether action has been cancelled 00117 char gametime[20]; // time when saving the game 00118 }; 00119 00120 #endif // DATA_SCREEN_H__