source: flair-src/trunk/lib/FlairCore/src/CheckBox.cpp@ 13

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

flaircore

File size: 1.2 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// created: 2011/10/07
6// filename: CheckBox.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class displaying a QCheckBox on the ground station
14//
15//
16/*********************************************************************/
17#include "CheckBox.h"
18
19using std::string;
20
21namespace flair
22{
23namespace gui
24{
25
26CheckBox::CheckBox(const LayoutPosition* position,string name,bool default_value):Box(position,name,"CheckBox")
27{
28 //update value from xml file
29 box_value=default_value;
30
31 GetPersistentXmlProp("value",box_value);
32 SetPersistentXmlProp("value",Value());
33 SendXml();
34}
35
36CheckBox::~CheckBox()
37{
38
39}
40
41bool CheckBox::IsChecked(void) const
42{
43 bool tmp;
44
45 GetMutex();
46 tmp=box_value;
47 ReleaseMutex();
48
49 return tmp;
50}
51
52int CheckBox::Value(void) const
53{
54 if(IsChecked()==true)
55 return 1;
56 else
57 return 0;
58}
59
60void CheckBox::XmlEvent(void)
61{
62 GetMutex();
63 if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
64 ReleaseMutex();
65}
66
67} // end namespace gui
68} // end namespace flair
Note: See TracBrowser for help on using the repository browser.