source: flair-src/trunk/lib/FlairCore/src/PushButton.cpp

Last change on this file was 15, checked in by Bayard Gildas, 6 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:   PushButton.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class displaying a QPushButton on the ground station
14//
15//
16/*********************************************************************/
17
18#include "PushButton.h"
19#include "Layout.h"
20#include "LayoutPosition.h"
21
22using std::string;
23
24namespace flair {
25namespace gui {
26
27PushButton::PushButton(const LayoutPosition *position, string name)
28    : Widget(position->getLayout(), name, "PushButton") {
29  SetVolatileXmlProp("row", position->Row());
30  SetVolatileXmlProp("col", position->Col());
31  delete position;
32
33  SendXml();
34
35  clicked = false;
36}
37
38PushButton::~PushButton() {}
39
40void PushButton::XmlEvent(void) {
41  int clic = 0;
42  GetPersistentXmlProp("value", clic);
43
44  if (clic == 1)
45    clicked = true;
46}
47
48bool PushButton::Clicked(void) {
49  if (clicked == true) {
50    clicked = false;
51    return true;
52  } else {
53    return false;
54  }
55}
56
57} // end namespace gui
58} // end namespace flair
Note: See TracBrowser for help on using the repository browser.