cWidget::WithColorFunctions Class Reference

Offers basic functions to parse nodes that contain color information like Forground or Background. More...

#include <cWidgetBase.h>

Inheritance diagram for cWidget::WithColorFunctions:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool Process (tXmlParser::node cur)
 just passes on to Base::Process()

Protected Member Functions

rGradient ProcessGradient (tXmlParser::node cur)
 Processes the inside of a nodes like Foreground or Background.
void ProcessGradientCore (tXmlParser::node cur, rGradient &gradient)
 Processes the inside of a Solid or Gradient nodes.
void ProcessImage (tXmlParser::node cur, rGradient &gradient, int repeat)
 Processes the inside of an Image node.


Detailed Description

Offers basic functions to parse nodes that contain color information like Forground or Background.

Definition at line 160 of file cWidgetBase.h.


Member Function Documentation

rGradient cWidget::WithColorFunctions::ProcessGradient ( tXmlParser::node  cur  )  [protected]

Processes the inside of a nodes like Foreground or Background.

Definition at line 384 of file cWidgetBase.cpp.

References rGradient::horizontal, ProcessGradientCore(), ProcessImage(), repeat, rGradient::SetDir(), rGradient::SetTextureScale(), tERR_WARN, rGradient::value, rGradient::vertical, tCoord::x, and tCoord::y.

Referenced by cWidget::WithLineColor::Process(), cWidget::WithBackground::Process(), and cWidget::WithForeground::Process().

00385                                                                 {
00386     rGradient ret;
00387     for (cur = cur.GetFirstChild(); cur; ++cur) {
00388         tString name=cur.GetName();
00389         if(name == "Solid") {
00390             ProcessGradientCore(cur, ret);
00391         } else if(name == "Gradient") {
00392             std::map<tString, rGradient::direction> directions;
00393             directions[tString("horizontal")] = rGradient::horizontal;
00394             directions[tString("vertical")] = rGradient::vertical;
00395             directions[tString("value")] = rGradient::value;
00396             std::map<tString, rGradient::direction>::iterator iter;
00397             if((iter = directions.find(cur.GetProp("orientation"))) != directions.end()) {
00398                 ret.SetDir(iter->second);
00399             } else {
00400                 tERR_WARN("Gradient orientation '" + cur.GetProp("orientation") + "' unknown!");
00401             }
00402             ProcessGradientCore(cur, ret);
00403         } else if(name == "Image") {
00404             int rep = 0;
00405             std::map<tString, int> repeat;
00406             repeat[tString("none")] = 0;
00407             repeat[tString("x")] = 1;
00408             repeat[tString("y")] = 2;
00409             repeat[tString("both")] = 3;
00410             std::map<tString, int>::iterator iter;
00411             if((iter = repeat.find(cur.GetProp("repeat"))) != repeat.end()) {
00412                 rep = iter->second;
00413             } else {
00414                 tERR_WARN("Repeat setting '" + cur.GetProp("repeat") + "' unknown!");
00415             }
00416             tCoord scale;
00417             cur.GetProp("scale_x", scale.x);
00418             cur.GetProp("scale_y", scale.y);
00419             ret.SetTextureScale(scale);
00420             ProcessImage(cur, ret, rep);
00421         }
00422     }
00423     return ret;

Here is the call graph for this function:

Here is the caller graph for this function:

void cWidget::WithColorFunctions::ProcessGradientCore ( tXmlParser::node  cur,
rGradient gradient 
) [protected]

Processes the inside of a Solid or Gradient nodes.

Definition at line 425 of file cWidgetBase.cpp.

References a, and b.

Referenced by ProcessGradient().

00426                                                                                     {
00427     for (cur = cur.GetFirstChild(); cur; ++cur) {
00428         if(cur.IsOfType("Color")) {
00429             float r,g,b,a,at;
00430             cur.GetProp("r", r);
00431             cur.GetProp("g", g);
00432             cur.GetProp("b", b);
00433             cur.GetProp("alpha", a);
00434             cur.GetProp("at", at);
00435             gradient[at] = rColor(r ,g ,b ,a);
00436         }
00437     }

Here is the caller graph for this function:

void cWidget::WithColorFunctions::ProcessImage ( tXmlParser::node  cur,
rGradient gradient,
int  repeat 
) [protected]

Processes the inside of an Image node.

Definition at line 439 of file cWidgetBase.cpp.

References cWidget::Base::m_Cockpit, and rGradient::SetTexture().

Referenced by ProcessGradient().

00440                                                                                          {
00441     for(cur = cur.GetFirstChild(); cur; ++cur) {
00442         if(cur.IsOfType("Graphic")) {
00443             tResourcePath path(
00444                 cur.HasProp("author") ? cur.GetProp("author") : m_Cockpit->Path().Author(),
00445                 cur.HasProp("category") ? cur.GetProp("category") : m_Cockpit->Path().Category(),
00446                 cur.GetProp("name"),
00447                 cur.GetProp("version"),
00448                 tString("aatex"),
00449                 cur.GetProp("extension"),
00450                 cur.GetProp("uri")
00451             );
00452             gradient.SetTexture(rResourceTexture(path, repeat & 1, repeat & 2));
00453         }
00454     }

Here is the call graph for this function:

Here is the caller graph for this function:

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

just passes on to Base::Process()

Reimplemented from cWidget::Base.

Reimplemented in cWidget::BarGauge, cWidget::Map, cWidget::Rectangle, cWidget::WithForeground, cWidget::WithBackground, and cWidget::WithLineColor.

Definition at line 380 of file cWidgetBase.cpp.

References cWidget::Base::Process().

Referenced by cWidget::WithLineColor::Process(), cWidget::WithBackground::Process(), and cWidget::WithForeground::Process().

00381                                                    {
00382     return Base::Process(cur);

Here is the call graph for this function:

Here is the caller graph for this function:


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