orxonox::OverlayGroup Class Reference

OverlayGroup does almost exactly what it says: It groups OrxonoxOverlays together. You can scroll the entire group by a certain amount. Scale however works differently than expected: Each OrxonoxOverlay scales individually. That's quite useful when you create your HUD with an OverlayGroup and then want to alter its size. More...

#include <src/orxonox/overlays/OverlayGroup.h>

Inheritance diagram for orxonox::OverlayGroup:

orxonox::BaseObject orxonox::OrxonoxClass orxonox::NotificationQueue

List of all members.

Public Member Functions

void addElement (OrxonoxOverlay *element)
 Adds an element to the set (used when loading with XMLPort).
void changedVisibility ()
 Changes the visibility of all elements.
OrxonoxOverlaygetElement (unsigned int index)
 Returns a different element as long as index < hudElements_.size().
const std::set< OrxonoxOverlay * > & getOverlays () const
BaseObjectgetOwner () const
Vector2 getScale () const
 Returns the current size of the group.
Vector2 getScroll () const
 Returns the current scrolling offset of the group.
 OverlayGroup (BaseObject *creator)
bool removeElement (OrxonoxOverlay *element)
 Removes an element from the map.
void scale (const Vector2 &scale)
 Scales each OrxonoxOverlay individually by scale.
void scroll (const Vector2 &scroll)
 Scrolls each OrxonoxOverlay individually by scroll.
void setOwner (BaseObject *owner)
void setScale (const Vector2 &scale)
 Scales every element in the set.
void setScroll (const Vector2 &scroll)
 Scrolls every element in the set.
virtual void XMLPort (Element &xmlElement, XMLPort::Mode mode)
 Loads the group and all its children OrxonoxOverlays.
 ~OverlayGroup ()
 Empty destructor.

Static Public Member Functions

static void scaleGroup (const std::string &name, float scale)
 Scales an overlay group by its name.
static void scrollGroup (const std::string &name, const Vector2 &scroll)
 Scrolls an overlay group by its name.
static void toggleVisibility (const std::string &name)
 Hides/shows an overlay group by its name.

Private Attributes

std::set< OrxonoxOverlay * > hudElements_
 Contains all the OrxonoxOverlays of the this group.
BaseObjectowner_
 The owner of this OverlayGroup.
Vector2 scale_
 Current scale (independent of the elements).
Vector2 scroll_
 Current scrolling offset.


Detailed Description

OverlayGroup does almost exactly what it says: It groups OrxonoxOverlays together. You can scroll the entire group by a certain amount. Scale however works differently than expected: Each OrxonoxOverlay scales individually. That's quite useful when you create your HUD with an OverlayGroup and then want to alter its size.

Constructor & Destructor Documentation

orxonox::OverlayGroup::OverlayGroup ( BaseObject creator  ) 

orxonox::OverlayGroup::~OverlayGroup (  ) 

Empty destructor.

References hudElements_.


Member Function Documentation

void orxonox::OverlayGroup::addElement ( OrxonoxOverlay element  ) 

Adds an element to the set (used when loading with XMLPort).

Remarks:
The names of the OrxonoxOverlays have to be unique!

References hudElements_, orxonox::BaseObject::isVisible(), owner_, orxonox::OrxonoxOverlay::setOwner(), and orxonox::BaseObject::setVisible().

Referenced by orxonox::NotificationQueue::addNotification(), orxonox::HUDHealthBar::changedOverlayGroup(), and XMLPort().

void orxonox::OverlayGroup::changedVisibility (  )  [virtual]

Changes the visibility of all elements.

Reimplemented from orxonox::BaseObject.

References hudElements_.

OrxonoxOverlay * orxonox::OverlayGroup::getElement ( unsigned int  index  ) 

Returns a different element as long as index < hudElements_.size().

References hudElements_.

Referenced by XMLPort().

const std::set<OrxonoxOverlay*>& orxonox::OverlayGroup::getOverlays (  )  const [inline]

BaseObject* orxonox::OverlayGroup::getOwner (  )  const [inline]

Vector2 orxonox::OverlayGroup::getScale (  )  const [inline]

Returns the current size of the group.

Referenced by XMLPort().

Vector2 orxonox::OverlayGroup::getScroll (  )  const [inline]

Returns the current scrolling offset of the group.

Referenced by XMLPort().

bool orxonox::OverlayGroup::removeElement ( OrxonoxOverlay element  ) 

Removes an element from the map.

Parameters:
name The name of the element that is removed.
Returns:
Returns true if there was such an element to remove, false if not.

References hudElements_.

Referenced by orxonox::NotificationQueue::removeContainer().

void orxonox::OverlayGroup::scale ( const Vector2 &  scale  )  [inline]

Scales each OrxonoxOverlay individually by scale.

void orxonox::OverlayGroup::scaleGroup ( const std::string name,
float  scale 
) [static]

Scales an overlay group by its name.

Parameters:
name The name of the group defined BaseObject::setName() (usually done with the "name" attribute in the xml file).

References orxonox::MT_Type::Vector2.

void orxonox::OverlayGroup::scroll ( const Vector2 &  scroll  )  [inline]

Scrolls each OrxonoxOverlay individually by scroll.

void orxonox::OverlayGroup::scrollGroup ( const std::string name,
const Vector2 &  scroll 
) [static]

Scrolls an overlay group by its name.

Parameters:
name The name of the group defined BaseObject::setName() (usually done with the "name" attribute in the xml file).

void orxonox::OverlayGroup::setOwner ( BaseObject owner  ) 

void orxonox::OverlayGroup::setScale ( const Vector2 &  scale  ) 

Scales every element in the set.

References hudElements_, and scale_.

Referenced by XMLPort().

void orxonox::OverlayGroup::setScroll ( const Vector2 &  scroll  ) 

Scrolls every element in the set.

References hudElements_, and scroll_.

Referenced by XMLPort().

void orxonox::OverlayGroup::toggleVisibility ( const std::string name  )  [static]

Hides/shows an overlay group by its name.

Parameters:
name The name of the group defined BaseObject::setName() (usually done with the "name" attribute in the xml file).

void orxonox::OverlayGroup::XMLPort ( Element &  xmlElement,
XMLPort::Mode  mode 
) [virtual]

Loads the group and all its children OrxonoxOverlays.

XML loading and saving.

Parameters:
xmlelement The XML-element
loading Loading (true) or saving (false)
Returns:
The XML-element

Reimplemented from orxonox::BaseObject.

Reimplemented in orxonox::NotificationQueue.

References addElement(), getElement(), getScale(), getScroll(), setScale(), setScroll(), SUPER, XMLPortObject, and XMLPortParam.


Member Data Documentation

Contains all the OrxonoxOverlays of the this group.

Referenced by addElement(), changedVisibility(), getElement(), removeElement(), setOwner(), setScale(), setScroll(), and ~OverlayGroup().

The owner of this OverlayGroup.

Referenced by addElement(), and setOwner().

Vector2 orxonox::OverlayGroup::scale_ [private]

Current scale (independent of the elements).

Referenced by setScale().

Vector2 orxonox::OverlayGroup::scroll_ [private]

Current scrolling offset.

Referenced by setScroll().


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

Generated on Tue Jul 28 16:22:51 2009 for Orxonox by  doxygen 1.5.6