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

Last change on this file since 358 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

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 {
22namespace gui {
23
24CheckBox::CheckBox(const LayoutPosition *position, string name,
25 bool default_value)
26 : Box(position, name, "CheckBox") {
27 // update value from xml file
28 box_value = default_value;
29
30 GetPersistentXmlProp("value", box_value);
31 SetPersistentXmlProp("value", Value());
32 SendXml();
33}
34
35CheckBox::~CheckBox() {}
36
37bool CheckBox::IsChecked(void) const {
38 bool tmp;
39
40 GetMutex();
41 tmp = box_value;
42 ReleaseMutex();
43
44 return tmp;
45}
46
47int CheckBox::Value(void) const {
48 if (IsChecked() == true)
49 return 1;
50 else
51 return 0;
52}
53
54void CheckBox::XmlEvent(void) {
55 GetMutex();
56 if (GetPersistentXmlProp("value", box_value))
57 SetValueChanged();
58 ReleaseMutex();
59}
60
61} // end namespace gui
62} // end namespace flair
Note: See TracBrowser for help on using the repository browser.