source: flair-src/trunk/lib/FlairCore/src/ComboBox.cpp @ 124

Last change on this file since 124 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:   ComboBox.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class displaying a QComboBox on the ground station
14//
15//
16/*********************************************************************/
17#include "ComboBox.h"
18
19using std::string;
20
21namespace flair {
22namespace gui {
23
24ComboBox::ComboBox(const LayoutPosition *position, string name)
25    : Box(position, name, "ComboBox") {
26  // update value from xml file
27  box_value = 0;
28  GetPersistentXmlProp("value", box_value);
29  SetPersistentXmlProp("value", box_value);
30
31  SendXml();
32}
33
34ComboBox::~ComboBox() {}
35
36void ComboBox::AddItem(string name) {
37  SetVolatileXmlProp("item", name);
38  SendXml();
39}
40
41int ComboBox::CurrentIndex(void) const {
42  int tmp;
43
44  GetMutex();
45  tmp = box_value;
46  ReleaseMutex();
47
48  return tmp;
49}
50
51void ComboBox::XmlEvent(void) {
52  GetMutex();
53  if (GetPersistentXmlProp("value", box_value))
54    SetValueChanged();
55  ReleaseMutex();
56}
57
58} // end namespace gui
59} // end namespace flair
Note: See TracBrowser for help on using the repository browser.