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