source: flair-dev/trunk/include/FlairCore/Box.h @ 76

Last change on this file since 76 was 13, checked in by Bayard Gildas, 5 years ago

formatting script + include reformatted

File size: 2.5 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file Box.h
7 * \brief Abstract class to display a box on the ground station
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2011/10/28
10 * \version 4.0
11 */
12
13#ifndef BOX_H
14#define BOX_H
15
16#include <Widget.h>
17
18namespace flair {
19namespace gui {
20
21class Layout;
22class LayoutPosition;
23
24/*! \class Box
25*
26* \brief Abstract class to display a box on the ground station
27*
28* This is an abstract class to display boxes (like CheckBox, SpinBox, etc). \n
29* To access reimplemented box's value, use Box::GetMutex and Box::ReleaseMutex.
30*\n
31* Note that this mutex is in reality the one from the parent Layout. To minimize
32*memory
33* footprint, each Box does not have its own Mutex.
34*/
35class Box : public Widget {
36public:
37  /*!
38  * \brief Constructor
39  *
40  * Construct a Box. \n
41  * Type must agree with predifined (hard coded) types
42  * in ground station code. \n
43  * The Box will automatically be child of position->getLayout() Layout. After
44  *calling this method,
45  * position will be deleted as it is no longer usefull.
46  *
47  * \param position position
48  * \param name name
49  * \param type type
50  */
51  Box(const LayoutPosition *position, std::string name, std::string type);
52
53  /*!
54  * \brief Destructor
55  *
56  */
57  ~Box();
58
59  /*!
60  * \brief Has the value changed since last call?
61  *
62  * This method returns the value of an internal flag
63  * which is set through SetValueChanged(). \n
64  * After calling this method, the internal flag is
65  * set to false.
66  *
67  * \return true is valued has changed since last call
68  */
69  bool ValueChanged(void);
70
71protected:
72  /*!
73  * \brief Set the value changed flag
74  *
75  * The reimplemented class must call this method when Box's value is changed.
76  *\n
77  * This method must be called with Mutex locked. Indeed, as reimplemented class
78  * also has to lock the Mutex to change the Box value, this mecanism avoid two
79  *successives
80  * lock and unlock.
81  *
82  */
83  void SetValueChanged(void);
84
85  /*!
86  * \brief Get Mutex
87  *
88  * This method must be called before changing Box's value or
89  * calling SetValueChanged().
90  *
91  */
92  void GetMutex(void) const;
93
94  /*!
95  * \brief Release Mutex
96  *
97   * This method must be called after changing Box's value or
98  *  calling SetValueChanged().
99  *
100  */
101  void ReleaseMutex(void) const;
102
103private:
104  bool value_changed;
105};
106
107} // end namespace gui
108} // end namespace flair
109
110#endif // BOX_H
Note: See TracBrowser for help on using the repository browser.