Browse Source

Minor cleanup from review and testing for LightTest

setaylor 13 years ago
parent
commit
f2abbbe113
5 changed files with 357 additions and 361 deletions
  1. 317 317
      gameplay/gameplay.vcxproj.filters
  2. 0 1
      gameplay/src/CheckBox.cpp
  3. 6 6
      gameplay/src/Container.cpp
  4. 19 21
      gameplay/src/Control.cpp
  5. 15 16
      gameplay/src/Control.h

File diff suppressed because it is too large
+ 317 - 317
gameplay/gameplay.vcxproj.filters


+ 0 - 1
gameplay/src/CheckBox.cpp

@@ -96,7 +96,6 @@ bool CheckBox::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int cont
         }
         break;
     }
-
     return Button::touchEvent(evt, x, y, contactIndex);
 }
 

+ 6 - 6
gameplay/src/Container.cpp

@@ -379,7 +379,6 @@ Animation* Container::getAnimation(const char* id) const
 {
     std::vector<Control*>::const_iterator itr = _controls.begin();
     std::vector<Control*>::const_iterator end = _controls.end();
-        
     Control* control = NULL;
     for (; itr != end; itr++)
     {
@@ -396,7 +395,6 @@ Animation* Container::getAnimation(const char* id) const
                 return animation;
         }
     }
-
     return NULL;
 }
 
@@ -438,9 +436,13 @@ void Container::update(const Control* container, const Vector2& offset)
 
     GP_ASSERT(_layout);
     if (_scroll != SCROLL_NONE)
+    {
         updateScroll();
+    }
     else
+    {
         _layout->update(this, Vector2::zero());
+    }
 }
 
 void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needsClear, bool cleared, float targetHeight)
@@ -484,8 +486,7 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
 
         spriteBatch->start();
 
-        if (_scrollBarBounds.height > 0 &&
-            ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL))
+        if (_scrollBarBounds.height > 0 &&((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL))
         {
             const Rectangle& topRegion = _scrollBarTopCap->getRegion();
             const Theme::UVs& topUVs = _scrollBarTopCap->getUVs();
@@ -516,8 +517,7 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
             spriteBatch->draw(bounds.x, bounds.y, bounds.width, bounds.height, bottomUVs.u1, bottomUVs.v1, bottomUVs.u2, bottomUVs.v2, bottomColor, clipRegion);
         }
 
-        if (_scrollBarBounds.width > 0 &&
-            ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL))
+        if (_scrollBarBounds.width > 0 && ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL))
         {
             const Rectangle& leftRegion = _scrollBarLeftCap->getRegion();
             const Theme::UVs& leftUVs = _scrollBarLeftCap->getUVs();

+ 19 - 21
gameplay/src/Control.cpp

@@ -276,7 +276,6 @@ void Control::setOpacity(float opacity, unsigned char states)
     {
         overlays[i]->setOpacity(opacity);
     }
-        
     _dirty = true;
 }
 
@@ -287,6 +286,25 @@ float Control::getOpacity(State state) const
     return overlay->getOpacity();
 }
 
+void Control::setEnabled(bool enabled)
+{
+	if (enabled && _state == Control::DISABLED)
+	{
+		_state = Control::NORMAL;
+        _dirty = true;
+	}
+	else if (!enabled && _state != Control::DISABLED)
+	{
+		_state = Control::DISABLED;
+		_dirty = true;
+	}
+}
+
+bool Control::isEnabled() const
+{
+    return _state != DISABLED;
+}
+
 void Control::setBorder(float top, float bottom, float left, float right, unsigned char states)
 {
     overrideStyle();
@@ -318,7 +336,6 @@ void Control::setSkinRegion(const Rectangle& region, unsigned char states)
     {
         overlays[i]->setSkinRegion(region, _style->_tw, _style->_th);
     }
-
     _dirty = true;
 }
 
@@ -619,25 +636,6 @@ Control::State Control::getState() const
     return _state;
 }
 
-void Control::setEnabled(bool enabled)
-{
-	if (enabled && _state == Control::DISABLED)
-	{
-		_state = Control::NORMAL;
-		_dirty = true;
-	}
-	else if (!enabled && _state != Control::DISABLED)
-	{
-		_state = Control::DISABLED;
-		_dirty = true;
-	}
-}
-
-bool Control::isEnabled() const
-{
-    return _state != DISABLED;
-}
-
 Theme::Style::OverlayType Control::getOverlayType() const
 {
     switch (_state)

+ 15 - 16
gameplay/src/Control.h

@@ -610,8 +610,7 @@ public:
      * Set the opacity of this control.
      *
      * @param opacity The new opacity.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
+     * @param states The states to set this property on. One or more members of the Control::State enum, OR'ed together.
      */
     void setOpacity(float opacity, unsigned char states = STATE_ALL);
 
@@ -624,6 +623,20 @@ public:
      */
     float getOpacity(State state = NORMAL) const;
 
+	/**
+	 * Enables/Disables a control. 
+	 *
+	 * @param enabled true if the control is enabled; false if disabled.
+	 */
+	virtual void setEnabled(bool enabled);
+
+    /**
+     * Get whether this control is currently enabled.
+     *
+     * @return Whether this control is currently enabled.
+     */
+    bool isEnabled() const;
+
     /**
      * Get the bounds of this control, relative to its parent container, after clipping.
      *
@@ -652,20 +665,6 @@ public:
      */
     State getState() const;
 
-	/**
-	 * Enables/Disables a control. 
-	 *
-	 * @param enabled true if the control is enabled; false if disabled.
-	 */
-	void setEnabled(bool enabled);
-
-    /**
-     * Get whether this control is currently enabled.
-     *
-     * @return Whether this control is currently enabled.
-     */
-    bool isEnabled() const;
-
     /**
      * Set whether this control consumes input events,
      * preventing them from being passed to the game.

Some files were not shown because too many files changed in this diff