Property::Index index =1;
Actor placementActor = Actor::New();
+ DALI_TEST_CHECK( !dummyImpl.GetVisual( index ) );
+ DALI_TEST_CHECK( !dummyImpl.GetPlacementActor( index ) );
+
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
Property::Map newMap;
newMap[Visual::Property::TYPE] = Visual::COLOR;
// ReRegister with altered color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
tet_result(TET_PASS);
END_TEST;
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
// ReRegister to self
dummyImpl.RegisterVisual( index, dummy, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == dummy );
+
END_TEST;
}
// Register to self
dummyImpl.RegisterVisual( index, dummy, visual );
DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), false, TEST_LOCATION ); // Control not destroyed yet
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == dummy );
}
DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), true, TEST_LOCATION ); // Should be destroyed
// ReRegister with altered color visual
dummyImpl.RegisterVisual( index2, secondPlacementActor, secondVisual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index2 ) == secondVisual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index2 ) == secondPlacementActor );
+
END_TEST;
}
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
// Unregister visual
dummyImpl.UnregisterVisual( index );
+ DALI_TEST_CHECK( !dummyImpl.GetVisual( index ) );
+ DALI_TEST_CHECK( !dummyImpl.GetPlacementActor( index ) );
+
END_TEST;
}
}
}
+Toolkit::Visual::Base Control::GetVisual( Property::Index index )
+{
+ std::vector< RegisteredVisual >::iterator iter;
+ if ( FindVisual( index, mImpl->mVisuals, iter ) )
+ {
+ return (*iter).visual;
+ }
+
+ return Toolkit::Visual::Base();
+}
+
+Actor Control::GetPlacementActor( Property::Index index )
+{
+ std::vector< RegisteredVisual >::iterator iter;
+ if ( FindVisual( index, mImpl->mVisuals, iter ) )
+ {
+ if( (*iter).placementActor )
+ {
+ return (*iter).placementActor;
+ }
+ else
+ {
+ return Self();
+ }
+ }
+
+ return Actor();
+}
+
bool Control::OnAccessibilityActivated()
{
return false; // Accessibility activation is not handled by default
*/
void UnregisterVisual( Property::Index index );
+ /**
+ * @brief Retrieve the visual associated with the given property index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @param[in] index The Property index of the visual.
+ * @return The registered visual if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ */
+ Toolkit::Visual::Base GetVisual( Property::Index index );
+
+ /**
+ * @brief Retrieve the placement actor associated with the given index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @@param[in] index The Property index of the visual.
+ * @return Then placement actor if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned placement actor as a member which increments its reference count.
+ */
+ Actor GetPlacementActor( Property::Index index );
+
/**
* @brief Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal
*