#include <cWidgetBase.h>
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? | |
cCockpit * | m_Cockpit |
the cockpit this widget belongs to | |
Private Attributes | |
int | m_Cam |
The camera(s) the widget will be rendered for. | |
bool | m_ParsingTemplate |
Definition at line 59 of file cWidgetBase.h.
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] |
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.
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 }
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 }
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.
cur | the node that's being attempted to parse |
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().
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; }
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().
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; }
bool cWidget::Base::Active | ( | ) | [inline] |
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 }
virtual void cWidget::Base::HandleEvent | ( | bool | state, | |
int | id | |||
) | [inline, virtual] |
Overwrite if you need to handle custom events (other than toggling)
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); }
void cWidget::Base::ParseTemplate | ( | bool | state | ) | [inline] |
Call this to surpress warnings about unknown tags
state | whether to surpress warnings |
Definition at line 96 of file cWidgetBase.h.
References m_ParsingTemplate.
Referenced by cCockpit::ProcessWidgets().
00096 {m_ParsingTemplate = state;}
int cWidget::Base::m_Cam [private] |
bool cWidget::Base::m_ParsingTemplate [private] |
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().