// EXTERNAL INCLUDES
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/math/rect.h>
namespace Dali
{
// The state information for grab handle events
enum GrabHandleState
{
- GRAB_HANDLE_MOVING,
+ GRAB_HANDLE_TAPPED,
+ GRAB_HANDLE_PRESSED,
GRAB_HANDLE_RELEASED
};
+// The set the selection-handle positions etc.
+enum SelectionHandle
+{
+ PRIMARY_SELECTION_HANDLE,
+ SECONDARY_SELECTION_HANDLE,
+ SELECTION_HANDLE_COUNT
+};
+
+enum SelectionHandleState
+{
+ SELECTION_HANDLE_PRESSED,
+ SELECTION_HANDLE_RELEASED
+};
+
/**
* @brief A Text Decorator is used to display cursors, handles, selection highlights and pop-ups.
*
*
* @param[in] state The grab handle state.
* @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
*/
- virtual void GrabHandleEvent( GrabHandleState state, float x ) = 0;
+ virtual void GrabHandleEvent( GrabHandleState state, float x, float y ) = 0;
};
/**
static DecoratorPtr New( Dali::Toolkit::Internal::Control& parent, Observer& observer );
/**
+ * @brief Set the bounding box which handles, popup and similar decorations will not exceed.
+ *
+ * The default value is the width and height of the stage from the top left origin.
+ * If a title bar for example is on the top of the screen then the y should be the title's height and
+ * the boundary height the stage height minus the title's height.
+ * Restrictions - The boundary box should be set up with a fixed z position for the text-input and the default camera.
+ *
+ * ------------------------------------------
+ * |(x,y) |
+ * |o---------------------------------------|
+ * || ||
+ * || Bounding Box || boundary height
+ * || ||
+ * |----------------------------------------|
+ * ------------------------------------------
+ * boundary width
+ *
+ * @param[in] boundingBox Vector( x coordinate, y coordinate, width, height )
+ */
+ void SetBoundingBox( const Rect<int>& boundingBox );
+
+ /**
+ * @brief Retrieve the bounding box origin and dimensions.
+ *
+ * default is set once control is added to stage, before this the return vector will be Vector4:ZERO
+ * @return Rect<int> the bounding box origin, width and height
+ */
+ const Rect<int>& GetBoundingBox() const;
+
+ /**
* @brief The decorator waits until a relayout before creating actors etc.
*
* @param[in] size The size of the parent control after size-negotiation.
*/
Dali::Image GetGrabHandleImage() const;
+ /**
+ * @brief Sets whether the selection handles and highlight are active.
+ *
+ * @param[in] active True if the selection handles and highlight are active.
+ */
+ void SetSelectionActive( bool active );
+
+ /**
+ * @brief Query whether the selection handles and highlight are active.
+ *
+ * @return True if the selection handles and highlight are active.
+ */
+ bool IsSelectionActive() const;
+
+ /**
+ * @brief Sets the position of a selection handle.
+ *
+ * @param[in] handle The handle to set.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
+ * @param[in] cursorHeight The logical cursor height at this position.
+ */
+ void SetPosition( SelectionHandle handle, float x, float y, float cursorHeight );
+
+ /**
+ * @brief Retrieves the position of a selection handle.
+ *
+ * @param[in] handle The handle to get.
+ * @param[out] x The x position relative to the top-left of the parent control.
+ * @param[out] y The y position relative to the top-left of the parent control.
+ * @param[out] cursorHeight The logical cursor height at this position.
+ */
+ void GetPosition( SelectionHandle handle, float& x, float& y, float& cursorHeight ) const;
+
+ /**
+ * @brief Sets the image for one of the selection handles.
+ *
+ * @param[in] handle The selection handle.
+ * @param[in] state A different image can be set for the pressed/released states.
+ * @param[in] image The image to use.
+ */
+ void SetImage( SelectionHandle handle, SelectionHandleState state, Dali::Image image );
+
+ /**
+ * @brief Retrieves the image for a selection handle.
+ *
+ * @param[in] handle The selection handle.
+ * @param[in] state A different image can be set for the pressed/released states.
+ * @return The image.
+ */
+ Dali::Image GetImage( SelectionHandle handle, SelectionHandleState state ) const;
+
protected:
/**