source: flair-src/trunk/lib/FlairCore/src/Box.h@ 2

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 9 years ago

flaircore

File size: 3.1 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
19{
20namespace gui
21{
22
23 class Layout;
24 class LayoutPosition;
25
26 /*! \class Box
27 *
28 * \brief Abstract class to display a box on the ground station
29 *
30 * This is an abstract class to display boxes (like CheckBox, SpinBox, etc). \n
31 * To access reimplemented box's value, use Box::GetMutex and Box::ReleaseMutex. \n
32 * Note that this mutex is in reality the one from the parent Layout. To minimize memory
33 * footprint, each Box does not have its own Mutex.
34 */
35 class Box: public Widget
36 {
37 public:
38 /*!
39 * \brief Constructor
40 *
41 * Construct a Box. \n
42 * Type must agree with predifined (hard coded) types
43 * in ground station code. \n
44 * The Box will automatically be child of position->getLayout() Layout. After 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
71 protected:
72 /*!
73 * \brief Set the value changed flag
74 *
75 * The reimplemented class must call this method when Box's value is changed. \n
76 * This method must be called with Mutex locked. Indeed, as reimplemented class
77 * also has to lock the Mutex to change the Box value, this mecanism avoid two successives
78 * lock and unlock.
79 *
80 */
81 void SetValueChanged(void);
82
83 /*!
84 * \brief Get Mutex
85 *
86 * This method must be called before changing Box's value or
87 * calling SetValueChanged().
88 *
89 */
90 void GetMutex(void) const;
91
92 /*!
93 * \brief Release Mutex
94 *
95 * This method must be called after changing Box's value or
96 * calling SetValueChanged().
97 *
98 */
99 void ReleaseMutex(void) const;
100
101
102 private:
103 bool value_changed;
104 };
105
106} // end namespace gui
107} // end namespace flair
108
109#endif // BOX_H
Note: See TracBrowser for help on using the repository browser.