cWidget::Base Class Reference

Offers basic functions and keeps the camera settings. More...

#include <cWidgetBase.h>

Inheritance diagram for cWidget::Base:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Base ()
virtual ~Base ()
virtual void Render ()=0
 Needs to be owerwritten for all widgets that can be rendered (and therefore created).
void SetCam (int Cam)
 Set the camera(s) this widget will be rendered for.
int GetCam (void)
 Get the camera(s) this widget will be rendered for.
virtual bool Process (tXmlParser::node cur)
 Process a node.
void SetDefaultState (bool state)
void SetCockpit (cCockpit *cockpit)
 Set the cockpit this widget belongs to.
void SetSticky (bool sticky)
bool Active ()
void Toggle (bool state)
 Toggle activity.
virtual void HandleEvent (bool state, int id)
void ParseTemplate (bool state)

Protected Member Functions

void DisplayError (tXmlParser::node cur)
 Displays a parsing error message.

Protected Attributes

bool m_Render
 Should this Widget be rendered?
bool m_RenderDefault
 Should this Widget be rendered by default?
bool m_Sticky
 Should this Widget be sticky?
cCockpitm_Cockpit
 the cockpit this widget belongs to

Private Attributes

int m_Cam
 The camera(s) the widget will be rendered for.
bool m_ParsingTemplate


Detailed Description

Offers basic functions and keeps the camera settings.

Definition at line 59 of file cWidgetBase.h.


Constructor & Destructor Documentation

cWidget::Base::Base (  )  [inline]

Definition at line 69 of file cWidgetBase.h.

00069 : m_ParsingTemplate(false), m_Render(true), m_RenderDefault(true), m_Sticky(true) {}

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

Definition at line 70 of file cWidgetBase.h.

00070 { }


Member Function Documentation

void cWidget::Base::DisplayError ( tXmlParser::node  cur  )  [protected]

Displays a parsing error message.

Prints an error message to the console.

This should be called by derived classes if parsing a setting fails.

Parameters:
cur the node that's being attempted to parse

Definition at line 47 of file cWidgetBase.cpp.

References m_ParsingTemplate, and tERR_WARN.

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

00047                                           {
00048     if(!m_ParsingTemplate) {
00049         tERR_WARN("Element of type '" + cur.GetName() + "' not processable in this context: '" + typeid(*this).name() + "'");
00050     }
00051 }

Here is the caller graph for this function:

virtual void cWidget::Base::Render (  )  [pure virtual]

Needs to be owerwritten for all widgets that can be rendered (and therefore created).

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

void cWidget::Base::SetCam ( int  Cam  ) 

Set the camera(s) this widget will be rendered for.

Definition at line 39 of file cWidgetBase.cpp.

References m_Cam.

Referenced by cCockpit::ProcessWidgetCamera().

00039                          {
00040     m_Cam = Cam;
00041 }

Here is the caller graph for this function:

int cWidget::Base::GetCam ( void   )  [inline]

Get the camera(s) this widget will be rendered for.

Definition at line 74 of file cWidgetBase.h.

References m_Cam.

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

Process a node.

This needs to be overwritten if the derived class has anyting to parse or can be derived from.

It should try to parse the given node, return true on success or return the result of the Process() function of the widget it's derived from if it fails.

Parameters:
cur the node that's being attempted to parse
Returns:
true on success, false on failure

Reimplemented in cWidget::BarGauge, cWidget::Label, cWidget::Map, cWidget::Rectangle, cWidget::WithCoordinates, cWidget::WithDataFunctions, cWidget::WithSingleData, cWidget::WithIdData, cWidget::WithTable, cWidget::WithColorFunctions, cWidget::WithForeground, cWidget::WithBackground, cWidget::WithLineColor, cWidget::WithCaption, cWidget::WithReverse, cWidget::WithAngles, and cWidget::WithShowSettings.

Definition at line 58 of file cWidgetBase.cpp.

