OpenXcom  1.0
Open-source clone of the original X-Com
ListGamesState.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "../Engine/State.h"
21 #include "OptionsBaseState.h"
22 #include <vector>
23 #include <string>
24 #include "../Savegame/SavedGame.h"
25 #include "../Engine/Options.h"
26 
27 namespace OpenXcom
28 {
29 
30 class TextButton;
31 class Window;
32 class Text;
33 class TextList;
34 class ArrowButton;
35 
40 class ListGamesState : public State
41 {
42 protected:
43  TextButton *_btnCancel;
44  Window *_window;
45  Text *_txtTitle, *_txtName, *_txtDate, *_txtDelete, *_txtDetails;
46  TextList *_lstSaves;
47  ArrowButton *_sortName, *_sortDate;
48  OptionsOrigin _origin;
49  std::vector<SaveInfo> _saves;
50  unsigned int _firstValidRow;
51  bool _autoquick, _sortable;
52 
53  void updateArrows();
54 public:
56  ListGamesState(OptionsOrigin origin, int firstValidRow, bool autoquick);
58  virtual ~ListGamesState();
60  void init();
62  void sortList(SaveSort sort);
64  virtual void updateList();
66  void btnCancelClick(Action *action);
68  void lstSavesMouseOver(Action *action);
70  void lstSavesMouseOut(Action *action);
72  virtual void lstSavesPress(Action *action);
74  void sortNameClick(Action *action);
76  void sortDateClick(Action *action);
78  void disableSort();
79 };
80 
81 }
void updateArrows()
Updates the sorting arrows based on the current setting.
Definition: ListGamesState.cpp:188
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
A game state that receives user input and reacts accordingly.
Definition: State.h:43
Box with a coloured border and custom background.
Definition: Window.h:40
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: ListGamesState.cpp:256
List of Text&#39;s split into columns.
Definition: TextList.h:40
Text string displayed on screen.
Definition: Text.h:40
void sortNameClick(Action *action)
Handler for clicking the Name arrow.
Definition: ListGamesState.cpp:301
void disableSort()
disables the sort buttons.
Definition: ListGamesState.cpp:341
virtual ~ListGamesState()
Cleans up the Saved Game state.
Definition: ListGamesState.cpp:155
void lstSavesMouseOver(Action *action)
Handler for moving the mouse over a list item.
Definition: ListGamesState.cpp:265
virtual void updateList()
Updates the savegame list.
Definition: ListGamesState.cpp:237
Coloured button with a text label.
Definition: TextButton.h:38
Button with an arrow on it.
Definition: ArrowButton.h:35
void sortList(SaveSort sort)
Sorts the savegame list.
Definition: ListGamesState.cpp:213
Base class for saved game screens which provides the common layout and listing.
Definition: ListGamesState.h:40
void sortDateClick(Action *action)
Handler for clicking the Date arrow.
Definition: ListGamesState.cpp:323
void lstSavesMouseOut(Action *action)
Handler for moving the mouse outside the list borders.
Definition: ListGamesState.cpp:280
ListGamesState(OptionsOrigin origin, int firstValidRow, bool autoquick)
Creates the Saved Game state.
Definition: ListGamesState.cpp:85
virtual void lstSavesPress(Action *action)
Handler for clicking the Saves list.
Definition: ListGamesState.cpp:289
void init()
Sets up the saves list.
Definition: ListGamesState.cpp:163
Definition: BaseInfoState.cpp:40