Last change
on this file since 325 was 15, checked in by Bayard Gildas, 8 years ago |
sources reformatted with flair-format-dir script
|
File size:
1.2 KB
|
Rev | Line | |
---|
[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: 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 |
|
---|
[15] | 21 | namespace flair {
|
---|
| 22 | namespace gui {
|
---|
[2] | 23 |
|
---|
[15] | 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);
|
---|
[2] | 30 |
|
---|
[15] | 31 | SendXml();
|
---|
[2] | 32 | }
|
---|
| 33 |
|
---|
[15] | 34 | ComboBox::~ComboBox() {}
|
---|
[2] | 35 |
|
---|
[15] | 36 | void ComboBox::AddItem(string name) {
|
---|
| 37 | SetVolatileXmlProp("item", name);
|
---|
| 38 | SendXml();
|
---|
[2] | 39 | }
|
---|
| 40 |
|
---|
[15] | 41 | int ComboBox::CurrentIndex(void) const {
|
---|
| 42 | int tmp;
|
---|
[2] | 43 |
|
---|
[15] | 44 | GetMutex();
|
---|
| 45 | tmp = box_value;
|
---|
| 46 | ReleaseMutex();
|
---|
[2] | 47 |
|
---|
[15] | 48 | return tmp;
|
---|
[2] | 49 | }
|
---|
| 50 |
|
---|
[15] | 51 | void ComboBox::XmlEvent(void) {
|
---|
| 52 | GetMutex();
|
---|
| 53 | if (GetPersistentXmlProp("value", box_value))
|
---|
| 54 | SetValueChanged();
|
---|
| 55 | ReleaseMutex();
|
---|
[2] | 56 | }
|
---|
| 57 |
|
---|
| 58 | } // end namespace gui
|
---|
| 59 | } // end namespace flair
|
---|
Note:
See
TracBrowser
for help on using the repository browser.