Browse Source

Updated some of the form Control classes so that they get marked as dirty when modified.

Darryl Gough 12 years ago
parent
commit
0b62bd0466

+ 1 - 0
gameplay/src/CheckBox.cpp

@@ -56,6 +56,7 @@ void CheckBox::setChecked(bool checked)
 void CheckBox::setImageSize(float width, float height)
 {
     _imageSize.set(width, height);
+    _dirty = true;
 }
 
 const Vector2& CheckBox::getImageSize() const

+ 5 - 0
gameplay/src/ImageControl.cpp

@@ -76,6 +76,7 @@ void ImageControl::setImage(const char* path)
     _tw = 1.0f / texture->getWidth();
     _th = 1.0f / texture->getHeight();
     texture->release();
+    _dirty = true;
 }
 
 void ImageControl::setRegionSrc(float x, float y, float width, float height)
@@ -86,11 +87,13 @@ void ImageControl::setRegionSrc(float x, float y, float width, float height)
     _uvs.u2 = (x + width) * _tw;
     _uvs.v1 = 1.0f - (y * _th);
     _uvs.v2 = 1.0f - ((y + height) * _th);
+    _dirty = true;
 }
 
 void ImageControl::setRegionSrc(const Rectangle& region)
 {
     setRegionSrc(region.x, region.y, region.width, region.height);
+    _dirty = true;
 }
 
 const Rectangle& ImageControl::getRegionSrc() const
@@ -101,11 +104,13 @@ const Rectangle& ImageControl::getRegionSrc() const
 void ImageControl::setRegionDst(float x, float y, float width, float height)
 {
     _dstRegion.set(x, y, width, height);
+    _dirty = true;
 }
 
 void ImageControl::setRegionDst(const Rectangle& region)
 {
     setRegionDst(region.x, region.y, region.width, region.height);
+    _dirty = true;
 }
 
 const Rectangle& ImageControl::getRegionDst() const

+ 5 - 0
gameplay/src/RadioButton.cpp

@@ -66,12 +66,17 @@ bool RadioButton::isSelected() const
 
 void RadioButton::setSelected(bool selected)
 {
+    if (selected != _selected)
+    {
+        _dirty = true;
+    }
     _selected = selected;
 }
 
 void RadioButton::setImageSize(float width, float height)
 {
     _imageSize.set(width, height);
+    _dirty = true;
 }
 
 const Vector2& RadioButton::getImageSize() const

+ 25 - 0
gameplay/src/Slider.cpp

@@ -59,6 +59,10 @@ Slider* Slider::create(Theme::Style* style, Properties* properties)
 
 void Slider::setMin(float min)
 {
+    if (_min != _min)
+    {
+        _dirty = true;
+    }
     _min = min;
 }
 
@@ -69,6 +73,10 @@ float Slider::getMin() const
 
 void Slider::setMax(float max)
 {
+    if (max != _max)
+    {
+        _dirty = true;
+    }
     _max = max;
 }
 
@@ -94,11 +102,20 @@ float Slider::getValue() const
 
 void Slider::setValue(float value)
 {
+    float oldValue = _value;
     _value = MATH_CLAMP(value, _min, _max);
+    if (_value != value)
+    {
+        _dirty = true;
+    }
 }
 
 void Slider::setValueTextVisible(bool valueTextVisible)
 {
+    if (valueTextVisible != _valueTextVisible)
+    {
+        _dirty = true;
+    }
     _valueTextVisible = valueTextVisible;
 }
 
@@ -109,6 +126,10 @@ bool Slider::isValueTextVisible() const
 
 void Slider::setValueTextAlignment(Font::Justify alignment)
 {
+    if (alignment != _alignment)
+    {
+        _dirty = true;
+    }
     _valueTextAlignment = alignment;
 }
 
@@ -119,6 +140,10 @@ Font::Justify Slider::getValueTextAlignment() const
 
 void Slider::setValueTextPrecision(unsigned int precision)
 {
+    if (precision != _valueTextPrecision)
+    {
+        _dirty = true;
+    }
     _valueTextPrecision = precision;
 }