cWidget::Rectangle Class Reference

Processes and renders a simple rectangle with foreground and background gradients. More...

#include <cRectangle.h>

Inheritance diagram for cWidget::Rectangle:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~Rectangle ()
void Render ()
 Do- nothing destructor.
virtual bool Process (tXmlParser::node cur)
 Passes on to all Process() functions of the base classes and calls Base::DisplayError() on failure.


Detailed Description

Processes and renders a simple rectangle with foreground and background gradients.

Definition at line 43 of file cRectangle.h.


Constructor & Destructor Documentation

virtual cWidget::Rectangle::~Rectangle (  )  [inline, virtual]

Definition at line 45 of file cRectangle.h.

00045 { }; 


Member Function Documentation

void cWidget::Rectangle::Render (  )  [virtual]

Do- nothing destructor.

Renders the rectangle

Implements cWidget::Base.

Definition at line 50 of file cRectangle.cpp.

References rGradient::BeginDraw(), rGradient::DrawRect(), vValue::Type::Set::GetMax(), vValue::Type::Set::GetMin(), vValue::Type::Set::GetVal(), cWidget::WithBackground::m_background, cWidget::WithSingleData::m_data, cWidget::WithForeground::m_foreground, cWidget::WithCoordinates::m_position, cWidget::WithCoordinates::m_size, max(), rGradient::SetGradientEdges(), rGradient::SetValue(), tCoord::x, and tCoord::y.

00050                        {
00051     float val=m_data.GetVal().GetFloat();
00052     float min=m_data.GetMin().GetFloat();
00053     float max=m_data.GetMax().GetFloat();
00054     float where = (val-min)/(max-min);
00055 
00056     const tCoord edge1(tCoord(m_position.x-m_size.x, m_position.y+m_size.y));
00057     const tCoord edge2(tCoord(m_position.x+m_size.x, m_position.y-m_size.y));
00058 
00059     m_foreground.SetGradientEdges(edge1, edge2);
00060     m_background.SetGradientEdges(edge1, edge2);
00061 
00062     glEnable(GL_ALPHA_TEST);
00063     glAlphaFunc(GL_GREATER,0);
00064 
00065     m_foreground.SetValue(where);
00066     m_background.SetValue(where);
00067 
00068     m_background.BeginDraw();
00069     m_background.DrawRect(edge1, edge2);
00070 }

Here is the call graph for this function:

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

Passes on to all Process() functions of the base classes and calls Base::DisplayError() on failure.

Reimplemented from cWidget::WithCoordinates.

Definition at line 37 of file cRectangle.cpp.

References cWidget::Base::DisplayError(), cWidget::WithCoordinates::Process(), cWidget::WithForeground::Process(), cWidget::WithBackground::Process(), and cWidget::WithSingleData::Process().

00037                                           {
00038     if (
00039         WithSingleData  ::Process(cur) ||
00040         WithBackground  ::Process(cur) ||
00041         WithForeground  ::Process(cur) ||
00042         WithCoordinates ::Process(cur))
00043         return true;
00044     else {
00045         DisplayError(cur);
00046         return false;
00047     }
00048 }

Here is the call graph for this function:


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