struct KeyEvent;
struct TouchEvent;
+struct HoverEvent;
struct MouseWheelEvent;
namespace Internal
class Actor;
class ActorGestureData;
class RenderTask;
-class ShaderEffect;
-typedef IntrusivePtr<ShaderEffect> ShaderEffectPtr;
struct DynamicsData;
typedef IntrusivePtr<Actor> ActorPtr;
void Add(Actor& child);
/**
+ * Inserts a child Actor to this Actor's child list
+ * @pre The child actor is not the same as the parent actor.
+ * @pre The child actor does not already have a parent.
+ * @param [in] index in childlist to insert child at
+ * @param [in] child The child.
+ * @post The child will be referenced by its parent.
+ */
+ void Insert(unsigned int index, Actor& child);
+
+ /**
* Removes a child Actor from this Actor.
* @param [in] child The child.
* @post The child will be unreferenced.
void SetDepth( float depth );
/**
- * Retrieve the Actor's size.
+ * Retrieve the Actor's size from event side.
+ * This size will be the size set or if animating then the target size.
+ * @return The Actor's size.
+ */
+ const Vector3& GetSize() const;
+
+ /**
+ * Retrieve the Actor's size from update side.
+ * This size will be the size set or animating but will be a frame behind.
* @return The Actor's size.
*/
const Vector3& GetCurrentSize() const;
/**
+ * Return the natural size of the actor
+ *
+ * @return The actor's natural size
+ */
+ virtual Vector3 GetNaturalSize() const;
+
+ /**
* Set the origin of an actor, within its parent's area.
* This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
* and (1.0, 1.0, 0.5) is the bottom-right corner.
float GetCurrentOpacity() const;
/**
- * Sets whether an actor should emit touch signals; see SignalTouch().
+ * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
* An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
- * the touch event signal will be emitted.
+ * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
+ * hover event signal will be emitted.
*
- * If the application wishes to temporarily disable the touch event signal emission, then they can do so by calling:
+ * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
* @code
* actor.SetSensitive(false);
* @endcode
*
- * Then, to re-enable the touch event signal emission, the application should call:
+ * Then, to re-enable the touch or hover event signal emission, the application should call:
* @code
* actor.SetSensitive(true);
* @endcode
*
- * @see SignalTouch().
- * @note If an actor's sensitivity is set to false, then it's children will not emit a touch event signal either.
- * @param[in] sensitive true to enable emission of the touch event signals, false otherwise.
+ * @see SignalTouch() and SignalHover().
+ * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
+ * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
*/
void SetSensitive(bool sensitive)
{
}
/**
- * Query whether an actor emits touch event signals.
+ * Query whether an actor emits touch or hover event signals.
* @see SetSensitive(bool)
- * @return true, if emission of touch event signals is enabled, false otherwise.
+ * @return true, if emission of touch or hover event signals is enabled, false otherwise.
*/
bool IsSensitive() const
{
return mSensitive;
}
- // Shader effects, these are virtual so that RenderableActor can override the behaviour.
- // Default actor behaviour is to do nothing, but the API is kept in Actor for convenience.
-
- /**
- * @todo remove when API is cleaned up
- * Sets the shader effect for the Actor.
- * Shader effects provide special effects like rippling and bending.
- * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
- * @param [in] effect The shader effect.
- */
- virtual void SetShaderEffect(ShaderEffect& effect);
-
- /**
- * @todo remove when API is cleaned up
- * Retrieve the shader effect for the Actor.
- * @return The shader effect
- */
- virtual ShaderEffectPtr GetShaderEffect() const;
-
- /**
- * @todo remove when API is cleaned up
- * Removes the current shader effect.
- */
- virtual void RemoveShaderEffect();
-
/**
* @copydoc Dali::Actor::SetDrawMode
*/
bool RayActorTest( const Vector4& rayOrigin, const Vector4& rayDir, Vector4& hitPointLocal, float& distance ) const;
/**
- * Sets whether the actor should receive a notification when touch motion events leave
+ * Sets whether the actor should receive a notification when touch or hover motion events leave
* the boundary of the actor.
*
* @note By default, this is set to false as most actors do not require this.
- * @note Need to connect to the SignalTouch to actually receive this event.
+ * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
*
* @param[in] required Should be set to true if a Leave event is required
*/
void SetLeaveRequired(bool required);
/**
- * This returns whether the actor requires touch events whenever touch motion events leave
+ * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
* the boundary of the actor.
* @return true if a Leave event is required, false otherwise.
*/
bool GetTouchRequired() const;
/**
+ * Query whether the application or derived actor type requires hover events.
+ * @return True if hover events are required.
+ */
+ bool GetHoverRequired() const;
+
+ /**
* Query whether the application or derived actor type requires mouse wheel events.
* @return True if mouse wheel events are required.
*/
bool EmitTouchEventSignal(const TouchEvent& event);
/**
+ * Used by the EventProcessor to emit hover event signals.
+ * @param[in] event The hover event.
+ * @return True if the event was consumed.
+ */
+ bool EmitHoverEventSignal(const HoverEvent& event);
+
+ /**
* Used by the EventProcessor to emit mouse wheel event signals.
* @param[in] event The mouse wheel event.
* @return True if the event was consumed.
Dali::Actor::TouchSignalV2& TouchedSignal();
/**
+ * @copydoc Dali::Actor::HoveredSignal()
+ */
+ Dali::Actor::HoverSignalV2& HoveredSignal();
+
+ /**
* @copydoc Dali::Actor::MouseWheelEventSignal()
*/
Dali::Actor::MouseWheelEventSignalV2& MouseWheelEventSignal();
public: // For Animation
/**
+ * This should only be called by Animation, when the actor is resized using Animation::Resize().
+ *
+ * @param[in] animation The animation that resized the actor
+ * @param[in] targetSize The new target size of the actor
+ */
+ void NotifySizeAnimation(Animation& animation, const Vector3& targetSize);
+
+ /**
* For use in derived classes.
* This should only be called by Animation, when the actor is resized using Animation::Resize().
*/
/**
* Called on a child during Add() when the parent actor is connected to the Stage.
* @param[in] stage The stage.
+ * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
*/
- void ConnectToStage(Stage& stage);
+ void ConnectToStage(Stage& stage, int index = -1);
/**
* Helper for ConnectToStage, to recursively connect a tree of actors.
* This is atomic i.e. not interrupted by user callbacks.
* @param[in] stage The stage.
+ * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
* @param[out] connectionList On return, the list of connected actors which require notification.
*/
- void RecursiveConnectToStage( Stage& stage, ActorContainer& connectionList );
+ void RecursiveConnectToStage( Stage& stage, ActorContainer& connectionList, int index = -1 );
/**
* Connect the Node associated with this Actor to the scene-graph.
+ * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
*/
- void ConnectToSceneGraph();
+ void ConnectToSceneGraph(int index = -1);
/**
* Helper for ConnectToStage, to notify a connected actor through the public API.
*/
bool IsNodeConnected() const;
+ /**
+ * Calculate the size of the z dimension for a 2D size
+ *
+ * @param[in] size The 2D size (X, Y) to calculate Z from
+ *
+ * @return Return the Z dimension for this size
+ */
+ float CalculateSizeZ( const Vector2& size ) const;
+
public: // Default property extensions from ProxyObject
/**
/**
* Set the actors parent.
* @param[in] parent The new parent.
+ * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
*/
- void SetParent(Actor* parent);
+ void SetParent(Actor* parent, int index = -1);
/**
* Helper to create a Node for this Actor.
/**
* For use in derived classes.
- * This is only called if mTouchRequired is true, and the touch-signal was not consumed.
+ * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
* @param[in] event The touch event.
* @return True if the event should be consumed.
*/
/**
* For use in derived classes.
+ * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
+ * @param[in] event The hover event.
+ * @return True if the event should be consumed.
+ */
+ virtual bool OnHoverEvent(const HoverEvent& event) { return false; }
+
+ /**
+ * For use in derived classes.
* This is only called if the mouse wheel signal was not consumed.
* @param[in] event The mouse event.
* @return True if the event should be consumed.
// Signals
Dali::Actor::TouchSignalV2 mTouchedSignalV2;
+ Dali::Actor::HoverSignalV2 mHoveredSignalV2;
Dali::Actor::MouseWheelEventSignalV2 mMouseWheelEventSignalV2;
Dali::Actor::SetSizeSignalV2 mSetSizeSignalV2;
Dali::Actor::OnStageSignalV2 mOnStageSignalV2;
Dali::Actor::OffStageSignalV2 mOffStageSignalV2;
+ Vector3 mSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+
std::string mName; ///< Name of the actor
unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
+ bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
bool mDerivedRequiresMouseWheelEvent : 1; ///< Whether the derived actor type requires mouse wheel event signals
bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
bool mInheritRotation : 1; ///< Cached: Whether the parent's rotation should be inherited.