Changeset 15 in flair-src for trunk/lib/FlairCore/src/DoubleSpinBox.cpp
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/DoubleSpinBox.cpp
r2 r15 20 20 using std::string; 21 21 22 namespace flair 23 { 24 namespace gui 25 { 22 namespace flair { 23 namespace gui { 26 24 27 DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox") 28 { 29 //update value from xml file 30 if(default_value<min) default_value=min; 31 if(default_value>max) default_value=max; 32 box_value=default_value; 25 DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name, 26 double min, double max, double step, int decimals, 27 double default_value) 28 : Box(position, name, "DoubleSpinBox") { 29 // update value from xml file 30 if (default_value < min) 31 default_value = min; 32 if (default_value > max) 33 default_value = max; 34 box_value = default_value; 33 35 34 SetVolatileXmlProp("min",min);35 SetVolatileXmlProp("max",max);36 SetVolatileXmlProp("step",step);37 SetVolatileXmlProp("decimals",decimals);38 GetPersistentXmlProp("value",box_value);39 SetPersistentXmlProp("value",box_value);36 SetVolatileXmlProp("min", min); 37 SetVolatileXmlProp("max", max); 38 SetVolatileXmlProp("step", step); 39 SetVolatileXmlProp("decimals", decimals); 40 GetPersistentXmlProp("value", box_value); 41 SetPersistentXmlProp("value", box_value); 40 42 41 43 SendXml(); 42 44 } 43 45 44 DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,string suffix,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox") 45 { 46 //update value from xml file 47 if(default_value<min) default_value=min; 48 if(default_value>max) default_value=max; 49 box_value=default_value; 46 DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name, 47 string suffix, double min, double max, double step, 48 int decimals, double default_value) 49 : Box(position, name, "DoubleSpinBox") { 50 // update value from xml file 51 if (default_value < min) 52 default_value = min; 53 if (default_value > max) 54 default_value = max; 55 box_value = default_value; 50 56 51 SetVolatileXmlProp("suffix",suffix);52 SetVolatileXmlProp("min",min);53 SetVolatileXmlProp("max",max);54 SetVolatileXmlProp("step",step);55 SetVolatileXmlProp("decimals",decimals);56 GetPersistentXmlProp("value",box_value);57 SetPersistentXmlProp("value",box_value);57 SetVolatileXmlProp("suffix", suffix); 58 SetVolatileXmlProp("min", min); 59 SetVolatileXmlProp("max", max); 60 SetVolatileXmlProp("step", step); 61 SetVolatileXmlProp("decimals", decimals); 62 GetPersistentXmlProp("value", box_value); 63 SetPersistentXmlProp("value", box_value); 58 64 59 65 SendXml(); 60 66 } 61 67 62 DoubleSpinBox::~DoubleSpinBox() 63 { 68 DoubleSpinBox::~DoubleSpinBox() {} 64 69 70 double DoubleSpinBox::Value(void) const { 71 double tmp; 72 73 GetMutex(); 74 tmp = box_value; 75 ReleaseMutex(); 76 77 return tmp; 65 78 } 66 79 67 double DoubleSpinBox::Value(void) const 68 { 69 double tmp; 70 71 GetMutex(); 72 tmp=box_value; 73 ReleaseMutex(); 74 75 return tmp; 76 } 77 78 void DoubleSpinBox::XmlEvent(void) 79 { 80 GetMutex(); 81 if(GetPersistentXmlProp("value",box_value)) SetValueChanged(); 82 ReleaseMutex(); 80 void DoubleSpinBox::XmlEvent(void) { 81 GetMutex(); 82 if (GetPersistentXmlProp("value", box_value)) 83 SetValueChanged(); 84 ReleaseMutex(); 83 85 } 84 86
Note:
See TracChangeset
for help on using the changeset viewer.