You can save the environment variables to a file:
- dali-env/opt/bin/scripts/dali_env -s > setenv
+ dali-env/opt/bin/dali_env -s > setenv
This process only needs to be done once.
namespace
{
+// Enumeration properties to test:
+const Scripting::StringEnum< int > SIZE_MODE_VALUES[] =
+{
+ { "USE_OWN_SIZE", USE_OWN_SIZE },
+ { "SIZE_EQUAL_TO_PARENT", SIZE_EQUAL_TO_PARENT },
+ { "SIZE_RELATIVE_TO_PARENT", SIZE_RELATIVE_TO_PARENT },
+ { "SIZE_FIXED_OFFSET_FROM_PARENT", SIZE_FIXED_OFFSET_FROM_PARENT },
+};
+const unsigned int SIZE_MODE_VALUES_COUNT = sizeof( SIZE_MODE_VALUES ) / sizeof( SIZE_MODE_VALUES[0] );
bool gTouchCallBackCalled=false;
bool gTouchCallBack2Called=false;
END_TEST;
}
+int UtcDaliActorSizeMode(void)
+{
+ tet_infoline("Testing Actor::SetSizeMode");
+ TestApplication application;
+
+ // Create a parent and a child.
+ Actor parent = Actor::New();
+ parent.SetParentOrigin( ParentOrigin::CENTER );
+ parent.SetAnchorPoint( AnchorPoint::CENTER );
+ Vector3 parentPosition( 0.0f, 0.0f, 0.0f );
+ parent.SetPosition( parentPosition );
+ parent.SetSize( 10.0f, 20.0f, 40.0f );
+ parent.SetSizeMode( USE_OWN_SIZE );
+ Stage::GetCurrent().Add( parent );
+
+ Actor child = Actor::New();
+ child.SetParentOrigin( ParentOrigin::CENTER );
+ child.SetAnchorPoint( AnchorPoint::CENTER );
+ Vector3 childPosition( 0.0f, 0.0f, 0.0f );
+ child.SetPosition( childPosition );
+ child.SetSize( 1.0f, 2.0f, 4.0f );
+ child.SetSizeMode( USE_OWN_SIZE );
+ parent.Add( child );
+
+ // Flush the queue and render once.
+ application.SendNotification();
+ application.Render();
+
+ // Test USE_OWN_SIZE uses the user-set size value.
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 1.0f, 2.0f, 4.0f ), TEST_LOCATION );
+ // Render and check again to ensure double-buffering does not cause old value to reappear.
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 1.0f, 2.0f, 4.0f ), TEST_LOCATION );
+
+ // Test SIZE_EQUAL_TO_PARENT overrides size with the parents size.
+ child.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 10.0f, 20.0f, 40.0f ), TEST_LOCATION );
+ // Render and check again to ensure double-buffering does not cause old value to reappear.
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 10.0f, 20.0f, 40.0f ), TEST_LOCATION );
+
+ // Test SIZE_RELATIVE_TO_PARENT overrides size with parents size * SizeModeFactor.
+ child.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+
+ application.SendNotification();
+ application.Render();
+ // First check without setting a relative factor, to confirm that the default factor (of 1.0f) is used.
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 10.0f, 20.0f, 40.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Render and check again to ensure double-buffering does not cause old value to reappear.
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 10.0f, 20.0f, 40.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Set an arbitary relative factor to check against.
+ child.SetSizeModeFactor( Vector3( 2.0f, 3.0f, 4.0f ) );
+
+ application.SendNotification();
+ application.Render();
+ // Check with a valid relative factor.
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 20.0f, 60.0f, 160.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Render and check again to ensure double-buffering does not cause old value to reappear.
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 20.0f, 60.0f, 160.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Test SIZE_FIXED_OFFSET_FROM_PARENT overrides size with parents size + SizeModeFactor.
+ child.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
+
+ application.SendNotification();
+ application.Render();
+ // Check with a valid relative factor.
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 12.0f, 23.0f, 44.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Render and check again to ensure double-buffering does not cause old value to reappear.
+ application.Render();
+ DALI_TEST_EQUALS( child.GetCurrentSize(), Vector3( 12.0f, 23.0f, 44.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ application.SendNotification();
+
+ // Test the calculation order in update by having a parent with a size-relative
+ // factor and a rotation rotate a child anchored to one of the parents corners.
+ // .---. c
+ // .-----. | .-----. The new child is parented from the top-left of its parent.
+ // | '-|-' -----> | | We rotate the parent to confirm that the relative size calculation is
+ // | p | Rotate | .-|-. done before rotation. If it wasn't, the childs resultant
+ // '-----' parent '-----' | world-position would be incorrect.
+ // 90° '---'
+ //
+ // Create a new parent and child, and a root parent which the parent can grab relative size from.
+ Actor rootParent = Actor::New();
+ rootParent.SetParentOrigin( ParentOrigin::CENTER );
+ rootParent.SetAnchorPoint( AnchorPoint::CENTER );
+ rootParent.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ rootParent.SetSize( 10.0f, 10.0f, 10.0f );
+ rootParent.SetSizeMode( USE_OWN_SIZE );
+ Stage::GetCurrent().Add( rootParent );
+
+ Actor newParent = Actor::New();
+ newParent.SetParentOrigin( ParentOrigin::CENTER );
+ newParent.SetAnchorPoint( AnchorPoint::CENTER );
+ newParent.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ newParent.SetSize( 10.0f, 10.0f, 10.0f );
+ newParent.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ newParent.SetSizeModeFactor( Vector3( 0.5f, 0.5f, 0.5f ) );
+ rootParent.Add( newParent );
+
+ Actor newChild = Actor::New();
+ newChild.SetParentOrigin( ParentOrigin::TOP_RIGHT );
+ newChild.SetAnchorPoint( AnchorPoint::CENTER );
+ newChild.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ newChild.SetSize( 1.0f, 1.0f, 1.0f );
+ newChild.SetSizeMode( USE_OWN_SIZE );
+ newParent.Add( newChild );
+
+ // Set up the rotation by 90 degrees on Z.
+ newParent.RotateBy( Radian( M_PI * 0.5f ), Vector3::ZAXIS );
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( newParent.GetCurrentSize(), Vector3( 5.0f, 5.0f, 5.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( newParent.GetCurrentWorldPosition(), Vector3( 0.0f, 0.0f, 0.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( newChild.GetCurrentWorldPosition(), Vector3( 2.5f, 2.5f, 0.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Test changing the parents size to check the child's size is updated.
+ Actor newParent2 = Actor::New();
+ newParent2.SetParentOrigin( ParentOrigin::CENTER );
+ newParent2.SetAnchorPoint( AnchorPoint::CENTER );
+ newParent2.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ newParent2.SetSize( 10.0f, 10.0f, 10.0f );
+ newParent2.SetSizeMode( USE_OWN_SIZE );
+ rootParent.Add( newParent2 );
+
+ Actor newChild2 = Actor::New();
+ newChild2.SetParentOrigin( ParentOrigin::TOP_RIGHT );
+ newChild2.SetAnchorPoint( AnchorPoint::CENTER );
+ newChild2.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ newChild2.SetSize( Vector3::ONE );
+ newChild2.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ newChild2.SetSizeModeFactor( Vector3( 0.5f, 0.5f, 0.5f ) );
+ newParent2.Add( newChild2 );
+
+ // Check the child has no size yet.
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
+
+ // Check the child now has a relative size to the parent.
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 5.0f, 5.0f, 5.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Change the parent's size and check the child's size changes also.
+ newParent2.SetSize( 100.0f, 100.0f, 100.0f );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 50.0f, 50.0f, 50.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Confirm the child's size is still correct on the next frame.
+ application.Render();
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 50.0f, 50.0f, 50.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Text that reparenting a child causes its size to update relative to its new parent.
+ Actor newParent3 = Actor::New();
+ newParent3.SetParentOrigin( ParentOrigin::CENTER );
+ newParent3.SetAnchorPoint( AnchorPoint::CENTER );
+ newParent3.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) );
+ newParent3.SetSize( 400.0f, 400.0f, 400.0f );
+ newParent3.SetSizeMode( USE_OWN_SIZE );
+ rootParent.Add( newParent3 );
+
+ // Reparent the child but don't update yet. Check it still has its old size.
+ newParent3.Add( newChild2 );
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 50.0f, 50.0f, 50.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Check the child's size has updated based on the new parent.
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 200.0f, 200.0f, 200.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Confirm the child's size is still correct on the next frame.
+ application.Render();
+ DALI_TEST_EQUALS( newChild2.GetCurrentSize(), Vector3( 200.0f, 200.0f, 200.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Properties:
+ // Test setting and getting the SizeMode property (by string).
+ Actor propertyActor = Actor::New();
+ propertyActor.SetParentOrigin( ParentOrigin::CENTER );
+ propertyActor.SetAnchorPoint( AnchorPoint::CENTER );
+ propertyActor.SetPosition( Vector3::ZERO );
+ propertyActor.SetSize( Vector3::ONE );
+ propertyActor.SetSizeMode( USE_OWN_SIZE );
+
+ // Loop through each SizeMode enumeration.
+ for( unsigned int propertyIndex = 0; propertyIndex < SIZE_MODE_VALUES_COUNT; ++propertyIndex )
+ {
+ Property::Value inValue = SIZE_MODE_VALUES[ propertyIndex ].string;
+ propertyActor.SetProperty( Actor::SIZE_MODE, inValue );
+ std::string outString = propertyActor.GetProperty( Actor::SIZE_MODE ).Get< std::string >();
+ DALI_TEST_EQUALS( inValue.Get< std::string >(), outString, TEST_LOCATION );
+ }
+
+ // Test setting and getting the SizeModeFactor property.
+ Vector3 testPropertySizeModeFactor( 1.0f, 2.0f, 3.0f );
+ Property::Value inValueFactor = testPropertySizeModeFactor;
+ propertyActor.SetProperty( Actor::SIZE_MODE_FACTOR, inValueFactor );
+ Vector3 outValueFactor = propertyActor.GetProperty( Actor::SIZE_MODE_FACTOR ).Get< Vector3 >();
+ DALI_TEST_EQUALS( testPropertySizeModeFactor, outValueFactor, TEST_LOCATION );
+
+ END_TEST;
+}
+
// SetRotation(float angleRadians, Vector3 axis)
int UtcDaliActorSetRotation01(void)
{
END_TEST;
}
-int UtcDaliActorSetSizeSignal(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- actor.SetSizeSignal().Connect( SetSizeCallback );
-
- gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
- gSetSizeCallBackCalled = false;
- Vector2 size2d( 1.0f, 2.0f );
- actor.SetSize( size2d );
- DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
- // SetSize with Vector2 sets depth to be the minimum of width & height
- DALI_TEST_EQUALS( Vector3( 1.0f, 2.0f, 1.0f ), gSetSize, TEST_LOCATION );
-
- gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
- gSetSizeCallBackCalled = false;
- actor.SetSize( 22.0f, 11.0f );
- DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
- // SetSize with Vector2 sets depth to be the minimum of width & height
- DALI_TEST_EQUALS( Vector3( 22.0f, 11.0f, 11.0f ), gSetSize, TEST_LOCATION );
-
- gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
- gSetSizeCallBackCalled = false;
- Vector3 size( 3.0f, 4.0f, 5.0f );
- actor.SetSize( size );
- DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
- DALI_TEST_EQUALS( size, gSetSize, TEST_LOCATION );
-
- // add actor to stage to see that signal still works
- Stage::GetCurrent().Add( actor );
-
- gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
- gSetSizeCallBackCalled = false;
- actor.SetSize( -1.0f, -2.0f, -3.0f );
- DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
- DALI_TEST_EQUALS( Vector3( -1.0f, -2.0f, -3.0f ), gSetSize, TEST_LOCATION );
- END_TEST;
-}
-
int UtcDaliActorOnOffStageSignal(void)
{
tet_infoline("Testing Dali::Actor::OnStageSignal() and OffStageSignal()");
{ "color-mode", Actor::COLOR_MODE, Property::STRING },
{ "position-inheritance", Actor::POSITION_INHERITANCE, Property::STRING },
{ "draw-mode", Actor::DRAW_MODE, Property::STRING },
+ { "size-mode", Actor::SIZE_MODE, Property::STRING },
+ { "size-mode-factor", Actor::SIZE_MODE_FACTOR, Property::VECTOR3 },
};
const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
} // unnamed namespace
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::COLOR_MODE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::POSITION_INHERITANCE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::DRAW_MODE ) );
+ DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::SIZE_MODE ) );
+ DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::SIZE_MODE_FACTOR ) );
END_TEST;
}
valueMap.SetValue("key", 5.f);
valueMap.SetValue("2key", "a string");
- DALI_TEST_EQUALS( true, valueMap.HasKey("key"), TEST_LOCATION);
+ DALI_TEST_EQUALS( true, valueMap.HasKey("key"), TEST_LOCATION);
DALI_TEST_EQUALS( "key", valueMap.GetKey(0), TEST_LOCATION);
DALI_TEST_EQUALS( true, valueMap.HasKey("2key"), TEST_LOCATION);
valueMap.SetItem(0, Property::Value("a string"));
valueMap.SetItem(1, Property::Value(5.f));
- DALI_TEST_EQUALS( 5.f, valueMap.GetValue("2key").Get<float>(), TEST_LOCATION);
- DALI_TEST_EQUALS( "a string", valueMap.GetValue("key").Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS( 5.f, valueMap.GetValue("2key").Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS( "a string", valueMap.GetValue("key").Get<std::string>(), TEST_LOCATION);
// ordered map
valueMap = Property::Value(Property::MAP);
{
TestApplication application; // Reset all test adapter return codes
- PanGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
+ PanGesture gesture;
+ DALI_TEST_EQUALS(Gesture::Clear, gesture.state, TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
- PanGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
+ PanGesture gesture2(Gesture::Started);
+ DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture2.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS(Gesture::Pan, gesture2.type, TEST_LOCATION);
- PanGesture gesture3(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
+ PanGesture gesture3(Gesture::Continuing);
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture3.state, TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture3.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS(Gesture::Pan, gesture3.type, TEST_LOCATION);
+ PanGesture gesture4(Gesture::Finished);
+ DALI_TEST_EQUALS(Gesture::Finished, gesture4.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture4.numberOfTouches, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture4.type, TEST_LOCATION);
+
// Test copy constructor
- gesture3.numberOfTouches = 3u;
+ gesture4.numberOfTouches = 3u;
- PanGesture pan(gesture3);
+ PanGesture pan(gesture4);
DALI_TEST_EQUALS(Gesture::Finished, pan.state, TEST_LOCATION);
DALI_TEST_EQUALS(3u, pan.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( DRAW_MODE_VALUES[0] );
-
//////////////////////////////////////////////////////////////////////////////
// Helpers for string to enum comparisons for Image and ImageAttributes
//////////////////////////////////////////////////////////////////////////////
DALI_TEST_CHECK( !handle.MouseWheelEventSignal().GetConnectionCount() );
DALI_TEST_CHECK( !handle.OffStageSignal().GetConnectionCount() );
DALI_TEST_CHECK( !handle.OnStageSignal().GetConnectionCount() );
- DALI_TEST_CHECK( !handle.SetSizeSignal().GetConnectionCount() );
DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() );
}
END_TEST;
actor.SetLeaveRequired( true );
actor.SetInheritRotation( false );
actor.SetInheritScale( false );
+ actor.SetSizeMode( USE_OWN_SIZE );
+ actor.SetSizeModeFactor( Vector3::ONE );
Stage::GetCurrent().Add( actor );
application.SendNotification();
DALI_TEST_EQUALS( value.GetValue( "inherit-rotation" ).Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "inherit-scale" ) );
DALI_TEST_EQUALS( value.GetValue( "inherit-scale" ).Get< bool >(), false, TEST_LOCATION );
+ DALI_TEST_CHECK( value.HasKey( "size-mode-factor" ) );
+ DALI_TEST_EQUALS( value.GetValue( "size-mode-factor" ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
Stage::GetCurrent().Remove( actor );
}
*/
void Disconnect();
- /**
- * Sets whether a renderable attachment is visible.
- * By default attachments are visible.
- * @param[in] visible True if the object is visible.
- */
- void SetVisible(bool visible);
-
- /**
- * Retrieve whether a renderable attachment is visible.
- * @return True if the object is visible.
- */
- bool IsVisible() const;
-
protected:
/**
namespace Internal
{
-ImageAttachmentPtr ImageAttachment::New( const SceneGraph::Node& parentNode )
+ImageAttachmentPtr ImageAttachment::New( Stage& stage, const SceneGraph::Node& parentNode )
{
- StagePtr stage = Stage::GetCurrent();
-
- ImageAttachmentPtr attachment( new ImageAttachment( *stage ) );
+ ImageAttachmentPtr attachment( new ImageAttachment( stage ) );
// Transfer object ownership of scene-object to message
SceneGraph::ImageAttachment* sceneObject = CreateSceneObject();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* An attachment for rendering images in various ways.
- * The default geometry scaling mode is ScaleToFill.
*/
class ImageAttachment : public RenderableAttachment
{
/**
* Create a new ImageAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* @return A smart-pointer to the newly allocated ImageAttachment.
*/
- static ImageAttachmentPtr New( const SceneGraph::Node& parentNode );
+ static ImageAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode );
/**
* Sets image rendered by the attachment.
/**
* First stage construction of a ImageAttachment.
* @param[in] stage Used to send messages to scene-graph.
- * @param[in] image A pointer to the image to display or NULL to not render anything.
*/
ImageAttachment(Stage& stage);
namespace Internal
{
-MeshAttachmentPtr MeshAttachment::New( const SceneGraph::Node& parentNode )
+MeshAttachmentPtr MeshAttachment::New( Stage& stage, const SceneGraph::Node& parentNode )
{
- StagePtr stage = Stage::GetCurrent();
-
- MeshAttachmentPtr attachment( new MeshAttachment( *stage ) );
+ MeshAttachmentPtr attachment( new MeshAttachment( stage ) );
// Transfer object ownership of scene-object to message
SceneGraph::MeshAttachment* sceneObject = SceneGraph::MeshAttachment::New();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* Create an initialised MeshAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* This will not be displayed until a mesh is added with SetMesh().
* @return A handle to a newly allocated Dali resource.
*/
- static MeshAttachmentPtr New( const SceneGraph::Node& parentNode );
+ static MeshAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode );
/**
* Set the mesh to be rendererd by this attachment
namespace Internal
{
-TextAttachmentPtr TextAttachment::New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
+TextAttachmentPtr TextAttachment::New( Stage& stage, const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
{
- StagePtr stage = Stage::GetCurrent();
-
- TextAttachmentPtr attachment( new TextAttachment( *stage ) );
+ TextAttachmentPtr attachment( new TextAttachment( stage ) );
// Second-phase construction
// Transfer object ownership of scene-object to message
SceneGraph::TextAttachment* sceneObject = SceneGraph::TextAttachment::New();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* Create a new TextAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* @param [in] text The text which will be displayed.
* @param [in] font The font which will be used for the text.
* @return A smart-pointer to the newly allocated TextAttachment.
*/
- static TextAttachmentPtr New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
+ static TextAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
/**
* Set the text label displayed by the attachment
const Property::Index Actor::COLOR_MODE = 40;
const Property::Index Actor::POSITION_INHERITANCE = 41;
const Property::Index Actor::DRAW_MODE = 42;
+const Property::Index Actor::SIZE_MODE = 43;
+const Property::Index Actor::SIZE_MODE_FACTOR = 44;
namespace // unnamed namespace
{
{ "color-mode", Property::STRING, true, false, false }, // COLOR_MODE
{ "position-inheritance", Property::STRING, true, false, false }, // POSITION_INHERITANCE
{ "draw-mode", Property::STRING, true, false, false }, // DRAW_MODE
+ { "size-mode", Property::STRING, true, false, false }, // SIZE_MODE
+ { "size-mode-factor", Property::VECTOR3, true, false, false }, // SIZE_MODE_FACTOR
};
const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails );
+// Enumeration to/from text conversion tables:
+const Scripting::StringEnum< SizeMode > SIZE_MODE_TABLE[] =
+{
+ { "USE_OWN_SIZE", USE_OWN_SIZE },
+ { "SIZE_EQUAL_TO_PARENT", SIZE_EQUAL_TO_PARENT },
+ { "SIZE_RELATIVE_TO_PARENT", SIZE_RELATIVE_TO_PARENT },
+ { "SIZE_FIXED_OFFSET_FROM_PARENT", SIZE_FIXED_OFFSET_FROM_PARENT },
+};
+const unsigned int SIZE_MODE_TABLE_COUNT = sizeof( SIZE_MODE_TABLE ) / sizeof( SIZE_MODE_TABLE[0] );
+
} // unnamed namespace
namespace Internal
SignalConnectorType signalConnector1(mType, Dali::Actor::SIGNAL_TOUCHED, &Actor::DoConnectSignal);
SignalConnectorType signalConnector2(mType, Dali::Actor::SIGNAL_HOVERED, &Actor::DoConnectSignal);
-SignalConnectorType signalConnector3(mType, Dali::Actor::SIGNAL_SET_SIZE, &Actor::DoConnectSignal);
SignalConnectorType signalConnector4(mType, Dali::Actor::SIGNAL_ON_STAGE, &Actor::DoConnectSignal);
SignalConnectorType signalConnector5(mType, Dali::Actor::SIGNAL_OFF_STAGE, &Actor::DoConnectSignal);
return mInheritRotation;
}
+void Actor::SetSizeMode(SizeMode mode)
+{
+ // non animateable so keep local copy
+ mSizeMode = mode;
+ if( NULL != mNode )
+ {
+ // mNode is being used in a separate thread; queue a message to set the value
+ SetSizeModeMessage( mStage->GetUpdateInterface(), *mNode, mode );
+ }
+}
+
+void Actor::SetSizeModeFactor(const Vector3& factor)
+{
+ // non animateable so keep local copy
+ mSizeModeFactor = factor;
+ if( NULL != mNode )
+ {
+ // mNode is being used in a separate thread; queue a message to set the value
+ SetSizeModeFactorMessage( mStage->GetUpdateInterface(), *mNode, factor );
+ }
+}
+
+SizeMode Actor::GetSizeMode() const
+{
+ return mSizeMode;
+}
+
+const Vector3& Actor::GetSizeModeFactor() const
+{
+ return mSizeModeFactor;
+}
+
void Actor::SetColorMode(ColorMode colorMode)
{
// non animateable so keep local copy
// Notification for derived classes
OnSizeSet( mSize );
-
- // Emit signal for application developer
-
- if( !mSetSizeSignal.Empty() )
- {
- Dali::Actor handle( this );
- mSetSizeSignal.Emit( handle, mSize );
- }
}
}
return mMouseWheelEventSignal;
}
-Dali::Actor::SetSizeSignalType& Actor::SetSizeSignal()
-{
- return mSetSizeSignal;
-}
-
Dali::Actor::OnStageSignalType& Actor::OnStageSignal()
{
return mOnStageSignal;
{
actor->MouseWheelEventSignal().Connect( tracker, functor );
}
- else if(Dali::Actor::SIGNAL_SET_SIZE == signalName)
- {
- actor->SetSizeSignal().Connect( tracker, functor );
- }
else if(Dali::Actor::SIGNAL_ON_STAGE == signalName)
{
actor->OnStageSignal().Connect( tracker, functor );
mGestureData( NULL ),
mAttachment(),
mSize( 0.0f, 0.0f, 0.0f ),
+ mSizeModeFactor( Vector3::ONE ),
mName(),
mId( ++mActorCounter ), // actor ID is initialised to start from 1, and 0 is reserved
mIsRoot( ROOT_LAYER == derivedType ),
mInheritScale( true ),
mDrawMode( DrawMode::NORMAL ),
mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
- mColorMode( Node::DEFAULT_COLOR_MODE )
+ mColorMode( Node::DEFAULT_COLOR_MODE ),
+ mSizeMode( Node::DEFAULT_SIZE_MODE )
{
}
break;
}
+ case Dali::Actor::SIZE_MODE:
+ {
+ SetSizeMode( Scripting::GetEnumeration< SizeMode >( property.Get<std::string>(), SIZE_MODE_TABLE, SIZE_MODE_TABLE_COUNT ) );
+ break;
+ }
+
+ case Dali::Actor::SIZE_MODE_FACTOR:
+ {
+ SetSizeModeFactor( property.Get<Vector3>() );
+ break;
+ }
+
case Dali::Actor::INHERIT_SCALE:
{
SetInheritScale( property.Get<bool>() );
break;
}
+ case Dali::Actor::SIZE_MODE:
+ {
+ value = Scripting::GetEnumerationName< SizeMode >( GetSizeMode(), SIZE_MODE_TABLE, SIZE_MODE_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::SIZE_MODE_FACTOR:
+ {
+ value = GetSizeModeFactor();
+ break;
+ }
+
case Dali::Actor::INHERIT_SCALE:
{
value = IsScaleInherited();
bool IsRotationInherited() const;
/**
+ * @brief Defines how a child actors size is affected by its parents size.
+ * @param[in] mode The size relative to parent mode to use.
+ */
+ void SetSizeMode(SizeMode mode);
+
+ /**
+ * Query how the child actors size is affected by its parents size.
+ * @return The size relative to parent mode in use.
+ */
+ SizeMode GetSizeMode() const;
+
+ /**
+ * Sets the factor of the parents size used for the child actor.
+ * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * @param[in] factor The vector to multiply the parents size by to get the childs size.
+ */
+ void SetSizeModeFactor(const Vector3& factor);
+
+ /**
+ * Gets the factor of the parents size used for the child actor.
+ * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * @return The vector being used to multiply the parents size by to get the childs size.
+ */
+ const Vector3& GetSizeModeFactor() const;
+
+ /**
* @copydoc Dali::Actor::GetCurrentWorldRotation()
*/
const Quaternion& GetCurrentWorldRotation() const;
Dali::Actor::MouseWheelEventSignalType& MouseWheelEventSignal();
/**
- * @copydoc Dali::Actor::SetSizeSignal()
- */
- Dali::Actor::SetSizeSignalType& SetSizeSignal();
-
- /**
* @copydoc Dali::Actor::OnStageSignal()
*/
Dali::Actor::OnStageSignalType& OnStageSignal();
Actor* mParent; ///< Each actor (except the root) can have one parent
ActorContainer* mChildren; ///< Container of referenced actors
const SceneGraph::Node* mNode; ///< Not owned
- Vector3* mParentOrigin; // NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
- Vector3* mAnchorPoint; // NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
+ Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
+ Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
#ifdef DYNAMICS_SUPPORT
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
Dali::Actor::TouchSignalType mTouchedSignal;
Dali::Actor::HoverSignalType mHoveredSignal;
Dali::Actor::MouseWheelEventSignalType mMouseWheelEventSignal;
- Dali::Actor::SetSizeSignalType mSetSizeSignal;
Dali::Actor::OnStageSignalType mOnStageSignal;
Dali::Actor::OffStageSignalType mOffStageSignal;
Vector3 mSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+ Vector3 mSizeModeFactor; ///< Factor of parent size used for certain SizeModes.
std::string mName; ///< Name of the actor
unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
+ SizeMode mSizeMode : 2; ///< Cached: Determines how the actors parent affects the actors size.
private:
actor->Initialize();
// Create the attachment
- actor->mImageAttachment = ImageAttachment::New( *actor->mNode );
+ actor->mImageAttachment = ImageAttachment::New( *actor->mStage, *actor->mNode );
actor->Attach( *actor->mImageAttachment );
return actor;
actor->Initialize();
// Create the attachment
- actor->mMeshAttachment = MeshAttachment::New( *actor->mNode );
+ actor->mMeshAttachment = MeshAttachment::New( *actor->mStage, *actor->mNode );
actor->Attach(*actor->mMeshAttachment);
actor->SetCullFace( Dali::CullBack );
MeshActorPtr MeshActor::New(ModelDataPtr modelData, Dali::Entity entity)
{
- MeshActorPtr actor(new MeshActor());
- // Second-phase construction
- actor->Initialize();
+ MeshActorPtr actor = MeshActor::New();
- // Create the attachment
- actor->mMeshAttachment = MeshAttachment::New( *actor->mNode );
- actor->Attach(*actor->mMeshAttachment);
actor->SetName(entity.GetName());
- actor->SetCullFace( Dali::CullBack );
DALI_ASSERT_ALWAYS(entity.NumberOfMeshes() == 1 && "Dali does not support multiple meshes per node in the model");
actor->Initialize();
//create the attachment
- actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
+ actor->mTextAttachment = TextAttachment::New( *actor->mStage, *actor->mNode, Integration::TextArray(), fontPtr );
actor->Attach(*actor->mTextAttachment);
// Note: SetTextStyle() MUST be called before SetText(), to ensure
if( mTexture )
{
- // got effect texture, bind it to texture unit 1
- mTextureCache->BindTexture( mTexture, mRenderTextureId, GL_TEXTURE_2D, TEXTURE_UNIT_SHADER);
-
- // Just apply the default sampling options for now
- mTexture->ApplySampler( TEXTURE_UNIT_SHADER, ImageSampler::PackBitfield( FilterMode::DEFAULT, FilterMode::DEFAULT ) );
-
- // get effect sampler uniform
+ // if effect sampler uniform used by the program ?
const GLint loc = program.GetUniformLocation( Program::UNIFORM_EFFECT_SAMPLER );
if( Program::UNIFORM_UNKNOWN != loc )
{
+ // got effect texture, bind it to texture unit 1
+ mTextureCache->BindTexture( mTexture, mRenderTextureId, GL_TEXTURE_2D, TEXTURE_UNIT_SHADER);
+
+ // Apply the default sampling options for now
+ mTexture->ApplySampler( TEXTURE_UNIT_SHADER, ImageSampler::PackBitfield( FilterMode::DEFAULT, FilterMode::DEFAULT ) );
+
DALI_PRINT_UNIFORM( debugStream, bufferIndex, "sEffect", TEXTURE_UNIT_SHADER );
// set the uniform
program.SetUniform1i( loc, TEXTURE_UNIT_SHADER );
inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferIndex updateBufferIndex )
{
// If the transform values need to be reinherited
- if ( nodeDirtyFlags & TransformFlag )
+ if( nodeDirtyFlags & TransformFlag )
{
+ // Handle size relative to parent modes.
+ // This must be delt with before rotation/translation as otherwise anything
+ // anchored to a corner of this child would appear at the wrong position.
+ // Note: Switch is in order of use-case commonality.
+ switch( node.GetSizeMode() )
+ {
+ case USE_OWN_SIZE:
+ {
+ // Completely ignore the parents size.
+ break;
+ }
+
+ case SIZE_EQUAL_TO_PARENT:
+ {
+ // Set the nodes size to that of the parent.
+ node.SetSize( updateBufferIndex, node.GetParent()->GetSize( updateBufferIndex ) );
+ break;
+ }
+
+ case SIZE_RELATIVE_TO_PARENT:
+ {
+ // Set the nodes size to the parents multiplied by a user defined value.
+ node.SetSize( updateBufferIndex, node.GetSizeModeFactor() * node.GetParent()->GetSize( updateBufferIndex ) );
+ break;
+ }
+
+ case SIZE_FIXED_OFFSET_FROM_PARENT:
+ {
+ // Set the nodes size to the parents plus a user defined value.
+ node.SetSize( updateBufferIndex, node.GetSizeModeFactor() + node.GetParent()->GetSize( updateBufferIndex ) );
+ break;
+ }
+ }
+
// With a non-central anchor-point, the world rotation and scale affects the world position.
// Therefore the world rotation & scale must be updated before the world position.
-
if( node.IsRotationInherited() )
{
node.InheritWorldRotation( updateBufferIndex );
node.CopyPreviousWorldRotation( updateBufferIndex );
node.CopyPreviousWorldScale( updateBufferIndex );
node.CopyPreviousWorldPosition( updateBufferIndex );
+ node.CopyPreviousSize( updateBufferIndex );
}
}
const PositionInheritanceMode Node::DEFAULT_POSITION_INHERITANCE_MODE( INHERIT_PARENT_POSITION );
const ColorMode Node::DEFAULT_COLOR_MODE( USE_OWN_MULTIPLY_PARENT_ALPHA );
+const SizeMode Node::DEFAULT_SIZE_MODE( USE_OWN_SIZE );
Node* Node::New()
{
mChildren(),
mGeometryScale( Vector3::ONE ),
mInitialVolume( Vector3::ONE ),
+ mSizeModeFactor( Vector3::ONE ),
mDirtyFlags(AllFlags),
mIsRoot( false ),
mInheritRotation( true ),
mIsActive( true ),
mDrawMode( DrawMode::NORMAL ),
mPositionInheritanceMode( DEFAULT_POSITION_INHERITANCE_MODE ),
- mColorMode( DEFAULT_COLOR_MODE )
+ mColorMode( DEFAULT_COLOR_MODE ),
+ mSizeMode( DEFAULT_SIZE_MODE )
{
}
// value types used by messages
template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
+template <> struct ParameterType< SizeMode > : public BasicType< SizeMode > {};
namespace SceneGraph
{
// Defaults
static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
static const ColorMode DEFAULT_COLOR_MODE;
+ static const SizeMode DEFAULT_SIZE_MODE;
// Creation methods
}
/**
+ * @brief Defines how a child actor's size is affected by its parent's size.
+ * @param[in] mode The size relative to parent mode to use.
+ */
+ void SetSizeMode( SizeMode mode )
+ {
+ if ( mode != mSizeMode )
+ {
+ mSizeMode = mode;
+
+ SetDirtyFlag( TransformFlag );
+ }
+ }
+
+ /**
+ * Query how the child actor's size is affected by its parent's size.
+ * @return The size relative to parent mode in use.
+ */
+ SizeMode GetSizeMode() const
+ {
+ return mSizeMode;
+ }
+
+ /**
+ * Sets the factor of the parents size used for the child actor.
+ * Note: Only used for certain SizeModes.
+ * @param[in] factor The vector to multiply the parents size by to get the childs size.
+ */
+ void SetSizeModeFactor( const Vector3& factor )
+ {
+ mSizeModeFactor = factor;
+
+ SetDirtyFlag( TransformFlag );
+ }
+
+ /**
+ * Gets the factor of the parents size used for the child actor.
+ * Note: Only used for certain SizeModes.
+ * @return The vector being used to multiply the parents size by to get the childs size.
+ */
+ const Vector3& GetSizeModeFactor() const
+ {
+ return mSizeModeFactor;
+ }
+
+ /**
* Set the initial volume of the node. Used for calculating geometry scaling
* as the node size is changed when transmitGeometryScaling is set to true.
*
*
* @param[in] volume The initial volume of this nodes meshes & children
*/
- void SetInitialVolume( const Vector3& volume)
+ void SetInitialVolume( const Vector3& volume )
{
mInitialVolume = volume;
SetDirtyFlag(SizeFlag);
}
/**
+ * Copies the previously used size, if this changed in the previous frame.
+ * @param[in] updateBufferIndex The current update buffer index.
+ */
+ void CopyPreviousSize( BufferIndex updateBufferIndex )
+ {
+ SetSize( updateBufferIndex, GetSize( 1u - updateBufferIndex ) );
+ }
+
+ /**
* Retrieve the visibility of the node.
* @param[in] bufferIndex The buffer to read from.
* @return True if the node is visible.
}
/**
+ * Sets the size of the node.
+ * @param[in] bufferIndex The buffer to write to.
+ * @param[in] size The size to write.
+ */
+ void SetSize( BufferIndex bufferIndex, const Vector3& size )
+ {
+ mSize[bufferIndex] = size;
+ }
+
+ /**
* Retrieve the size of the node.
* @param[in] bufferIndex The buffer to read from.
* @return The size.
NodeContainer mChildren; ///< Container of children; not owned
Vector3 mGeometryScale; ///< Applied before calculating world transform.
- Vector3 mInitialVolume; ///< Initial volume... TODO - need a better name
+ Vector3 mInitialVolume; ///< Initial volume... TODO - need a better name.
+ Vector3 mSizeModeFactor; ///< Factor of parent size. Used for certain SizeModes.
// flags, compressed to bitfield
int mDirtyFlags:10; ///< A composite set of flags for each of the Node properties
DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
PositionInheritanceMode mPositionInheritanceMode:2;///< Determines how position is inherited, 2 bits is enough
ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
+ SizeMode mSizeMode:2; ///< Determines how the actors parent affects the actors size.
// Changes scope, should be at end of class
DALI_LOG_OBJECT_STRING_DECLARATION;
new (slot) LocalType( &node, &Node::SetInheritRotation, inherit );
}
+inline void SetSizeModeMessage( EventToUpdate& eventToUpdate, const Node& node, SizeMode mode )
+{
+ typedef MessageValue1< Node, SizeMode > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &node, &Node::SetSizeMode, mode );
+}
+
+inline void SetSizeModeFactorMessage( EventToUpdate& eventToUpdate, const Node& node, const Vector3& factor )
+{
+ typedef MessageValue1< Node, Vector3 > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &node, &Node::SetSizeModeFactor, factor );
+}
+
inline void SetInitialVolumeMessage( EventToUpdate& eventToUpdate, const Node& node, const Vector3& initialVolume )
{
typedef MessageValue1< Node, Vector3 > LocalType;
DONT_INHERIT_POSITION ///< Actor will not inherit position. Local position is treated as world position. This is useful if a constraint is used to override local position or if an actor is positioned globally. This option ignores parent origin, anchor point and local position.
};
+/**
+ * @brief Actor size relative to parent mode.
+ */
+enum SizeMode
+{
+ USE_OWN_SIZE, ///< The mode is bypassed. The size Vector3 will be used as normal.
+ SIZE_EQUAL_TO_PARENT, ///< The actor will have the exact same size as the parent.
+ SIZE_RELATIVE_TO_PARENT, ///< The actors size will be ( ParentSize * SizeRelativeToParentFactor ).
+ SIZE_FIXED_OFFSET_FROM_PARENT ///< The actors size will be ( ParentSize + SizeRelativeToParentFactor ).
+};
} // namespace Dali
const char* const Actor::SIGNAL_TOUCHED = "touched";
const char* const Actor::SIGNAL_HOVERED = "hovered";
const char* const Actor::SIGNAL_MOUSE_WHEEL_EVENT = "mouse-wheel-event";
-const char* const Actor::SIGNAL_SET_SIZE = "set-size";
const char* const Actor::SIGNAL_ON_STAGE = "on-stage";
const char* const Actor::SIGNAL_OFF_STAGE = "off-stage";
return GetImplementation(*this).IsScaleInherited();
}
+void Actor::SetSizeMode(SizeMode mode)
+{
+ GetImplementation(*this).SetSizeMode(mode);
+}
+
+SizeMode Actor::GetSizeMode() const
+{
+ return GetImplementation(*this).GetSizeMode();
+}
+
+void Actor::SetSizeModeFactor(const Vector3& factor)
+{
+ GetImplementation(*this).SetSizeModeFactor(factor);
+}
+
+Vector3 Actor::GetSizeModeFactor() const
+{
+ return GetImplementation(*this).GetSizeModeFactor();
+}
+
Matrix Actor::GetCurrentWorldMatrix() const
{
return GetImplementation(*this).GetCurrentWorldMatrix();
return GetImplementation(*this).MouseWheelEventSignal();
}
-Actor::SetSizeSignalType& Actor::SetSizeSignal()
-{
- return GetImplementation(*this).SetSizeSignal();
-}
-
Actor::OnStageSignalType& Actor::OnStageSignal()
{
return GetImplementation(*this).OnStageSignal();
typedef Signal< bool (Actor, const TouchEvent&)> TouchSignalType; ///< Touch signal type
typedef Signal< bool (Actor, const HoverEvent&)> HoverSignalType; ///< Hover signal type
typedef Signal< bool (Actor, const MouseWheelEvent&) > MouseWheelEventSignalType;///< Mousewheel signal type
- typedef Signal< void (Actor, const Vector3&) > SetSizeSignalType; ///< SetSize signal type
typedef Signal< void (Actor) > OnStageSignalType; ///< Stage connection signal type
typedef Signal< void (Actor) > OffStageSignalType; ///< Stage disconnection signal type
static const Property::Index COLOR_MODE; ///< name "color-mode", type STRING
static const Property::Index POSITION_INHERITANCE; ///< name "position-inheritance", type STRING
static const Property::Index DRAW_MODE; ///< name "draw-mode", type STRING
+ static const Property::Index SIZE_MODE; ///< name "size-mode", type STRING
+ static const Property::Index SIZE_MODE_FACTOR; ///< name "size-mode-factor", type VECTOR3
/** @} */
/// @name Signals
static const char* const SIGNAL_TOUCHED; ///< name "touched", @see TouchedSignal()
static const char* const SIGNAL_HOVERED; ///< name "hovered", @see HoveredSignal()
static const char* const SIGNAL_MOUSE_WHEEL_EVENT; ///< name "mouse-wheel-event", @see MouseWheelEventSignal()
- static const char* const SIGNAL_SET_SIZE; ///< name "set-size", @see SetSizeSignal()
static const char* const SIGNAL_ON_STAGE; ///< name "on-stage", @see OnStageSignal()
static const char* const SIGNAL_OFF_STAGE; ///< name "off-stage", @see OffStageSignal()
/** @} */
bool IsScaleInherited() const;
/**
+ * @brief Defines how a child actor's size is affected by its parent's size.
+ *
+ * The default is to ignore the parent's size and use the size property of this actor.
+ *
+ * If USE_OWN_SIZE is used, this option is bypassed and the actor's size
+ * property is used.
+ *
+ * If SIZE_EQUAL_TO_PARENT is used, this actor's size will be equal to that
+ * of its parent. The actor's size property is ignored.
+ *
+ * If SIZE_RELATIVE_TO_PARENT is used, this actor's size will be based on
+ * its parent's size by multiplying the parent size by
+ * SizeModeFactor.
+ *
+ * If SIZE_FIXED_OFFSET_FROM_PARENT is used, this actor's size will be based on
+ * its parent's size plus SizeModeFactor.
+ *
+ * @pre The Actor has been initialized.
+ * @param[in] mode The size relative to parent mode to use.
+ */
+ void SetSizeMode(const SizeMode mode);
+
+ /**
+ * @brief Returns the actor's mode for modifying its size relative to its parent.
+ *
+ * @pre The Actor has been initialized.
+ * @return The mode used.
+ */
+ SizeMode GetSizeMode() const;
+
+ /**
+ * @brief Sets the relative to parent size factor of the actor.
+ *
+ * This factor is only used when SizeMode is set to either:
+ * SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * This actor's size is set to the actor's parent size multipled by or added to this factor,
+ * depending on SideMode (See SetSizeMode).
+ *
+ * @pre The Actor has been initialized.
+ * @param [in] factor A Vector3 representing the relative factor to be applied to each axis.
+ */
+ void SetSizeModeFactor(const Vector3& factor);
+
+ /**
+ * @brief Retrieve the relative to parent size factor of the actor.
+ *
+ * @pre The Actor has been initialized.
+ * @return The Actor's current relative size factor.
+ */
+ Vector3 GetSizeModeFactor() const;
+
+ /**
* @brief Retrieves the world-matrix of the actor.
*
* @note The actor will not have a world-matrix, unless it has previously been added to the stage.
MouseWheelEventSignalType& MouseWheelEventSignal();
/**
- * @brief Signal to indicate when the actor's size is set by application code.
- *
- * This signal is emitted when actors size is being <b>set</b> by application code.
- * This signal is <b>not</b> emitted when size is animated
- * Note! GetCurrentSize might not return this same size as the set size message may still be queued
- * A callback of the following type may be connected:
- * @code
- * void YourCallback(Actor actor, const Vector3& newSize);
- * @endcode
- * @pre The Actor has been initialized.
- * @return The signal to connect to.
- */
- SetSizeSignalType& SetSizeSignal();
-
- /**
* @brief This signal is emitted after the actor has been connected to the stage.
*
* When an actor is connected, it will be directly or indirectly parented to the root Actor.
*
* @post The image actor uses the natural image size after an image
* has been loaded.
- * @note Actor::SetSizeSignal() will be triggered if there is a current image.
*/
void SetToNaturalSize();
const unsigned int CORE_MAJOR_VERSION = 1;
const unsigned int CORE_MINOR_VERSION = 0;
-const unsigned int CORE_MICRO_VERSION = 29;
+const unsigned int CORE_MICRO_VERSION = 30;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
namespace Dali
{
+PanGesture::PanGesture()
+: Gesture(Gesture::Pan, Gesture::Clear),
+ numberOfTouches(1)
+{
+}
+
PanGesture::PanGesture(Gesture::State state)
: Gesture(Gesture::Pan, state),
numberOfTouches(1)
/**
* @brief Default Constructor.
+ */
+ PanGesture();
+
+ /**
+ * @brief Constructor.
*
* @param[in] state The state of the gesture
*/
Name: dali
Summary: The OpenGLES Canvas Core Library
-Version: 1.0.29
+Version: 1.0.30
Release: 1
Group: System/Libraries
License: Apache-2.0