OpenXcom  1.0
Open-source clone of the original X-Com
InventoryState.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 "../Interface/TextButton.h"
22 #include "../Savegame/EquipmentLayoutItem.h"
23 
24 
25 namespace OpenXcom
26 {
27 
28 class Surface;
29 class Text;
30 class InteractiveSurface;
31 class Inventory;
32 class SavedBattleGame;
33 class BattlescapeState;
34 class BattleUnit;
35 class BattlescapeButton;
36 
40 class InventoryState : public State
41 {
42 private:
43  Surface *_bg, *_soldier;
44  Text *_txtName, *_txtItem, *_txtAmmo, *_txtWeight, *_txtTus, *_txtFAcc, *_txtReact, *_txtPSkill, *_txtPStr;
45  BattlescapeButton *_btnOk, *_btnPrev, *_btnNext, *_btnUnload, *_btnGround, *_btnRank;
46  BattlescapeButton *_btnCreateTemplate, *_btnApplyTemplate;
47  Surface *_selAmmo;
48  Inventory *_inv;
49  std::vector<EquipmentLayoutItem*> _curInventoryTemplate;
50  SavedBattleGame *_battleGame;
51  const bool _tu;
52  BattlescapeState *_parent;
53  std::string _currentTooltip;
54 public:
56  InventoryState(bool tu, BattlescapeState *parent);
60  void init();
62  void updateStats();
64  void saveEquipmentLayout();
66  void btnOkClick(Action *action);
68  void btnPrevClick(Action *action);
70  void btnNextClick(Action *action);
72  void btnUnloadClick(Action *action);
74  void btnGroundClick(Action *action);
76  void btnRankClick(Action *action);
78  void btnCreateTemplateClick(Action *action);
80  void btnApplyTemplateClick(Action *action);
82  void onClearInventory(Action *action);
84  void onAutoequip(Action *action);
86  void invClick(Action *action);
88  void invMouseOver(Action *action);
90  void invMouseOut(Action *action);
92  void handle(Action *action);
94  void txtTooltipIn(Action *action);
96  void txtTooltipOut(Action *action);
97 
98 private:
100  void _updateTemplateButtons(bool isVisible);
102  void _refreshMouse();
103 };
104 
105 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void btnCreateTemplateClick(Action *action)
Handler for clicking on the Create Template button.
Definition: InventoryState.cpp:557
void btnNextClick(Action *action)
Handler for clicking the Next button.
Definition: InventoryState.cpp:506
A game state that receives user input and reacts accordingly.
Definition: State.h:44
InventoryState(bool tu, BattlescapeState *parent)
Creates the Inventory state.
Definition: InventoryState.cpp:63
void btnGroundClick(Action *action)
Handler for clicking on the Ground -> button.
Definition: InventoryState.cpp:543
void invMouseOut(Action *action)
Handler for hiding item info.
Definition: InventoryState.cpp:902
void invClick(Action *action)
Handler for clicking on the inventory.
Definition: InventoryState.cpp:819
Text string displayed on screen.
Definition: Text.h:40
void onAutoequip(Action *action)
Handler for hitting the Autoequip hotkey.
Definition: InventoryState.cpp:787
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: InventoryState.cpp:447
void btnPrevClick(Action *action)
Handler for clicking the Previous button.
Definition: InventoryState.cpp:484
void btnApplyTemplateClick(Action *action)
Handler for clicking the Apply Template button.
Definition: InventoryState.cpp:622
void saveEquipmentLayout()
Saves the soldiers&#39; equipment-layout.
Definition: InventoryState.cpp:407
void btnUnloadClick(Action *action)
Handler for clicking the Unload button.
Definition: InventoryState.cpp:527
void init()
Updates all soldier info.
Definition: InventoryState.cpp:275
void invMouseOver(Action *action)
Handler for showing item info.
Definition: InventoryState.cpp:828
Interactive view of an inventory.
Definition: Inventory.h:39
Screen which displays soldier&#39;s inventory.
Definition: InventoryState.h:40
void btnRankClick(Action *action)
Handler for clicking the Rank button.
Definition: InventoryState.cpp:552
void updateStats()
Updates the soldier info (Weight, TU).
Definition: InventoryState.cpp:364
void txtTooltipOut(Action *action)
Handler for hiding tooltip.
Definition: InventoryState.cpp:951
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:47
Regular image that works like a button.
Definition: BattlescapeButton.h:34
void onClearInventory(Action *action)
Handler for hitting the Clear Inventory hotkey.
Definition: InventoryState.cpp:764
void txtTooltipIn(Action *action)
Handler for showing tooltip.
Definition: InventoryState.cpp:938
Battlescape screen which shows the tactical battle.
Definition: BattlescapeState.h:47
~InventoryState()
Cleans up the Inventory state.
Definition: InventoryState.cpp:249
void handle(Action *action)
Handles keypresses.
Definition: InventoryState.cpp:914
Definition: BaseInfoState.cpp:40