Bladeren bron

Merge pull request #1383 from dgough/next

Fixed doxygen warnings in headers
Sean Taylor 12 jaren geleden
bovenliggende
commit
a4be1d520b
9 gewijzigde bestanden met toevoegingen van 3295 en 3287 verwijderingen
  1. 1 1
      gameplay/src/AudioListener.h
  2. 385 386
      gameplay/src/Camera.h
  3. 1392 1392
      gameplay/src/Control.h
  4. 1 1
      gameplay/src/FileSystem.h
  5. 1 1
      gameplay/src/Game.h
  6. 148 138
      gameplay/src/ImageControl.h
  7. 861 861
      gameplay/src/ParticleEmitter.h
  8. 183 183
      gameplay/src/RadioButton.h
  9. 323 324
      gameplay/src/Slider.h

+ 1 - 1
gameplay/src/AudioListener.h

@@ -14,7 +14,7 @@ namespace gameplay
  * The audio listener represents where you are listening from.
  * In a 3D scene this is usually the active camera.
  * 
- * @seee Scene::bindAudioListenerToCamera
+ * @see Scene::bindAudioListenerToCamera
  */
 class AudioListener : public Camera::Listener
 {

+ 385 - 386
gameplay/src/Camera.h

@@ -1,386 +1,385 @@
-#ifndef CAMERA_H_
-#define CAMERA_H_
-
-#include "Ref.h"
-#include "Transform.h"
-#include "Frustum.h"
-#include "Rectangle.h"
-#include "Properties.h"
-
-namespace gameplay
-{
-
-class Node;
-class NodeCloneContext;
-
-/**
- * Defines a camera which acts as a view of a scene to be rendered.
- */
-class Camera : public Ref, public Transform::Listener
-{
-    friend class Node;
-
-public:
-
-    /**
-     * The type of camera.
-     */
-    enum Type
-    {
-        PERSPECTIVE = 1,
-        ORTHOGRAPHIC = 2
-    };
-
-    /**
-     * Listener interface for camera events.
-     */
-    class Listener
-    {
-    public:
-
-        virtual ~Listener() { }
-
-        /**
-         * Handles when an camera settings change or the transform changed for the node its attached to.
-         *
-         * @param transform The Transform object that was changed.
-         * @param cookie Cookie value that was specified when the listener was registered.
-         */
-        virtual void cameraChanged(Camera* camera) = 0;
-    };
-
-    /**
-     * Creates a perspective camera.
-     *
-     * @param fieldOfView The field of view for the perspective camera (normally in the range of 40-60 degrees).
-     * @param aspectRatio The aspect ratio of the camera (normally the width of the viewport divided by the height of the viewport).
-     * @param nearPlane The near plane distance.
-     * @param farPlane The far plane distance.
-     *
-     * @return The new Camera.
-     */
-    static Camera* createPerspective(float fieldOfView, float aspectRatio, float nearPlane, float farPlane);
-
-    /**
-     * Creates an orthographic camera.
-     *
-     * @param zoomX The zoom factor along the X-axis of the orthographic projection (the width of the ortho projection).
-     * @param zoomY The zoom factor along the Y-axis of the orthographic projection (the height of the ortho projection).
-     * @param aspectRatio The aspect ratio of the orthographic projection.
-     * @param nearPlane The near plane distance.
-     * @param farPlane The far plane distance.
-     *
-     * @return The new Camera.
-     */
-    static Camera* createOrthographic(float zoomX, float zoomY, float aspectRatio, float nearPlane, float farPlane);
-
-    /**
-     * Creates a camera from a properties definition.
-     *
-     * The properties object must contain a "type" parameter, specifying either PERSPECTIVE or ORTHOGRAPHIC,
-     * as well as values for all required parameters in the Camera::createPerspective and Camera::createOrthographic
-     * methods.
-     *
-     * @param properties The properties definition of the Camera.
-     *
-     * @return The new Camera.
-     */
-    static Camera* create(Properties* properties);
-
-    /**
-     * Gets the type of camera.
-     *
-     * @return The camera type.
-     */
-    Camera::Type getCameraType() const;
-
-    /**
-     * Gets the field of view for a perspective camera.
-     *
-     * @return The field of view.
-     */
-    float getFieldOfView() const;
-
-    /**
-     * Sets the field of view.
-     *
-     * @param fieldOfView The field of view.
-     */
-    void setFieldOfView(float fieldOfView);
-
-    /**
-     * Gets the x-zoom (magnification) for an orthographic camera.
-     * Default is 1.0f.
-     *
-     * @return The magnification (zoom) for x.
-     */
-    float getZoomX() const;
-
-    /**
-     * Sets the x-zoom (magnification) for a orthographic camera.
-     * Default is 1.0f.
-     *
-     * @param zoomX The magnification (zoom) for x.
-     */
-    void setZoomX(float zoomX);
-
-    /**
-     * Gets the y-zoom (magnification) for a orthographic camera.
-     * Default is 1.0f.
-     *
-     * @return The magnification (zoom) for y.
-     */
-    float getZoomY() const;
-
-    /**
-     * Sets the y-zoom (magnification) for a orthographic camera.
-     *
-     * @param zoomY The magnification (zoom) for y.
-     */
-    void setZoomY(float zoomY);
-
-    /**
-     * Gets the aspect ratio.
-     *
-     * @return The aspect ratio.
-     */
-    float getAspectRatio() const;
-
-    /**
-     * Sets the aspect ratio.
-     *
-     * @param aspectRatio The aspect ratio.
-     */
-    void setAspectRatio(float aspectRatio);
-
-    /**
-     * Gets the near z clipping plane distance.
-     *
-     * @return The near z clipping plane distance.
-     */
-    float getNearPlane() const;
-
-    /**
-     * Sets the near z clipping plane distance.
-     *
-     * @param nearPlane The near z clipping plane distance.
-     */
-    void setNearPlane(float nearPlane);
-
-    /**
-     * Gets the far z clipping plane distance.
-     *
-     * @return The far z clipping plane distance.
-     */
-    float getFarPlane() const;
-
-    /**
-     * Sets the far z clipping plane distance.
-     *
-     * @param farPlane The far z clipping plane distance.
-     */
-    void setFarPlane(float farPlane);
-
-    /**
-     * Gets the node that this camera is attached to.
-     *
-     * @return The node that this camera is attached to.
-     */
-    Node* getNode() const;
-
-    /**
-     * Gets the camera's view matrix.
-     *
-     * @return The camera view matrix.
-     */
-    const Matrix& getViewMatrix() const;
-
-    /**
-     * Gets the camera's inverse view matrix.
-     *
-     * @return The camera inverse view matrix.
-     */
-    const Matrix& getInverseViewMatrix() const;
-
-    /**
-     * Gets the camera's projection matrix.
-     *
-     * @return The camera projection matrix.
-     */
-    const Matrix& getProjectionMatrix() const;
-
-    /**
-     * Sets a custom projection matrix to be used by the camera.
-     *
-     * Setting a custom projection matrix results in the internally
-     * computed projection matrix being completely overridden until
-     * the resetProjectionMatrix method is called. A custom projection
-     * matrix is normally not necessary, but can be used for special
-     * projection effects, such as setting an oblique view frustum
-     * for near plane clipping.
-     *
-     * @param matrix Custom projection matrix.
-     */
-    void setProjectionMatrix(const Matrix& matrix);
-
-    /**
-     * Resets the camera to use the internally computed projection matrix
-     * instead of any previously specified user-defined matrix.
-     */
-    void resetProjectionMatrix();
-
-    /**
-     * Gets the camera's view * projection matrix.
-     *
-     * @return The camera view * projection matrix.
-     */
-    const Matrix& getViewProjectionMatrix() const;
-
-    /**
-     * Gets the camera's inverse view * projection matrix.
-     *
-     * @return The camera inverse view * projection matrix.
-     */
-    const Matrix& getInverseViewProjectionMatrix() const;
-
-    /**
-     * Gets the view bounding frustum.
-     *
-     * @return The viewing bounding frustum.
-     */
-    const Frustum& getFrustum() const;
-
-    /**
-     * Projects the specified world position into the viewport coordinates.
-     *
-     * @param viewport The viewport rectangle to use.
-     * @param position The world space position.
-     * @param x The returned viewport x coordinate.
-     * @param y The returned viewport y coordinate.
-     * @param depth The returned pixel depth (can be NULL).
-     *
-     * @script{ignore}
-     */
-    void project(const Rectangle& viewport, const Vector3& position, float* x, float* y, float* depth = NULL) const;
-
-    /**
-     * Projects the specified world position into the viewport coordinates.
-     *
-     * @param viewport The viewport rectangle to use.
-     * @param position The world space position.
-     * @param out Populated with the resulting screen-space position.
-     */
-    void project(const Rectangle& viewport, const Vector3& position, Vector2* out) const;
-
-    /**
-     * Projects the specified world position into the viewport coordinates.
-     *
-     * @param viewport The viewport rectangle to use.
-     * @param position The world space position.
-     * @param out Populated with the resulting screen-space position, with the pixel depth in the Z coordinate.
-     */
-    void project(const Rectangle& viewport, const Vector3& position, Vector3* out) const;
-
-    /**
-     * Converts a viewport-space coordinate to a world-space position for the given depth value.
-     *
-     * The depth parameter is a value ranging between 0 and 1, where 0 returns a point on the
-     * near clipping plane and 1 returns a point on the far clipping plane.
-     *
-     * @param viewport The viewport rectangle to use.
-     * @param x The viewport-space x coordinate.
-     * @param y The viewport-space y coordinate.
-     * @param depth The depth range.
-     * @param dst The world space position.
-     */
-    void unproject(const Rectangle& viewport, float x, float y, float depth, Vector3* dst) const;
-
-    /**
-     * Picks a ray that can be used for picking given the specified viewport-space coordinates.
-     *
-     * @param viewport The viewport rectangle to use.
-     * @param x The viewport x-coordinate.
-     * @param y The viewport y-coordinate.
-     * @param dst The computed pick ray.
-     */
-    void pickRay(const Rectangle& viewport, float x, float y, Ray* dst) const;
-
-    /**
-    * Adds a camera listener.
-    *
-    * @param listener The listener to add.
-    */
-    void addListener(Camera::Listener* listener);
-
-    /**
-     * Removes a camera listener.
-     *
-     * @param listener The listener to remove.
-     */
-    void removeListener(Camera::Listener* listener);
-
-private:
-
-    /**
-     * Constructor.
-     */
-    Camera(float fieldOfView, float aspectRatio, float nearPlane, float farPlane);
-
-    /**
-     * Constructor.
-     */
-    Camera(float zoomX, float zoomY, float aspectRatio, float nearPlane, float farPlane);
-
-    /**
-     * Destructor.
-     */
-    virtual ~Camera();
-
-    /**
-     * Hidden copy assignment operator.
-     */
-    Camera& operator=(const Camera&);
-
-    /**
-     * Clones the camera and returns a new camera.
-     *
-     * @param context The clone context.
-     * @return The newly created camera.
-     */
-    Camera* clone(NodeCloneContext &context) const;
-
-    /**
-     * Sets the node associated with this camera.
-     */
-    void setNode(Node* node);
-
-    /**
-     * @see Transform::Listener::transformChanged
-     */
-    void transformChanged(Transform* transform, long cookie);
-
-    /**
-     *
-     */
-    void cameraChanged();
-
-    Camera::Type _type;
-    float _fieldOfView;
-    float _zoom[2];
-    float _aspectRatio;
-    float _nearPlane;
-    float _farPlane;
-    mutable Matrix _view;
-    mutable Matrix _projection;
-    mutable Matrix _viewProjection;
-    mutable Matrix _inverseView;
-    mutable Matrix _inverseViewProjection;
-    mutable Frustum _bounds;
-    mutable int _bits;
-    Node* _node;
-    std::list<Camera::Listener*>* _listeners;
-};
-
-}
-
-#endif
+#ifndef CAMERA_H_
+#define CAMERA_H_
+
+#include "Ref.h"
+#include "Transform.h"
+#include "Frustum.h"
+#include "Rectangle.h"
+#include "Properties.h"
+
+namespace gameplay
+{
+
+class Node;
+class NodeCloneContext;
+
+/**
+ * Defines a camera which acts as a view of a scene to be rendered.
+ */
+class Camera : public Ref, public Transform::Listener
+{
+    friend class Node;
+
+public:
+
+    /**
+     * The type of camera.
+     */
+    enum Type
+    {
+        PERSPECTIVE = 1,
+        ORTHOGRAPHIC = 2
+    };
+
+    /**
+     * Listener interface for camera events.
+     */
+    class Listener
+    {
+    public:
+
+        virtual ~Listener() { }
+
+        /**
+         * Handles when an camera settings change or the transform changed for the node its attached to.
+         *
+         * @param camera The camera that was changed.
+         */
+        virtual void cameraChanged(Camera* camera) = 0;
+    };
+
+    /**
+     * Creates a perspective camera.
+     *
+     * @param fieldOfView The field of view for the perspective camera (normally in the range of 40-60 degrees).
+     * @param aspectRatio The aspect ratio of the camera (normally the width of the viewport divided by the height of the viewport).
+     * @param nearPlane The near plane distance.
+     * @param farPlane The far plane distance.
+     *
+     * @return The new Camera.
+     */
+    static Camera* createPerspective(float fieldOfView, float aspectRatio, float nearPlane, float farPlane);
+
+    /**
+     * Creates an orthographic camera.
+     *
+     * @param zoomX The zoom factor along the X-axis of the orthographic projection (the width of the ortho projection).
+     * @param zoomY The zoom factor along the Y-axis of the orthographic projection (the height of the ortho projection).
+     * @param aspectRatio The aspect ratio of the orthographic projection.
+     * @param nearPlane The near plane distance.
+     * @param farPlane The far plane distance.
+     *
+     * @return The new Camera.
+     */
+    static Camera* createOrthographic(float zoomX, float zoomY, float aspectRatio, float nearPlane, float farPlane);
+
+    /**
+     * Creates a camera from a properties definition.
+     *
+     * The properties object must contain a "type" parameter, specifying either PERSPECTIVE or ORTHOGRAPHIC,
+     * as well as values for all required parameters in the Camera::createPerspective and Camera::createOrthographic
+     * methods.
+     *
+     * @param properties The properties definition of the Camera.
+     *
+     * @return The new Camera.
+     */
+    static Camera* create(Properties* properties);
+
+    /**
+     * Gets the type of camera.
+     *
+     * @return The camera type.
+     */
+    Camera::Type getCameraType() const;
+
+    /**
+     * Gets the field of view for a perspective camera.
+     *
+     * @return The field of view.
+     */
+    float getFieldOfView() const;
+
+    /**
+     * Sets the field of view.
+     *
+     * @param fieldOfView The field of view.
+     */
+    void setFieldOfView(float fieldOfView);
+
+    /**
+     * Gets the x-zoom (magnification) for an orthographic camera.
+     * Default is 1.0f.
+     *
+     * @return The magnification (zoom) for x.
+     */
+    float getZoomX() const;
+
+    /**
+     * Sets the x-zoom (magnification) for a orthographic camera.
+     * Default is 1.0f.
+     *
+     * @param zoomX The magnification (zoom) for x.
+     */
+    void setZoomX(float zoomX);
+
+    /**
+     * Gets the y-zoom (magnification) for a orthographic camera.
+     * Default is 1.0f.
+     *
+     * @return The magnification (zoom) for y.
+     */
+    float getZoomY() const;
+
+    /**
+     * Sets the y-zoom (magnification) for a orthographic camera.
+     *
+     * @param zoomY The magnification (zoom) for y.
+     */
+    void setZoomY(float zoomY);
+
+    /**
+     * Gets the aspect ratio.
+     *
+     * @return The aspect ratio.
+     */
+    float getAspectRatio() const;
+
+    /**
+     * Sets the aspect ratio.
+     *
+     * @param aspectRatio The aspect ratio.
+     */
+    void setAspectRatio(float aspectRatio);
+
+    /**
+     * Gets the near z clipping plane distance.
+     *
+     * @return The near z clipping plane distance.
+     */
+    float getNearPlane() const;
+
+    /**
+     * Sets the near z clipping plane distance.
+     *
+     * @param nearPlane The near z clipping plane distance.
+     */
+    void setNearPlane(float nearPlane);
+
+    /**
+     * Gets the far z clipping plane distance.
+     *
+     * @return The far z clipping plane distance.
+     */
+    float getFarPlane() const;
+
+    /**
+     * Sets the far z clipping plane distance.
+     *
+     * @param farPlane The far z clipping plane distance.
+     */
+    void setFarPlane(float farPlane);
+
+    /**
+     * Gets the node that this camera is attached to.
+     *
+     * @return The node that this camera is attached to.
+     */
+    Node* getNode() const;
+
+    /**
+     * Gets the camera's view matrix.
+     *
+     * @return The camera view matrix.
+     */
+    const Matrix& getViewMatrix() const;
+
+    /**
+     * Gets the camera's inverse view matrix.
+     *
+     * @return The camera inverse view matrix.
+     */
+    const Matrix& getInverseViewMatrix() const;
+
+    /**
+     * Gets the camera's projection matrix.
+     *
+     * @return The camera projection matrix.
+     */
+    const Matrix& getProjectionMatrix() const;
+
+    /**
+     * Sets a custom projection matrix to be used by the camera.
+     *
+     * Setting a custom projection matrix results in the internally
+     * computed projection matrix being completely overridden until
+     * the resetProjectionMatrix method is called. A custom projection
+     * matrix is normally not necessary, but can be used for special
+     * projection effects, such as setting an oblique view frustum
+     * for near plane clipping.
+     *
+     * @param matrix Custom projection matrix.
+     */
+    void setProjectionMatrix(const Matrix& matrix);
+
+    /**
+     * Resets the camera to use the internally computed projection matrix
+     * instead of any previously specified user-defined matrix.
+     */
+    void resetProjectionMatrix();
+
+    /**
+     * Gets the camera's view * projection matrix.
+     *
+     * @return The camera view * projection matrix.
+     */
+    const Matrix& getViewProjectionMatrix() const;
+
+    /**
+     * Gets the camera's inverse view * projection matrix.
+     *
+     * @return The camera inverse view * projection matrix.
+     */
+    const Matrix& getInverseViewProjectionMatrix() const;
+
+    /**
+     * Gets the view bounding frustum.
+     *
+     * @return The viewing bounding frustum.
+     */
+    const Frustum& getFrustum() const;
+
+    /**
+     * Projects the specified world position into the viewport coordinates.
+     *
+     * @param viewport The viewport rectangle to use.
+     * @param position The world space position.
+     * @param x The returned viewport x coordinate.
+     * @param y The returned viewport y coordinate.
+     * @param depth The returned pixel depth (can be NULL).
+     *
+     * @script{ignore}
+     */
+    void project(const Rectangle& viewport, const Vector3& position, float* x, float* y, float* depth = NULL) const;
+
+    /**
+     * Projects the specified world position into the viewport coordinates.
+     *
+     * @param viewport The viewport rectangle to use.
+     * @param position The world space position.
+     * @param out Populated with the resulting screen-space position.
+     */
+    void project(const Rectangle& viewport, const Vector3& position, Vector2* out) const;
+
+    /**
+     * Projects the specified world position into the viewport coordinates.
+     *
+     * @param viewport The viewport rectangle to use.
+     * @param position The world space position.
+     * @param out Populated with the resulting screen-space position, with the pixel depth in the Z coordinate.
+     */
+    void project(const Rectangle& viewport, const Vector3& position, Vector3* out) const;
+
+    /**
+     * Converts a viewport-space coordinate to a world-space position for the given depth value.
+     *
+     * The depth parameter is a value ranging between 0 and 1, where 0 returns a point on the
+     * near clipping plane and 1 returns a point on the far clipping plane.
+     *
+     * @param viewport The viewport rectangle to use.
+     * @param x The viewport-space x coordinate.
+     * @param y The viewport-space y coordinate.
+     * @param depth The depth range.
+     * @param dst The world space position.
+     */
+    void unproject(const Rectangle& viewport, float x, float y, float depth, Vector3* dst) const;
+
+    /**
+     * Picks a ray that can be used for picking given the specified viewport-space coordinates.
+     *
+     * @param viewport The viewport rectangle to use.
+     * @param x The viewport x-coordinate.
+     * @param y The viewport y-coordinate.
+     * @param dst The computed pick ray.
+     */
+    void pickRay(const Rectangle& viewport, float x, float y, Ray* dst) const;
+
+    /**
+    * Adds a camera listener.
+    *
+    * @param listener The listener to add.
+    */
+    void addListener(Camera::Listener* listener);
+
+    /**
+     * Removes a camera listener.
+     *
+     * @param listener The listener to remove.
+     */
+    void removeListener(Camera::Listener* listener);
+
+private:
+
+    /**
+     * Constructor.
+     */
+    Camera(float fieldOfView, float aspectRatio, float nearPlane, float farPlane);
+
+    /**
+     * Constructor.
+     */
+    Camera(float zoomX, float zoomY, float aspectRatio, float nearPlane, float farPlane);
+
+    /**
+     * Destructor.
+     */
+    virtual ~Camera();
+
+    /**
+     * Hidden copy assignment operator.
+     */
+    Camera& operator=(const Camera&);
+
+    /**
+     * Clones the camera and returns a new camera.
+     *
+     * @param context The clone context.
+     * @return The newly created camera.
+     */
+    Camera* clone(NodeCloneContext &context) const;
+
+    /**
+     * Sets the node associated with this camera.
+     */
+    void setNode(Node* node);
+
+    /**
+     * @see Transform::Listener::transformChanged
+     */
+    void transformChanged(Transform* transform, long cookie);
+
+    /**
+     *
+     */
+    void cameraChanged();
+
+    Camera::Type _type;
+    float _fieldOfView;
+    float _zoom[2];
+    float _aspectRatio;
+    float _nearPlane;
+    float _farPlane;
+    mutable Matrix _view;
+    mutable Matrix _projection;
+    mutable Matrix _viewProjection;
+    mutable Matrix _inverseView;
+    mutable Matrix _inverseViewProjection;
+    mutable Frustum _bounds;
+    mutable int _bits;
+    Node* _node;
+    std::list<Camera::Listener*>* _listeners;
+};
+
+}
+
+#endif

+ 1392 - 1392
gameplay/src/Control.h

@@ -1,1392 +1,1392 @@
-#ifndef CONTROL_H_
-#define CONTROL_H_
-
-#include "Ref.h"
-#include "Rectangle.h"
-#include "Vector2.h"
-#include "Theme.h"
-#include "ThemeStyle.h"
-#include "Touch.h"
-#include "Keyboard.h"
-#include "Mouse.h"
-#include "ScriptTarget.h"
-#include "Gamepad.h"
-
-namespace gameplay
-{
-
-class Container;
-class Form;
-
-/**
- * Defines the base class for all controls.
- *
- * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
- */
-class Control : public Ref, public AnimationTarget, public ScriptTarget
-{
-    friend class Form;
-    friend class Container;
-    friend class Layout;
-    friend class AbsoluteLayout;
-    friend class VerticalLayout;
-    friend class FlowLayout;
-
-public:
-
-    /**
-     * The possible states a control can be in.
-     */
-    enum State
-    {
-        /**
-         * State of an enabled but inactive control.
-         */
-        NORMAL = 0x01,
-
-        /**
-         * State of a control when it is currently in focus.
-         */
-        FOCUS = 0x02,
-
-        /**
-         * State of a control that is currently being acted on,
-         * e.g. through touch or mouse-click events.
-         */
-        ACTIVE = 0x04,
-
-        /**
-         * State of a control that has been disabled.
-         */
-        DISABLED = 0x08,
-
-        /**
-         * When a mouse is in use, the state of a control the cursor is over.
-         */
-        HOVER = 0x10,
-    };
-
-    /**
-     * Defines the set of alignments for positioning controls and justifying text.
-     */
-    enum Alignment
-    {
-        // Specify horizontal alignment, use default vertical alignment (ALIGN_TOP).
-        ALIGN_LEFT = 0x01,
-        ALIGN_HCENTER = 0x02,
-        ALIGN_RIGHT = 0x04,
-    
-        // Specify vertical alignment, use default horizontal alignment (ALIGN_LEFT).
-        ALIGN_TOP = 0x10,
-        ALIGN_VCENTER = 0x20,
-        ALIGN_BOTTOM = 0x40,
-
-        // Specify both vertical and horizontal alignment.
-        ALIGN_TOP_LEFT = ALIGN_TOP | ALIGN_LEFT,
-        ALIGN_VCENTER_LEFT = ALIGN_VCENTER | ALIGN_LEFT,
-        ALIGN_BOTTOM_LEFT = ALIGN_BOTTOM | ALIGN_LEFT,
-        ALIGN_TOP_HCENTER = ALIGN_TOP | ALIGN_HCENTER,
-        ALIGN_VCENTER_HCENTER = ALIGN_VCENTER | ALIGN_HCENTER,
-        ALIGN_BOTTOM_HCENTER = ALIGN_BOTTOM | ALIGN_HCENTER,
-        ALIGN_TOP_RIGHT = ALIGN_TOP | ALIGN_RIGHT,
-        ALIGN_VCENTER_RIGHT = ALIGN_VCENTER | ALIGN_RIGHT,
-        ALIGN_BOTTOM_RIGHT = ALIGN_BOTTOM | ALIGN_RIGHT
-    };
-
-    /**
-     * Defines supported auto sizing modes for controls.
-     */
-    enum AutoSize
-    {
-        /**
-         * No auto sizing is applied.
-         */
-        AUTO_SIZE_NONE = 0x00,
-
-        /**
-         * The control's size is stretched to fill the content area of its parent container.
-         */
-        AUTO_SIZE_STRETCH = 0x01,
-
-        /**
-         * The control's size is set to tightly fit its contents.
-         *
-         * Not all controls support this auto sizing mode.
-         */
-        AUTO_SIZE_FIT = 0x02
-    };
-
-    /**
-     * Implement Control::Listener and call Control::addListener()
-     * in order to listen for events on controls.
-     */
-    class Listener
-    {
-    public:
-
-        /**
-         * Defines the Listener's event types.
-         */
-        enum EventType
-        {
-            /**
-             * Mouse-down or touch-press event.
-             */
-            PRESS           = 0x01,
-
-            /**
-             * Mouse-up or touch-release event.
-             */
-            RELEASE         = 0x02,
-
-            /**
-             * Event triggered after consecutive PRESS and RELEASE events take place
-             * within the bounds of a control.
-             */
-            CLICK           = 0x04,
-
-            /**
-             * Event triggered when the value of a slider, check box, or radio button
-             * changes.
-             */
-            VALUE_CHANGED   = 0x08,
-
-            /**
-             * Event triggered when the contents of a text box are modified.
-             */
-            TEXT_CHANGED    = 0x10,
-
-            /**
-             * Event triggered when a control is clicked with the middle mouse button.
-             */
-            MIDDLE_CLICK    = 0x20,
-
-            /**
-             * Event triggered when a control is clicked with the right mouse button.
-             */
-            RIGHT_CLICK     = 0x40,
-
-            /**
-             * Event triggered when a mouse cursor enters a control.
-             */
-            ENTER           = 0x80,
-
-            /**
-             * Event triggered when a mouse cursor leaves a control.
-             */
-            LEAVE           = 0x100,
-
-            /**
-             * Event triggered when a control gains focus.
-             */
-            FOCUS_GAINED    = 0x200,
-
-            /**
-             * Event triggered when a control loses focus.
-             */
-            FOCUS_LOST      = 0x400
-        };
-
-        /*
-         * Destructor.
-         */
-        virtual ~Listener() { }
-
-        /**
-         * Method called by controls when an event is triggered.
-         * 
-         * @param control The control triggering the event.
-         * @param evt The event triggered.
-         */
-        virtual void controlEvent(Control* control, EventType evt) = 0;
-    };
-
-    /**
-     * @script{ignore}
-     * A constant used for setting themed attributes on all control states simultaneously.
-     */
-    static const unsigned char STATE_ALL = NORMAL | ACTIVE | FOCUS | DISABLED | HOVER;
-
-    /**
-     * Position animation property. Data = x, y
-     */
-    static const int ANIMATE_POSITION = 1;
-
-    /**
-     * Position x animation property. Data = x
-     */
-    static const int ANIMATE_POSITION_X = 2;
-
-    /**
-     * Position y animation property. Data = y
-     */
-    static const int ANIMATE_POSITION_Y = 3;
-
-    /**
-     * Size animation property.  Data = width, height
-     */
-    static const int ANIMATE_SIZE = 4;
-
-    /**
-     * Size width animation property.  Data = width
-     */
-    static const int ANIMATE_SIZE_WIDTH = 5;
-
-    /**
-     * Size height animation property.  Data = height
-     */
-    static const int ANIMATE_SIZE_HEIGHT = 6;
-
-    /**
-     * Opacity property.  Data = opacity
-     */
-    static const int ANIMATE_OPACITY = 7;
-
-    /**
-     * Get this control's ID string.
-     *
-     * @return This control's ID.
-     */
-    const char* getId() const;
-
-	/**
-	 * Sets this control's ID string.
-	 *
-	 * @param id The new control ID.
-	 */
-	void setId(const char* id);
-
-    /**
-     * Get the x coordinate of this control.
-     *
-     * @return The x coordinate of this control.
-     */
-    float getX() const;
-
-    /**
-     * Sets the X coordinate for the control.
-     *
-     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
-     * between 0-1, where 1 equals the full size of it's parent.
-     *
-     * @param x The new X coordinate.
-     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
-     */
-    void setX(float x, bool percentage = false);
-
-    /**
-     * Determines if the X coordinate of this control computed as a percentage of its parent container.
-     *
-     * @return True if the X value is computed as a percentage of its parent container.
-     */
-    bool isXPercentage() const;
-
-    /**
-     * Get the y coordinate of this control.
-     *
-     * @return The y coordinate of this control.
-     */
-    float getY() const;
-
-    /**
-     * Sets the Y coordinate for the control.
-     *
-     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
-     * between 0-1, where 1 equals the full size of it's parent.
-     *
-     * @param y The new Y coordinate.
-     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
-     */
-    void setY(float y, bool percentage = false);
-
-    /**
-     * Determines if the Y coordinate of this control is computed as a percentage of its parent container.
-     *
-     * @return True if the Y value is computed as a percentage of its parent container.
-     */
-    bool isYPercentage() const;
-
-    /**
-     * Get the width of this control.
-     *
-     * @return The width of this control.
-     */
-    float getWidth() const;
-
-    /**
-     * Set the desired width of the control, including it's border and padding, before clipping.
-     *
-     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
-     * between 0-1, where 1 equals the full size of it's parent.
-     *
-     * @param width The width.
-     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
-     */
-    void setWidth(float width, bool percentage = false);
-
-    /**
-     * Determines if the width of this control is computed as a percentage of its parent container.
-     *
-     * @return True if the width is computed as a percentage of its parent container.
-     */
-    bool isWidthPercentage() const;
-
-    /**
-     * Get the height of this control.
-     *
-     * @return The height of this control.
-     */
-    float getHeight() const;
-
-    /**
-     * Set the desired height of the control, including it's border and padding, before clipping.
-     *
-     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
-     * between 0-1, where 1 equals the full size of it's parent.
-     *
-     * @param height The height.
-     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
-     */
-    void setHeight(float height, bool percentage = false);
-
-    /**
-     * Determines if the height of this control is computed as a percentage of its parent container.
-     *
-     * @return True if the height is computed as a percentage of its parent container.
-     */
-    bool isHeightPercentage() const;
-
-    /**
-     * Set the position of this control relative to its parent container.
-     *
-     * This method sets the local position of the control, relative to its container.
-     * Setting percetage values is not supported with this method, use setX
-     * and setY instead.
-     *
-     * @param x The x coordinate.
-     * @param y The y coordinate.
-     */
-    void setPosition(float x, float y);
-
-    /**
-     * Set the desired size of this control, including its border and padding, before clipping.
-     *
-     * This method sets the size of the control, relative to its container.
-     * Setting percetage values is not supported with this method, use setWidth
-     * and setHeight instead.
-     *
-     * @param width The width.
-     * @param height The height.
-     */
-    void setSize(float width, float height);
-
-    /**
-     * Get the bounds of this control, relative to its parent container and including its
-     * border and padding, before clipping.
-     *
-     * @return The bounds of this control.
-     */
-    const Rectangle& getBounds() const;
-
-    /**
-     * Set the bounds of this control, relative to its parent container and including its
-     * border and padding, before clipping.
-     *
-     * This method sets the local bounds of the control, relative to its container.
-     * Setting percetage values is not supported with this method, use setX,
-     * setY, setWidth and setHeight instead.
-     *
-     * @param bounds The new bounds to set.
-     */
-    void setBounds(const Rectangle& bounds);
-
-    /**
-     * Get the absolute bounds of this control, in pixels, including border and padding,
-     * before clipping.
-     *
-     * The absolute bounds of a control represents its final computed bounds after all 
-     * alignment, auto sizing, relative position and sizing has been computed. The
-     * returned bounds is in absolute coordinates, relative to the control's top-most
-     * parent container (usually its form).
-     *
-     * @return The absolute bounds of this control.
-     */
-    const Rectangle& getAbsoluteBounds() const;
-
-    /**
-     * Get the bounds of this control, relative to its parent container, after clipping.
-     *
-     * @return The bounds of this control.
-     */
-    const Rectangle& getClipBounds() const;
-
-    /**
-     * Get the content area of this control, in screen coordinates, after clipping.
-     *
-     * @return The clipping area of this control.
-     */
-    const Rectangle& getClip() const;
-
-    /**
-     * Returns the auto sizing mode for this control's width.
-     *
-     * @return The auto size mode for this control's width.
-     */
-    AutoSize getAutoWidth() const;
-
-    /**
-     * Enables or disables auto sizing for this control's width.
-     *
-     * This method is a simplified version of setAutoWidth(AutoSize) left intact for legacy reasons.
-     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's width.
-     *
-     * @param autoWidth True to enable AUTO_SIZE_STRETCH for this control's width.
-     */
-    void setAutoWidth(bool autoWidth);
-
-    /**
-     * Sets the auto size mode for this control's width.
-     *
-     * @param mode The new auto size mode for this control's width.
-     */
-    void setAutoWidth(AutoSize mode);
-
-    /**
-     * Returns the auto sizing mode for this control's height.
-     *
-     * @return The auto size mode for this control's height.
-     */
-    AutoSize getAutoHeight() const;
-
-    /**
-     * Enables or disables auto sizing for this control's height.
-     *
-     * This method is a simplified version of setAutoHeight(AutoSize) left intact for legacy reasons.
-     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's height.
-     *
-     * @param autoWidth True to enable AUTO_SIZE_STRETCH for this control's height.
-     */
-    void setAutoHeight(bool autoHeight);
-
-    /**
-     * Sets the auto size mode for this control's height.
-     *
-     * @param mode The new auto size mode for this control's height.
-     */
-    void setAutoHeight(AutoSize mode);
-
-    /**
-     * Set the alignment of this control within its parent container.
-     *
-     * @param alignment This control's alignment.
-     */
-    void setAlignment(Alignment alignment);
-
-    /**
-     * Get the alignment of this control within its parent container.
-     *
-     * @return The alignment of this control within its parent container.
-     */
-    Alignment getAlignment() const;
-
-    /**
-     * Set the size of this control's border.
-     *
-     * @param top The height of the border's top side.
-     * @param bottom The height of the border's bottom side.
-     * @param left The width of the border's left side.
-     * @param right The width of the border's right side.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setBorder(float top, float bottom, float left, float right, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the measurements of this control's border for a given state. 
-     *
-     * @return This control's border.
-     */
-    const Theme::Border& getBorder(State state = NORMAL) const;
-
-    /**
-     * Set the texture region of this control's skin.
-     *
-     * @param region The texture region, in pixels.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setSkinRegion(const Rectangle& region, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the texture region of this control's skin for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The texture region of this control's skin.
-     */
-    const Rectangle& getSkinRegion(State state = NORMAL) const;
-
-    /**
-     * Set the blend color of this control's skin.
-     *
-     * @param color The new blend color.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setSkinColor(const Vector4& color, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the blend color of this control's skin for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The blend color of this control's skin.
-     */
-    const Vector4& getSkinColor(State state = NORMAL) const;
-
-    /**
-     * Set this control's margin.
-     *
-     * @param top Height of top margin.
-     * @param bottom Height of bottom margin.
-     * @param left Width of left margin.
-     * @param right Width of right margin.
-     */
-    void setMargin(float top, float bottom, float left, float right);
-
-    /**
-     * Get this control's margin.
-     *
-     * @return This control's margin.
-     */
-    const Theme::Margin& getMargin() const;
-
-    /**
-     * Set this control's padding.
-     *
-     * @param top Height of top padding.
-     * @param bottom Height of bottom padding.
-     * @param left Width of left padding.
-     * @param right Width of right padding.
-     */
-    void setPadding(float top, float bottom, float left, float right);
-
-    /**
-     * Get this control's padding.
-     *
-     * @return This control's padding.
-     */
-    const Theme::Padding& getPadding() const;
-
-    /**
-     * Set the texture region of an image used by this control.
-     *
-     * @param id The ID of the image to modify.
-     * @param region The new texture region of the image.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setImageRegion(const char* id, const Rectangle& region, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the texture region of an image used by this control for a given state.
-     *
-     * @param id The ID of the image.
-     * @param state The state to get this property from.
-     *
-     * @return The texture region of the specified image.
-     */
-    const Rectangle& getImageRegion(const char* id, State state) const;
-
-    /**
-     * Set the blend color of an image used by this control.
-     *
-     * @param id The ID of the image to modify.
-     * @param color The new blend color of the image.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setImageColor(const char* id, const Vector4& color, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the blend color of an image used by this control for a given state.
-     *
-     * @param id The ID of the image.
-     * @param state The state to get this property from.
-     *
-     * @return The blend color of the specified image.
-     */
-    const Vector4& getImageColor(const char* id, State state) const;
-
-    /**
-     * Get the texture coordinates of an image used by this control for a given state.
-     *
-     * @param id The ID of the image.
-     * @param state The state to get this property from.
-     *
-     * @return The texture coordinates of the specified image.
-     */
-    const Theme::UVs& getImageUVs(const char* id, State state) const;
-
-    /**
-     * Set the texture region of this control's cursor.
-     *
-     * @param region The cursor region.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setCursorRegion(const Rectangle& region, unsigned char states);
-
-    /**
-     * Get the texture region of this control's cursor for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The texture region of this control's cursor.
-     */
-    const Rectangle& getCursorRegion(State state) const;
-
-    /**
-     * Set the blend color of this control's cursor.
-     *
-     * @param color The new blend color.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setCursorColor(const Vector4& color, unsigned char states);
-
-    /**
-     * Get the blend color of this control's cursor for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The blend color of this control's cursor.
-     */
-    const Vector4& getCursorColor(State state);
-    
-    /**
-     * Get the texture coordinates of this control's cursor for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The texture coordinates of this control's cursor.
-     */
-    const Theme::UVs& getCursorUVs(State state);
-
-    /**
-     * Set the font used by this control.
-     *
-     * @param font The new font to use.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setFont(Font* font, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the font used by this control for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return the font used by this control.
-     */
-    Font* getFont(State state = NORMAL) const;
-
-    /**
-     * Set this control's font size.
-     *
-     * @param size The new font size.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setFontSize(unsigned int size, unsigned char states = STATE_ALL);
-
-    /**
-     * Get this control's font size for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return This control's font size.
-     */
-    unsigned int getFontSize(State state = NORMAL) const;
-
-    /**
-     * Set this control's text color.
-     *
-     * @param color The new text color.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setTextColor(const Vector4& color, unsigned char states = STATE_ALL);
-
-    /**
-     * Get this control's text color for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return This control's text color.
-     */
-    const Vector4& getTextColor(State state = NORMAL) const;
-
-    /**
-     * Set this control's text alignment.
-     *
-     * @param alignment The new text alignment.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setTextAlignment(Font::Justify alignment, unsigned char states = STATE_ALL);
-
-    /**
-     * Get this control's text alignment for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return This control's text alignment for the given state.
-     */
-    Font::Justify getTextAlignment(State state = NORMAL) const;
-
-    /**
-     * Set whether text is drawn from right to left within this control.
-     *
-     * @param rightToLeft Whether text is drawn from right to left within this control.
-     * @param states The states to set this property on.
-     *               One or more members of the Control::State enum, ORed together.
-     */
-    void setTextRightToLeft(bool rightToLeft, unsigned char states = STATE_ALL);
-
-    /**
-     * Get whether text is drawn from right to left within this control, for a given state.
-     *
-     * @param state The state to get this property from.
-     *
-     * @return Whether text is drawn from right to left within this control, for the given state.
-     */
-    bool getTextRightToLeft(State state = NORMAL) const;
-
-    /**
-     * Sets the visibility of a control.
-     *
-     * This is a quick way to hide a control without having to remove it from a form.
-     *
-     * @param visible true if the control is visible and enabled; false if not-visible and disabled.
-     */
-    void setVisible(bool visible);
-
-    /**
-     * Get the visibility of a control.
-     *
-     * @return true if the control is visible; false if not visible.
-     */
-    bool isVisible() const;
-
-    /**
-     * Determines if this control is visible in its hierarchy.
-     *
-     * A control is visible in its hierarchy if it is visible and all of its parents
-     * are also visible.
-     */
-    bool isVisibleInHierarchy() const;
-
-    /**
-     * 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, OR'ed together.
-     */
-    void setOpacity(float opacity, unsigned char states = STATE_ALL);
-
-    /**
-     * Get the opacity of this control for a given state. 
-     *
-     * @param state The state to get this property from.
-     *
-     * @return The opacity of this control for a given state.
-     */
-    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;
-
-    /**
-     * Determines if this control is enabled in its hierarchy.
-     *
-     * A control is enabled in its hierarchy if it is enabled and all of its parents
-     * are also enabled.
-     */
-    bool isEnabledInHierarchy() const;
-
-    /**
-     * Get this control's current state.
-     *
-     * @return This control's current state.
-     */
-    State getState() const;
-
-    /**
-     * Set whether this control consumes input events,
-     * preventing them from being passed to the game.
-     *
-     * @param consume Whether this control consumes input events.
-     */
-    void setConsumeInputEvents(bool consume);
-
-    /**
-     * Get whether this control consumes touch events.
-     *
-     * @return Whether this control consumes touch events.
-     */
-    bool getConsumeInputEvents();
-
-    /**
-     * Get this control's style.
-     *
-     * @return This control's style.
-     */
-    Theme::Style* getStyle() const;
-
-    /**
-     * Set the style this control will use when rendering.
-     *
-     * @param style The style this control will use when rendering.
-     */
-    void setStyle(Theme::Style* style);
-
-    /**
-     * Returns the theme for this control.
-     */
-    Theme* getTheme() const;
-
-    /**
-     * Get this control's z-index.
-     *
-     * @return This control's z-index.
-     */
-    int getZIndex() const;
-
-    /**
-     * Set this control's z-index.
-     *
-     * @param zIndex The new z-index.
-     */
-    void setZIndex(int zIndex);
-
-    /**
-     * Determines if this control accepts focus.
-     *
-     * @return True if this control accepts focus, false if it does not.
-     */
-    bool canFocus() const;
-
-    /**
-     * Sets whether or not the control accepts input focus.
-     *
-     * @param acceptsFocus True if the control should accept input focus, false otherwise.
-     */
-    void setCanFocus(bool acceptsFocus);
-
-    /**
-     * Determines if this control is currently in focus.
-     *
-     * @return True if the control is currently in focus.
-     */
-    bool hasFocus() const;
-
-    /**
-     * Sets input focus to this control.
-     *
-     * If this control accepts focus (the hasFocus method returns true), input focus
-     * is set to this control. If this control is a container, the first focusable
-     * control within it gains focus.
-     *
-     * @return True if this control or one of its children successfully gained focus,
-     *      false otherwise.
-     */
-    virtual bool setFocus();
-
-    /**
-     * Get this control's focus index.
-     *
-     * @return This control's focus index.
-     */
-    int getFocusIndex() const;
-
-    /**
-     * Set this control's focus index.
-     *
-     * Focus indexes control the order in which input focus changes between controls
-     * when using the focus change controls such as the TAB key.
-     *
-     * Valid focus indexes should be zero or greater, with a negative number indicating
-     * an unset focus index.
-     *
-     * @param focusIndex The new focus index.
-     */
-    void setFocusIndex(int focusIndex);
-
-    /**
-     * Returns whether this Control object is a Container or not.
-     *
-     * @return true if this object is of class Container, false otherwise.
-     */
-    virtual bool isContainer() const;
-
-    /**
-     * Gets the type of the Control and returns it as a string.
-     *
-     * @return The string of the Control type, all in lower-case.
-     */
-    virtual const char* getType() const;
-
-    /**
-     * Returns this control's parent, or NULL if this control does not have a parent.
-     *
-     * @return This control's parent.
-     */
-    Control* getParent() const;
-
-    /**
-     * Determines if this control is a child (at any level of hierarchy) of the 
-     * specified control.
-     *
-     * @param control The control to check.
-     * @return True if this control is a direct or indirect child of the specified control.
-     */
-    bool isChild(Control* control) const;
-
-    /**
-     * Returns this control's top level form, or NULL if this control does not belong to a form.
-     *
-     * @return this control's form.
-     */
-    Form* getTopLevelForm() const;
-
-    /**
-     * Adds a listener to be notified of specific events affecting
-     * this control.  Event types can be OR'ed together.
-     * E.g. To listen to touch-press and touch-release events,
-     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
-     * as the second parameter.
-     *
-     * @param listener The listener to add.
-     * @param eventFlags The events to listen for.
-     */
-    virtual void addListener(Control::Listener* listener, int eventFlags);
-
-    /**
-     * Removes a listener from this control.
-     * 
-     * @param listener The listener to remove.
-     */
-    virtual void removeListener(Control::Listener* listener);
-
-    /**
-     * @see AnimationTarget::getAnimationPropertyComponentCount
-     */
-    virtual unsigned int getAnimationPropertyComponentCount(int propertyId) const;
-
-    /**
-     * @see AnimationTarget::getAnimationProperty
-     */
-    virtual void getAnimationPropertyValue(int propertyId, AnimationValue* value);
-
-    /**
-     * @see AnimationTarget::setAnimationProperty
-     */
-    virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
-
-protected:
-
-    /**
-     *  Constant value representing an unset or invalid contact index.
-     */
-    static const int INVALID_CONTACT_INDEX = -1;
-
-    /**
-     * Constructor.
-     */
-    Control();
-
-    /**
-     * Destructor.
-     */
-    virtual ~Control();
-
-    /**
-     * Hidden copy assignment operator.
-     */
-    Control& operator=(const Control&);
-
-    /**
-     * Get the overlay type corresponding to this control's current state.
-     *
-     * @return The overlay type corresponding to this control's current state.
-     */
-    Theme::Style::OverlayType getOverlayType() const;
-
-    /**
-     * Touch callback on touch events.  Controls return true if they consume the touch event.
-     *
-     * @param evt The touch event that occurred.
-     * @param x The x position of the touch in pixels. Left edge is zero.
-     * @param y The y position of the touch in pixels. Top edge is zero.
-     * @param contactIndex The order of occurrence for multiple touch contacts starting at zero.
-     *
-     * @return Whether the touch event was consumed by this control.
-     *
-     * @see Touch::TouchEvent
-     */
-    virtual bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
-
-    /**
-     * Keyboard callback on key events.
-     *
-     * @param evt The key event that occurred.
-     * @param key If evt is KEY_PRESS or KEY_RELEASE then key is the key code from Keyboard::Key.
-     *            If evt is KEY_CHAR then key is the unicode value of the character.
-     *
-     * @return Whether the key event was consumed by this control.
-     * 
-     * @see Keyboard::KeyEvent
-     * @see Keyboard::Key
-     */
-    virtual bool keyEvent(Keyboard::KeyEvent evt, int key);
-
-    /**
-     * Mouse callback on mouse events.
-     *
-     * @param evt The mouse event that occurred.
-     * @param x The x position of the mouse in pixels. Left edge is zero.
-     * @param y The y position of the mouse in pixels. Top edge is zero.
-     * @param wheelDelta The number of mouse wheel ticks. Positive is up (forward), negative is down (backward).
-     *
-     * @return True if the mouse event is consumed or false if it is not consumed.
-     *
-     * @see Mouse::MouseEvent
-     */
-    virtual bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
-
-    /**
-     * Gamepad callback on gamepad events.
-     *
-     * @param gamepad The gamepad whose state changed.
-     * @param evt The gamepad event that occurred.
-     * @param analogIndex If evt is JOYSTICK_EVENT or TRIGGER_EVENT, this will be the index of the corresponding control.
-     */
-    virtual bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
-
-    /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This control's parent container.
-     * @param offset Positioning offset to add to the control's position.
-     */
-    virtual void update(const Control* container, const Vector2& offset);
-
-    /**
-     * Indicates that a control will begin drawing into the specified batch.
-     *
-     * When drawing is finshed (before any other batch can be drawn into), the
-     * finishBatch method should be called.
-     *
-     * @param form The form beign drawn.
-     * @param batch The sprite batch to be drawn into.
-     */
-    void startBatch(Form* form, SpriteBatch* batch);
-
-    /**
-     * Called after a batch has been drawn into and before any other batch is used.
-     *
-     * @param form The form being drawn.
-     * @param batch The batch that was previously started (via Control::startBatch).
-     */
-    void finishBatch(Form* form, SpriteBatch* batch);
-
-    /**
-     * Draws the control.
-     *
-     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
-     * Batches should not be explicitly started or finished, but instead should be passed
-     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
-     * and finishing the batch when neccessary.
-     *
-     * @param form The top level form being drawn.
-     * @param clip The clipping rectangle.
-     *
-     * @return The number of draw calls issued.
-     */
-    virtual unsigned int draw(Form* form, const Rectangle& clip);
-
-    /**
-     * Draws the themed border and background of a control.
-     *
-     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
-     * Batches should not be explicitly started or finished, but instead should be passed
-     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
-     * and finishing the batch when neccessary.
-     *
-     * @param form The top level form being drawn.
-     * @param clip The clipping rectangle of this control's parent container.
-     *
-     * @return The number of draw calls issued.
-     */
-    virtual unsigned int drawBorder(Form* form, const Rectangle& clip);
-
-    /**
-     * Draw the images associated with this control.
-     *
-     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
-     * Batches should not be explicitly started or finished, but instead should be passed
-     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
-     * and finishing the batch when neccessary.
-     *
-     * @param form The top level form being drawn.
-     * @param clip The clipping rectangle of this control's parent container.
-     *
-     * @return The number of draw calls issued.
-     */
-    virtual unsigned int drawImages(Form* form, const Rectangle& clip);
-
-    /**
-     * Draw this control's text.
-     *
-     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
-     * Batches should not be explicitly started or finished, but instead should be passed
-     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
-     * and finishing the batch when neccessary.
-     *
-     * @param form The top level form being drawn.
-     * @param clip The clipping rectangle of this control's parent container.
-     *
-     * @return The number of draw calls issued.
-     */
-    virtual unsigned int drawText(Form* form, const Rectangle& clip);
-
-    /**
-     * Initializes the control.
-     *
-     * @param typeName The type name of the control being initalized.
-     * @param style The style to apply to this control (optional).
-     * @param properties The properties to set on this control (optional).
-     */
-    virtual void initialize(const char* typeName, Theme::Style* style, Properties* properties);
-
-    /**
-     * Returns whether this control has been modified and requires an update.
-     *
-     * @return Whether this control has been modified and requires an update.
-     */
-    virtual bool isDirty();
-
-    /**
-     * Get a Control::State enum from a matching string.
-     *
-     * @param state The string to match.
-     *
-     * @return The Control::State enum that matches the given string.
-     */
-    static State getState(const char* state);
-
-    /**
-     * Get a Theme::ThemeImage from its ID, for a given state.
-     *
-     * @param id The ID of the image to retrieve.
-     * @param state The state to get this image from.
-     *
-     * @return The requested Theme::ThemeImage, or NULL if none was found.
-     */
-    Theme::ThemeImage* getImage(const char* id, State state);
-
-    /**
-     * Notify this control's listeners of a specific event.
-     *
-     * @param eventType The event to trigger.
-     */
-    void notifyListeners(Control::Listener::EventType eventType);
-
-    /**
-     * Called when a control event is fired for this control, before external
-     * listeners are notified of the event.
-     *
-     * @param evt The event type.
-     */
-    virtual void controlEvent(Control::Listener::EventType evt);
-
-    /**
-     * Gets the Alignment by string.
-     *
-     * @param alignment The string representation of the Alignment type.
-     * @return The Alignment enum value corresponding to the given string.
-     */
-    static Alignment getAlignment(const char* alignment);
-
-    /** 
-     * The Control's ID.
-     */ 
-    std::string _id;
-
-    /**
-     * Whether the control is enabled.
-     */
-    bool _enabled;
-
-    /**
-     * Bits indicating whether bounds values are absolute values or percentages.
-     */
-    int _boundsBits;
-
-    /**
-     * Local bounds, relative to parent container's clipping window, possibly stored as percentages (see _boundsBits).
-     */
-    Rectangle _relativeBounds;
-
-    /**
-     * Local bounds, relative to parent container's clipping window, and desired size.
-     */
-    Rectangle _bounds;
-
-    /**
-     * Local bounds, relative to parent container's clipping window, including border and padding, after clipping.
-     */
-    Rectangle _clipBounds;
-
-    /**
-     * Absolute bounds, including border and padding, before clipping.
-     */
-    Rectangle _absoluteBounds;
-
-    /**
-     * Absolute bounds, including border and padding, after clipping.
-     */
-    Rectangle _absoluteClipBounds;
-
-    /**
-     * Absolute bounds of content area (i.e. without border and padding), before clipping.
-     */
-    Rectangle _viewportBounds;
-
-    /**
-     * Absolute bounds of content area (i.e. without border and padding), after clipping.
-     */
-    Rectangle _viewportClipBounds;
-
-    /**
-     * If the control is dirty and need updating.
-     */
-    bool _dirty;
-    
-    /**
-     * Flag for whether the Control consumes input events.
-     */
-    bool _consumeInputEvents;
-    
-    /**
-     * The Control's Alignment
-     */
-    Alignment _alignment;
-
-    /**
-     * Whether the Control's alignment has been set programmatically.
-     */
-    bool _isAlignmentSet;
-    
-    /**
-     * Whether the Control's width is auto-sized.
-     */
-    AutoSize _autoWidth;
-    
-    /**
-     * Whether the Control's height is auto-sized.
-     */
-    AutoSize _autoHeight;
-    
-    /**
-     * Listeners map of EventType's to a list of Listeners.
-     */
-    //std::map<Listener::EventType, std::list<Listener*>*>* _listeners;
-    std::map<Control::Listener::EventType, std::list<Control::Listener*>*>* _listeners;
-    
-    /**
-     * The Control's Theme::Style.
-     */
-    Theme::Style* _style;
-
-    /**
-     * The control is not visible and _state become DISABLED if false.
-     */
-    bool _visible;
-
-    /**
-     * The current opacity of the control.
-     */
-    float _opacity;
-    
-    /**
-     * The z-order of the control.
-     */
-    int _zIndex;
-
-    /**
-     * The contact index assigned to this control.
-     */
-    int _contactIndex;
-
-    /**
-     * The focus order of the control.
-     */
-    int _focusIndex;
-
-    /**
-     * Whether or not the control accepts input focus.
-     */
-    bool _canFocus;
-
-    /**
-     * The control's parent container.
-     */
-    Container* _parent;
-
-private:
-
-    /*
-     * Constructor.
-     */    
-    Control(const Control& copy);
-
-    Theme::Style::Overlay** getOverlays(unsigned char overlayTypes, Theme::Style::Overlay** overlays);
-
-    Theme::Style::Overlay* getOverlay(Control::State state) const;
-
-    void overrideStyle();
-
-    void overrideThemedProperties(Properties* properties, unsigned char states);
-
-    void setImageList(Theme::ImageList* imageList, unsigned char states = STATE_ALL);
-
-    void setCursor(Theme::ThemeImage* cursor, unsigned char states = STATE_ALL);
-
-    void setSkin(Theme::Skin* skin, unsigned char states = STATE_ALL);
-
-    Theme::Skin* getSkin(State state);
-
-    void addSpecificListener(Control::Listener* listener, Control::Listener::EventType eventType);
-
-    bool _styleOverridden;
-    Theme::Skin* _skin;
-
-};
-
-}
-
-#endif
+#ifndef CONTROL_H_
+#define CONTROL_H_
+
+#include "Ref.h"
+#include "Rectangle.h"
+#include "Vector2.h"
+#include "Theme.h"
+#include "ThemeStyle.h"
+#include "Touch.h"
+#include "Keyboard.h"
+#include "Mouse.h"
+#include "ScriptTarget.h"
+#include "Gamepad.h"
+
+namespace gameplay
+{
+
+class Container;
+class Form;
+
+/**
+ * Defines the base class for all controls.
+ *
+ * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
+ */
+class Control : public Ref, public AnimationTarget, public ScriptTarget
+{
+    friend class Form;
+    friend class Container;
+    friend class Layout;
+    friend class AbsoluteLayout;
+    friend class VerticalLayout;
+    friend class FlowLayout;
+
+public:
+
+    /**
+     * The possible states a control can be in.
+     */
+    enum State
+    {
+        /**
+         * State of an enabled but inactive control.
+         */
+        NORMAL = 0x01,
+
+        /**
+         * State of a control when it is currently in focus.
+         */
+        FOCUS = 0x02,
+
+        /**
+         * State of a control that is currently being acted on,
+         * e.g. through touch or mouse-click events.
+         */
+        ACTIVE = 0x04,
+
+        /**
+         * State of a control that has been disabled.
+         */
+        DISABLED = 0x08,
+
+        /**
+         * When a mouse is in use, the state of a control the cursor is over.
+         */
+        HOVER = 0x10,
+    };
+
+    /**
+     * Defines the set of alignments for positioning controls and justifying text.
+     */
+    enum Alignment
+    {
+        // Specify horizontal alignment, use default vertical alignment (ALIGN_TOP).
+        ALIGN_LEFT = 0x01,
+        ALIGN_HCENTER = 0x02,
+        ALIGN_RIGHT = 0x04,
+    
+        // Specify vertical alignment, use default horizontal alignment (ALIGN_LEFT).
+        ALIGN_TOP = 0x10,
+        ALIGN_VCENTER = 0x20,
+        ALIGN_BOTTOM = 0x40,
+
+        // Specify both vertical and horizontal alignment.
+        ALIGN_TOP_LEFT = ALIGN_TOP | ALIGN_LEFT,
+        ALIGN_VCENTER_LEFT = ALIGN_VCENTER | ALIGN_LEFT,
+        ALIGN_BOTTOM_LEFT = ALIGN_BOTTOM | ALIGN_LEFT,
+        ALIGN_TOP_HCENTER = ALIGN_TOP | ALIGN_HCENTER,
+        ALIGN_VCENTER_HCENTER = ALIGN_VCENTER | ALIGN_HCENTER,
+        ALIGN_BOTTOM_HCENTER = ALIGN_BOTTOM | ALIGN_HCENTER,
+        ALIGN_TOP_RIGHT = ALIGN_TOP | ALIGN_RIGHT,
+        ALIGN_VCENTER_RIGHT = ALIGN_VCENTER | ALIGN_RIGHT,
+        ALIGN_BOTTOM_RIGHT = ALIGN_BOTTOM | ALIGN_RIGHT
+    };
+
+    /**
+     * Defines supported auto sizing modes for controls.
+     */
+    enum AutoSize
+    {
+        /**
+         * No auto sizing is applied.
+         */
+        AUTO_SIZE_NONE = 0x00,
+
+        /**
+         * The control's size is stretched to fill the content area of its parent container.
+         */
+        AUTO_SIZE_STRETCH = 0x01,
+
+        /**
+         * The control's size is set to tightly fit its contents.
+         *
+         * Not all controls support this auto sizing mode.
+         */
+        AUTO_SIZE_FIT = 0x02
+    };
+
+    /**
+     * Implement Control::Listener and call Control::addListener()
+     * in order to listen for events on controls.
+     */
+    class Listener
+    {
+    public:
+
+        /**
+         * Defines the Listener's event types.
+         */
+        enum EventType
+        {
+            /**
+             * Mouse-down or touch-press event.
+             */
+            PRESS           = 0x01,
+
+            /**
+             * Mouse-up or touch-release event.
+             */
+            RELEASE         = 0x02,
+
+            /**
+             * Event triggered after consecutive PRESS and RELEASE events take place
+             * within the bounds of a control.
+             */
+            CLICK           = 0x04,
+
+            /**
+             * Event triggered when the value of a slider, check box, or radio button
+             * changes.
+             */
+            VALUE_CHANGED   = 0x08,
+
+            /**
+             * Event triggered when the contents of a text box are modified.
+             */
+            TEXT_CHANGED    = 0x10,
+
+            /**
+             * Event triggered when a control is clicked with the middle mouse button.
+             */
+            MIDDLE_CLICK    = 0x20,
+
+            /**
+             * Event triggered when a control is clicked with the right mouse button.
+             */
+            RIGHT_CLICK     = 0x40,
+
+            /**
+             * Event triggered when a mouse cursor enters a control.
+             */
+            ENTER           = 0x80,
+
+            /**
+             * Event triggered when a mouse cursor leaves a control.
+             */
+            LEAVE           = 0x100,
+
+            /**
+             * Event triggered when a control gains focus.
+             */
+            FOCUS_GAINED    = 0x200,
+
+            /**
+             * Event triggered when a control loses focus.
+             */
+            FOCUS_LOST      = 0x400
+        };
+
+        /*
+         * Destructor.
+         */
+        virtual ~Listener() { }
+
+        /**
+         * Method called by controls when an event is triggered.
+         * 
+         * @param control The control triggering the event.
+         * @param evt The event triggered.
+         */
+        virtual void controlEvent(Control* control, EventType evt) = 0;
+    };
+
+    /**
+     * @script{ignore}
+     * A constant used for setting themed attributes on all control states simultaneously.
+     */
+    static const unsigned char STATE_ALL = NORMAL | ACTIVE | FOCUS | DISABLED | HOVER;
+
+    /**
+     * Position animation property. Data = x, y
+     */
+    static const int ANIMATE_POSITION = 1;
+
+    /**
+     * Position x animation property. Data = x
+     */
+    static const int ANIMATE_POSITION_X = 2;
+
+    /**
+     * Position y animation property. Data = y
+     */
+    static const int ANIMATE_POSITION_Y = 3;
+
+    /**
+     * Size animation property.  Data = width, height
+     */
+    static const int ANIMATE_SIZE = 4;
+
+    /**
+     * Size width animation property.  Data = width
+     */
+    static const int ANIMATE_SIZE_WIDTH = 5;
+
+    /**
+     * Size height animation property.  Data = height
+     */
+    static const int ANIMATE_SIZE_HEIGHT = 6;
+
+    /**
+     * Opacity property.  Data = opacity
+     */
+    static const int ANIMATE_OPACITY = 7;
+
+    /**
+     * Get this control's ID string.
+     *
+     * @return This control's ID.
+     */
+    const char* getId() const;
+
+	/**
+	 * Sets this control's ID string.
+	 *
+	 * @param id The new control ID.
+	 */
+	void setId(const char* id);
+
+    /**
+     * Get the x coordinate of this control.
+     *
+     * @return The x coordinate of this control.
+     */
+    float getX() const;
+
+    /**
+     * Sets the X coordinate for the control.
+     *
+     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
+     * between 0-1, where 1 equals the full size of it's parent.
+     *
+     * @param x The new X coordinate.
+     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
+     */
+    void setX(float x, bool percentage = false);
+
+    /**
+     * Determines if the X coordinate of this control computed as a percentage of its parent container.
+     *
+     * @return True if the X value is computed as a percentage of its parent container.
+     */
+    bool isXPercentage() const;
+
+    /**
+     * Get the y coordinate of this control.
+     *
+     * @return The y coordinate of this control.
+     */
+    float getY() const;
+
+    /**
+     * Sets the Y coordinate for the control.
+     *
+     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
+     * between 0-1, where 1 equals the full size of it's parent.
+     *
+     * @param y The new Y coordinate.
+     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
+     */
+    void setY(float y, bool percentage = false);
+
+    /**
+     * Determines if the Y coordinate of this control is computed as a percentage of its parent container.
+     *
+     * @return True if the Y value is computed as a percentage of its parent container.
+     */
+    bool isYPercentage() const;
+
+    /**
+     * Get the width of this control.
+     *
+     * @return The width of this control.
+     */
+    float getWidth() const;
+
+    /**
+     * Set the desired width of the control, including it's border and padding, before clipping.
+     *
+     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
+     * between 0-1, where 1 equals the full size of it's parent.
+     *
+     * @param width The width.
+     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
+     */
+    void setWidth(float width, bool percentage = false);
+
+    /**
+     * Determines if the width of this control is computed as a percentage of its parent container.
+     *
+     * @return True if the width is computed as a percentage of its parent container.
+     */
+    bool isWidthPercentage() const;
+
+    /**
+     * Get the height of this control.
+     *
+     * @return The height of this control.
+     */
+    float getHeight() const;
+
+    /**
+     * Set the desired height of the control, including it's border and padding, before clipping.
+     *
+     * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
+     * between 0-1, where 1 equals the full size of it's parent.
+     *
+     * @param height The height.
+     * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
+     */
+    void setHeight(float height, bool percentage = false);
+
+    /**
+     * Determines if the height of this control is computed as a percentage of its parent container.
+     *
+     * @return True if the height is computed as a percentage of its parent container.
+     */
+    bool isHeightPercentage() const;
+
+    /**
+     * Set the position of this control relative to its parent container.
+     *
+     * This method sets the local position of the control, relative to its container.
+     * Setting percetage values is not supported with this method, use setX
+     * and setY instead.
+     *
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     */
+    void setPosition(float x, float y);
+
+    /**
+     * Set the desired size of this control, including its border and padding, before clipping.
+     *
+     * This method sets the size of the control, relative to its container.
+     * Setting percetage values is not supported with this method, use setWidth
+     * and setHeight instead.
+     *
+     * @param width The width.
+     * @param height The height.
+     */
+    void setSize(float width, float height);
+
+    /**
+     * Get the bounds of this control, relative to its parent container and including its
+     * border and padding, before clipping.
+     *
+     * @return The bounds of this control.
+     */
+    const Rectangle& getBounds() const;
+
+    /**
+     * Set the bounds of this control, relative to its parent container and including its
+     * border and padding, before clipping.
+     *
+     * This method sets the local bounds of the control, relative to its container.
+     * Setting percetage values is not supported with this method, use setX,
+     * setY, setWidth and setHeight instead.
+     *
+     * @param bounds The new bounds to set.
+     */
+    void setBounds(const Rectangle& bounds);
+
+    /**
+     * Get the absolute bounds of this control, in pixels, including border and padding,
+     * before clipping.
+     *
+     * The absolute bounds of a control represents its final computed bounds after all 
+     * alignment, auto sizing, relative position and sizing has been computed. The
+     * returned bounds is in absolute coordinates, relative to the control's top-most
+     * parent container (usually its form).
+     *
+     * @return The absolute bounds of this control.
+     */
+    const Rectangle& getAbsoluteBounds() const;
+
+    /**
+     * Get the bounds of this control, relative to its parent container, after clipping.
+     *
+     * @return The bounds of this control.
+     */
+    const Rectangle& getClipBounds() const;
+
+    /**
+     * Get the content area of this control, in screen coordinates, after clipping.
+     *
+     * @return The clipping area of this control.
+     */
+    const Rectangle& getClip() const;
+
+    /**
+     * Returns the auto sizing mode for this control's width.
+     *
+     * @return The auto size mode for this control's width.
+     */
+    AutoSize getAutoWidth() const;
+
+    /**
+     * Enables or disables auto sizing for this control's width.
+     *
+     * This method is a simplified version of setAutoWidth(AutoSize) left intact for legacy reasons.
+     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's width.
+     *
+     * @param autoWidth True to enable AUTO_SIZE_STRETCH for this control's width.
+     */
+    void setAutoWidth(bool autoWidth);
+
+    /**
+     * Sets the auto size mode for this control's width.
+     *
+     * @param mode The new auto size mode for this control's width.
+     */
+    void setAutoWidth(AutoSize mode);
+
+    /**
+     * Returns the auto sizing mode for this control's height.
+     *
+     * @return The auto size mode for this control's height.
+     */
+    AutoSize getAutoHeight() const;
+
+    /**
+     * Enables or disables auto sizing for this control's height.
+     *
+     * This method is a simplified version of setAutoHeight(AutoSize) left intact for legacy reasons.
+     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's height.
+     *
+     * @param autoHeight True to enable AUTO_SIZE_STRETCH for this control's height.
+     */
+    void setAutoHeight(bool autoHeight);
+
+    /**
+     * Sets the auto size mode for this control's height.
+     *
+     * @param mode The new auto size mode for this control's height.
+     */
+    void setAutoHeight(AutoSize mode);
+
+    /**
+     * Set the alignment of this control within its parent container.
+     *
+     * @param alignment This control's alignment.
+     */
+    void setAlignment(Alignment alignment);
+
+    /**
+     * Get the alignment of this control within its parent container.
+     *
+     * @return The alignment of this control within its parent container.
+     */
+    Alignment getAlignment() const;
+
+    /**
+     * Set the size of this control's border.
+     *
+     * @param top The height of the border's top side.
+     * @param bottom The height of the border's bottom side.
+     * @param left The width of the border's left side.
+     * @param right The width of the border's right side.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setBorder(float top, float bottom, float left, float right, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the measurements of this control's border for a given state. 
+     *
+     * @return This control's border.
+     */
+    const Theme::Border& getBorder(State state = NORMAL) const;
+
+    /**
+     * Set the texture region of this control's skin.
+     *
+     * @param region The texture region, in pixels.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setSkinRegion(const Rectangle& region, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the texture region of this control's skin for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The texture region of this control's skin.
+     */
+    const Rectangle& getSkinRegion(State state = NORMAL) const;
+
+    /**
+     * Set the blend color of this control's skin.
+     *
+     * @param color The new blend color.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setSkinColor(const Vector4& color, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the blend color of this control's skin for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The blend color of this control's skin.
+     */
+    const Vector4& getSkinColor(State state = NORMAL) const;
+
+    /**
+     * Set this control's margin.
+     *
+     * @param top Height of top margin.
+     * @param bottom Height of bottom margin.
+     * @param left Width of left margin.
+     * @param right Width of right margin.
+     */
+    void setMargin(float top, float bottom, float left, float right);
+
+    /**
+     * Get this control's margin.
+     *
+     * @return This control's margin.
+     */
+    const Theme::Margin& getMargin() const;
+
+    /**
+     * Set this control's padding.
+     *
+     * @param top Height of top padding.
+     * @param bottom Height of bottom padding.
+     * @param left Width of left padding.
+     * @param right Width of right padding.
+     */
+    void setPadding(float top, float bottom, float left, float right);
+
+    /**
+     * Get this control's padding.
+     *
+     * @return This control's padding.
+     */
+    const Theme::Padding& getPadding() const;
+
+    /**
+     * Set the texture region of an image used by this control.
+     *
+     * @param id The ID of the image to modify.
+     * @param region The new texture region of the image.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setImageRegion(const char* id, const Rectangle& region, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the texture region of an image used by this control for a given state.
+     *
+     * @param id The ID of the image.
+     * @param state The state to get this property from.
+     *
+     * @return The texture region of the specified image.
+     */
+    const Rectangle& getImageRegion(const char* id, State state) const;
+
+    /**
+     * Set the blend color of an image used by this control.
+     *
+     * @param id The ID of the image to modify.
+     * @param color The new blend color of the image.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setImageColor(const char* id, const Vector4& color, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the blend color of an image used by this control for a given state.
+     *
+     * @param id The ID of the image.
+     * @param state The state to get this property from.
+     *
+     * @return The blend color of the specified image.
+     */
+    const Vector4& getImageColor(const char* id, State state) const;
+
+    /**
+     * Get the texture coordinates of an image used by this control for a given state.
+     *
+     * @param id The ID of the image.
+     * @param state The state to get this property from.
+     *
+     * @return The texture coordinates of the specified image.
+     */
+    const Theme::UVs& getImageUVs(const char* id, State state) const;
+
+    /**
+     * Set the texture region of this control's cursor.
+     *
+     * @param region The cursor region.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setCursorRegion(const Rectangle& region, unsigned char states);
+
+    /**
+     * Get the texture region of this control's cursor for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The texture region of this control's cursor.
+     */
+    const Rectangle& getCursorRegion(State state) const;
+
+    /**
+     * Set the blend color of this control's cursor.
+     *
+     * @param color The new blend color.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setCursorColor(const Vector4& color, unsigned char states);
+
+    /**
+     * Get the blend color of this control's cursor for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The blend color of this control's cursor.
+     */
+    const Vector4& getCursorColor(State state);
+    
+    /**
+     * Get the texture coordinates of this control's cursor for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The texture coordinates of this control's cursor.
+     */
+    const Theme::UVs& getCursorUVs(State state);
+
+    /**
+     * Set the font used by this control.
+     *
+     * @param font The new font to use.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setFont(Font* font, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the font used by this control for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return the font used by this control.
+     */
+    Font* getFont(State state = NORMAL) const;
+
+    /**
+     * Set this control's font size.
+     *
+     * @param size The new font size.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setFontSize(unsigned int size, unsigned char states = STATE_ALL);
+
+    /**
+     * Get this control's font size for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return This control's font size.
+     */
+    unsigned int getFontSize(State state = NORMAL) const;
+
+    /**
+     * Set this control's text color.
+     *
+     * @param color The new text color.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setTextColor(const Vector4& color, unsigned char states = STATE_ALL);
+
+    /**
+     * Get this control's text color for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return This control's text color.
+     */
+    const Vector4& getTextColor(State state = NORMAL) const;
+
+    /**
+     * Set this control's text alignment.
+     *
+     * @param alignment The new text alignment.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setTextAlignment(Font::Justify alignment, unsigned char states = STATE_ALL);
+
+    /**
+     * Get this control's text alignment for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return This control's text alignment for the given state.
+     */
+    Font::Justify getTextAlignment(State state = NORMAL) const;
+
+    /**
+     * Set whether text is drawn from right to left within this control.
+     *
+     * @param rightToLeft Whether text is drawn from right to left within this control.
+     * @param states The states to set this property on.
+     *               One or more members of the Control::State enum, ORed together.
+     */
+    void setTextRightToLeft(bool rightToLeft, unsigned char states = STATE_ALL);
+
+    /**
+     * Get whether text is drawn from right to left within this control, for a given state.
+     *
+     * @param state The state to get this property from.
+     *
+     * @return Whether text is drawn from right to left within this control, for the given state.
+     */
+    bool getTextRightToLeft(State state = NORMAL) const;
+
+    /**
+     * Sets the visibility of a control.
+     *
+     * This is a quick way to hide a control without having to remove it from a form.
+     *
+     * @param visible true if the control is visible and enabled; false if not-visible and disabled.
+     */
+    void setVisible(bool visible);
+
+    /**
+     * Get the visibility of a control.
+     *
+     * @return true if the control is visible; false if not visible.
+     */
+    bool isVisible() const;
+
+    /**
+     * Determines if this control is visible in its hierarchy.
+     *
+     * A control is visible in its hierarchy if it is visible and all of its parents
+     * are also visible.
+     */
+    bool isVisibleInHierarchy() const;
+
+    /**
+     * 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, OR'ed together.
+     */
+    void setOpacity(float opacity, unsigned char states = STATE_ALL);
+
+    /**
+     * Get the opacity of this control for a given state. 
+     *
+     * @param state The state to get this property from.
+     *
+     * @return The opacity of this control for a given state.
+     */
+    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;
+
+    /**
+     * Determines if this control is enabled in its hierarchy.
+     *
+     * A control is enabled in its hierarchy if it is enabled and all of its parents
+     * are also enabled.
+     */
+    bool isEnabledInHierarchy() const;
+
+    /**
+     * Get this control's current state.
+     *
+     * @return This control's current state.
+     */
+    State getState() const;
+
+    /**
+     * Set whether this control consumes input events,
+     * preventing them from being passed to the game.
+     *
+     * @param consume Whether this control consumes input events.
+     */
+    void setConsumeInputEvents(bool consume);
+
+    /**
+     * Get whether this control consumes touch events.
+     *
+     * @return Whether this control consumes touch events.
+     */
+    bool getConsumeInputEvents();
+
+    /**
+     * Get this control's style.
+     *
+     * @return This control's style.
+     */
+    Theme::Style* getStyle() const;
+
+    /**
+     * Set the style this control will use when rendering.
+     *
+     * @param style The style this control will use when rendering.
+     */
+    void setStyle(Theme::Style* style);
+
+    /**
+     * Returns the theme for this control.
+     */
+    Theme* getTheme() const;
+
+    /**
+     * Get this control's z-index.
+     *
+     * @return This control's z-index.
+     */
+    int getZIndex() const;
+
+    /**
+     * Set this control's z-index.
+     *
+     * @param zIndex The new z-index.
+     */
+    void setZIndex(int zIndex);
+
+    /**
+     * Determines if this control accepts focus.
+     *
+     * @return True if this control accepts focus, false if it does not.
+     */
+    bool canFocus() const;
+
+    /**
+     * Sets whether or not the control accepts input focus.
+     *
+     * @param acceptsFocus True if the control should accept input focus, false otherwise.
+     */
+    void setCanFocus(bool acceptsFocus);
+
+    /**
+     * Determines if this control is currently in focus.
+     *
+     * @return True if the control is currently in focus.
+     */
+    bool hasFocus() const;
+
+    /**
+     * Sets input focus to this control.
+     *
+     * If this control accepts focus (the hasFocus method returns true), input focus
+     * is set to this control. If this control is a container, the first focusable
+     * control within it gains focus.
+     *
+     * @return True if this control or one of its children successfully gained focus,
+     *      false otherwise.
+     */
+    virtual bool setFocus();
+
+    /**
+     * Get this control's focus index.
+     *
+     * @return This control's focus index.
+     */
+    int getFocusIndex() const;
+
+    /**
+     * Set this control's focus index.
+     *
+     * Focus indexes control the order in which input focus changes between controls
+     * when using the focus change controls such as the TAB key.
+     *
+     * Valid focus indexes should be zero or greater, with a negative number indicating
+     * an unset focus index.
+     *
+     * @param focusIndex The new focus index.
+     */
+    void setFocusIndex(int focusIndex);
+
+    /**
+     * Returns whether this Control object is a Container or not.
+     *
+     * @return true if this object is of class Container, false otherwise.
+     */
+    virtual bool isContainer() const;
+
+    /**
+     * Gets the type of the Control and returns it as a string.
+     *
+     * @return The string of the Control type, all in lower-case.
+     */
+    virtual const char* getType() const;
+
+    /**
+     * Returns this control's parent, or NULL if this control does not have a parent.
+     *
+     * @return This control's parent.
+     */
+    Control* getParent() const;
+
+    /**
+     * Determines if this control is a child (at any level of hierarchy) of the 
+     * specified control.
+     *
+     * @param control The control to check.
+     * @return True if this control is a direct or indirect child of the specified control.
+     */
+    bool isChild(Control* control) const;
+
+    /**
+     * Returns this control's top level form, or NULL if this control does not belong to a form.
+     *
+     * @return this control's form.
+     */
+    Form* getTopLevelForm() const;
+
+    /**
+     * Adds a listener to be notified of specific events affecting
+     * this control.  Event types can be OR'ed together.
+     * E.g. To listen to touch-press and touch-release events,
+     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
+     * as the second parameter.
+     *
+     * @param listener The listener to add.
+     * @param eventFlags The events to listen for.
+     */
+    virtual void addListener(Control::Listener* listener, int eventFlags);
+
+    /**
+     * Removes a listener from this control.
+     * 
+     * @param listener The listener to remove.
+     */
+    virtual void removeListener(Control::Listener* listener);
+
+    /**
+     * @see AnimationTarget::getAnimationPropertyComponentCount
+     */
+    virtual unsigned int getAnimationPropertyComponentCount(int propertyId) const;
+
+    /**
+     * @see AnimationTarget::getAnimationProperty
+     */
+    virtual void getAnimationPropertyValue(int propertyId, AnimationValue* value);
+
+    /**
+     * @see AnimationTarget::setAnimationProperty
+     */
+    virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
+
+protected:
+
+    /**
+     *  Constant value representing an unset or invalid contact index.
+     */
+    static const int INVALID_CONTACT_INDEX = -1;
+
+    /**
+     * Constructor.
+     */
+    Control();
+
+    /**
+     * Destructor.
+     */
+    virtual ~Control();
+
+    /**
+     * Hidden copy assignment operator.
+     */
+    Control& operator=(const Control&);
+
+    /**
+     * Get the overlay type corresponding to this control's current state.
+     *
+     * @return The overlay type corresponding to this control's current state.
+     */
+    Theme::Style::OverlayType getOverlayType() const;
+
+    /**
+     * Touch callback on touch events.  Controls return true if they consume the touch event.
+     *
+     * @param evt The touch event that occurred.
+     * @param x The x position of the touch in pixels. Left edge is zero.
+     * @param y The y position of the touch in pixels. Top edge is zero.
+     * @param contactIndex The order of occurrence for multiple touch contacts starting at zero.
+     *
+     * @return Whether the touch event was consumed by this control.
+     *
+     * @see Touch::TouchEvent
+     */
+    virtual bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
+
+    /**
+     * Keyboard callback on key events.
+     *
+     * @param evt The key event that occurred.
+     * @param key If evt is KEY_PRESS or KEY_RELEASE then key is the key code from Keyboard::Key.
+     *            If evt is KEY_CHAR then key is the unicode value of the character.
+     *
+     * @return Whether the key event was consumed by this control.
+     * 
+     * @see Keyboard::KeyEvent
+     * @see Keyboard::Key
+     */
+    virtual bool keyEvent(Keyboard::KeyEvent evt, int key);
+
+    /**
+     * Mouse callback on mouse events.
+     *
+     * @param evt The mouse event that occurred.
+     * @param x The x position of the mouse in pixels. Left edge is zero.
+     * @param y The y position of the mouse in pixels. Top edge is zero.
+     * @param wheelDelta The number of mouse wheel ticks. Positive is up (forward), negative is down (backward).
+     *
+     * @return True if the mouse event is consumed or false if it is not consumed.
+     *
+     * @see Mouse::MouseEvent
+     */
+    virtual bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
+
+    /**
+     * Gamepad callback on gamepad events.
+     *
+     * @param gamepad The gamepad whose state changed.
+     * @param evt The gamepad event that occurred.
+     * @param analogIndex If evt is JOYSTICK_EVENT or TRIGGER_EVENT, this will be the index of the corresponding control.
+     */
+    virtual bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
+
+    /**
+     * Called when a control's properties change.  Updates this control's internal rendering
+     * properties, such as its text viewport.
+     *
+     * @param container This control's parent container.
+     * @param offset Positioning offset to add to the control's position.
+     */
+    virtual void update(const Control* container, const Vector2& offset);
+
+    /**
+     * Indicates that a control will begin drawing into the specified batch.
+     *
+     * When drawing is finshed (before any other batch can be drawn into), the
+     * finishBatch method should be called.
+     *
+     * @param form The form beign drawn.
+     * @param batch The sprite batch to be drawn into.
+     */
+    void startBatch(Form* form, SpriteBatch* batch);
+
+    /**
+     * Called after a batch has been drawn into and before any other batch is used.
+     *
+     * @param form The form being drawn.
+     * @param batch The batch that was previously started (via Control::startBatch).
+     */
+    void finishBatch(Form* form, SpriteBatch* batch);
+
+    /**
+     * Draws the control.
+     *
+     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
+     * Batches should not be explicitly started or finished, but instead should be passed
+     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
+     * and finishing the batch when neccessary.
+     *
+     * @param form The top level form being drawn.
+     * @param clip The clipping rectangle.
+     *
+     * @return The number of draw calls issued.
+     */
+    virtual unsigned int draw(Form* form, const Rectangle& clip);
+
+    /**
+     * Draws the themed border and background of a control.
+     *
+     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
+     * Batches should not be explicitly started or finished, but instead should be passed
+     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
+     * and finishing the batch when neccessary.
+     *
+     * @param form The top level form being drawn.
+     * @param clip The clipping rectangle of this control's parent container.
+     *
+     * @return The number of draw calls issued.
+     */
+    virtual unsigned int drawBorder(Form* form, const Rectangle& clip);
+
+    /**
+     * Draw the images associated with this control.
+     *
+     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
+     * Batches should not be explicitly started or finished, but instead should be passed
+     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
+     * and finishing the batch when neccessary.
+     *
+     * @param form The top level form being drawn.
+     * @param clip The clipping rectangle of this control's parent container.
+     *
+     * @return The number of draw calls issued.
+     */
+    virtual unsigned int drawImages(Form* form, const Rectangle& clip);
+
+    /**
+     * Draw this control's text.
+     *
+     * Implementations of Control are expected to perform all drawing into a SpriteBatch.
+     * Batches should not be explicitly started or finished, but instead should be passed
+     * to Control::prepare(Form*, SpriteBatch*). This will handle automatically starting
+     * and finishing the batch when neccessary.
+     *
+     * @param form The top level form being drawn.
+     * @param clip The clipping rectangle of this control's parent container.
+     *
+     * @return The number of draw calls issued.
+     */
+    virtual unsigned int drawText(Form* form, const Rectangle& clip);
+
+    /**
+     * Initializes the control.
+     *
+     * @param typeName The type name of the control being initalized.
+     * @param style The style to apply to this control (optional).
+     * @param properties The properties to set on this control (optional).
+     */
+    virtual void initialize(const char* typeName, Theme::Style* style, Properties* properties);
+
+    /**
+     * Returns whether this control has been modified and requires an update.
+     *
+     * @return Whether this control has been modified and requires an update.
+     */
+    virtual bool isDirty();
+
+    /**
+     * Get a Control::State enum from a matching string.
+     *
+     * @param state The string to match.
+     *
+     * @return The Control::State enum that matches the given string.
+     */
+    static State getState(const char* state);
+
+    /**
+     * Get a Theme::ThemeImage from its ID, for a given state.
+     *
+     * @param id The ID of the image to retrieve.
+     * @param state The state to get this image from.
+     *
+     * @return The requested Theme::ThemeImage, or NULL if none was found.
+     */
+    Theme::ThemeImage* getImage(const char* id, State state);
+
+    /**
+     * Notify this control's listeners of a specific event.
+     *
+     * @param eventType The event to trigger.
+     */
+    void notifyListeners(Control::Listener::EventType eventType);
+
+    /**
+     * Called when a control event is fired for this control, before external
+     * listeners are notified of the event.
+     *
+     * @param evt The event type.
+     */
+    virtual void controlEvent(Control::Listener::EventType evt);
+
+    /**
+     * Gets the Alignment by string.
+     *
+     * @param alignment The string representation of the Alignment type.
+     * @return The Alignment enum value corresponding to the given string.
+     */
+    static Alignment getAlignment(const char* alignment);
+
+    /** 
+     * The Control's ID.
+     */ 
+    std::string _id;
+
+    /**
+     * Whether the control is enabled.
+     */
+    bool _enabled;
+
+    /**
+     * Bits indicating whether bounds values are absolute values or percentages.
+     */
+    int _boundsBits;
+
+    /**
+     * Local bounds, relative to parent container's clipping window, possibly stored as percentages (see _boundsBits).
+     */
+    Rectangle _relativeBounds;
+
+    /**
+     * Local bounds, relative to parent container's clipping window, and desired size.
+     */
+    Rectangle _bounds;
+
+    /**
+     * Local bounds, relative to parent container's clipping window, including border and padding, after clipping.
+     */
+    Rectangle _clipBounds;
+
+    /**
+     * Absolute bounds, including border and padding, before clipping.
+     */
+    Rectangle _absoluteBounds;
+
+    /**
+     * Absolute bounds, including border and padding, after clipping.
+     */
+    Rectangle _absoluteClipBounds;
+
+    /**
+     * Absolute bounds of content area (i.e. without border and padding), before clipping.
+     */
+    Rectangle _viewportBounds;
+
+    /**
+     * Absolute bounds of content area (i.e. without border and padding), after clipping.
+     */
+    Rectangle _viewportClipBounds;
+
+    /**
+     * If the control is dirty and need updating.
+     */
+    bool _dirty;
+    
+    /**
+     * Flag for whether the Control consumes input events.
+     */
+    bool _consumeInputEvents;
+    
+    /**
+     * The Control's Alignment
+     */
+    Alignment _alignment;
+
+    /**
+     * Whether the Control's alignment has been set programmatically.
+     */
+    bool _isAlignmentSet;
+    
+    /**
+     * Whether the Control's width is auto-sized.
+     */
+    AutoSize _autoWidth;
+    
+    /**
+     * Whether the Control's height is auto-sized.
+     */
+    AutoSize _autoHeight;
+    
+    /**
+     * Listeners map of EventType's to a list of Listeners.
+     */
+    //std::map<Listener::EventType, std::list<Listener*>*>* _listeners;
+    std::map<Control::Listener::EventType, std::list<Control::Listener*>*>* _listeners;
+    
+    /**
+     * The Control's Theme::Style.
+     */
+    Theme::Style* _style;
+
+    /**
+     * The control is not visible and _state become DISABLED if false.
+     */
+    bool _visible;
+
+    /**
+     * The current opacity of the control.
+     */
+    float _opacity;
+    
+    /**
+     * The z-order of the control.
+     */
+    int _zIndex;
+
+    /**
+     * The contact index assigned to this control.
+     */
+    int _contactIndex;
+
+    /**
+     * The focus order of the control.
+     */
+    int _focusIndex;
+
+    /**
+     * Whether or not the control accepts input focus.
+     */
+    bool _canFocus;
+
+    /**
+     * The control's parent container.
+     */
+    Container* _parent;
+
+private:
+
+    /*
+     * Constructor.
+     */    
+    Control(const Control& copy);
+
+    Theme::Style::Overlay** getOverlays(unsigned char overlayTypes, Theme::Style::Overlay** overlays);
+
+    Theme::Style::Overlay* getOverlay(Control::State state) const;
+
+    void overrideStyle();
+
+    void overrideThemedProperties(Properties* properties, unsigned char states);
+
+    void setImageList(Theme::ImageList* imageList, unsigned char states = STATE_ALL);
+
+    void setCursor(Theme::ThemeImage* cursor, unsigned char states = STATE_ALL);
+
+    void setSkin(Theme::Skin* skin, unsigned char states = STATE_ALL);
+
+    Theme::Skin* getSkin(State state);
+
+    void addSpecificListener(Control::Listener* listener, Control::Listener::EventType eventType);
+
+    bool _styleOverridden;
+    Theme::Skin* _skin;
+
+};
+
+}
+
+#endif

+ 1 - 1
gameplay/src/FileSystem.h

@@ -218,7 +218,7 @@ public:
      * - "image.png" will return ""
      * - "c:\foo\bar\image.png" will return "c:/foo/bar/"
      * 
-     * @param The file path. May be relative or absolute, forward or back slashes. May be NULL.
+     * @param path The file path. May be relative or absolute, forward or back slashes. May be NULL.
      * 
      * @return The directory name with the trailing '/'. Returns "" if path is NULL or the path does not contain a directory.
      */

+ 1 - 1
gameplay/src/Game.h

@@ -507,7 +507,7 @@ public:
      */
     inline void setMultiSampling(bool enabled);
 
-    /*
+    /**
      * Is multi-sampling enabled.
      *
      * @return true if multi-sampling is enabled.

+ 148 - 138
gameplay/src/ImageControl.h

@@ -1,139 +1,149 @@
-#ifndef IMAGECONTROL_H_
-#define IMAGECONTROL_H_
-
-#include "Control.h"
-#include "Theme.h"
-#include "Image.h"
-#include "SpriteBatch.h"
-#include "Rectangle.h"
-
-namespace gameplay
-{
-
-/**
- * Defines an image control.
- *
- * This allows forms to display seperate images from arbitrary files not specified in the theme.
- *
- * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
- */
-class ImageControl : public Control
-{
-    friend class Container;
-    friend class ControlFactory;
-
-public:
-
-    /**
-     * Creates a new ImageControl.
-     *
-     * @param id The image control ID.
-     * @param style The image control style (optional).
-     *
-     * @return The new image control.
-     * @script{create}
-     */
-    static ImageControl* create(const char* id, Theme::Style* style = NULL);
-
-    /**
-     * Set the path of the image for this ImageControl to display.
-     *
-     * @param path The path to the image.
-     */
-    void setImage(const char* path);
-
-    /**
-     * Set the source region of this ImageControl.  This is the region of the file,
-     * in pixels, to use when drawing.
-     *
-     * @param x The x coordinate of the source region.
-     * @param y The y coordinate of the source region.
-     * @param width The width of the source region.
-     * @param height The height of the source region.
-     */
-    void setRegionSrc(float x, float y, float width, float height);
-
-    /**
-     * Set the source region of this ImageControl.  This is the region of the file,
-     * in pixels, to use when drawing.
-     *
-     * @param region The new source region.
-     */
-    void setRegionSrc(const Rectangle& region);
-
-    /**
-     * Get the source region of this ImageControl.
-     *
-     * @return The source region of this ImageControl.
-     */
-    const Rectangle& getRegionSrc() const;
-
-    /**
-     * Sets the destination region of this ImageControl.  This is the region
-     * within the control's viewport to draw the image.
-     *
-     * @param x The x coordinate of the destination region.
-     * @param y The y coordinate of the destination region.
-     * @param width The width of the destination region.
-     * @param height The height of the destination region.
-     */
-    void setRegionDst(float x, float y, float width, float height);
-
-    /**
-     * Sets the destination region of this ImageControl.  This is the region
-     * within the control's viewport to draw the image.
-     *
-     * @param region The new destination region.
-     */
-    void setRegionDst(const Rectangle& region);
-
-    /**
-     * Get the destination region of this ImageControl.
-     *
-     * @return The destination region of this ImageControl.
-     */
-    const Rectangle& getRegionDst() const;
-
-    const char* getType() const;
-
-protected:
-
-    ImageControl();
-
-    virtual ~ImageControl();
-
-    static Control* create(Theme::Style* style, Properties* properties = NULL);
-
-    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
-
-    /**
-     * @see Control::drawImages
-     */
-    unsigned int drawImages(Form* form, const Rectangle& clip);
-
-    /**
-     * @see Control#update(const Control*, const Vector2&)
-     */
-    void update(const Control* container, const Vector2& offset);
-
-    // Source region.
-    Rectangle _srcRegion;
-    // Destination region.
-    Rectangle _dstRegion;
-    SpriteBatch* _batch;
-
-    // One over texture width and height, for use when calculating UVs from a new source region.
-    float _tw;
-    float _th;
-    
-    // Calculated UVs.
-    Theme::UVs _uvs;
-
-private:
-
-    ImageControl(const ImageControl& copy);
-};
-
-}
-
+#ifndef IMAGECONTROL_H_
+#define IMAGECONTROL_H_
+
+#include "Control.h"
+#include "Theme.h"
+#include "Image.h"
+#include "SpriteBatch.h"
+#include "Rectangle.h"
+
+namespace gameplay
+{
+
+/**
+ * Defines an image control.
+ *
+ * This allows forms to display seperate images from arbitrary files not specified in the theme.
+ *
+ * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
+ */
+class ImageControl : public Control
+{
+    friend class Container;
+    friend class ControlFactory;
+
+public:
+
+    /**
+     * Creates a new ImageControl.
+     *
+     * @param id The image control ID.
+     * @param style The image control style (optional).
+     *
+     * @return The new image control.
+     * @script{create}
+     */
+    static ImageControl* create(const char* id, Theme::Style* style = NULL);
+
+    /**
+     * Set the path of the image for this ImageControl to display.
+     *
+     * @param path The path to the image.
+     */
+    void setImage(const char* path);
+
+    /**
+     * Set the source region of this ImageControl.  This is the region of the file,
+     * in pixels, to use when drawing.
+     *
+     * @param x The x coordinate of the source region.
+     * @param y The y coordinate of the source region.
+     * @param width The width of the source region.
+     * @param height The height of the source region.
+     */
+    void setRegionSrc(float x, float y, float width, float height);
+
+    /**
+     * Set the source region of this ImageControl.  This is the region of the file,
+     * in pixels, to use when drawing.
+     *
+     * @param region The new source region.
+     */
+    void setRegionSrc(const Rectangle& region);
+
+    /**
+     * Get the source region of this ImageControl.
+     *
+     * @return The source region of this ImageControl.
+     */
+    const Rectangle& getRegionSrc() const;
+
+    /**
+     * Sets the destination region of this ImageControl.  This is the region
+     * within the control's viewport to draw the image.
+     *
+     * @param x The x coordinate of the destination region.
+     * @param y The y coordinate of the destination region.
+     * @param width The width of the destination region.
+     * @param height The height of the destination region.
+     */
+    void setRegionDst(float x, float y, float width, float height);
+
+    /**
+     * Sets the destination region of this ImageControl.  This is the region
+     * within the control's viewport to draw the image.
+     *
+     * @param region The new destination region.
+     */
+    void setRegionDst(const Rectangle& region);
+
+    /**
+     * Get the destination region of this ImageControl.
+     *
+     * @return The destination region of this ImageControl.
+     */
+    const Rectangle& getRegionDst() const;
+
+    const char* getType() const;
+
+protected:
+
+    ImageControl();
+
+    virtual ~ImageControl();
+
+    /**
+     * Creates a new ImageControl.
+     * 
+     * @param style The control's custom style.
+     * @param properties A properties object containing a definition of the ImageControl (optional).
+     *
+     * @return The new ImageControl.
+     * @script{create}
+      * 
+      */
+    static Control* create(Theme::Style* style, Properties* properties = NULL);
+
+    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
+
+    /**
+     * @see Control::drawImages
+     */
+    unsigned int drawImages(Form* form, const Rectangle& clip);
+
+    /**
+     * @see Control#update(const Control*, const Vector2&)
+     */
+    void update(const Control* container, const Vector2& offset);
+
+private:
+
+    ImageControl(const ImageControl& copy);
+
+    // Source region.
+    Rectangle _srcRegion;
+    // Destination region.
+    Rectangle _dstRegion;
+    SpriteBatch* _batch;
+
+    // One over texture width and height, for use when calculating UVs from a new source region.
+    float _tw;
+    float _th;
+    
+    // Calculated UVs.
+    Theme::UVs _uvs;
+};
+
+}
+
 #endif

