cWidget::WithCoordinates Class Reference

Able to store and parse the position and size of a widget. More...

#include <cWidgetBase.h>

Inheritance diagram for cWidget::WithCoordinates:

Inheritance graph
[legend]
Collaboration diagram for cWidget::WithCoordinates:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 WithCoordinates ()
 Default constructor.
bool Process (tXmlParser::node cur)
 This function will parse Size and Position nodes.
void SetFactor (float factor)
 multiply all y- coordinates by a value

Protected Attributes

tCoord m_position
 The x- and y- coordinates of the widget.
tCoord m_size
 The size as width and height.

Private Attributes

tCoord m_originalPosition
 The position without any transformations applied.
tCoord m_originalSize
 The size without any transformations applied.


Detailed Description

Able to store and parse the position and size of a widget.

Definition at line 102 of file cWidgetBase.h.


Constructor & Destructor Documentation

cWidget::WithCoordinates::WithCoordinates (  ) 

Default constructor.

Definition at line 62 of file cWidgetBase.cpp.

00062                                  : m_originalPosition(0,0), m_originalSize(1,1), m_position(0,0), m_size(1,1)
00063 {}


Member Function Documentation

bool cWidget::WithCoordinates::Process ( tXmlParser::node  cur  )  [virtual]

This function will parse Size and Position nodes.

Reimplemented from cWidget::Base.

Reimplemented in cWidget::BarGauge, cWidget::Label, cWidget::Map, and cWidget::Rectangle.

Definition at line 65 of file cWidgetBase.cpp.

References m_originalPosition, m_originalSize, m_position, m_size, cWidget::Base::Process(), tCoord::x, and tCoord::y.

Referenced by cWidget::Rectangle::Process(), cWidget::Map::Process(), cWidget::Label::Process(), and cWidget::BarGauge::Process().

00065                                                 {
00066     if(cur.IsOfType("Position")) {
00067         tCoord shift;
00068         cur.GetProp("x", shift.x);
00069         cur.GetProp("y", shift.y);
00070         m_position += shift;
00071         m_originalPosition = m_position;
00072         return true;
00073     }
00074     if(cur.IsOfType("Size")) {
00075         tCoord factor;
00076         cur.GetProp("width", factor.x);
00077         cur.GetProp("height", factor.y);
00078         m_size *= factor;
00079         m_originalSize = m_size;
00080         return true;
00081     }
00082     return Base::Process(cur);
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:

void cWidget::WithCoordinates::SetFactor ( float  factor  ) 

multiply all y- coordinates by a value

Definition at line 86 of file cWidgetBase.cpp.

References m_originalPosition, m_originalSize, m_position, m_size, and tCoord::y.

00086                                             {
00087     m_position.y = (m_originalPosition.y + 1.) * factor - 1.;
00088     m_size.y = m_originalSize.y * factor;
00089 }


Member Data Documentation

tCoord cWidget::WithCoordinates::m_originalPosition [private]

The position without any transformations applied.

Definition at line 103 of file cWidgetBase.h.

Referenced by Process(), and SetFactor().

tCoord cWidget::WithCoordinates::m_originalSize [private]

The size without any transformations applied.

Definition at line 104 of file cWidgetBase.h.

Referenced by Process(), and SetFactor().

tCoord cWidget::WithCoordinates::m_position [protected]

The x- and y- coordinates of the widget.

Definition at line 106 of file cWidgetBase.h.

Referenced by Process(), cWidget::Rectangle::Render(), cWidget::Map::Render(), cWidget::Label::Render(), cWidget::VerticalBarGauge::RenderCaption(), cWidget::BarGauge::RenderCaption(), cWidget::NeedleGauge::RenderGraph(), cWidget::VerticalBarGauge::RenderGraph(), cWidget::BarGauge::RenderGraph(), cWidget::BarGauge::RenderMinMax(), and SetFactor().

tCoord cWidget::WithCoordinates::m_size [protected]

The size as width and height.

Definition at line 107 of file cWidgetBase.h.

Referenced by Process(), cWidget::Rectangle::Render(), cWidget::Map::Render(), cWidget::Label::Render(), cWidget::VerticalBarGauge::RenderCaption(), cWidget::BarGauge::RenderCaption(), cWidget::NeedleGauge::RenderGraph(), cWidget::VerticalBarGauge::RenderGraph(), cWidget::BarGauge::RenderGraph(), cWidget::BarGauge::RenderMinMax(), and SetFactor().


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 00:04:24 2008 for Armagetron Advanced by  doxygen 1.5.4