END_TEST;
}
-int UtcDaliActorFindChildByAlias(void)
-{
- tet_infoline("Testing Dali::Actor::FindChildByAlias()");
- TestApplication application;
-
- Actor parent = Actor::New();
- parent.SetName( "parent" );
- Actor first = Actor::New();
- first .SetName( "first" );
- Actor second = Actor::New();
- second.SetName( "second" );
-
- parent.Add(first);
- first.Add(second);
-
- Actor found = parent.FindChildByAlias( "foo" );
- DALI_TEST_CHECK( !found );
-
- found = parent.FindChildByAlias( "parent" );
- DALI_TEST_CHECK( found == parent );
-
- found = parent.FindChildByAlias( "first" );
- DALI_TEST_CHECK( found == first );
-
- found = parent.FindChildByAlias( "second" );
- DALI_TEST_CHECK( found == second );
- END_TEST;
-}
-
int UtcDaliActorFindChildById(void)
{
tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
{
AddToCallStacks("OnKeyInputFocusLost");
}
- virtual Actor GetChildByAlias(const std::string& actorAlias)
- {
- AddToCallStacks("GetChildByAlias");
-
- if ("found" == actorAlias)
- {
- return Actor::New();
- }
- else
- {
- return Actor();
- }
- }
-
virtual Vector3 GetNaturalSize()
{
return Vector3( 0.0f, 0.0f, 0.0f );
{
}
- virtual Actor GetChildByAlias(const std::string& actorAlias)
- {
- return Actor();
- }
-
virtual Vector3 GetNaturalSize()
{
return Vector3( 0.0f, 0.0f, 0.0f );
END_TEST;
}
-int UtcDaliCustomActorFindChildByAlias(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::CustomActor::GetChildByAlias()");
-
- TestCustomActor custom = TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
- custom.Add(Actor::New());
-
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
- DALI_TEST_CHECK( !custom.FindChildByAlias("not-found") );
-
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "GetChildByAlias", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
-
- DALI_TEST_CHECK( custom.FindChildByAlias("found") );
- END_TEST;
-}
-
int UtcDaliCustomActorImplOnPropertySet(void)
{
TestApplication application;
virtual void OnKeyInputFocusLost()
{
}
- virtual Actor GetChildByAlias(const std::string& actorAlias)
- {
- return Actor::New();
- }
-
virtual Vector3 GetNaturalSize()
{
return Vector3( 0.0f, 0.0f, 0.0f );
return child;
}
-Dali::Actor Actor::FindChildByAlias(const std::string& actorAlias)
-{
- Dali::Actor child = DoGetChildByAlias(actorAlias);
-
- // If not found then search by name.
- if (!child)
- {
- Internal::ActorPtr child_ptr = FindChildByName(actorAlias);
- if (child_ptr)
- {
- child = Dali::Actor(child_ptr.Get());
- }
- }
-
- return child;
-}
-
-Dali::Actor Actor::DoGetChildByAlias(const std::string& actorAlias)
-{
- Dali::Actor child = GetChildByAlias(actorAlias);
-
- if (!child && mChildren )
- {
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
- {
- child = GetImplementation(*iter).DoGetChildByAlias(actorAlias);
-
- if (child)
- {
- break;
- }
- }
- }
-
- return child;
-}
-
ActorPtr Actor::FindChildById(const unsigned int id)
{
ActorPtr child = 0;
ActorPtr FindChildByName(const std::string& actorName);
/**
- * @copydoc Dali::Actor::FindChildByAlias
- */
- Dali::Actor FindChildByAlias(const std::string& actorAlias);
-
- /**
* @copydoc Dali::Actor::FindChildById
*/
ActorPtr FindChildById(const unsigned int id);
*/
virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) { return false; }
- /**
- * For use in derived class
- * If an alias for a child exists, return the child otherwise return an empty handle.
- * For example 'previous' could return the last selected child.
- * @pre The Actor has been initialized.
- * @param[in] actorAlias the name of the actor to find
- * @return A handle to the actor if found, or an empty handle if not.
- */
- virtual Dali::Actor GetChildByAlias(const std::string& actorAlias) { return Dali::Actor(); }
-
- /**
- * Support function for FindChildByAlias
- * @pre The Actor has been initialized.
- * @param[in] actorAlias the name of the aliased actor to find
- * @return A handle to the actor if found, or an empty handle if not.
- */
- Dali::Actor DoGetChildByAlias(const std::string& actorAlias);
-
protected:
StagePtr mStage; ///< Used to send messages to Node; valid until Core destruction
}
/**
- * @copydoc Internal::Actor::GetChildByAlias
- */
- virtual Dali::Actor GetChildByAlias(const std::string& actorAlias)
- {
- return mImpl->GetChildByAlias(actorAlias);
- }
-
- /**
* @copydoc Internal::Actor::GetNaturalSize
*/
virtual Vector3 GetNaturalSize() const
return Actor(child.Get());
}
-Actor Actor::FindChildByAlias(const std::string& actorAlias)
-{
- Actor child = GetImplementation(*this).FindChildByAlias(actorAlias);
- return child;
-}
-
Actor Actor::FindChildById(const unsigned int id)
{
Internal::ActorPtr child = GetImplementation(*this).FindChildById(id);
Actor FindChildByName(const std::string& actorName);
/**
- * @brief Search through this actor's hierarchy for an actor with the given name or alias.
- *
- * Actors can customize this function to provide actors with preferred alias'
- * For example 'previous' could return the last selected child.
- * If no aliased actor is found then FindChildByName() is called.
- * @pre The Actor has been initialized.
- * @param[in] actorAlias the name of the actor to find
- * @return A handle to the actor if found, or an empty handle if not.
- */
- Actor FindChildByAlias(const std::string& actorAlias);
-
- /**
* @brief Search through this actor's hierarchy for an actor with the given unique ID.
*
* The actor itself is also considered in the search
virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) = 0;
/**
- * @brief Called to find a child by an alias.
- *
- * If an alias for a child exists, return the child otherwise return an empty handle.
- * For example 'previous' could return the last selected child.
- * @pre The Actor has been initialized.
- * @param[in] actorAlias the name of the actor to find
- * @return A handle to the actor if found, or an empty handle if not.
- */
- virtual Dali::Actor GetChildByAlias(const std::string& actorAlias) = 0;
-
- /**
* Return the natural size of the actor
*
* @return The actor's natural size