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 "../Savegame/SavedGame.h"
24 #include "../Engine/Options.h"
25 
26 namespace OpenXcom
27 {
28 
29 class TextButton;
30 class Window;
31 class Text;
32 class TextList;
33 class ArrowButton;
34 
39 class ListGamesState : public State
40 {
41 protected:
42  TextButton *_btnCancel;
43  Window *_window;
44  Text *_txtTitle, *_txtName, *_txtDate, *_txtDelete, *_txtDetails;
45  TextList *_lstSaves;
46  ArrowButton *_sortName, *_sortDate;
47  OptionsOrigin _origin;
48  std::vector<SaveInfo> _saves;
49  unsigned int _firstValidRow;
50  bool _autoquick, _sortable;
51 
52  void updateArrows();
53 public:
55  ListGamesState(OptionsOrigin origin, int firstValidRow, bool autoquick);
57  virtual ~ListGamesState();
59  void init();
61  void sortList(SaveSort sort);
63  virtual void updateList();
65  void btnCancelClick(Action *action);
67  void lstSavesMouseOver(Action *action);
69  void lstSavesMouseOut(Action *action);
71  virtual void lstSavesPress(Action *action);
73  void sortNameClick(Action *action);
75  void sortDateClick(Action *action);
77  void disableSort();
78 };
79 
80 }
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:44
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:39
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