Last change
on this file since 26 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: 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 |
|
---|
19 | using std::string;
|
---|
20 |
|
---|
21 | namespace flair {
|
---|
22 | namespace gui {
|
---|
23 |
|
---|
24 | ComboBox::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 |
|
---|
34 | ComboBox::~ComboBox() {}
|
---|
35 |
|
---|
36 | void ComboBox::AddItem(string name) {
|
---|
37 | SetVolatileXmlProp("item", name);
|
---|
38 | SendXml();
|
---|
39 | }
|
---|
40 |
|
---|
41 | int ComboBox::CurrentIndex(void) const {
|
---|
42 | int tmp;
|
---|
43 |
|
---|
44 | GetMutex();
|
---|
45 | tmp = box_value;
|
---|
46 | ReleaseMutex();
|
---|
47 |
|
---|
48 | return tmp;
|
---|
49 | }
|
---|
50 |
|
---|
51 | void 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.