blob: b26bbdfc61d36fe766e9a004f2636be40f9a8214 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
client/savegamewindow.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#ifndef __INCLUDED_CLIENT_SAVEGAMEMENU_H__
#define __INCLUDED_CLIENT_SAVEGAMEMENU_H__
#include "ui/bitmap.h"
#include "ui/button.h"
#include "ui/iconbutton.h"
#include "ui/inputbox.h"
#include "ui/label.h"
#include "ui/listview.h"
#include "ui/window.h"
namespace client
{
class SaveGameMenu : public ui::Window
{
public:
enum Mode { Save = 0, Load = 1 };
SaveGameMenu(ui::Widget *parent = 0, const char *label = 0, const Mode mode = Save);
virtual ~SaveGameMenu();
/// load the specified savegame
static void loadgame(std::string savename);
/// save the current game state to the specified savegame name
static void savegame(std::string savename, const std::string & description);
/// delete the specified savegame
static void deletegame(std::string savename);
protected:
/// called when the widget receives a key press
virtual bool on_keypress(const int key, const unsigned int modifier);
/// called if the widget receives an emit evet
virtual bool on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data);
virtual void resize();
virtual void show();
virtual void hide();
/**
* @brief show file info for the selected savegame
* */
void show_file_info();
/**
* @brief show confirm save dialog
* */
void show_save_dialog();
/**
* @brief show confirm load dialog
* */
void show_load_dialog();
/**
* @brief show confirm delete dialog
* */
void show_delete_dialog();
void refresh();
private:
/// save a screenshot for a specified savegame
static void savescreenshot(std::string savename);
void get_savegame_info(const std::string & savename, std::string &game_descr, std::string &game_info, std::string &game_timestamp);
Mode savegamemenu_mode;
ui::Label *savegamemenu_titlelabel;
ui::IconButton *savegamemenu_closebutton;
ui::ListView *savegamemenu_filelistview;
ui::IconButton *savegamemenu_deletebutton;
ui::Label *savegamemenu_descrtitle;
ui::Label *savegamemenu_descrlabel;
ui::InputBox *savegamemenu_descrinput;
ui::Button *savegamemenu_savebutton;
ui::Button *savegamemenu_cancelbutton;
ui::Button *savegamemenu_confirmsavebutton;
ui::Button *savegamemenu_confirmdeletebutton;
ui::Bitmap *savegamemenu_screenshot;
}; // class SaveGameMenu
} // namespace client
#endif // __INCLUDED_CLIENT_SAVEGAMEMENU_H__
|