Rev | 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 | {
|
---|
| 23 | namespace gui
|
---|
| 24 | {
|
---|
| 25 |
|
---|
| 26 | ComboBox::ComboBox(const LayoutPosition* position,string name):Box(position,name,"ComboBox")
|
---|
| 27 | {
|
---|
| 28 | //update value from xml file
|
---|
| 29 | box_value=0;
|
---|
| 30 | GetPersistentXmlProp("value",box_value);
|
---|
| 31 | SetPersistentXmlProp("value",box_value);
|
---|
| 32 |
|
---|
| 33 | SendXml();
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | ComboBox::~ComboBox()
|
---|
| 37 | {
|
---|
| 38 |
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | void ComboBox::AddItem(string name)
|
---|
| 42 | {
|
---|
| 43 | SetVolatileXmlProp("item",name);
|
---|
| 44 | SendXml();
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | int ComboBox::CurrentIndex(void) const
|
---|
| 48 | {
|
---|
| 49 | int tmp;
|
---|
| 50 |
|
---|
| 51 | GetMutex();
|
---|
| 52 | tmp=box_value;
|
---|
| 53 | ReleaseMutex();
|
---|
| 54 |
|
---|
| 55 | return tmp;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | void ComboBox::XmlEvent(void)
|
---|
| 59 | {
|
---|
| 60 | GetMutex();
|
---|
| 61 | if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
|
---|
| 62 | ReleaseMutex();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | } // end namespace gui
|
---|
| 66 | } // end namespace flair
|
---|
Note:
See
TracBrowser
for help on using the repository browser.