Changeset 15 in flair-src for trunk/lib/FlairCore/src/SpinBox.cpp


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/SpinBox.cpp

    r2 r15  
    2020using std::string;
    2121
    22 namespace flair { namespace gui {
     22namespace flair {
     23namespace gui {
    2324
    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;
     25SpinBox::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;
    2934
    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);
    3540
    36     SendXml();
     41  SendXml();
    3742}
    3843
    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;
     44SpinBox::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;
    4453
    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     SendXml();
     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();
    5261}
    5362
    54 SpinBox::~SpinBox() {
    55 }
     63SpinBox::~SpinBox() {}
    5664
    5765int SpinBox::Value(void) const {
    58     int tmp;
     66  int tmp;
    5967
    60     GetMutex();
    61     tmp=box_value;
    62     ReleaseMutex();
     68  GetMutex();
     69  tmp = box_value;
     70  ReleaseMutex();
    6371
    64     return tmp;
     72  return tmp;
    6573}
    6674
    6775void 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();
    7180}
    7281
Note: See TracChangeset for help on using the changeset viewer.