OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::Window Class Reference

Box with a coloured border and custom background. More...

#include <Window.h>

Inheritance diagram for OpenXcom::Window:
OpenXcom::Surface

Public Member Functions

 Window (State *state, int width, int height, int x=0, int y=0, WindowPopup popup=POPUP_NONE)
 Creates a new window with the specified size and position. More...
 
 ~Window ()
 Cleans up the window. More...
 
void setBackground (Surface *bg)
 Sets the background surface. More...
 
void setColor (Uint8 color)
 Sets the border color. More...
 
Uint8 getColor () const
 Gets the border color. More...
 
void setHighContrast (bool contrast)
 Sets the high contrast color setting. More...
 
void think ()
 Handles the timers. More...
 
void popup ()
 Popups the window. More...
 
void draw ()
 Draws the window. More...
 
void setDX (int dx)
 sets the X delta. More...
 
void setDY (int dy)
 sets the Y delta. More...
 
void setThinBorder ()
 Give this window a thin border. More...
 
- Public Member Functions inherited from OpenXcom::Surface
 Surface (int width, int height, int x=0, int y=0, int bpp=8)
 Creates a new surface with the specified size and position. More...
 
 Surface (const Surface &other)
 Creates a new surface from an existing one. More...
 
virtual ~Surface ()
 Cleans up the surface. More...
 
void loadScr (const std::string &filename)
 Loads an X-Com SCR graphic. More...
 
void loadSpk (const std::string &filename)
 Loads an X-Com SPK graphic. More...
 
void loadBdy (const std::string &filename)
 Loads a TFTD BDY graphic. More...
 
void loadImage (const std::string &filename)
 Loads a general image file. More...
 
void clear ()
 Clears the surface's contents. More...
 
void offset (int off, int min=-1, int max=-1, int mul=1)
 Offsets the surface's colors by a set amount. More...
 
void invert (Uint8 mid)
 Inverts the surface's colors. More...
 
virtual void blit (Surface *surface)
 Blits this surface onto another one. More...
 
virtual void initText (Font *, Font *, Language *)
 Initializes the surface's various text resources.
 
void copy (Surface *surface)
 Copies a portion of another surface into this one. More...
 
void drawRect (SDL_Rect *rect, Uint8 color)
 Draws a filled rectangle on the surface. More...
 
void drawRect (Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 color)
 Draws a filled rectangle on the surface. More...
 
void drawLine (Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 color)
 Draws a line on the surface. More...
 
void drawCircle (Sint16 x, Sint16 y, Sint16 r, Uint8 color)
 Draws a filled circle on the surface. More...
 
void drawPolygon (Sint16 *x, Sint16 *y, int n, Uint8 color)
 Draws a filled polygon on the surface. More...
 
void drawTexturedPolygon (Sint16 *x, Sint16 *y, int n, Surface *texture, int dx, int dy)
 Draws a textured polygon on the surface. More...
 
void drawString (Sint16 x, Sint16 y, const char *s, Uint8 color)
 Draws a string on the surface. More...
 
virtual void setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256)
 Sets the surface's palette. More...
 
SDL_Color * getPalette () const
 Returns the surface's 8bpp palette. More...
 
virtual void setX (int x)
 Sets the X position of the surface. More...
 
int getX () const
 Returns the position of the surface in the X axis. More...
 
virtual void setY (int y)
 Sets the Y position of the surface. More...
 
int getY () const
 Returns the position of the surface in the Y axis. More...
 
void setVisible (bool visible)
 Sets the surface's visibility. More...
 
bool getVisible () const
 Gets the surface's visibility. More...
 
void resetCrop ()
 Resets the cropping rectangle for the surface. More...
 
SDL_Rect * getCrop ()
 Gets the cropping rectangle for the surface. More...
 
void setPixel (int x, int y, Uint8 pixel)
 Changes the color of a pixel in the surface, relative to the top-left corner of the surface. More...
 
void setPixelIterative (int *x, int *y, Uint8 pixel)
 Changes the color of a pixel in the surface and returns the next pixel position. More...
 
Uint8 getPixel (int x, int y) const
 Returns the color of a specified pixel in the surface. More...
 
SDL_Surface * getSurface () const
 Returns the internal SDL_Surface for SDL calls. More...
 
int getWidth () const
 Returns the width of the surface. More...
 
virtual void setWidth (int width)
 Sets the width of the surface. More...
 
int getHeight () const
 Returns the height of the surface. More...
 
virtual void setHeight (int height)
 Sets the height of the surface. More...
 
void setHidden (bool hidden)
 Sets the surface's special hidden flag. More...
 
void lock ()
 Locks the surface. More...
 
void unlock ()
 Unlocks the surface. More...
 
void blitNShade (Surface *surface, int x, int y, int off, bool half=false, int newBaseColor=0)
 Specific blit function to blit battlescape terrain data in different shades in a fast way. More...
 
void invalidate ()
 Invalidate the surface: force it to be redrawn. More...
 
std::string getTooltip () const
 Gets the tooltip of the surface. More...
 
void setTooltip (const std::string &tooltip)
 Sets the tooltip of the surface. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXcom::Surface
void resize (int width, int height)
 Recreates the surface with a new size. More...
 

Detailed Description

Box with a coloured border and custom background.

Pretty much used as the background in most of the interface. In fact it's also used in screens, so it's not really much of a window, just a... box. But box sounds lame.

Constructor & Destructor Documentation

OpenXcom::Window::Window ( State state,
int  width,
int  height,
int  x = 0,
int  y = 0,
WindowPopup  popup = POPUP_NONE 
)

Creates a new window with the specified size and position.

Sets up a blank window with the specified size and position.

Parameters
statePointer to state the window belongs to.
widthWidth in pixels.
heightHeight in pixels.
xX position in pixels.
yY position in pixels.
popupPopup animation.
OpenXcom::Window::~Window ( )

Cleans up the window.

Deletes timers.

Member Function Documentation

void OpenXcom::Window::draw ( )
virtual

Draws the window.

Draws the bordered window with a graphic background.

The background never moves with the window, it's always aligned to the top-left corner of the screen and cropped to fit the inside area.

Reimplemented from OpenXcom::Surface.

Uint8 OpenXcom::Window::getColor ( ) const

Gets the border color.

Returns the color used to draw the shaded border.

Returns
Color value.
void OpenXcom::Window::popup ( )

Popups the window.

Plays the window popup animation.

void OpenXcom::Window::setBackground ( Surface bg)

Sets the background surface.

Changes the surface used to draw the background of the window.

Parameters
bgNew background.
void OpenXcom::Window::setColor ( Uint8  color)

Sets the border color.

Changes the color used to draw the shaded border.

Parameters
colorColor value.
void OpenXcom::Window::setDX ( int  dx)

sets the X delta.

Changes the horizontal offset of the surface in the X axis.

Parameters
dxX position in pixels.
void OpenXcom::Window::setDY ( int  dy)

sets the Y delta.

Changes the vertical offset of the surface in the Y axis.

Parameters
dyY position in pixels.
void OpenXcom::Window::setHighContrast ( bool  contrast)

Sets the high contrast color setting.

Enables/disables high contrast color.

Mostly used for Battlescape UI.

Parameters
contrastHigh contrast setting.
void OpenXcom::Window::setThinBorder ( )

Give this window a thin border.

Changes the window to have a thin border.

void OpenXcom::Window::think ( )
virtual

Handles the timers.

Keeps the animation timers running.

Reimplemented from OpenXcom::Surface.


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