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

Abstract class to display a box on the ground station. More...

#include <Box.h>

+ Inheritance diagram for flair::gui::Box:

Public Member Functions

 Box (const LayoutPosition *position, std::string name, std::string type)
 Constructor. More...
 
 ~Box ()
 Destructor. More...
 
bool ValueChanged (void)
 Has the value changed since last call? More...
 
- Public Member Functions inherited from flair::gui::Widget
 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

void SetValueChanged (void)
 Set the value changed flag. More...
 
void GetMutex (void) const
 Get Mutex. More...
 
void ReleaseMutex (void) const
 Release Mutex. More...
 
- Protected Member Functions inherited from flair::gui::Widget
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 to display a box on the ground station.

This is an abstract class to display boxes (like CheckBox, SpinBox, etc).
To access reimplemented box's value, use Box::GetMutex and Box::ReleaseMutex.
Note that this mutex is in reality the one from the parent Layout. To minimize memory footprint, each Box does not have its own Mutex.

Constructor & Destructor Documentation

flair::gui::Box::Box ( const LayoutPosition position,
std::string  name,
std::string  type 
)

Constructor.

Construct a Box.
Type must agree with predifined (hard coded) types in ground station code.
The Box will automatically be child of position->getLayout() Layout. After calling this method, position will be deleted as it is no longer usefull.

Parameters
positionposition
namename
typetype
flair::gui::Box::~Box ( )

Destructor.

Member Function Documentation

bool flair::gui::Box::ValueChanged ( void  )

Has the value changed since last call?

This method returns the value of an internal flag which is set through SetValueChanged().
After calling this method, the internal flag is set to false.

Returns
true is valued has changed since last call
void flair::gui::Box::SetValueChanged ( void  )
protected

Set the value changed flag.

The reimplemented class must call this method when Box's value is changed.
This method must be called with Mutex locked. Indeed, as reimplemented class also has to lock the Mutex to change the Box value, this mecanism avoid two successives lock and unlock.

void flair::gui::Box::GetMutex ( void  ) const
protected

Get Mutex.

This method must be called before changing Box's value or calling SetValueChanged().

void flair::gui::Box::ReleaseMutex ( void  ) const
protected

Release Mutex.

This method must be called after changing Box's value or calling SetValueChanged().