OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenXcom::ArticleState Class Reference

UfopaediaArticle is the base class for all articles of various types. More...

#include <ArticleState.h>

Inheritance diagram for OpenXcom::ArticleState:
OpenXcom::State OpenXcom::ArticleStateArmor OpenXcom::ArticleStateBaseFacility OpenXcom::ArticleStateCraft OpenXcom::ArticleStateCraftWeapon OpenXcom::ArticleStateItem OpenXcom::ArticleStateText OpenXcom::ArticleStateTextImage OpenXcom::ArticleStateTFTD OpenXcom::ArticleStateUfo OpenXcom::ArticleStateVehicle

Public Member Functions

std::string getId () const
 return the article id
 
- Public Member Functions inherited from OpenXcom::State
 State ()
 Creates a new state linked to a game. More...
 
virtual ~State ()
 Cleans up the state. More...
 
void setInterface (const std::string &s, bool alterPal=false, SavedBattleGame *battleGame=0)
 Set interface rules. More...
 
void add (Surface *surface)
 Adds a child element to the state. More...
 
void add (Surface *surface, const std::string &id, const std::string &category, Surface *parent=0)
 Adds a child element to the state. More...
 
bool isScreen () const
 Gets whether the state is a full-screen. More...
 
void toggleScreen ()
 Toggles whether the state is a full-screen. More...
 
virtual void init ()
 Initializes the state. More...
 
virtual void handle (Action *action)
 Handles any events. More...
 
virtual void think ()
 Runs state functionality every cycle. More...
 
virtual void blit ()
 Blits the state to the screen. More...
 
void hideAll ()
 Hides all the state surfaces. More...
 
void showAll ()
 Shws all the state surfaces. More...
 
void resetAll ()
 Resets all the state surfaces. More...
 
const LocalizedTexttr (const std::string &id) const
 Get the localized text. More...
 
LocalizedText tr (const std::string &id, unsigned n) const
 Get the localized text. More...
 
const LocalizedTexttr (const std::string &id, SoldierGender gender) const
 Get the localized text. More...
 
void redrawText ()
 redraw all the text-type surfaces.
 
void centerAllSurfaces ()
 center all surfaces relative to the screen. More...
 
void lowerAllSurfaces ()
 lower all surfaces by half the screen height. More...
 
void applyBattlescapeTheme ()
 switch the colours to use the battlescape palette. More...
 
void setModal (InteractiveSurface *surface)
 Sets a modal surface. More...
 
void setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256, bool immediately=true)
 Changes a set of colors on the state's 8bpp palette. More...
 
void setPalette (const std::string &palette, int backpals=-1)
 Changes the state's 8bpp palette with certain resources. More...
 
SDL_Color * getPalette ()
 Gets the state's 8bpp palette. More...
 
virtual void resize (int &dX, int &dY)
 Let the state know the window has been resized. More...
 
virtual void recenter (int dX, int dY)
 Re-orients all the surfaces in the state. More...
 

Protected Member Functions

 ArticleState (const std::string &article_id)
 constructor (protected, so it can only be instantiated by derived classes) More...
 
virtual ~ArticleState ()
 destructor More...
 
std::string getDamageTypeText (ItemDamageType dt) const
 converts damage type to string
 
void initLayout ()
 screen layout helpers More...
 
void btnOkClick (Action *action)
 callback for OK button More...
 
void btnPrevClick (Action *action)
 callback for PREV button More...
 
void btnNextClick (Action *action)
 callback for NEXT button More...
 

Protected Attributes

std::string _id
 the article id
 
Surface_bg
 screen elements common to all articles!
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenXcom::State
static void setGamePtr (Game *game)
 Sets game object pointer.
 
- Static Protected Attributes inherited from OpenXcom::State
static Game_game = 0
 Initializes static member.
 

Detailed Description

UfopaediaArticle is the base class for all articles of various types.

It encapsulates the basic characteristics.

Constructor & Destructor Documentation

◆ ArticleState()

OpenXcom::ArticleState::ArticleState ( const std::string &  article_id)
protected

constructor (protected, so it can only be instantiated by derived classes)

Constructor.

Parameters
gamePointer to current game.
article_idThe article id of this article state instance.

◆ ~ArticleState()

OpenXcom::ArticleState::~ArticleState ( )
protectedvirtual

destructor

Destructor.

Member Function Documentation

◆ btnNextClick()

void OpenXcom::ArticleState::btnNextClick ( Action action)
protected

callback for NEXT button

Shows the next available article.

Loops to the first.

Parameters
actionPointer to an action.

◆ btnOkClick()

void OpenXcom::ArticleState::btnOkClick ( Action action)
protected

callback for OK button

Returns to the previous screen.

Parameters
actionPointer to an action.

◆ btnPrevClick()

void OpenXcom::ArticleState::btnPrevClick ( Action action)
protected

callback for PREV button

Shows the previous available article.

Parameters
actionPointer to an action.

◆ initLayout()

void OpenXcom::ArticleState::initLayout ( )
protected

screen layout helpers

Set captions and click handlers for the common control elements.


The documentation for this class was generated from the following files: