#include <string>
// INTERNAL INCLUDES
-#include <dali/public-api/common/map-wrapper.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/actor.h>
struct KeyEvent;
struct TouchEvent;
+struct HoverEvent;
struct MouseWheelEvent;
namespace Internal
class Actor;
class ActorGestureData;
+class Animation;
class RenderTask;
-class ShaderEffect;
struct DynamicsData;
typedef IntrusivePtr<Actor> ActorPtr;
-typedef IntrusivePtr<ShaderEffect> ShaderEffectPtr;
typedef Dali::ActorContainer ActorContainer; // Store handles to return via public-api
typedef ActorContainer::iterator ActorIter;
typedef ActorContainer::const_iterator ActorConstIter;
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
{
}
/**
- * Set whether the actor inherits a shader effect from its parent.
- * The inherited effect can be overridden using SetShaderEffect()
- * @param [in] inherit True if the parent effect is inherited.
- */
- void SetInheritShaderEffect(bool inherit);
-
- /**
- * Query whether the actor inherits a shader effect from its parent.
- * @return True if the parent effect is inherited.
- */
- bool GetInheritShaderEffect() const;
-
- /**
- * 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.
- */
- void SetShaderEffect(ShaderEffect& effect);
-
- /**
- * Retrieve the shader effect for the Actor.
- * @return The shader effect
- */
- ShaderEffectPtr GetShaderEffect() const;
-
- /**
- * Removes the current shader effect.
- */
- void RemoveShaderEffect();
-
- /**
* @copydoc Dali::Actor::SetDrawMode
*/
void SetDrawMode( DrawMode::Type drawMode );
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().
*/
- virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) {}
+ virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize) {}
protected:
/**
* 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;
-public: // Default property extensions from ProxyObject
-
/**
- * @copydoc Dali::Internal::ProxyObject::IsSceneObjectRemovable()
+ * 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
*/
- virtual bool IsSceneObjectRemovable() const;
+ float CalculateSizeZ( const Vector2& size ) const;
+
+public: // Default property extensions from ProxyObject
/**
* @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
/**
* @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
*/
- virtual const std::string& GetDefaultPropertyName(Property::Index index) const;
+ virtual const char* GetDefaultPropertyName(Property::Index index) const;
/**
* @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
/**
- * @copydoc Dali::Internal::ProxyObject::SetCustomProperty()
+ * @copydoc Dali::Internal::ProxyObject::SetSceneGraphProperty()
*/
- virtual void SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
+ virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
/**
* @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
virtual Property::Value GetDefaultProperty( Property::Index index ) const;
/**
- * @copydoc Dali::Internal::ProxyObject::InstallSceneObjectProperty()
+ * @copydoc Dali::Internal::ProxyObject::GetPropertyOwner()
*/
- virtual void InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index );
+ virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
/**
* @copydoc Dali::Internal::ProxyObject::GetSceneObject()
/**
* 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 called after a non animatable custom property is set.
- * @param [in] index The index of the property.
- * @param [in] propertyValue The value of the property.
+ * 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.
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ) {}
+ virtual bool OnTouchEvent(const TouchEvent& event) { return false; }
/**
* For use in derived classes.
- * This is only called if mTouchRequired is true, and the touch-signal was not consumed.
- * @param[in] event The touch event.
+ * 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 OnTouchEvent(const TouchEvent& event) { return false; }
+ virtual bool OnHoverEvent(const HoverEvent& event) { return false; }
/**
* For use in derived classes.
DynamicsData* mDynamicsData; ///< optional physics data
#endif
- ActorGestureData* mGestureData; /// Optional Gesture data. Only created when actor requires gestures
+ ActorGestureData* mGestureData; /// Optional Gesture data. Only created when actor requires gestures
ActorAttachmentPtr mAttachment; ///< Optional referenced attachment
- ShaderEffectPtr mShaderEffect; ///< Optional referenced shader effect
// 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.
PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
- // Default properties
- typedef std::map<std::string, Property::Index> DefaultPropertyLookup;
-
private:
static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
static unsigned int mActorCounter; ///< A counter to track the actor instance creation
- // Default properties
- static DefaultPropertyLookup* mDefaultPropertyLookup;
-
-};
-
-/**
- * @brief Structure for setting up default properties and their details.
- */
-struct PropertyDetails
-{
- std::string name; ///< The name of the property.
- Property::Type type; ///< The property type.
- bool writable:1; ///< Whether the property is writable
- bool animatable:1; ///< Whether the property is animatable.
- bool constraintInput:1; ///< Whether the property can be used as an input to a constraint.
};
} // namespace Internal