+ 861 - 861
gameplay/src/ParticleEmitter.h

@@ -1,861 +1,861 @@
-#ifndef PARTICLEEMITTER_H_
-#define PARTICLEEMITTER_H_
-
-#include "Transform.h"
-#include "Mesh.h"
-#include "Vector2.h"
-#include "Vector4.h"
-#include "Texture.h"
-#include "Rectangle.h"
-#include "SpriteBatch.h"
-#include "Properties.h"
-
-namespace gameplay
-{
-
-class Node;
-
-/**
- * Defines a particle emitter that can be made to simulate and render a particle system.
- *
- * Once created, the emitter can be set on a node in order to follow an object or be placed
- * within a scene.
- *
- * A ParticleEmitter has a texture and a maximum number of particles that can be alive at
- * once, both of which are set when the ParticleEmitter is created and cannot be changed
- * from then on.  Particles are rendered as camera-facing billboards using the emitter's
- * texture.  The ParticleEmitter's texture properties determine whether the texture
- * is treated as a single image, a texture atlas or an animated sprite.
- *
- * A ParticleEmitter also has a number of properties that determine values assigned to
- * individual particles it emits.  Scalar properties such as particle begin- and end-size
- * are assigned within a minimum and maximum value; vector properties are assigned within
- * the domain defined by a base vector and a variance vector as follows: The variance vector
- * is multiplied by a random scalar between 1 and -1, and the base vector is added to this
- * result.  This allows a ParticleEmitter to be created which emits particles with properties
- * that are randomized, yet fit within a well-defined range.  To make a property deterministic,
- * simply set the minimum to the same value as the maximum for that property or set its
- * variance to the zero vector.
- *
- * <h2>Scalar properties:</h2>
- *
- * Begin-Size: \n
- * The size of a newly emitted particle.
- *
- * End-Size: \n
- * The size of a particle at the end of its lifetime.  A particle's size will
- * interpolate linearly between its begin-size and end-size over its lifetime.
- *
- * Energy: \n
- * The length of time a particle will remain alive for.
- *
- * RotationSpeedPerParticle: \n
- * The speed and direction a particle will spin.  Since particles are
- * rendered as billboards, no axis of rotation can be specified per particle.
- * Each particles rotates around their center points, around the z-axis in
- * screen space.
- *
- * RotationSpeed:\n
- * The speed a particle will spin around its RotationAxis in world space.
- * (See RotationAxis under "Vector properties" below.)
- *
- *
- * <h2>Vector properties:</h2>
- * 
- * Initial Position: \n
- * The position of a new particle at the moment it is emitted, relative
- * to the node its ParticleEmitter is set on.  This property is unique
- * in that the initial positions of new particles can be restricted to
- * fit within an ellipsoidal domain; see setEllipsoid().
- *
- * Initial Velocity: \n
- * The velocity of a new particle at the moment it is emitted.  This
- * property is measured in world coordinates per second and modifies
- * a particle's current position each time ParticleEmitter::update()
- * is called.
- *
- * Acceleration:\n
- * The particle's change in velocity, measured in world coordinates per second.
- * This property modifies a particle's current position each time 
- * ParticleEmitter::update() is called.
- *
- * Color: \n
- * The color of a particle at the end of its lifetime.  A particle's color
- * will interpolate linearly between its begin-color and end-color over its lifetime.
- *
- * RotationAxis: \n
- * An axis in world space around which all particles will spin, allowing for tornado and
- * spiral effects.
- *
- * The vector properties Initial Position, Initial Velocity and Acceleration can be set to
- * orbit around the origin of a node a ParticleEmitter is set on by that node's rotation matrix.
- * This allows the rotation of a node, and not just its position, to affect these properties of
- * newly emitted particles.  An example of where this would be useful would be a water-fountain
- * emitter attached to the nozzle of a hose.  The initial position and initial velocity would be
- * set to orbit around the node's origin so that the water would always spray out in the direction
- * the nozzle was facing.  However, acceleration would not be set to orbit the node's origin in
- * order for gravity to continue to act in the same direction on water particles, no matter
- * what direction they were originally aimed.
- * 
- * <h2>Rendering properties:</h2>
- *
- * Particles are rendered as screen-facing billboards -- that is, the ParticleEmitter's texture
- * is used to render particles as images that always face the camera.  For the simplest case,
- * where the entire texture is used for every particle, the default texture settings can be used.
- * However, a ParticleEmitter can also be configured to select one of several frames at random
- * for each particle, or to render each particle as a sprite that animates through the frames
- * over the course of its lifetime.
- *
- * Frame Count: \n
- * The number of individual images / frames contained in the texture.
- *
- * Texture Coordinates: \n
- * The coordinates within the texture used to render a specific frame.
- * Using a texture that places the frames together, without padding,
- * in left-to-right top-to-bottom order is recommended, as there is a utility
- * method for generating the texture coordinates for such a texture atlas /
- * sprite-map.  See setSpriteFrameCoords().
- *
- * Sprite Animating: \n
- * Set this to enable sprite animation.
- *
- * Sprite Looped: \n
- * If sprites are set to loop, each frame will last for the emitter's frameDuration.
- * If sprites are set not to loop, the animation will be timed so that the last frame
- * finishes just as a particle dies.  This setting has no effect if the sprite is not
- * animating.
- *
- * Sprite Random Offset: \n
- * New particles are created with one of the sprite frames in the emitter's texture.
- * If a maximum offset is set, a random frame from 0 to maxOffset will be selected.
- * If sprite animation is disabled and this offset is set to Frame Count, each
- * particle will use one of the sprite frames for its entire lifetime.
- *
- * Blend Mode: \n
- * Sets the blend mode used by this particle emitter.  The given blend factors will
- * be set before rendering the particle system and then will be reset to their original
- * values.  Accepts the same symbolic constants as glBlendFunc().
- *
- * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-Particles
- */
-class ParticleEmitter : public Ref
-{
-    friend class Node;
-
-public:
-
-    /**
-     * Defines the types of texture blending 
-     */
-    enum TextureBlending
-    {
-        BLEND_OPAQUE,
-        BLEND_TRANSPARENT,
-        BLEND_ADDITIVE,
-        BLEND_MULTIPLIED
-    };
-
-    /**
-     * Creates a particle emitter using the data from the Properties object defined at the specified URL, 
-     * where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>"
-     * (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). 
-     * 
-     * @param url The URL pointing to the Properties object defining the particle emitter.
-     * 
-     * @return An initialized ParticleEmitter.
-     * @script{create}
-     */
-    static ParticleEmitter* create(const char* url);
-
-    /**
-     * Creates a particle emitter from the specified properties object.
-     * 
-     * @param properties The properties object defining the 
-     *      particle emitter (must have namespace equal to 'particle').
-     * @return The newly created particle emitter, or <code>NULL</code> if the particle emitter failed to load.
-     * @script{create}
-     */
-    static ParticleEmitter* create(Properties* properties);
-
-    /**
-     * Creates an uninitialized ParticleEmitter.
-     *
-     * @param texturePath A path to the image to use as this ParticleEmitter's texture.
-     * @param textureBlending The type of texture blending to be used for the particles emitted.
-     * @param particleCountMax The maximum number of particles that can be alive at one time in this ParticleEmitter's system.
-     * @script{create}
-     */
-    static ParticleEmitter* create(const char* texturePath, TextureBlending textureBlending,  unsigned int particleCountMax);
-
-    /**
-     * Sets a new texture for this particle emitter.
-     *
-     * The current texture's reference count is decreased.
-     *
-     * @param texturePath Path to the new texture to set.
-     * @param textureBlending Blending mode for the new texture.
-     */
-    void setTexture(const char* texturePath, TextureBlending textureBlending);
-
-    /**
-     * Sets a new texture for this particle emitter.
-     *
-     * The reference count of the specified texture is increased, and the 
-     * current texture's reference count is decreased.
-     *
-     * @param The new texture to set.
-     * @param textureBlending Blending mode for the new texture.
-     */
-    void setTexture(Texture* texture, TextureBlending textureBlending);
-
-    /**
-     * Returns the texture currently set for this particle emitter.
-     *
-     * @return The current texture.
-     */
-    Texture* getTexture() const;
-
-    /**
-     * Sets the maximum number of particles that can be emitted.
-     *
-     * @param max The maximum number of particles that can be emitted.
-     */
-    void setParticleCountMax(unsigned int max);
-
-    /**
-     * Returns the maximum number of particles that can be emitted.
-     *
-     * @return The maximum number of particles that can be emitted.
-     */
-    unsigned int getParticleCountMax() const;
-
-    /**
-     * Sets the emission rate, measured in particles per second.
-     *
-     * @param rate The emission rate, measured in particles per second.
-     */
-    void setEmissionRate(unsigned int rate);
-
-    /**
-     * Gets the emission rate, measured in particles per second.
-     *
-     * @return The emission rate, measured in particles per second.
-     */
-    unsigned int getEmissionRate() const;
-
-    /**
-     * Starts emitting particles over time at this ParticleEmitter's emission rate.
-     *
-     * @see ParticleEmitter::emit()
-     */
-    void start();
-
-    /**
-     * Stops emitting particles over time.
-     *
-     * @see ParticleEmitter::emit()
-     */
-    void stop();
-
-    /**
-     * Gets whether this ParticleEmitter is currently started.
-     *
-     * @return Whether this ParticleEmitter is currently started.
-     */
-    bool isStarted() const;
-
-    /**
-     * Gets whether this ParticleEmitter is currently active (i.e. if any of its particles are alive).
-     * 
-     * @return Whether this ParticleEmitter is currently active.
-     */
-    bool isActive() const;
-
-    /**
-     * Generates an arbitrary number of particles all at once.  Each newly emitted
-     * particle has its properties assigned within the ranges defined by its ParticleEmitter.
-     *
-     * Note that the maximum number of particles that can be alive at once in a particle
-     * system is defined when a ParticleEmitter is created and cannot be changed.  A call
-     * to emit() cannot cause the particle system to exceed this maximum, so fewer or zero
-     * particles will be emitted if the maximum is or has been reached.
-     *
-     * @param particleCount The number of particles to emit immediately.
-     */
-    void emitOnce(unsigned int particleCount);
-
-    /**
-     * Gets the current number of particles.
-     *
-     * @return The number of particles that are currently alive.
-     */
-    unsigned int getParticlesCount() const;
-
-    /**
-     * Sets whether the positions of newly emitted particles are generated within an ellipsoidal domain.
-     *
-     * Each vector property is generated such as to fall within the domain defined by a base vector and a
-     * variance vector. If that domain is ellipsoidal, vectors are generated within an ellipsoid centered 
-     * at the base vector and scaled by the variance vector. If that domain is not ellipsoidal, vectors are 
-     * generated by multiplying the variance vector by a random floating-point number between -1 and 1, 
-     * then adding this result to the base vector.
-     *
-     * Ellipsoidal domains are somewhat less efficient and only necessary when determining the positions of
-     * newly emitted particles.  Call this method with 'true' to make initial position an ellipsoidal domain.
-     * The default setting is 'false'.
-     *
-     * @param ellipsoid Whether initial particle positions are generated within an ellipsoidal domain.
-     */
-    void setEllipsoid(bool ellipsoid);
-
-    /**
-     * Determines whether the positions of newly emitted particles are generated within an ellipsoidal domain.
-     *
-     * @return true if is ellipsoid, false if not.
-     */
-    bool isEllipsoid() const;
-
-    /**
-     * Sets the minimum and maximum size that each particle can be at the time when it is spawned,
-     * as well as the minimum and maximum size for particles to be at the end of their lifetimes.
-     *
-     * @param startMin The minimum size that each particle can be at the time when it is started.
-     * @param startMax The maximum size that each particle can be at the time when it is started.
-     * @param endMin The minimum size that each particle can be at the end of its lifetime.
-     * @param endMax The maximum size that each particle can be at the end of its lifetime.
-     */
-    void setSize(float startMin, float startMax, float endMin, float endMax);
-
-    /**
-     * Gets the minimum size that each particle can be at the time when it is started.
-     *
-     * @return The minimum size that each particle can be at the time when it is started.
-     */
-    float getSizeStartMin() const;
-
-    /**
-     * Gets the maximum size that each particle can be at the time when it is started.
-     *
-     * @return The maximum size that each particle can be at the time when it is started.
-     */
-    float getSizeStartMax() const;
-
-    /**
-     * Gets the minimum size that each particle can be at the end of its lifetime.
-     *
-     * @return The minimum size that each particle can be at the end of its lifetime.
-     */
-    float getSizeEndMin() const;
-
-    /**
-     * Gets the maximum size that each particle can be at the end of its lifetime.
-     *
-     * @return The maximum size that each particle can be at the end of its lifetime.
-     */
-    float getSizeEndMax() const;
-
-    /**
-     * Set the start and end colors, and their variances, of particles in this emitter's system.
-     *
-     * @param start The base start color of emitted particles.
-     * @param startVariance The variance of start color of emitted particles.
-     * @param end The base end color of emitted particles.
-     * @param endVariance The variance of end color of emitted particles.
-     */
-    void setColor(const Vector4& start, const Vector4& startVariance, const Vector4& end, const Vector4& endVariance);
-    
-    /**
-     * Gets the base start color of emitted particles.
-     *
-     * @return The base start color of emitted particles.
-     */
-    const Vector4& getColorStart() const;
-
-    /**
-     * Gets the variance of start color of emitted particles.
-     *
-     * @return The variance of start color of emitted particles.
-     */
-    const Vector4& getColorStartVariance() const;
-
-    /**
-     * Gets the base end color of emitted particles.
-     *
-     * @return The base end color of emitted particles.
-     */
-    const Vector4& getColorEnd() const;
-
-    /**
-     * Gets the variance of end color of emitted particles.
-     *
-     * @return The variance of end color of emitted particles.
-     */
-    const Vector4& getColorEndVariance() const;
-
-    /**
-     * Sets the minimum and maximum lifetime of emitted particles, measured in milliseconds.
-     *
-     * @param energyMin The minimum lifetime of each particle, measured in milliseconds.
-     * @param energyMax The maximum lifetime of each particle, measured in milliseconds.
-     */
-    void setEnergy(long energyMin, long energyMax);
-
-    /**
-     * Gets the minimum lifetime of each particle, measured in milliseconds.
-     *
-     * @return The minimum lifetime of each particle, measured in milliseconds.
-     */
-    long getEnergyMin() const;
-
-    /**
-     * Gets the maximum lifetime of each particle, measured in milliseconds.
-     *
-     * @return The maximum lifetime of each particle, measured in milliseconds.
-     */
-    long getEnergyMax() const;
-
-    /**
-     * Sets the initial position and position variance of new particles.
-     *
-     * @param position The initial position of new particles.
-     * @param positionVariance The amount of variance allowed in the initial position of new particles.
-     */
-    void setPosition(const Vector3& position, const Vector3& positionVariance);
-
-    /**
-     * Gets the position of new particles, relative to the emitter's transform.
-     *
-     * @return The position of new particles, relative to the emitter's transform.
-     */
-    const Vector3& getPosition() const;
-
-    /**
-     * Gets the position variance of new particles.
-     *
-     * @return The position variance of new particles.
-     */
-    const Vector3& getPositionVariance() const;
-
-    /**
-     * Sets the base velocity of new particles and its variance.
-     *
-     * @param velocity The initial velocity of new particles.
-     * @param velocityVariance The amount of variance allowed in the initial velocity of new particles.
-     */
-    void setVelocity(const Vector3& velocity, const Vector3& velocityVariance);
-
-    /**
-     * Gets the initial velocity of new particles.
-     *
-     * @return The initial velocity of new particles.
-     */
-    const Vector3& getVelocity() const;
-
-    /**
-     * Gets the initial velocity variance of new particles.
-     *
-     * @return The initial velocity variance of new particles.
-     */
-    const Vector3& getVelocityVariance() const;
-
-    /**
-     * Gets the base acceleration vector of particles.
-     * 
-     * @return The base acceleration vector of particles.
-     */
-    const Vector3& getAcceleration() const;
-
-    /**
-     * Sets the base acceleration vector and its allowed variance for this ParticleEmitter.
-     *
-     * @param acceleration The base acceleration vector of emitted particles.
-     * @param accelerationVariance The variance allowed in the acceleration of emitted particles.
-     */
-    void setAcceleration(const Vector3& acceleration, const Vector3& accelerationVariance);
-
-    /**
-     * Gets the variance of acceleration of particles.
-     * 
-     * @return The variance of acceleration of particles.
-     */
-    const Vector3& getAccelerationVariance() const;
-
-    /**
-     * Gets the maximum rotation speed of each emitted particle.
-     * This determines the speed of rotation of each particle's screen-facing billboard.
-     *
-     * @param speedMin The minimum rotation speed (per particle).
-     * @param speedMax The maximum rotation speed (per particle).
-     */
-    void setRotationPerParticle(float speedMin, float speedMax);
-
-    /**
-     * Gets the minimum rotation speed of each emitted particle.
-     *
-     * @return The minimum rotation speed of each emitted particle.
-     */
-    float getRotationPerParticleSpeedMin() const;
-
-    /**
-     * Gets the maximum rotation speed of each emitted particle.
-     *
-     * @return The maximum rotation speed of each emitted particle.
-     */
-    float getRotationPerParticleSpeedMax() const;
-
-    /**
-     * Sets a rotation axis in world space around which all particles will spin,
-     * as well as the minimum and maximum rotation speed around this axis.
-     * This should not be confused with rotation speed per particle.
-     *
-     * @param axis The base rotation axis of emitted particles.
-     * @param axisVariance The variance of the rotation axis of emitted particles.
-     * @param speedMin The minimum rotation speed of emitted particles.
-     * @param speedMax The maximum rotation speed of emitted particles.
-     */
-   void setRotation(float speedMin, float speedMax, const Vector3& axis, const Vector3& axisVariance);
-
-    /**
-     * Gets the minimum rotation speed of emitted particles.
-     *
-     * @return The minimum rotation speed of emitted particles.
-     */
-    float getRotationSpeedMin() const;
-
-    /**
-     * Gets the maximum rotation speed of emitted particles.
-     *
-     * @return The maximum rotation speed of emitted particles.
-     */
-    float getRotationSpeedMax() const;
-
-    /**
-     * Gets the base rotation axis of emitted particles.
-     *
-     * @return The base rotation axis of emitted particles.
-     */
-    const Vector3& getRotationAxis() const;
-
-    /**
-     * Gets the variance of the rotation axis of emitted particles.
-     *
-     * @return The variance of the rotation axis of emitted particles.
-     */
-    const Vector3& getRotationAxisVariance() const;
-
-    /**
-     * Sets whether particles cycle through the sprite frames.
-     *
-     * @param animated Whether to animate particles through the sprite frames.
-     */
-    void setSpriteAnimated(bool animated);
-
-    /**
-     * Whether particles cycle through the sprite frames.
-     */
-    bool isSpriteAnimated() const;
-
-    /**
-     * If sprites are set to loop, each frame will last for the emitter's frameDuration.
-     * If sprites are set not to loop, the animation will be timed so that the last frame
-     * finishes just as a particle dies.
-     * Note: This timing is calculated based on a spriteRandomOffset of 0.
-     * For other offsets, the final frame may be reached earlier.
-     * If sprites are not set to animate, this setting has no effect.
-     *
-     * @param looped Whether to loop animated sprites.
-     * @see ParticleEmitter::setSpriteFrameDuration
-     */
-    void setSpriteLooped(bool looped);
-
-    /**
-     * Whether sprites are set to loop, each frame will last for the emitter's frameDuration.
-     *
-     * @return true if looped, false if not.
-     */
-    bool isSpriteLooped() const;
-
-    /**
-     * Sets the maximum offset that a random frame from 0 to maxOffset will be selected.
-     * Set maxOffset to 0 (the default) for all particles to start on the first frame.
-     * maxOffset will be clamped to frameCount.
-     *
-     * @param maxOffset The maximum sprite frame offset.
-     */
-    void setSpriteFrameRandomOffset(int maxOffset);
-    
-    /**
-     * Gets the maximum offset that a random frame from 0 to maxOffset will be selected.
-     */
-    int getSpriteFrameRandomOffset() const;
-
-    /**
-     * Set the animated sprites frame duration.
-     *
-     * @param duration The duration of a single sprite frame, in milliseconds.
-     */
-    void setSpriteFrameDuration(long duration);
-
-    /**
-     * Gets the animated sprites frame duration.
-     *
-     * @return The animated sprites frame duration.
-     */
-    long getSpriteFrameDuration() const;
-
-    /**
-     * Returns the width of the first frame this particle emitter's sprite.
-     *
-     * @return The width of the first frame of the sprite.
-     */
-    unsigned int getSpriteWidth() const;
-
-    /**
-     * Returns the height of the first frame this particle emitter's sprite.
-     *
-     * @return The height of the first frame of the sprite.
-     */
-    unsigned int getSpriteHeight() const;
-
-    /**
-     * Sets the sprite's texture coordinates in texture space.
-     *
-     * @param frameCount The number of frames to set texture coordinates for.
-     * @param texCoords The texture coordinates for all frames, in texture space.
-     */
-    void setSpriteTexCoords(unsigned int frameCount, float* texCoords);
-
-    /**
-     * Sets the sprite's texture coordinates in image space (pixels).
-     *
-     * @param frameCount The number of frames to set texture coordinates for.
-     * @param frameCoords A rectangle for each frame representing its position and size
-     *  within the texture image, measured in pixels.
-     */
-    void setSpriteFrameCoords(unsigned int frameCount, Rectangle* frameCoords);
-
-    /**
-     * Calculates and sets the sprite's texture coordinates based on the width and
-     * height of a single frame, measured in pixels.  This method assumes that there
-     * is no padding between sprite frames and that the first frame is in the top-left
-     * corner of the image.  Frames are ordered in the image from left to right, top to
-     * bottom.
-     *
-     * @param frameCount The number of frames to set texture coordinates for.
-     * @param width The width of a single frame, in pixels.
-     * @param height The height of a single frame, in pixels.
-     */
-    void setSpriteFrameCoords(unsigned int frameCount, int width, int height);
-
-    /**
-     * Returns the current number of frames for the particle emitter's sprite.
-     *
-     * @return The current frame count.
-     */
-    unsigned int getSpriteFrameCount() const;
-
-    /**
-     * Gets the node that this emitter is attached to.
-     *
-     * @return The node that this emitter is attached to.
-     */
-    Node* getNode() const;
-
-    /**
-     * Sets whether the vector properties of newly emitted particles are rotated around the node's position
-     * by the node's rotation matrix.
-     *
-     * @param orbitPosition Whether to rotate initial particle positions by the node's rotation matrix.
-     * @param orbitVelocity Whether to rotate initial particle velocity vectors by the node's rotation matrix.
-     * @param orbitAcceleration Whether to rotate initial particle acceleration vectors by the node's rotation matrix.
-     */
-    void setOrbit(bool orbitPosition, bool orbitVelocity, bool orbitAcceleration);
-
-    /**
-     * Whether new particle positions are rotated by the node's rotation matrix.
-     *
-     * @return True if orbiting positions, false otherwise.
-     */
-    bool getOrbitPosition() const;
-
-    /**
-     * Whether new particle velocities are rotated by the node's rotation matrix.
-     *
-     * @return True if orbiting velocities, false otherwise.
-     */
-    bool getOrbitVelocity() const;
-
-    /**
-     * Whether new particle accelerations are rotated by the node's rotation matrix.
-     *
-     * @return True if orbiting accelerations, false otherwise.
-     */
-    bool getOrbitAcceleration() const;
-
-    /**
-     * Updates the particles currently being emitted.
-     *
-     * @param elapsedTime The amount of time that has passed since the last call to update(), in milliseconds.
-     */
-    void update(float elapsedTime);
-
-    /**
-     * Draws the particles currently being emitted.
-     */
-    unsigned int draw();
-
-    /**
-     * Gets a TextureBlending enum from a corresponding string.
-     */
-    static TextureBlending getTextureBlendingFromString(const char* src);
-
-    /**
-     * Sets the texture blend mode for this particle emitter.
-     *
-     * @param blending The new blend mode.
-     */
-    void setTextureBlending(TextureBlending blending);
-
-    /**
-     * Gets the current texture blend mode for this particle emitter.
-     *
-     * @return The current blend mode.
-     */
-    TextureBlending getTextureBlending() const;
-
-    /**
-     * Clones the particle emitter and returns a new emitter.
-     * 
-     * @return The new cloned particle emitter.
-     */
-    ParticleEmitter* clone();
-
-private:
-
-    /**
-     * Constructor.
-     */
-    ParticleEmitter(unsigned int particlesCount);
-
-    /**
-     * Destructor.
-     */
-    ~ParticleEmitter();
-
-    /**
-     * Creates an uninitialized ParticleEmitter.
-     *
-     * @param texture the texture to use.
-     * @param textureBlending The type of texture blending to be used for the particles emitted.
-     * @param particleCountMax The maximum number of particles that can be alive at one time in this ParticleEmitter's system.
-     * @script{create}
-     */
-    static ParticleEmitter* create(Texture* texture, TextureBlending textureBlending,  unsigned int particleCountMax);
-
-    /**
-     * Hidden copy assignment operator.
-     */
-    ParticleEmitter& operator=(const ParticleEmitter&);
-
-    /**
-     * Sets the node that this emitter is attached to.
-     */
-    void setNode(Node* node);
-
-    // Generates a scalar within the range defined by min and max.
-    float generateScalar(float min, float max);
-
-    long generateScalar(long min, long max);
-
-    // Generates a vector within the domain defined by a base vector and its variance.
-    void generateVectorInRect(const Vector3& base, const Vector3& variance, Vector3* dst);
-
-    // Generates a vector within the ellipsoidal domain defined by a center point and scale vector.
-    void generateVectorInEllipsoid(const Vector3& center, const Vector3& scale, Vector3* dst);
-
-    void generateVector(const Vector3& base, const Vector3& variance, Vector3* dst, bool ellipsoid);
-
-    // Generates a color within the domain defined by a base vector and its variance.
-    void generateColor(const Vector4& base, const Vector4& variance, Vector4* dst);
-
-    /**
-     * Defines the data for a single particle in the system.
-     */
-    class Particle
-    {
-
-    public:
-        Vector3 _position;
-        Vector3 _velocity;
-        Vector3 _acceleration;
-        Vector4 _colorStart;
-        Vector4 _colorEnd;
-        Vector4 _color;
-        float _rotationPerParticleSpeed;
-        Vector3 _rotationAxis;
-        float _rotationSpeed;
-        float _angle;
-        long _energyStart;
-        long _energy;
-        float _sizeStart;
-        float _sizeEnd;
-        float _size;
-        unsigned int _frame;
-        float _timeOnCurrentFrame;
-    };
-
-    unsigned int _particleCountMax;
-    unsigned int _particleCount;
-    Particle* _particles;
-    unsigned int _emissionRate;
-    bool _started;
-    bool _ellipsoid;
-    float _sizeStartMin;
-    float _sizeStartMax;
-    float _sizeEndMin;
-    float _sizeEndMax;
-    float _energyMin;
-    float _energyMax;
-    Vector4 _colorStart;
-    Vector4 _colorStartVar;
-    Vector4 _colorEnd;
-    Vector4 _colorEndVar;
-    Vector3 _position;
-    Vector3 _positionVar;
-    Vector3 _velocity;
-    Vector3 _velocityVar;
-    Vector3 _acceleration;
-    Vector3 _accelerationVar;
-    float _rotationPerParticleSpeedMin;
-    float _rotationPerParticleSpeedMax;
-    float _rotationSpeedMin;
-    float _rotationSpeedMax;
-    Vector3 _rotationAxis;
-    Vector3 _rotationAxisVar;
-    Matrix _rotation;
-    SpriteBatch* _spriteBatch;
-    TextureBlending _spriteTextureBlending;
-    float _spriteTextureWidth;
-    float _spriteTextureHeight;
-    float _spriteTextureWidthRatio;
-    float _spriteTextureHeightRatio;
-    float* _spriteTextureCoords;
-    bool _spriteAnimated;
-    bool _spriteLooped;
-    unsigned int _spriteFrameCount;
-    unsigned int _spriteFrameRandomOffset;
-    long _spriteFrameDuration;
-    float _spriteFrameDurationSecs;
-    float _spritePercentPerFrame;
-    Node* _node;
-    bool _orbitPosition;
-    bool _orbitVelocity;
-    bool _orbitAcceleration;
-    float _timePerEmission;
-    float _emitTime;
-    double _lastUpdated;
-};
-
-}
-
-#endif
+#ifndef PARTICLEEMITTER_H_
+#define PARTICLEEMITTER_H_
+
+#include "Transform.h"
+#include "Mesh.h"
+#include "Vector2.h"
+#include "Vector4.h"
+#include "Texture.h"
+#include "Rectangle.h"
+#include "SpriteBatch.h"
+#include "Properties.h"
+
+namespace gameplay
+{
+
+class Node;
+
+/**
+ * Defines a particle emitter that can be made to simulate and render a particle system.
+ *
+ * Once created, the emitter can be set on a node in order to follow an object or be placed
+ * within a scene.
+ *
+ * A ParticleEmitter has a texture and a maximum number of particles that can be alive at
+ * once, both of which are set when the ParticleEmitter is created and cannot be changed
+ * from then on.  Particles are rendered as camera-facing billboards using the emitter's
+ * texture.  The ParticleEmitter's texture properties determine whether the texture
+ * is treated as a single image, a texture atlas or an animated sprite.
+ *
+ * A ParticleEmitter also has a number of properties that determine values assigned to
+ * individual particles it emits.  Scalar properties such as particle begin- and end-size
+ * are assigned within a minimum and maximum value; vector properties are assigned within
+ * the domain defined by a base vector and a variance vector as follows: The variance vector
+ * is multiplied by a random scalar between 1 and -1, and the base vector is added to this
+ * result.  This allows a ParticleEmitter to be created which emits particles with properties
+ * that are randomized, yet fit within a well-defined range.  To make a property deterministic,
+ * simply set the minimum to the same value as the maximum for that property or set its
+ * variance to the zero vector.
+ *
+ * <h2>Scalar properties:</h2>
+ *
+ * Begin-Size: \n
+ * The size of a newly emitted particle.
+ *
+ * End-Size: \n
+ * The size of a particle at the end of its lifetime.  A particle's size will
+ * interpolate linearly between its begin-size and end-size over its lifetime.
+ *
+ * Energy: \n
+ * The length of time a particle will remain alive for.
+ *
+ * RotationSpeedPerParticle: \n
+ * The speed and direction a particle will spin.  Since particles are
+ * rendered as billboards, no axis of rotation can be specified per particle.
+ * Each particles rotates around their center points, around the z-axis in
+ * screen space.
+ *
+ * RotationSpeed:\n
+ * The speed a particle will spin around its RotationAxis in world space.
+ * (See RotationAxis under "Vector properties" below.)
+ *
+ *
+ * <h2>Vector properties:</h2>
+ * 
+ * Initial Position: \n
+ * The position of a new particle at the moment it is emitted, relative
+ * to the node its ParticleEmitter is set on.  This property is unique
+ * in that the initial positions of new particles can be restricted to
+ * fit within an ellipsoidal domain; see setEllipsoid().
+ *
+ * Initial Velocity: \n
+ * The velocity of a new particle at the moment it is emitted.  This
+ * property is measured in world coordinates per second and modifies
+ * a particle's current position each time ParticleEmitter::update()
+ * is called.
+ *
+ * Acceleration:\n
+ * The particle's change in velocity, measured in world coordinates per second.
+ * This property modifies a particle's current position each time 
+ * ParticleEmitter::update() is called.
+ *
+ * Color: \n
+ * The color of a particle at the end of its lifetime.  A particle's color
+ * will interpolate linearly between its begin-color and end-color over its lifetime.
+ *
+ * RotationAxis: \n
+ * An axis in world space around which all particles will spin, allowing for tornado and
+ * spiral effects.
+ *
+ * The vector properties Initial Position, Initial Velocity and Acceleration can be set to
+ * orbit around the origin of a node a ParticleEmitter is set on by that node's rotation matrix.
+ * This allows the rotation of a node, and not just its position, to affect these properties of
+ * newly emitted particles.  An example of where this would be useful would be a water-fountain
+ * emitter attached to the nozzle of a hose.  The initial position and initial velocity would be
+ * set to orbit around the node's origin so that the water would always spray out in the direction
+ * the nozzle was facing.  However, acceleration would not be set to orbit the node's origin in
+ * order for gravity to continue to act in the same direction on water particles, no matter
+ * what direction they were originally aimed.
+ * 
+ * <h2>Rendering properties:</h2>
+ *
+ * Particles are rendered as screen-facing billboards -- that is, the ParticleEmitter's texture
+ * is used to render particles as images that always face the camera.  For the simplest case,
+ * where the entire texture is used for every particle, the default texture settings can be used.
+ * However, a ParticleEmitter can also be configured to select one of several frames at random
+ * for each particle, or to render each particle as a sprite that animates through the frames
+ * over the course of its lifetime.
+ *
+ * Frame Count: \n
+ * The number of individual images / frames contained in the texture.
+ *
+ * Texture Coordinates: \n
+ * The coordinates within the texture used to render a specific frame.
+ * Using a texture that places the frames together, without padding,
+ * in left-to-right top-to-bottom order is recommended, as there is a utility
+ * method for generating the texture coordinates for such a texture atlas /
+ * sprite-map.  See setSpriteFrameCoords().
+ *
+ * Sprite Animating: \n
+ * Set this to enable sprite animation.
+ *
+ * Sprite Looped: \n
+ * If sprites are set to loop, each frame will last for the emitter's frameDuration.
+ * If sprites are set not to loop, the animation will be timed so that the last frame
+ * finishes just as a particle dies.  This setting has no effect if the sprite is not
+ * animating.
+ *
+ * Sprite Random Offset: \n
+ * New particles are created with one of the sprite frames in the emitter's texture.
+ * If a maximum offset is set, a random frame from 0 to maxOffset will be selected.
+ * If sprite animation is disabled and this offset is set to Frame Count, each
+ * particle will use one of the sprite frames for its entire lifetime.
+ *
+ * Blend Mode: \n
+ * Sets the blend mode used by this particle emitter.  The given blend factors will
+ * be set before rendering the particle system and then will be reset to their original
+ * values.  Accepts the same symbolic constants as glBlendFunc().
+ *
+ * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-Particles
+ */
+class ParticleEmitter : public Ref
+{
+    friend class Node;
+
+public:
+
+    /**
+     * Defines the types of texture blending 
+     */
+    enum TextureBlending
+    {
+        BLEND_OPAQUE,
+        BLEND_TRANSPARENT,
+        BLEND_ADDITIVE,
+        BLEND_MULTIPLIED
+    };
+
+    /**
+     * Creates a particle emitter using the data from the Properties object defined at the specified URL, 
+     * where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>"
+     * (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). 
+     * 
+     * @param url The URL pointing to the Properties object defining the particle emitter.
+     * 
+     * @return An initialized ParticleEmitter.
+     * @script{create}
+     */
+    static ParticleEmitter* create(const char* url);
+
+    /**
+     * Creates a particle emitter from the specified properties object.
+     * 
+     * @param properties The properties object defining the 
+     *      particle emitter (must have namespace equal to 'particle').
+     * @return The newly created particle emitter, or <code>NULL</code> if the particle emitter failed to load.
+     * @script{create}
+     */
+    static ParticleEmitter* create(Properties* properties);
+
+    /**
+     * Creates an uninitialized ParticleEmitter.
+     *
+     * @param texturePath A path to the image to use as this ParticleEmitter's texture.
+     * @param textureBlending The type of texture blending to be used for the particles emitted.
+     * @param particleCountMax The maximum number of particles that can be alive at one time in this ParticleEmitter's system.
+     * @script{create}
+     */
+    static ParticleEmitter* create(const char* texturePath, TextureBlending textureBlending,  unsigned int particleCountMax);
+
+    /**
+     * Sets a new texture for this particle emitter.
+     *
+     * The current texture's reference count is decreased.
+     *
+     * @param texturePath Path to the new texture to set.
+     * @param textureBlending Blending mode for the new texture.
+     */
+    void setTexture(const char* texturePath, TextureBlending textureBlending);
+
+    /**
+     * Sets a new texture for this particle emitter.
+     *
+     * The reference count of the specified texture is increased, and the 
+     * current texture's reference count is decreased.
+     *
+     * @param texture The new texture to set.
+     * @param textureBlending Blending mode for the new texture.
+     */
+    void setTexture(Texture* texture, TextureBlending textureBlending);
+
+    /**
+     * Returns the texture currently set for this particle emitter.
+     *
+     * @return The current texture.
+     */
+    Texture* getTexture() const;
+
+    /**
+     * Sets the maximum number of particles that can be emitted.
+     *
+     * @param max The maximum number of particles that can be emitted.
+     */
+    void setParticleCountMax(unsigned int max);
+
+    /**
+     * Returns the maximum number of particles that can be emitted.
+     *
+     * @return The maximum number of particles that can be emitted.
+     */
+    unsigned int getParticleCountMax() const;
+
+    /**
+     * Sets the emission rate, measured in particles per second.
+     *
+     * @param rate The emission rate, measured in particles per second.
+     */
+    void setEmissionRate(unsigned int rate);
+
+    /**
+     * Gets the emission rate, measured in particles per second.
+     *
+     * @return The emission rate, measured in particles per second.
+     */
+    unsigned int getEmissionRate() const;
+
+    /**
+     * Starts emitting particles over time at this ParticleEmitter's emission rate.
+     *
+     * @see ParticleEmitter::emit()
+     */
+    void start();
+
+    /**
+     * Stops emitting particles over time.
+     *
+     * @see ParticleEmitter::emit()
+     */
+    void stop();
+
+    /**
+     * Gets whether this ParticleEmitter is currently started.
+     *
+     * @return Whether this ParticleEmitter is currently started.
+     */
+    bool isStarted() const;
+
+    /**
+     * Gets whether this ParticleEmitter is currently active (i.e. if any of its particles are alive).
+     * 
+     * @return Whether this ParticleEmitter is currently active.
+     */
+    bool isActive() const;
+
+    /**
+     * Generates an arbitrary number of particles all at once.  Each newly emitted
+     * particle has its properties assigned within the ranges defined by its ParticleEmitter.
+     *
+     * Note that the maximum number of particles that can be alive at once in a particle
+     * system is defined when a ParticleEmitter is created and cannot be changed.  A call
+     * to emit() cannot cause the particle system to exceed this maximum, so fewer or zero
+     * particles will be emitted if the maximum is or has been reached.
+     *
+     * @param particleCount The number of particles to emit immediately.
+     */
+    void emitOnce(unsigned int particleCount);
+
+    /**
+     * Gets the current number of particles.
+     *
+     * @return The number of particles that are currently alive.
+     */
+    unsigned int getParticlesCount() const;
+
+    /**
+     * Sets whether the positions of newly emitted particles are generated within an ellipsoidal domain.
+     *
+     * Each vector property is generated such as to fall within the domain defined by a base vector and a
+     * variance vector. If that domain is ellipsoidal, vectors are generated within an ellipsoid centered 
+     * at the base vector and scaled by the variance vector. If that domain is not ellipsoidal, vectors are 
+     * generated by multiplying the variance vector by a random floating-point number between -1 and 1, 
+     * then adding this result to the base vector.
+     *
+     * Ellipsoidal domains are somewhat less efficient and only necessary when determining the positions of
+     * newly emitted particles.  Call this method with 'true' to make initial position an ellipsoidal domain.
+     * The default setting is 'false'.
+     *
+     * @param ellipsoid Whether initial particle positions are generated within an ellipsoidal domain.
+     */
+    void setEllipsoid(bool ellipsoid);
+
+    /**
+     * Determines whether the positions of newly emitted particles are generated within an ellipsoidal domain.
+     *
+     * @return true if is ellipsoid, false if not.
+     */
+    bool isEllipsoid() const;
+
+    /**
+     * Sets the minimum and maximum size that each particle can be at the time when it is spawned,
+     * as well as the minimum and maximum size for particles to be at the end of their lifetimes.
+     *
+     * @param startMin The minimum size that each particle can be at the time when it is started.
+     * @param startMax The maximum size that each particle can be at the time when it is started.
+     * @param endMin The minimum size that each particle can be at the end of its lifetime.
+     * @param endMax The maximum size that each particle can be at the end of its lifetime.
+     */
+    void setSize(float startMin, float startMax, float endMin, float endMax);
+
+    /**
+     * Gets the minimum size that each particle can be at the time when it is started.
+     *
+     * @return The minimum size that each particle can be at the time when it is started.
+     */
+    float getSizeStartMin() const;
+
+    /**
+     * Gets the maximum size that each particle can be at the time when it is started.
+     *
+     * @return The maximum size that each particle can be at the time when it is started.
+     */
+    float getSizeStartMax() const;
+
+    /**
+     * Gets the minimum size that each particle can be at the end of its lifetime.
+     *
+     * @return The minimum size that each particle can be at the end of its lifetime.
+     */
+    float getSizeEndMin() const;
+
+    /**
+     * Gets the maximum size that each particle can be at the end of its lifetime.
+     *
+     * @return The maximum size that each particle can be at the end of its lifetime.
+     */
+    float getSizeEndMax() const;
+
+    /**
+     * Set the start and end colors, and their variances, of particles in this emitter's system.
+     *
+     * @param start The base start color of emitted particles.
+     * @param startVariance The variance of start color of emitted particles.
+     * @param end The base end color of emitted particles.
+     * @param endVariance The variance of end color of emitted particles.
+     */
+    void setColor(const Vector4& start, const Vector4& startVariance, const Vector4& end, const Vector4& endVariance);
+    
+    /**
+     * Gets the base start color of emitted particles.
+     *
+     * @return The base start color of emitted particles.
+     */
+    const Vector4& getColorStart() const;
+
+    /**
+     * Gets the variance of start color of emitted particles.
+     *
+     * @return The variance of start color of emitted particles.
+     */
+    const Vector4& getColorStartVariance() const;
+
+    /**
+     * Gets the base end color of emitted particles.
+     *
+     * @return The base end color of emitted particles.
+     */
+    const Vector4& getColorEnd() const;
+
+    /**
+     * Gets the variance of end color of emitted particles.
+     *
+     * @return The variance of end color of emitted particles.
+     */
+    const Vector4& getColorEndVariance() const;
+
+    /**
+     * Sets the minimum and maximum lifetime of emitted particles, measured in milliseconds.
+     *
+     * @param energyMin The minimum lifetime of each particle, measured in milliseconds.
+     * @param energyMax The maximum lifetime of each particle, measured in milliseconds.
+     */
+    void setEnergy(long energyMin, long energyMax);
+
+    /**
+     * Gets the minimum lifetime of each particle, measured in milliseconds.
+     *
+     * @return The minimum lifetime of each particle, measured in milliseconds.
+     */
+    long getEnergyMin() const;
+
+    /**
+     * Gets the maximum lifetime of each particle, measured in milliseconds.
+     *
+     * @return The maximum lifetime of each particle, measured in milliseconds.
+     */
+    long getEnergyMax() const;
+
+    /**
+     * Sets the initial position and position variance of new particles.
+     *
+     * @param position The initial position of new particles.
+     * @param positionVariance The amount of variance allowed in the initial position of new particles.
+     */
+    void setPosition(const Vector3& position, const Vector3& positionVariance);
+
+    /**
+     * Gets the position of new particles, relative to the emitter's transform.
+     *
+     * @return The position of new particles, relative to the emitter's transform.
+     */
+    const Vector3& getPosition() const;
+
+    /**
+     * Gets the position variance of new particles.
+     *
+     * @return The position variance of new particles.
+     */
+    const Vector3& getPositionVariance() const;
+
+    /**
+     * Sets the base velocity of new particles and its variance.
+     *
+     * @param velocity The initial velocity of new particles.
+     * @param velocityVariance The amount of variance allowed in the initial velocity of new particles.
+     */
+    void setVelocity(const Vector3& velocity, const Vector3& velocityVariance);
+
+    /**
+     * Gets the initial velocity of new particles.
+     *
+     * @return The initial velocity of new particles.
+     */
+    const Vector3& getVelocity() const;
+
+    /**
+     * Gets the initial velocity variance of new particles.
+     *
+     * @return The initial velocity variance of new particles.
+     */
+    const Vector3& getVelocityVariance() const;
+
+    /**
+     * Gets the base acceleration vector of particles.
+     * 
+     * @return The base acceleration vector of particles.
+     */
+    const Vector3& getAcceleration() const;
+
+    /**
+     * Sets the base acceleration vector and its allowed variance for this ParticleEmitter.
+     *
+     * @param acceleration The base acceleration vector of emitted particles.
+     * @param accelerationVariance The variance allowed in the acceleration of emitted particles.
+     */
+    void setAcceleration(const Vector3& acceleration, const Vector3& accelerationVariance);
+
+    /**
+     * Gets the variance of acceleration of particles.
+     * 
+     * @return The variance of acceleration of particles.
+     */
+    const Vector3& getAccelerationVariance() const;
+
+    /**
+     * Gets the maximum rotation speed of each emitted particle.
+     * This determines the speed of rotation of each particle's screen-facing billboard.
+     *
+     * @param speedMin The minimum rotation speed (per particle).
+     * @param speedMax The maximum rotation speed (per particle).
+     */
+    void setRotationPerParticle(float speedMin, float speedMax);
+
+    /**
+     * Gets the minimum rotation speed of each emitted particle.
+     *
+     * @return The minimum rotation speed of each emitted particle.
+     */
+    float getRotationPerParticleSpeedMin() const;
+
+    /**
+     * Gets the maximum rotation speed of each emitted particle.
+     *
+     * @return The maximum rotation speed of each emitted particle.
+     */
+    float getRotationPerParticleSpeedMax() const;
+
+    /**
+     * Sets a rotation axis in world space around which all particles will spin,
+     * as well as the minimum and maximum rotation speed around this axis.
+     * This should not be confused with rotation speed per particle.
+     *
+     * @param axis The base rotation axis of emitted particles.
+     * @param axisVariance The variance of the rotation axis of emitted particles.
+     * @param speedMin The minimum rotation speed of emitted particles.
+     * @param speedMax The maximum rotation speed of emitted particles.
+     */
+   void setRotation(float speedMin, float speedMax, const Vector3& axis, const Vector3& axisVariance);
+
+    /**
+     * Gets the minimum rotation speed of emitted particles.
+     *
+     * @return The minimum rotation speed of emitted particles.
+     */
+    float getRotationSpeedMin() const;
+
+    /**
+     * Gets the maximum rotation speed of emitted particles.
+     *
+     * @return The maximum rotation speed of emitted particles.
+     */
+    float getRotationSpeedMax() const;
+
+    /**
+     * Gets the base rotation axis of emitted particles.
+     *
+     * @return The base rotation axis of emitted particles.
+     */
+    const Vector3& getRotationAxis() const;
+
+    /**
+     * Gets the variance of the rotation axis of emitted particles.
+     *
+     * @return The variance of the rotation axis of emitted particles.
+     */
+    const Vector3& getRotationAxisVariance() const;
+
+    /**
+     * Sets whether particles cycle through the sprite frames.
+     *
+     * @param animated Whether to animate particles through the sprite frames.
+     */
+    void setSpriteAnimated(bool animated);
+
+    /**
+     * Whether particles cycle through the sprite frames.
+     */
+    bool isSpriteAnimated() const;
+
+    /**
+     * If sprites are set to loop, each frame will last for the emitter's frameDuration.
+     * If sprites are set not to loop, the animation will be timed so that the last frame
+     * finishes just as a particle dies.
+     * Note: This timing is calculated based on a spriteRandomOffset of 0.
+     * For other offsets, the final frame may be reached earlier.
+     * If sprites are not set to animate, this setting has no effect.
+     *
+     * @param looped Whether to loop animated sprites.
+     * @see ParticleEmitter::setSpriteFrameDuration
+     */
+    void setSpriteLooped(bool looped);
+
+    /**
+     * Whether sprites are set to loop, each frame will last for the emitter's frameDuration.
+     *
+     * @return true if looped, false if not.
+     */
+    bool isSpriteLooped() const;
+
+    /**
+     * Sets the maximum offset that a random frame from 0 to maxOffset will be selected.
+     * Set maxOffset to 0 (the default) for all particles to start on the first frame.
+     * maxOffset will be clamped to frameCount.
+     *
+     * @param maxOffset The maximum sprite frame offset.
+     */
+    void setSpriteFrameRandomOffset(int maxOffset);
+    
+    /**
+     * Gets the maximum offset that a random frame from 0 to maxOffset will be selected.
+     */
+    int getSpriteFrameRandomOffset() const;
+
+    /**
+     * Set the animated sprites frame duration.
+     *
+     * @param duration The duration of a single sprite frame, in milliseconds.
+     */
+    void setSpriteFrameDuration(long duration);
+
+    /**
+     * Gets the animated sprites frame duration.
+     *
+     * @return The animated sprites frame duration.
+     */
+    long getSpriteFrameDuration() const;
+
+    /**
+     * Returns the width of the first frame this particle emitter's sprite.
+     *
+     * @return The width of the first frame of the sprite.
+     */
+    unsigned int getSpriteWidth() const;
+
+    /**
+     * Returns the height of the first frame this particle emitter's sprite.
+     *
+     * @return The height of the first frame of the sprite.
+     */
+    unsigned int getSpriteHeight() const;
+
+    /**
+     * Sets the sprite's texture coordinates in texture space.
+     *
+     * @param frameCount The number of frames to set texture coordinates for.
+     * @param texCoords The texture coordinates for all frames, in texture space.
+     */
+    void setSpriteTexCoords(unsigned int frameCount, float* texCoords);
+
+    /**
+     * Sets the sprite's texture coordinates in image space (pixels).
+     *
+     * @param frameCount The number of frames to set texture coordinates for.
+     * @param frameCoords A rectangle for each frame representing its position and size
+     *  within the texture image, measured in pixels.
+     */
+    void setSpriteFrameCoords(unsigned int frameCount, Rectangle* frameCoords);
+
+    /**
+     * Calculates and sets the sprite's texture coordinates based on the width and
+     * height of a single frame, measured in pixels.  This method assumes that there
+     * is no padding between sprite frames and that the first frame is in the top-left
+     * corner of the image.  Frames are ordered in the image from left to right, top to
+     * bottom.
+     *
+     * @param frameCount The number of frames to set texture coordinates for.
+     * @param width The width of a single frame, in pixels.
+     * @param height The height of a single frame, in pixels.
+     */
+    void setSpriteFrameCoords(unsigned int frameCount, int width, int height);
+
+    /**
+     * Returns the current number of frames for the particle emitter's sprite.
+     *
+     * @return The current frame count.
+     */
+    unsigned int getSpriteFrameCount() const;
+
+    /**
+     * Gets the node that this emitter is attached to.
+     *
+     * @return The node that this emitter is attached to.
+     */
+    Node* getNode() const;
+
+    /**
+     * Sets whether the vector properties of newly emitted particles are rotated around the node's position
+     * by the node's rotation matrix.
+     *
+     * @param orbitPosition Whether to rotate initial particle positions by the node's rotation matrix.
+     * @param orbitVelocity Whether to rotate initial particle velocity vectors by the node's rotation matrix.
+     * @param orbitAcceleration Whether to rotate initial particle acceleration vectors by the node's rotation matrix.
+     */
+    void setOrbit(bool orbitPosition, bool orbitVelocity, bool orbitAcceleration);
+
+    /**
+     * Whether new particle positions are rotated by the node's rotation matrix.
+     *
+     * @return True if orbiting positions, false otherwise.
+     */
+    bool getOrbitPosition() const;
+
+    /**
+     * Whether new particle velocities are rotated by the node's rotation matrix.
+     *
+     * @return True if orbiting velocities, false otherwise.
+     */
+    bool getOrbitVelocity() const;
+
+    /**
+     * Whether new particle accelerations are rotated by the node's rotation matrix.
+     *
+     * @return True if orbiting accelerations, false otherwise.
+     */
+    bool getOrbitAcceleration() const;
+
+    /**
+     * Updates the particles currently being emitted.
+     *
+     * @param elapsedTime The amount of time that has passed since the last call to update(), in milliseconds.
+     */
+    void update(float elapsedTime);
+
+    /**
+     * Draws the particles currently being emitted.
+     */
+    unsigned int draw();
+
+    /**
+     * Gets a TextureBlending enum from a corresponding string.
+     */
+    static TextureBlending getTextureBlendingFromString(const char* src);
+
+    /**
+     * Sets the texture blend mode for this particle emitter.
+     *
+     * @param blending The new blend mode.
+     */
+    void setTextureBlending(TextureBlending blending);
+
+    /**
+     * Gets the current texture blend mode for this particle emitter.
+     *
+     * @return The current blend mode.
+     */
+    TextureBlending getTextureBlending() const;
+
+    /**
+     * Clones the particle emitter and returns a new emitter.
+     * 
+     * @return The new cloned particle emitter.
+     */
+    ParticleEmitter* clone();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    ParticleEmitter(unsigned int particlesCount);
+
+    /**
+     * Destructor.
+     */
+    ~ParticleEmitter();
+
+    /**
+     * Creates an uninitialized ParticleEmitter.
+     *
+     * @param texture the texture to use.
+     * @param textureBlending The type of texture blending to be used for the particles emitted.
+     * @param particleCountMax The maximum number of particles that can be alive at one time in this ParticleEmitter's system.
+     * @script{create}
+     */
+    static ParticleEmitter* create(Texture* texture, TextureBlending textureBlending,  unsigned int particleCountMax);
+
+    /**
+     * Hidden copy assignment operator.
+     */
+    ParticleEmitter& operator=(const ParticleEmitter&);
+
+    /**
+     * Sets the node that this emitter is attached to.
+     */
+    void setNode(Node* node);
+
+    // Generates a scalar within the range defined by min and max.
+    float generateScalar(float min, float max);
+
+    long generateScalar(long min, long max);
+
+    // Generates a vector within the domain defined by a base vector and its variance.
+    void generateVectorInRect(const Vector3& base, const Vector3& variance, Vector3* dst);
+
+    // Generates a vector within the ellipsoidal domain defined by a center point and scale vector.
+    void generateVectorInEllipsoid(const Vector3& center, const Vector3& scale, Vector3* dst);
+
+    void generateVector(const Vector3& base, const Vector3& variance, Vector3* dst, bool ellipsoid);
+
+    // Generates a color within the domain defined by a base vector and its variance.
+    void generateColor(const Vector4& base, const Vector4& variance, Vector4* dst);
+
+    /**
+     * Defines the data for a single particle in the system.
+     */
+    class Particle
+    {
+
+    public:
+        Vector3 _position;
+        Vector3 _velocity;
+        Vector3 _acceleration;
+        Vector4 _colorStart;
+        Vector4 _colorEnd;
+        Vector4 _color;
+        float _rotationPerParticleSpeed;
+        Vector3 _rotationAxis;
+        float _rotationSpeed;
+        float _angle;
+        long _energyStart;
+        long _energy;
+        float _sizeStart;
+        float _sizeEnd;
+        float _size;
+        unsigned int _frame;
+        float _timeOnCurrentFrame;
+    };
+
+    unsigned int _particleCountMax;
+    unsigned int _particleCount;
+    Particle* _particles;
+    unsigned int _emissionRate;
+    bool _started;
+    bool _ellipsoid;
+    float _sizeStartMin;
+    float _sizeStartMax;
+    float _sizeEndMin;
+    float _sizeEndMax;
+    float _energyMin;
+    float _energyMax;
+    Vector4 _colorStart;
+    Vector4 _colorStartVar;
+    Vector4 _colorEnd;
+    Vector4 _colorEndVar;
+    Vector3 _position;
+    Vector3 _positionVar;
+    Vector3 _velocity;
+    Vector3 _velocityVar;
+    Vector3 _acceleration;
+    Vector3 _accelerationVar;
+    float _rotationPerParticleSpeedMin;
+    float _rotationPerParticleSpeedMax;
+    float _rotationSpeedMin;
+    float _rotationSpeedMax;
+    Vector3 _rotationAxis;
+    Vector3 _rotationAxisVar;
+    Matrix _rotation;
+    SpriteBatch* _spriteBatch;
+    TextureBlending _spriteTextureBlending;
+    float _spriteTextureWidth;
+    float _spriteTextureHeight;
+    float _spriteTextureWidthRatio;
+    float _spriteTextureHeightRatio;
+    float* _spriteTextureCoords;
+    bool _spriteAnimated;
+    bool _spriteLooped;
+    unsigned int _spriteFrameCount;
+    unsigned int _spriteFrameRandomOffset;
+    long _spriteFrameDuration;
+    float _spriteFrameDurationSecs;
+    float _spritePercentPerFrame;
+    Node* _node;
+    bool _orbitPosition;
+    bool _orbitVelocity;
+    bool _orbitAcceleration;
+    float _timePerEmission;
+    float _emitTime;
+    double _lastUpdated;
+};
+
+}
+
+#endif

