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

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

sources reformatted with flair-format-dir script

File size: 1.2 KB
RevLine 
[2]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]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
[15]21namespace flair {
22namespace gui {
[2]23
[15]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;
[2]29
[15]30 GetPersistentXmlProp("value", box_value);
31 SetPersistentXmlProp("value", Value());
32 SendXml();
[2]33}
34
[15]35CheckBox::~CheckBox() {}
[2]36
[15]37bool CheckBox::IsChecked(void) const {
38 bool tmp;
[2]39
[15]40 GetMutex();
41 tmp = box_value;
42 ReleaseMutex();
[2]43
[15]44 return tmp;
[2]45}
46
[15]47int CheckBox::Value(void) const {
48 if (IsChecked() == true)
49 return 1;
50 else
51 return 0;
[2]52}
53
[15]54void CheckBox::XmlEvent(void) {
55 GetMutex();
56 if (GetPersistentXmlProp("value", box_value))
57 SetValueChanged();
58 ReleaseMutex();
[2]59}
60
61} // end namespace gui
62} // end namespace flair
Note: See TracBrowser for help on using the repository browser.