Flair
Framework Libre Air
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties
flair::gui::Widget Class Reference

Abstract class for all Framework's widget classes. More...

#include <Widget.h>

+ Inheritance diagram for flair::gui::Widget:

Public Member Functions

 Widget (const Widget *parent, std::string name, std::string type)
 Constructor. More...
 
virtual ~Widget ()
 Destructor. More...
 
void setEnabled (bool status)
 Set enabled. More...
 
bool isEnabled (void) const
 Is enabled? More...
 
- Public Member Functions inherited from flair::core::Object
 Object (const Object *parent=NULL, std::string name="", std::string type="")
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string ObjectName (void) const
 Name. More...
 
std::string ObjectType (void) const
 Type. More...
 
const ObjectParent (void) const
 Parent. More...
 
std::vector< const Object * > * TypeChilds (void) const
 Childs of the same type. More...
 
std::vector< const Object * > * Childs (void) const
 Childs. More...
 
void Information (const char *function, int line, const char *format,...) const
 Formatted information. More...
 
void Warning (const char *function, const char *format,...) const
 Formatted warning. More...
 
void Error (const char *function, const char *format,...) const
 Formatted error. More...
 
bool ErrorOccured (bool recursive=true) const
 Has an errror occured? More...
 

Protected Member Functions

template<typename T >
void SetPersistentXmlProp (std::string prop, T value)
 Set a persistent xml property. More...
 
template<typename T >
bool GetPersistentXmlProp (std::string prop, T &value)
 Get a persistent xml property. More...
 
template<typename T >
void SetVolatileXmlProp (std::string prop, T value, xmlNodePtr node=NULL)
 Set a volatile xml property. More...
 
void SendXml (void)
 Send xml. More...
 
virtual void XmlEvent (void)
 Xml event. More...
 

Additional Inherited Members

- Public Types inherited from flair::core::Object
enum  color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 }
 

Detailed Description

Abstract class for all Framework's widget classes.

A widget is an object to display on the ground station.
Communication with ground station is done through xml files; properties of theses files are modified through appropriate method.
A xml file is used for default values of the Widget, if it has been specified in the constructor of the FrameworkManager.

Constructor & Destructor Documentation

flair::gui::Widget::Widget ( const Widget parent,
std::string  name,
std::string  type 
)

Constructor.

Construct a Widget, the xml file specified to the FrameworkManager's constructor is sued for default values.
Two Widget with same parent must have different names. If a brother Widget already has the same name, the name of the new one will be automatically changed.
Type must agree with predifined (hard coded) types in ground station code.

Parameters
parentparent
namename
typetype
virtual flair::gui::Widget::~Widget ( )
virtual

Destructor.

Member Function Documentation

void flair::gui::Widget::setEnabled ( bool  status)

Set enabled.

Enable or disable the Widget on the ground station.
A disabled widget is greyed out on the ground station and in unmodifiable.

Parameters
status
bool flair::gui::Widget::isEnabled ( void  ) const

Is enabled?

Returns
true if widget is enabled
template<typename T >
void flair::gui::Widget::SetPersistentXmlProp ( std::string  prop,
value 
)
protected

Set a persistent xml property.

The property will be saved in the configuration xml and also used to configure the ground station.

Parameters
propproperty to set and save
valuevalue to set and save
template<typename T >
bool flair::gui::Widget::GetPersistentXmlProp ( std::string  prop,
T &  value 
)
protected

Get a persistent xml property.

Get the property from the xml file. If no corresponding property is found in the xml, value remains unchanged.
Thus value can be initialized with a default value before calling this method.

Parameters
propproperty to get
valuevalue to store the result
Returns
true if value was changed
template<typename T >
void flair::gui::Widget::SetVolatileXmlProp ( std::string  prop,
value,
xmlNodePtr  node = NULL 
)
protected

Set a volatile xml property.

This property should be used to configure the ground station (one time init).
The property will be destroyed after calling SendXml() as it should no be used anymore.

Parameters
propproperty to set
valuevalue to set
nodeif sepcified, node to set; otherwise use the node of the Widget
void flair::gui::Widget::SendXml ( void  )
protected

Send xml.

Send Widget's xml to ground station.
New changes will be taken into account by ground station.
All volatile properties will be erased after calling ths method, as they should not be used anymore.

virtual void flair::gui::Widget::XmlEvent ( void  )
inlineprotectedvirtual

Xml event.

This method must be reimplemented to handle a xml event.
It is automatically called when something changed from ground station.