OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ListGamesState.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_LISTGAMESSTATE_H
20 #define OPENXCOM_LISTGAMESSTATE_H
21 
22 #include "../Engine/State.h"
23 #include "OptionsBaseState.h"
24 #include <vector>
25 #include <string>
26 #include "../Savegame/SavedGame.h"
27 #include "../Engine/Options.h"
28 
29 namespace OpenXcom
30 {
31 
32 class TextButton;
33 class Window;
34 class Text;
35 class TextList;
36 class ArrowButton;
37 
42 class ListGamesState : public State
43 {
44 protected:
45  TextButton *_btnCancel;
46  Window *_window;
47  Text *_txtTitle, *_txtName, *_txtDate, *_txtDelete, *_txtDetails;
48  TextList *_lstSaves;
49  ArrowButton *_sortName, *_sortDate;
50  OptionsOrigin _origin;
51  bool _showMsg, _noUI;
52  std::vector<SaveInfo> _saves;
53  int _firstValidRow;
54  bool _autoquick, _sortable;
55 
56  void updateArrows();
57 public:
59  ListGamesState(Game *game, OptionsOrigin origin, int firstValidRow, bool autoquick);
61  virtual ~ListGamesState();
63  void init();
65  void sortList(SaveSort sort);
67  virtual void updateList();
69  void btnCancelClick(Action *action);
71  void lstSavesMouseOver(Action *action);
73  void lstSavesMouseOut(Action *action);
75  virtual void lstSavesPress(Action *action);
77  void sortNameClick(Action *action);
79  void sortDateClick(Action *action);
81  void disableSort();
82 };
83 
84 }
85 
86 #endif
void updateArrows()
Updates the sorting arrows based on the current setting.
Definition: ListGamesState.cpp:209
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Box with a coloured border and custom background.
Definition: Window.h:42
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: ListGamesState.cpp:276
List of Text's split into columns.
Definition: TextList.h:42
Text string displayed on screen.
Definition: Text.h:41
ListGamesState(Game *game, OptionsOrigin origin, int firstValidRow, bool autoquick)
Creates the Saved Game state.
Definition: ListGamesState.cpp:87
void sortNameClick(Action *action)
Handler for clicking the Name arrow.
Definition: ListGamesState.cpp:321
void disableSort()
disables the sort buttons.
Definition: ListGamesState.cpp:361
virtual ~ListGamesState()
Cleans up the Saved Game state.
Definition: ListGamesState.cpp:176
void lstSavesMouseOver(Action *action)
Handler for moving the mouse over a list item.
Definition: ListGamesState.cpp:285
virtual void updateList()
Updates the savegame list.
Definition: ListGamesState.cpp:258
Coloured button with a text label.
Definition: TextButton.h:40
Button with an arrow on it.
Definition: ArrowButton.h:37
void sortList(SaveSort sort)
Sorts the savegame list.
Definition: ListGamesState.cpp:234
Base class for saved game screens which provides the common layout and listing.
Definition: ListGamesState.h:42
void sortDateClick(Action *action)
Handler for clicking the Date arrow.
Definition: ListGamesState.cpp:343
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
void lstSavesMouseOut(Action *action)
Handler for moving the mouse outside the list borders.
Definition: ListGamesState.cpp:300
SaveSort
Savegame sorting modes.
Definition: Options.h:35
virtual void lstSavesPress(Action *action)
Handler for clicking the Saves list.
Definition: ListGamesState.cpp:309
void init()
Sets up the saves list.
Definition: ListGamesState.cpp:184