Referenced by cWidget::WithShowSettings::Process(), cWidget::WithAngles::Process(), cWidget::WithReverse::Process(), cWidget::WithCaption::Process(), cWidget::WithColorFunctions::Process(), cWidget::WithDataFunctions::Process(), cWidget::WithCoordinates::Process(), and cCockpit::ProcessWidgetCore().

00058                                      {
00059     return false;
00060 }

Here is the caller graph for this function:

void cWidget::Base::SetDefaultState ( bool  state  )  [inline]

Definition at line 76 of file cWidgetBase.h.

References m_Render, and m_RenderDefault.

Referenced by cCockpit::ProcessWidget().

00076 { m_Render = m_RenderDefault = state; }

Here is the caller graph for this function:

void cWidget::Base::SetCockpit ( cCockpit cockpit  )  [inline]

Set the cockpit this widget belongs to.

Definition at line 77 of file cWidgetBase.h.

References m_Cockpit.

Referenced by cCockpit::ProcessWidgets().

Here is the caller graph for this function:

void cWidget::Base::SetSticky ( bool  sticky  )  [inline]

Definition at line 78 of file cWidgetBase.h.

References m_Sticky.

Referenced by cCockpit::ProcessWidget().

00078 { m_Sticky = sticky; }

Here is the caller graph for this function:

bool cWidget::Base::Active (  )  [inline]

Should we render this?

Definition at line 79 of file cWidgetBase.h.

References m_Render.

void cWidget::Base::Toggle ( bool  state  )  [inline]

Toggle activity.

Definition at line 81 of file cWidgetBase.h.

References m_Render, and m_Sticky.

Referenced by HandleEvent().

00081                             {
00082         if(m_Sticky) {
00083             if(state) {
00084                 m_Render = !m_Render;
00085             }
00086         } else {
00087             m_Render = state;
00088         }
00089     }

Here is the caller graph for this function:

virtual void cWidget::Base::HandleEvent ( bool  state,
int  id 
) [inline, virtual]

Overwrite if you need to handle custom events (other than toggling)

Parameters:
state true if the key was pressed, false if it was released
id key id of the event that was received

Reimplemented in cWidget::Map.

Definition at line 93 of file cWidgetBase.h.

References Toggle().

00093 { Toggle(state); }

Here is the call graph for this function:

void cWidget::Base::ParseTemplate ( bool  state  )  [inline]

Call this to surpress warnings about unknown tags

Parameters:
state whether to surpress warnings

Definition at line 96 of file cWidgetBase.h.

References m_ParsingTemplate.

Referenced by cCockpit::ProcessWidgets().

00096 {m_ParsingTemplate = state;}

Here is the caller graph for this function:


Member Data Documentation

int cWidget::Base::m_Cam [private]

The camera(s) the widget will be rendered for.

Definition at line 60 of file cWidgetBase.h.

Referenced by GetCam(), and SetCam().

bool cWidget::Base::m_ParsingTemplate [private]

Definition at line 61 of file cWidgetBase.h.

Referenced by DisplayError(), and ParseTemplate().

bool cWidget::Base::m_Render [protected]

Should this Widget be rendered?

Definition at line 64 of file cWidgetBase.h.

Referenced by Active(), SetDefaultState(), and Toggle().

bool cWidget::Base::m_RenderDefault [protected]

Should this Widget be rendered by default?

Definition at line 65 of file cWidgetBase.h.

Referenced by SetDefaultState().

bool cWidget::Base::m_Sticky [protected]

Should this Widget be sticky?

Definition at line 66 of file cWidgetBase.h.

Referenced by SetSticky(), and Toggle().

cCockpit* cWidget::Base::m_Cockpit [protected]

the cockpit this widget belongs to

Definition at line 67 of file cWidgetBase.h.

Referenced by cWidget::Map::DrawMap(), cWidget::Map::Process(), cWidget::WithDataFunctions::ProcessDataSource(), cWidget::WithColorFunctions::ProcessImage(), and SetCockpit().


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