+ 183 - 183
gameplay/src/RadioButton.h

@@ -1,183 +1,183 @@
-#ifndef RADIOBUTTON_H_
-#define RADIOBUTTON_H_
-
-#include "Button.h"
-#include "Theme.h"
-#include "Properties.h"
-
-namespace gameplay
-{
-
-/**
- * Defines a radio button control.
- *
- * Radio buttons can be toggled between two states.
- * A radio button can belong to a group, and only one radio button
- * from a group can be selected at one time.
- *
- * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
- */
-class RadioButton : public Button
-{
-    friend class Container;
-    friend class ControlFactory;
-
-public:
-
-    /**
-     * Creates a new RadioButton.
-     *
-     * @param id The radio button ID.
-     * @param id The radio button style (optional).
-     *
-     * @return The new radio button.
-     * @script{create}
-     */
-    static RadioButton* create(const char* id, Theme::Style* style = NULL);
-
-    /**
-     * Get whether this radio button is currently selected.
-     *
-     * @return Whether this radio button is currently selected.
-     */
-    bool isSelected() const;
-
-    /**
-     * Sets whether this radio button is currently selected.
-     */
-    void setSelected(bool selected);
-
-    /**
-     * Set the size to draw the radio button icon.
-     *
-     * @param width The width to draw the radio button icon.
-     * @param height The height to draw the radio button icon.
-     */
-    void setImageSize(float width, float height);
-
-    /**
-     * Get the size at which the radio button icon will be drawn.
-     *
-     * @return The size of the radio button icon.
-     */
-    const Vector2& getImageSize() const;
-
-    /**
-     * @see Control::getType
-     */
-    const char* getType() const;
-
-    /**
-     * Add a listener to be notified of specific events affecting
-     * this control.  Event types can be OR'ed together.
-     * E.g. To listen to touch-press and touch-release events,
-     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
-     * as the second parameter.
-     *
-     * @param listener The listener to add.
-     * @param eventFlags The events to listen for.
-     */
-    virtual void addListener(Control::Listener* listener, int eventFlags);
-
-    /**
-     *
-     * @param groupId
-     */
-    void setGroupId(const char* groupId);
-
-    /**
-     * Gets the RadioButton's group ID.
-     *
-     * @return the RadioButton's group ID.
-     */
-    const char* getGroupId() const;
-
-protected:
-
-    /**
-     * Constructor.
-     */
-    RadioButton();
-
-    /**
-     * Destructor.
-     */
-    virtual ~RadioButton();
-
-    /**
-     * Create a radio button with a given style and properties.
-     *
-     * @param style The style to apply to this radio button.
-     * @param properties A properties object containing a definition of the radio button (optional).
-     *
-     * @return The new radio button.
-     */
-    static Control* create(Theme::Style* style, Properties* properties = NULL);
-
-    /**
-     * @see Control::initialize
-     */
-    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
-
-    /**
-     * Keyboard callback on key events.
-     *
-     * @see Keyboard::KeyEvent
-     * @see Keyboard::Key
-     */
-    bool keyEvent(Keyboard::KeyEvent evt, int key);
-
-    /**
-     * @see Control#controlEvent
-     */
-    void controlEvent(Control::Listener::EventType evt);
-
-    /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This control's parent container.
-     * @param offset Positioning offset to add to the control's position.
-     */
-    void update(const Control* container, const Vector2& offset);
-
-    /**
-     * @see Control::drawImages
-     */
-    unsigned int drawImages(Form* form, const Rectangle& clip);
-
-    /**
-     * Clear the _selected flag of all radio buttons in the given group.
-     *
-     * @param groupId The group to clear.
-     */
-    static void clearSelected(const std::string& groupId);
-
-    /**
-     * The RadioButton's group ID.
-     */
-    std::string _groupId;
-    
-    /**
-     * Whether the RadioButton is currently selected.
-     */
-    bool _selected;
-    
-    /**
-     * The size at which the RadioButton's icon will be drawn.
-     */
-    Vector2 _imageSize;
-
-    /**
-     * The ThemeImage to use for the RadioButton.
-     */ 
-    Theme::ThemeImage* _image;
-
-private:
-
-    RadioButton(const RadioButton& copy);
-};
-
-}
-
-#endif
+#ifndef RADIOBUTTON_H_
+#define RADIOBUTTON_H_
+
+#include "Button.h"
+#include "Theme.h"
+#include "Properties.h"
+
+namespace gameplay
+{
+
+/**
+ * Defines a radio button control.
+ *
+ * Radio buttons can be toggled between two states.
+ * A radio button can belong to a group, and only one radio button
+ * from a group can be selected at one time.
+ *
+ * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
+ */
+class RadioButton : public Button
+{
+    friend class Container;
+    friend class ControlFactory;
+
+public:
+
+    /**
+     * Creates a new RadioButton.
+     *
+     * @param id The radio button ID.
+     * @param style The radio button style (optional).
+     *
+     * @return The new radio button.
+     * @script{create}
+     */
+    static RadioButton* create(const char* id, Theme::Style* style = NULL);
+
+    /**
+     * Get whether this radio button is currently selected.
+     *
+     * @return Whether this radio button is currently selected.
+     */
+    bool isSelected() const;
+
+    /**
+     * Sets whether this radio button is currently selected.
+     */
+    void setSelected(bool selected);
+
+    /**
+     * Set the size to draw the radio button icon.
+     *
+     * @param width The width to draw the radio button icon.
+     * @param height The height to draw the radio button icon.
+     */
+    void setImageSize(float width, float height);
+
+    /**
+     * Get the size at which the radio button icon will be drawn.
+     *
+     * @return The size of the radio button icon.
+     */
+    const Vector2& getImageSize() const;
+
+    /**
+     * @see Control::getType
+     */
+    const char* getType() const;
+
+    /**
+     * Add a listener to be notified of specific events affecting
+     * this control.  Event types can be OR'ed together.
+     * E.g. To listen to touch-press and touch-release events,
+     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
+     * as the second parameter.
+     *
+     * @param listener The listener to add.
+     * @param eventFlags The events to listen for.
+     */
+    virtual void addListener(Control::Listener* listener, int eventFlags);
+
+    /**
+     *
+     * @param groupId
+     */
+    void setGroupId(const char* groupId);
+
+    /**
+     * Gets the RadioButton's group ID.
+     *
+     * @return the RadioButton's group ID.
+     */
+    const char* getGroupId() const;
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    RadioButton();
+
+    /**
+     * Destructor.
+     */
+    virtual ~RadioButton();
+
+    /**
+     * Create a radio button with a given style and properties.
+     *
+     * @param style The style to apply to this radio button.
+     * @param properties A properties object containing a definition of the radio button (optional).
+     *
+     * @return The new radio button.
+     */
+    static Control* create(Theme::Style* style, Properties* properties = NULL);
+
+    /**
+     * @see Control::initialize
+     */
+    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
+
+    /**
+     * Keyboard callback on key events.
+     *
+     * @see Keyboard::KeyEvent
+     * @see Keyboard::Key
+     */
+    bool keyEvent(Keyboard::KeyEvent evt, int key);
+
+    /**
+     * @see Control#controlEvent
+     */
+    void controlEvent(Control::Listener::EventType evt);
+
+    /**
+     * Called when a control's properties change.  Updates this control's internal rendering
+     * properties, such as its text viewport.
+     *
+     * @param container This control's parent container.
+     * @param offset Positioning offset to add to the control's position.
+     */
+    void update(const Control* container, const Vector2& offset);
+
+    /**
+     * @see Control::drawImages
+     */
+    unsigned int drawImages(Form* form, const Rectangle& clip);
+
+    /**
+     * Clear the _selected flag of all radio buttons in the given group.
+     *
+     * @param groupId The group to clear.
+     */
+    static void clearSelected(const std::string& groupId);
+
+    /**
+     * The RadioButton's group ID.
+     */
+    std::string _groupId;
+    
+    /**
+     * Whether the RadioButton is currently selected.
+     */
+    bool _selected;
+    
+    /**
+     * The size at which the RadioButton's icon will be drawn.
+     */
+    Vector2 _imageSize;
+
+    /**
+     * The ThemeImage to use for the RadioButton.
+     */ 
+    Theme::ThemeImage* _image;
+
+private:
+
+    RadioButton(const RadioButton& copy);
+};
+
+}
+
+#endif

