Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

button activation

  • Loading branch information...
commit 7992a93007e2ad831002838e233000241fe3f646 1 parent 1284af8
@robn authored
Showing with 25 additions and 2 deletions.
  1. +16 −1 src/ui/Button.cpp
  2. +9 −1 src/ui/Button.h
View
17 src/ui/Button.cpp
@@ -29,9 +29,24 @@ void Button::Draw()
if (GetInnerWidget()) drawSize += GetInnerWidget()->GetSize();
// XXX STYLE
- GetContext()->GetSkin().DrawButtonNormal(vector2f(0.0f), drawSize);
+ if (m_active)
+ GetContext()->GetSkin().DrawButtonActive(vector2f(0.0f), drawSize);
+ else
+ GetContext()->GetSkin().DrawButtonNormal(vector2f(0.0f), drawSize);
Container::Draw();
}
+void Button::Activate()
+{
+ m_active = true;
+ Widget::Activate();
+}
+
+void Button::Deactivate()
+{
+ m_active = false;
+ Widget::Deactivate();
+}
+
}
View
10 src/ui/Button.h
@@ -13,7 +13,15 @@ class Button: public Single {
protected:
friend class Context;
- Button(Context *context): Single(context) {}
+ Button(Context *context): Single(context), m_active(false) {}
+
+ friend class EventDispatcher;
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+private:
+ bool m_active;
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.