/* 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__