+ 323 - 324
gameplay/src/Slider.h

@@ -1,324 +1,323 @@
-#ifndef SLIDER_H_
-#define SLIDER_H_
-
-#include "Base.h"
-#include "Theme.h"
-#include "Properties.h"
-#include "Button.h"
-#include "Touch.h"
-
-namespace gameplay
-{
-
-/**
- * Defines a slider control.
- *
- * A slider consists of a marker (grabber) that can slide along a track between two end-caps.
- * 
- * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
- */
-class Slider : public Label
-{
-    friend class Container;
-    friend class ControlFactory;
-
-public:
-
-    /**
-     * Creates a new Slider.
-     *
-     * @param id The slider ID.
-     * @param style The slider style (optional).
-     *
-     * @return The new slider.
-     * @script{create}
-     */
-    static Slider* create(const char* id, Theme::Style* style = NULL);
-
-    /**
-     * Set the minimum value that can be set on this slider.
-     *
-     * @param min The new minimum.
-     */
-    void setMin(float min);
-
-    /**
-     * Get the minimum value that can be set on this slider.
-     *
-     * @return The minimum value that can be set on this slider.
-     */
-    float getMin() const;
-
-    /**
-     * Set the maximum value that can be set on this slider.
-     *
-     * @param max The new maximum.
-     */
-    void setMax(float max);
-
-    /**
-     * Get the maximum value that can be set on this slider.
-     *
-     * @return The maximum value that can be set on this slider.
-     */
-    float getMax() const;
-
-    /**
-     * Set this slider's step size.  If this is greater than zero, the marker
-     * will snap to discrete multiples of the step size.
-     *
-     * @param step The new step size.
-     */
-    void setStep(float step);
-
-    /**
-     * Get this slider's step size.
-     *
-     * @return This slider's step size.
-     */
-    float getStep() const;
-
-    /**
-     * Set this slider's value.  The new value will be clamped to fit within
-     * the slider's minimum and maximum values.
-     *
-     * @param value The new value.
-     */
-    void setValue(float value);
-
-    /**
-     * Get this slider's current value.
-     *
-     * @return This slider's current value.
-     */
-    float getValue() const;
-
-    /**
-     * @see Control::getType
-     */
-    const char* getType() const;
-
-    /**
-     * Sets if the slider value text is rendered below the control.
-     * 
-     * @param visible If the slider value text is rendered below the control. 
-     */
-    void setValueTextVisible(bool visible);
-
-    /**
-     * Gets if the slider value text is rendered below the control.
-     *
-     * @return true if the slider value text is rendered below the control, false if otherwise.
-     */
-    bool isValueTextVisible() const;
-
-    /**
-     * Sets the slider value text alignment.
-     * 
-     * @param alignment the slider value text alignment. 
-     */
-    void setValueTextAlignment(Font::Justify alignment);
-
-    /**
-     * Gets the slider value text alignment.
-     *
-     * @return The slider value text alignment. 
-     */
-    Font::Justify getValueTextAlignment() const;
-
-    /**
-     * Sets the precision, which is the number floating point digits after the decimal.
-     *
-     * @param precision The number floating point precision/digits after the decimal.
-     */
-    void setValueTextPrecision(unsigned int precision);
-
-    /**
-     * Gets the precision, which is the number floating point digits after the decimal.
-     *
-     * @return The number floating point precision/digits after the decimal.
-     */
-    unsigned int getValueTextPrecision() const;
-
-    /**
-     * Add a listener to be notified of specific events affecting
-     * this control.  Event types can be OR'ed together.
-     * E.g. To listen to touch-press and touch-release events,
-     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
-     * as the second parameter.
-     *
-     * @param listener The listener to add.
-     * @param eventFlags The events to listen for.
-     */
-    void addListener(Control::Listener* listener, int eventFlags);
-
-protected:
-
-    /**
-     * Constructor.
-     */
-    Slider();
-
-    /**
-     * Destructor.
-     */
-    ~Slider();
-
-    /**
-     * Create a slider with a given style and properties.
-     *
-     * @param style The style to apply to this slider.
-     * @param properties A properties object containing a definition of the slider (optional).
-     *
-     * @return The new slider.
-     */
-    static Control* create(Theme::Style* style, Properties* properties = NULL);
-
-    /**
-     * @see Control::initialize
-     */
-    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
-
-    /**
-     * Touch callback on touch events.  Controls return true if they consume the touch event.
-     *
-     * @param evt The touch event that occurred.
-     * @param x The x position of the touch in pixels. Left edge is zero.
-     * @param y The y position of the touch in pixels. Top edge is zero.
-     * @param contactIndex The order of occurrence for multiple touch contacts starting at zero.
-     *
-     * @return Whether the touch event was consumed by the control.
-     *
-     * @see Touch::TouchEvent
-     */
-    bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
-
-    /**
-     * Mouse callback on mouse events.
-     *
-     * @param evt The mouse event that occurred.
-     * @param x The x position of the mouse in pixels. Left edge is zero.
-     * @param y The y position of the mouse in pixels. Top edge is zero.
-     * @param wheelDelta The number of mouse wheel ticks. Positive is up (forward), negative is down (backward).
-     *
-     * @return True if the mouse event is consumed or false if it is not consumed.
-     *
-     * @see Mouse::MouseEvent
-     */
-    bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
-
-    /**
-     * Gamepad callback on gamepad events.
-     *
-     * @see Control::gamepadEvent
-     */
-    bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
-
-    /**
-     * Keyboard callback on key events.
-     *
-     * @see Keyboard::KeyEvent
-     * @see Keyboard::Key
-     */
-    bool keyEvent(Keyboard::KeyEvent evt, int key);
-
-    /**
-     * @see Control::drawImages
-     */
-    unsigned int drawImages(Form* form, const Rectangle& clip);
-
-    /**
-     * @see Control::drawText
-     */
-    unsigned int drawText(Form* form, const Rectangle& clip);
-
-    /**
-     * Called when a slider's properties change. Updates this slider's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This slider's parent container.
-     * @param offset The scroll offset of this slider's parent container.
-     */
-    void update(const Control* container, const Vector2& offset);
-
-    /**
-     * The minimum value for the Slider.
-     */
-    float _min;
-    
-    /**
-     * The maximum value for the Slider
-     */
-    float _max;
-    
-    /**
-     * The Slider's step size.
-     */
-    float _step;
-    
-    /**
-     * The Slider's current value.
-     */
-    float _value;
-
-    /**
-     * When a gamepad is in use, this stores how much to move the slider's value.
-     */
-    float _delta;
-
-    /**
-     * The image for the minimum slider value.
-     */
-    Theme::ThemeImage* _minImage;
-    
-    /**
-     * The image for the maximum slider value.
-     */
-    Theme::ThemeImage* _maxImage;
-    
-    /**
-     * The image for the slider track.
-     */
-    Theme::ThemeImage* _trackImage;
-    
-    /**
-     * The image for the slider marker.
-     */
-    Theme::ThemeImage* _markerImage;
-
-    /**
-     * Whether to display this slider's value.
-     */
-    bool _valueTextVisible;
-
-    /**
-     * Alignment of value text.
-     */
-    Font::Justify _valueTextAlignment;
-
-    /**
-     * Number of digits after the decimal to draw for value text.
-     */
-    unsigned int _valueTextPrecision;
-
-    /**
-     * The text displayed by this slider if set to display its value.
-     */
-    std::string _valueText;
-
-    float _gamepadValue;
-
-private:
-
-    /**
-     * Constructor.
-     */
-    Slider(const Slider& copy);
-
-    void updateValue(int x, int y);
-
-};
-
-}
-
-#endif
+#ifndef SLIDER_H_
+#define SLIDER_H_
+
+#include "Base.h"
+#include "Theme.h"
+#include "Properties.h"
+#include "Button.h"
+#include "Touch.h"
+
+namespace gameplay
+{
+
+/**
+ * Defines a slider control.
+ *
+ * A slider consists of a marker (grabber) that can slide along a track between two end-caps.
+ * 
+ * @see http://blackberry.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
+ */
+class Slider : public Label
+{
+    friend class Container;
+    friend class ControlFactory;
+
+public:
+
+    /**
+     * Creates a new Slider.
+     *
+     * @param id The slider ID.
+     * @param style The slider style (optional).
+     *
+     * @return The new slider.
+     * @script{create}
+     */
+    static Slider* create(const char* id, Theme::Style* style = NULL);
+
+    /**
+     * Set the minimum value that can be set on this slider.
+     *
+     * @param min The new minimum.
+     */
+    void setMin(float min);
+
+    /**
+     * Get the minimum value that can be set on this slider.
+     *
+     * @return The minimum value that can be set on this slider.
+     */
+    float getMin() const;
+
+    /**
+     * Set the maximum value that can be set on this slider.
+     *
+     * @param max The new maximum.
+     */
+    void setMax(float max);
+
+    /**
+     * Get the maximum value that can be set on this slider.
+     *
+     * @return The maximum value that can be set on this slider.
+     */
+    float getMax() const;
+
+    /**
+     * Set this slider's step size.  If this is greater than zero, the marker
+     * will snap to discrete multiples of the step size.
+     *
+     * @param step The new step size.
+     */
+    void setStep(float step);
+
+    /**
+     * Get this slider's step size.
+     *
+     * @return This slider's step size.
+     */
+    float getStep() const;
+
+    /**
+     * Set this slider's value.  The new value will be clamped to fit within
+     * the slider's minimum and maximum values.
+     *
+     * @param value The new value.
+     */
+    void setValue(float value);
+
+    /**
+     * Get this slider's current value.
+     *
+     * @return This slider's current value.
+     */
+    float getValue() const;
+
+    /**
+     * @see Control::getType
+     */
+    const char* getType() const;
+
+    /**
+     * Sets if the slider value text is rendered below the control.
+     * 
+     * @param visible If the slider value text is rendered below the control. 
+     */
+    void setValueTextVisible(bool visible);
+
+    /**
+     * Gets if the slider value text is rendered below the control.
+     *
+     * @return true if the slider value text is rendered below the control, false if otherwise.
+     */
+    bool isValueTextVisible() const;
+
+    /**
+     * Sets the slider value text alignment.
+     * 
+     * @param alignment the slider value text alignment. 
+     */
+    void setValueTextAlignment(Font::Justify alignment);
+
+    /**
+     * Gets the slider value text alignment.
+     *
+     * @return The slider value text alignment. 
+     */
+    Font::Justify getValueTextAlignment() const;
+
+    /**
+     * Sets the precision, which is the number floating point digits after the decimal.
+     *
+     * @param precision The number floating point precision/digits after the decimal.
+     */
+    void setValueTextPrecision(unsigned int precision);
+
+    /**
+     * Gets the precision, which is the number floating point digits after the decimal.
+     *
+     * @return The number floating point precision/digits after the decimal.
+     */
+    unsigned int getValueTextPrecision() const;
+
+    /**
+     * Add a listener to be notified of specific events affecting
+     * this control.  Event types can be OR'ed together.
+     * E.g. To listen to touch-press and touch-release events,
+     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
+     * as the second parameter.
+     *
+     * @param listener The listener to add.
+     * @param eventFlags The events to listen for.
+     */
+    void addListener(Control::Listener* listener, int eventFlags);
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    Slider();
+
+    /**
+     * Destructor.
+     */
+    ~Slider();
+
+    /**
+     * Create a slider with a given style and properties.
+     *
+     * @param style The style to apply to this slider.
+     * @param properties A properties object containing a definition of the slider (optional).
+     *
+     * @return The new slider.
+     */
+    static Control* create(Theme::Style* style, Properties* properties = NULL);
+
+    /**
+     * @see Control::initialize
+     */
+    void initialize(const char* typeName, Theme::Style* style, Properties* properties);
+
+    /**
+     * Touch callback on touch events.  Controls return true if they consume the touch event.
+     *
+     * @param evt The touch event that occurred.
+     * @param x The x position of the touch in pixels. Left edge is zero.
+     * @param y The y position of the touch in pixels. Top edge is zero.
+     * @param contactIndex The order of occurrence for multiple touch contacts starting at zero.
+     *
+     * @return Whether the touch event was consumed by the control.
+     *
+     * @see Touch::TouchEvent
+     */
+    bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
+
+    /**
+     * Mouse callback on mouse events.
+     *
+     * @param evt The mouse event that occurred.
+     * @param x The x position of the mouse in pixels. Left edge is zero.
+     * @param y The y position of the mouse in pixels. Top edge is zero.
+     * @param wheelDelta The number of mouse wheel ticks. Positive is up (forward), negative is down (backward).
+     *
+     * @return True if the mouse event is consumed or false if it is not consumed.
+     *
+     * @see Mouse::MouseEvent
+     */
+    bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
+
+    /**
+     * Gamepad callback on gamepad events.
+     *
+     * @see Control::gamepadEvent
+     */
+    bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
+
+    /**
+     * Keyboard callback on key events.
+     *
+     * @see Keyboard::KeyEvent
+     * @see Keyboard::Key
+     */
+    bool keyEvent(Keyboard::KeyEvent evt, int key);
+
+    /**
+     * @see Control::drawImages
+     */
+    unsigned int drawImages(Form* form, const Rectangle& clip);
+
+    /**
+     * @see Control::drawText
+     */
+    unsigned int drawText(Form* form, const Rectangle& clip);
+
+    /**
+     * Called when a slider's properties change. Updates this slider's internal rendering
+     * properties, such as its text viewport.
+     *
+     * @param container This slider's parent container.
+     * @param offset The scroll offset of this slider's parent container.
+     */
+    void update(const Control* container, const Vector2& offset);
+
+    /**
+     * The minimum value for the Slider.
+     */
+    float _min;
+    
+    /**
+     * The maximum value for the Slider
+     */
+    float _max;
+    
+    /**
+     * The Slider's step size.
+     */
+    float _step;
+    
+    /**
+     * The Slider's current value.
+     */
+    float _value;
+
+    /**
+     * When a gamepad is in use, this stores how much to move the slider's value.
+     */
+    float _delta;
+
+    /**
+     * The image for the minimum slider value.
+     */
+    Theme::ThemeImage* _minImage;
+    
+    /**
+     * The image for the maximum slider value.
+     */
+    Theme::ThemeImage* _maxImage;
+    
+    /**
+     * The image for the slider track.
+     */
+    Theme::ThemeImage* _trackImage;
+    
+    /**
+     * The image for the slider marker.
+     */
+    Theme::ThemeImage* _markerImage;
+
+    /**
+     * Whether to display this slider's value.
+     */
+    bool _valueTextVisible;
+
+    /**
+     * Alignment of value text.
+     */
+    Font::Justify _valueTextAlignment;
+
+    /**
+     * Number of digits after the decimal to draw for value text.
+     */
+    unsigned int _valueTextPrecision;
+
+private:
+
+    /**
+     * Constructor.
+     */
+    Slider(const Slider& copy);
+
+    void updateValue(int x, int y);
+
+    /**
+     * The text displayed by this slider if set to display its value.
+     */
+    std::string _valueText;
+
+    float _gamepadValue;
+};
+
+}
+
+#endif