OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ArticleState.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 
20 #ifndef OPENXCOM_ARTICLESTATE_H
21 #define OPENXCOM_ARTICLESTATE_H
22 
23 #include "../Engine/State.h"
24 #include "../Ruleset/RuleItem.h"
25 #include <string>
26 
27 namespace OpenXcom
28 {
29  class Game;
30  class Action;
31  class Surface;
32  class TextButton;
33 
40  class ArticleState : public State
41  {
42  protected:
44  ArticleState(Game *game, std::string article_id);
46  virtual ~ArticleState();
47 
48  public:
50  std::string getId() const { return _id; }
51 
52  protected:
53 
55  std::string getDamageTypeText(ItemDamageType dt) const;
56 
58  void initLayout();
59 
61  void btnOkClick(Action *action);
62 
64  void btnPrevClick(Action *action);
65 
67  void btnNextClick(Action *action);
69  std::string _id;
70 
73  TextButton *_btnOk;
74  TextButton *_btnPrev;
75  TextButton *_btnNext;
76  };
77 }
78 
79 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void btnOkClick(Action *action)
callback for OK button
Definition: ArticleState.cpp:119
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void btnNextClick(Action *action)
callback for NEXT button
Definition: ArticleState.cpp:137
std::string getId() const
return the article id
Definition: ArticleState.h:50
Surface * _bg
screen elements common to all articles!
Definition: ArticleState.h:72
void initLayout()
screen layout helpers
Definition: ArticleState.cpp:98
void btnPrevClick(Action *action)
callback for PREV button
Definition: ArticleState.cpp:128
virtual ~ArticleState()
destructor
Definition: ArticleState.cpp:53
Coloured button with a text label.
Definition: TextButton.h:40
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
std::string getDamageTypeText(ItemDamageType dt) const
converts damage type to string
Definition: ArticleState.cpp:56
ArticleState(Game *game, std::string article_id)
constructor (protected, so it can only be instantiated by derived classes)
Definition: ArticleState.cpp:40
UfopaediaArticle is the base class for all articles of various types.
Definition: ArticleState.h:40
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
std::string _id
the article id
Definition: ArticleState.h:69