Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Theme Class Reference

This class represents a theme. More...

#include <theme.h>

List of all members.

Public Types

enum  ImageType {
  LEFT_KEEPER_ON_FLOOR, RIGHT_KEEPER_ON_FLOOR, UP_KEEPER_ON_FLOOR, DOWN_KEEPER_ON_FLOOR,
  LEFT_KEPPER_ON_DEAD_FLOOR, RIGHT_KEPPER_ON_DEAD_FLOOR, UP_KEPPER_ON_DEAD_FLOOR, DOWN_KEPPER_ON_DEAD_FLOOR,
  LEFT_KEEPER_ON_GOAL, RIGHT_KEEPER_ON_GOAL, UP_KEEPER_ON_GOAL, DOWN_KEEPER_ON_GOAL,
  LEFT_MOVING_KEEPER, RIGHT_MOVING_KEEPER, DOWN_MOVING_KEEPER, UP_MOVING_KEEPER,
  LEFT_VIRTUAL_KEEPER, RIGHT_VIRTUAL_KEEPER, UP_VIRTUAL_KEEPER, DOWN_VIRTUAL_KEEPER,
  GEM_ON_FLOOR, GEM_ON_DEAD_FLOOR, GEM_ON_GOAL, MOVING_GEM,
  EMPTY_FLOOR, EMPTY_DEAD_FLOOR, EMPTY_GOAL, LEFT_ARROW,
  RIGHT_ARROW, UP_ARROW, DOWN_ARROW, WALL,
  OUTSIDE
}

Public Methods

 Theme (QDomElement const &dom_element)
bool hideGems () const
void setHideGems (bool hide)
bool hideGoals () const
void setHideGoals (bool hide)
bool outsideAsWall () const
void setOutsideAsWall (bool outside_as_wall)
QString const & name () const
QString const & backgroundImage () const
QColor backgroundColor () const
std::vector< int > const & imageIndices (ImageType type, QPoint const &position, Map const &map) const
std::vector< int > const & imageIndicesFromPosition (int direction, QPoint const &position, Map const &map) const
PieceImage const & pieceImage (int index) const
int nrOfPieceImages () const
double upperBorder () const
double lowerBorder () const
double leftBorder () const
double rightBorder () const

Private Methods

void addAlternates (QDomElement const &dom_element)
void addPieceImageAlternates (QDomElement const &dom_element)
void addWallPieceAlternates (QDomElement const &dom_element)
void addAlternatesImages (QDomElement const &dom_element)
int patternForPieceImage (QDomElement const &dom_element, QString const &name)
int patternForWallPiece (QDomElement const &dom_element, QString const &name)
int getNonWallPattern (QPoint const &position, Map const &map) const
int getWallPattern (QPoint const &position, Map const &map) const

Private Attributes

QString m_name
double m_upper_border
double m_lower_border
double m_left_border
double m_right_border
QColor m_background_color
QString m_background_image
std::vector< int > m_alternate_starts
std::vector< int > m_alternate_sizes
std::vector< int > m_alternative_piece_image_starts
std::vector< int > m_alternative_piece_image_nr
std::vector< int > m_patterns
std::vector< int > m_piece_image_indices
std::vector< PieceImagem_piece_images
bool m_hide_gems
bool m_hide_goals
bool m_outside_as_wall

Static Private Attributes

char const * s_elements [33]
char const * s_short_elements [33]
int const s_types_for_hidden_gems [33]
int const s_types_for_hidden_goals [33]


Detailed Description

This class represents a theme.

Author:
Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
Version:
0.1


Member Enumeration Documentation

enum Theme::ImageType
 

Defines the image types.

Enumeration values:
LEFT_KEEPER_ON_FLOOR   A keeper looking left on a non dead floor.
RIGHT_KEEPER_ON_FLOOR   A keeper looking right on a non dead floor.
UP_KEEPER_ON_FLOOR   A keeper looking up on a non dead floor.
DOWN_KEEPER_ON_FLOOR   A keeper looking down on a non dead floor.
LEFT_KEPPER_ON_DEAD_FLOOR   A keeper looking left on a dead floor.
RIGHT_KEPPER_ON_DEAD_FLOOR   A keeper looking right on a dead floor.
UP_KEPPER_ON_DEAD_FLOOR   A keeper looking up on a dead floor.
DOWN_KEPPER_ON_DEAD_FLOOR   A keeper looking down on a dead floor.
LEFT_KEEPER_ON_GOAL   A keeper looking left on a goal field.
RIGHT_KEEPER_ON_GOAL   A keeper looking right on a goal field.
UP_KEEPER_ON_GOAL   A keeper looking up on a goal field.
DOWN_KEEPER_ON_GOAL   A keeper looking down on a goal field.
LEFT_MOVING_KEEPER   A moving keeper looking left.
RIGHT_MOVING_KEEPER   A moving keeper looking right.
DOWN_MOVING_KEEPER   A moving keeper looking down.
UP_MOVING_KEEPER   A moving keeper looking up.
LEFT_VIRTUAL_KEEPER   The virtual keeper looking left.
RIGHT_VIRTUAL_KEEPER   The virtual keeper looking right.
UP_VIRTUAL_KEEPER   The virtual keeper up.
DOWN_VIRTUAL_KEEPER   The virtual keeper down.
GEM_ON_FLOOR   A gem on a non dead floor.
GEM_ON_DEAD_FLOOR   A gem on a dead floor.
GEM_ON_GOAL   A gem on a goal.
MOVING_GEM   A moving gem.
EMPTY_FLOOR   The empty floor.
EMPTY_DEAD_FLOOR   The empty dead floor.
EMPTY_GOAL   An empty goal field.
LEFT_ARROW   A left arrow.
RIGHT_ARROW   A right arrow.
UP_ARROW   An up arrow.
DOWN_ARROW   A down arrow.
WALL   A wall field.
OUTSIDE   An outside field.


