#include <cRectangle.h>
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. |
Definition at line 43 of file cRectangle.h.
virtual cWidget::Rectangle::~Rectangle | ( | ) | [inline, virtual] |
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 }
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 }