OpenXcom  1.0
Open-source clone of the original X-Com
ArticleState.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 "../Mod/RuleItem.h"
22 #include <string>
23 
24 namespace OpenXcom
25 {
26  class Game;
27  class Action;
28  class Surface;
29  class TextButton;
30 
37  class ArticleState : public State
38  {
39  protected:
41  ArticleState(const std::string &article_id);
43  virtual ~ArticleState();
44 
45  public:
47  std::string getId() const { return _id; }
48 
49  protected:
50 
52  std::string getDamageTypeText(ItemDamageType dt) const;
53 
55  void initLayout();
56 
58  void btnOkClick(Action *action);
59 
61  void btnPrevClick(Action *action);
62 
64  void btnNextClick(Action *action);
66  std::string _id;
67 
70  TextButton *_btnOk;
71  TextButton *_btnPrev;
72  TextButton *_btnNext;
73  };
74 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void btnOkClick(Action *action)
callback for OK button
Definition: ArticleState.cpp:117
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:135
ArticleState(const std::string &article_id)
constructor (protected, so it can only be instantiated by derived classes)
Definition: ArticleState.cpp:37
Surface * _bg
screen elements common to all articles!
Definition: ArticleState.h:69
void initLayout()
screen layout helpers
Definition: ArticleState.cpp:94
void btnPrevClick(Action *action)
callback for PREV button
Definition: ArticleState.cpp:126
virtual ~ArticleState()
destructor
Definition: ArticleState.cpp:49
Coloured button with a text label.
Definition: TextButton.h:38
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
UfopaediaArticle is the base class for all articles of various types.
Definition: ArticleState.h:37
std::string _id
the article id
Definition: ArticleState.h:66
std::string getId() const
return the article id
Definition: ArticleState.h:47
Definition: BaseInfoState.cpp:40
std::string getDamageTypeText(ItemDamageType dt) const
converts damage type to string
Definition: ArticleState.cpp:52