Constructor & Destructor Documentation

Theme::Theme QDomElement const & dom_element
 

Creates a theme from an dom element.

Parameters:
dom_element   The dom element to use.


Member Function Documentation

void Theme::addAlternates QDomElement const & dom_element [private]
 

Adds the alternates of an image type.

Parameters:
dom_element   The dom element to use.

void Theme::addAlternatesImages QDomElement const & dom_element [private]
 

Addes the alternates piece images of the dom element.

Parameters:
dom_element   The dom element to use.

void Theme::addPieceImageAlternates QDomElement const & dom_element [private]
 

Adds piece image alternates.

Parameters:
dom_element   The dom element to use.

void Theme::addWallPieceAlternates QDomElement const & dom_element [private]
 

Adds wall piece alternates.

Parameters:
dom_element   The dom element to use.

QColor Theme::backgroundColor const
 

Returns the background color, which will be used if we don't have a background image or it could not be loaded.

QString const& Theme::backgroundImage const
 

Returns the name background image or an empty string if we dont use one.

int Theme::getNonWallPattern QPoint const & position,
Map const & map
const [private]
 

Returns the pattern for a non wall piece at the given position in the map.

@pattern position The position of the image. @pattern map The map to use.

int Theme::getWallPattern QPoint const & position,
Map const & map
const [private]
 

Returns the pattern for a wall piece at the given position in the map.

@pattern position The position of the image. @pattern map The map to use.

bool Theme::hideGems const
 

Returns true, if we hide the gems.

bool Theme::hideGoals const
 

Returns true, if we hide the goals.

std::vector<int> const& Theme::imageIndices ImageType type,
QPoint const & position,
Map const & map
const
 

Returns the indices of the images requested.

Parameters:
type   The type of the images.
position   The position of the image (is ignored for moving images).
map   The map to use.

std::vector<int> const& Theme::imageIndicesFromPosition int direction,
QPoint const & position,
Map const & map
const
 

Returns the indices of the images of the piece at the given position.

Parameters:
direction   The direction of the keeper.
position   The position of the field.
map   The map to use.

double Theme::leftBorder const
 

Return the left border given relative to the field size.

double Theme::lowerBorder const
 

Returns the lower border given relative to the field size.

QString const& Theme::name const
 

Returns the name of the theme.

int Theme::nrOfPieceImages const
 

Returns the number of piece images.

bool Theme::outsideAsWall const
 

Returns true if outside fields are treated as wall.

int Theme::patternForPieceImage QDomElement const & dom_element,
QString const & name
[private]
 

Returns the pattern value for the given attribute of the dom element for piece images.

Parameters:
dom_element   The dom element to use.
name   The name of the attribute to use.

int Theme::patternForWallPiece QDomElement const & dom_element,
QString const & name
[private]
 

Returns the pattern value for the given attribute of the dom element for wall pieces.

Parameters:
dom_element   The dom element to use.
name   The name of the attribute to use.

PieceImage const& Theme::pieceImage int index const
 

Returns the piece image with the given index.

Parameters:
index   The index of the piece image.

double Theme::rightBorder const
 

Returns the right border given relative to the field size.

void Theme::setHideGems bool hide
 

Hides all gems.

Parameters:
hide   If true, all gems are hidden.

void Theme::setHideGoals bool hide
 

Hides all goals.

Parameters:
hide   If true, all goals are hidden.

void Theme::setOutsideAsWall bool outside_as_wall
 

Sets if outside fields are treated as wall.

Parameters:
outside_as_wall   If true, outside fields are treated as wall.

double Theme::upperBorder const
 

Returns the upper border given relative to the field size.


Member Data Documentation

std::vector<int> Theme::m_alternate_sizes [private]
 

The number of alternates for the image types.

std::vector<int> Theme::m_alternate_starts [private]
 

The start index of the image type in the alternates.

std::vector<int> Theme::m_alternative_piece_image_nr [private]
 

The number of alternative piece images for the alternates.

std::vector<int> Theme::m_alternative_piece_image_starts [private]
 

The start index of alternative piece images for the alternates.

QColor Theme::m_background_color [private]
 

The background color to use.

QString Theme::m_background_image [private]
 

The background image to use.

bool Theme::m_hide_gems [private]
 

If true, all gems are hidden.

bool Theme::m_hide_goals [private]
 

If true, all goals are hidden.

double Theme::m_left_border [private]
 

The left border.

double Theme::m_lower_border [private]
 

The lower border.

QString Theme::m_name [private]
 

The name of the theme.

bool Theme::m_outside_as_wall [private]
 

If true, outside fields are treated as wall.

std::vector<int> Theme::m_patterns [private]
 

The alternates patterns.

std::vector<int> Theme::m_piece_image_indices [private]
 

Points to the piece indices.

std::vector<PieceImage> Theme::m_piece_images [private]
 

The piece images.

double Theme::m_right_border [private]
 

The right border.

double Theme::m_upper_border [private]
 

The upper border.

char const* Theme::s_elements[33] [static, private]
 

Here we store the names of the elements of the root element of the theme file.

char const* Theme::s_short_elements[33] [static, private]
 

Here we store the alternative short names of the elements of the root element of the theme file.

int const Theme::s_types_for_hidden_gems[33] [static, private]
 

The translation table if we don't show gems.

int const Theme::s_types_for_hidden_goals[33] [static, private]
 

The translation table if we don't show goals.


The documentation for this class was generated from the following file:
Generated at Sun Jan 6 18:49:13 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001