{
}
-void DummyControlImpl::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual )
+void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual )
{
- Control::RegisterVisual( index, placementActor, visual );
+ Control::RegisterVisual( index, visual );
}
-void DummyControlImpl::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual, bool enabled )
+void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled )
{
- Control::RegisterVisual( index, placementActor, visual, enabled );
+ Control::RegisterVisual( index, visual, enabled );
}
void DummyControlImpl::UnregisterVisual( Property::Index index )
return Control::IsVisualEnabled( index );
}
-Actor DummyControlImpl::GetPlacementActor( Property::Index index )
-{
- return Control::GetPlacementActor( index );
-}
-
Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
{
return Control::CreateTransition( transition );
inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
- void RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual);
- void RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual, bool enabled );
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
void UnregisterVisual( Property::Index index );
void EnableVisual( Property::Index index, bool enabled );
bool IsVisualEnabled( Property::Index index );
Toolkit::Visual::Base GetVisual( Property::Index index );
- Actor GetPlacementActor( Property::Index index );
Animation CreateTransition( const Toolkit::TransitionData& transition );
// Used to test signal connections
"{\"styles\":{\n"
" \"textlabel\":\n"
" {\n"
- " \"fontStyle\":\"Regular\",\n"
+ " \"fontStyle\":{\"weight\":\"normal\"},\n"
" \"pointSize\":18\n"
" }\n"
" }\n"
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
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;
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( index, placementActor, visual );
+ dummyImpl.RegisterVisual( index, visual );
DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
- DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
Property::Map newMap;
newMap[Visual::Property::TYPE] = Visual::COLOR;
DALI_TEST_CHECK(visual);
// ReRegister with altered color visual
- dummyImpl.RegisterVisual( index, placementActor, visual );
+ dummyImpl.RegisterVisual( index, visual );
DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
- DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
tet_result(TET_PASS);
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
Property::Index index =1;
- Actor placementActor = Actor::New();
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( index, placementActor, visual );
+ dummyImpl.RegisterVisual( index, visual );
DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
- DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
// ReRegister to self
- dummyImpl.RegisterVisual( index, dummy, visual );
+ dummyImpl.RegisterVisual( index, visual );
DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
- DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == dummy );
END_TEST;
}
objectDestructionTracker.Start( dummy );
Property::Index index = 1;
- Actor placementActor = Actor::New();
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
DALI_TEST_CHECK(visual);
// Register to self
- dummyImpl.RegisterVisual( index, dummy, visual );
+ dummyImpl.RegisterVisual( index, 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
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
Property::Index index =1;
- Actor placementActor = Actor::New();
-
Property::Index index2 =2;
- Actor secondPlacementActor = Actor::New();
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( index, placementActor, visual );
+ dummyImpl.RegisterVisual( index, visual );
Property::Map newMap;
newMap[Visual::Property::TYPE] = Visual::COLOR;
DALI_TEST_CHECK( secondVisual );
// ReRegister with altered color visual
- dummyImpl.RegisterVisual( index2, secondPlacementActor, secondVisual );
+ dummyImpl.RegisterVisual( index2, 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;
}
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
Property::Index index =1;
- Actor placementActor = Actor::New();
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( index, placementActor, visual );
+ dummyImpl.RegisterVisual( index, 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;
}
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( TEST_PROPERTY, dummy, visual, false );
+ dummyImpl.RegisterVisual( TEST_PROPERTY, visual, false );
DALI_TEST_CHECK( dummyImpl.GetVisual( TEST_PROPERTY ) == visual );
DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY ) == false );
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( TEST_PROPERTY, dummy, visual );
+ dummyImpl.RegisterVisual( TEST_PROPERTY, visual );
Stage::GetCurrent().Add(dummy);
DALI_TEST_CHECK(visual);
// Register index with a color visual
- dummyImpl.RegisterVisual( TEST_PROPERTY, dummy, visual, false );
+ dummyImpl.RegisterVisual( TEST_PROPERTY, visual, false );
Stage::GetCurrent().Add(dummy);
// Render and notify
DALI_TEST_CHECK(visual2);
// Register index with a color visual
- dummyImpl.RegisterVisual( TEST_PROPERTY1, dummy, visual1 );
+ dummyImpl.RegisterVisual( TEST_PROPERTY1, visual1 );
// Register second index with a color visual
- dummyImpl.RegisterVisual( TEST_PROPERTY2, dummy, visual2 );
+ dummyImpl.RegisterVisual( TEST_PROPERTY2, visual2 );
Stage::GetCurrent().Add(dummy);
// Render and notify
#include <sstream>
#include <dali-toolkit-test-suite-utils.h>
#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/public-api/images/buffer-image.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
const unsigned int TOTAL_PAGE_NUMBER = 20;
const Vector2 PAGE_SIZE( 300.f,400.f );
-const unsigned int IMAGE_WIDTH = 30;
-const unsigned int IMAGE_HEIGHT = 30;
-const Vector2 IMAGE_SIZE( static_cast<float>( IMAGE_WIDTH ), static_cast<float>(IMAGE_HEIGHT) );
const Vector2 SPINE_SHADOW_PARAMETER( 60.0f, 30.0f );
static bool gObjectCreatedCallBackCalled;
{
public:
- TestPageFactory(ToolkitTestApplication& application)
- : mApplication( application )
+ TestPageFactory(ToolkitTestApplication& application, bool returnValidTexture = true )
+ : mApplication( application ),
+ mValidTexture( returnValidTexture )
{
mTotalPageNumber = TOTAL_PAGE_NUMBER;
}
}
/**
- * Create an image to represent a page content.
+ * Create an texture to represent a page content.
* @param[in] pageId The ID of the page to create.
* @return An image, or an empty handle if the ID is out of range.
*/
- virtual Image NewPage( unsigned int pageId )
+ virtual Texture NewPage( unsigned int pageId )
{
- return BufferImage::WHITE();
+ if( mValidTexture )
+ {
+ return Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, 100, 100 );
+ }
+ return Texture(); // empty handle
}
private:
ToolkitTestApplication& mApplication;
unsigned int mTotalPageNumber;
+ bool mValidTexture;
};
}// namespace
DALI_TEST_CHECK( factory.GetExtension() == NULL );
END_TEST;
}
+
+int UtcDaliPageTurnEmptyTextureHandle(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnEmptyTextureHandle ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+
+ TestPageFactory factory(application, false); // returns empty handles
+ Vector2 size = Stage::GetCurrent().GetSize();
+ try
+ {
+ PageTurnView portraitView = PageTurnPortraitView::New( factory, size );
+ portraitView.SetParentOrigin( ParentOrigin::CENTER );
+ Stage::GetCurrent().Add( portraitView );
+
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& e)
+ {
+ DALI_TEST_ASSERT(e, "must pass in valid texture", TEST_LOCATION );
+ }
+ catch (...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
keyState );
}
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextEditorConstructorP(void)
// Check font properties.
editor.SetProperty( TextEditor::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+ Property::Value* slantValue = NULL;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check that the Alignment properties can be correctly set
editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "END" );
// Check input font properties.
editor.SetProperty( TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset input font style.
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check the line spacing property
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Check the underline property
- editor.SetProperty( TextEditor::Property::UNDERLINE, "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), std::string("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}"), TEST_LOCATION );
+
+ Property::Map underlineMapSet;
+ Property::Map underlineMapGet;
+
+ underlineMapSet.Insert( "enable", "true" );
+ underlineMapSet.Insert( "color", "red" );
+ underlineMapSet.Insert( "height", "1" );
+
+ editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet );
+
+ underlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::UNDERLINE );
+ DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
// Check the input underline property
editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "Underline input properties" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
// Check the shadow property
- editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::SHADOW ), std::string("{\"color\":\"green\",\"offset\":\"2 2\"}"), TEST_LOCATION );
+ Property::Map shadowMapSet;
+ Property::Map shadowMapGet;
+
+ shadowMapSet.Insert( "color", "green" );
+ shadowMapSet.Insert( "offset", "2 2" );
+
+ editor.SetProperty( TextEditor::Property::SHADOW, shadowMapSet );
+
+ shadowMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::SHADOW );
+ DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
// Check the input shadow property
editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "Shadow input properties" );
const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
- const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
{
DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
- const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_CHECK( style.empty() );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 20.f );
editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 5.f );
inputStyleChangedSignal = false;
editor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVuSerif" );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"black\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "black" );
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
// Create a tap event to touch the text editor.
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
return tap;
}
-
Integration::LongPressGestureEvent GenerateLongPress(
Gesture::State state,
unsigned int numberOfTouches,
keyState );
}
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextFieldConstructorP(void)
// Check font properties.
field.SetProperty( TextField::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+ Property::Value* slantValue = NULL;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check that the MAX_LENGTH property can be correctly set
const int maxNumberOfCharacters = 20;
// Check input font properties.
field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset input font style.
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ Property::Map underlineMapSet;
+ Property::Map underlineMapGet;
+
+ underlineMapSet.Insert( "enable", "true" );
+ underlineMapSet.Insert( "color", "red" );
+ underlineMapSet.Insert( "height", "1" );
// Check the underline property
- field.SetProperty( TextField::Property::UNDERLINE, "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::UNDERLINE ), std::string("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::UNDERLINE, underlineMapSet );
+
+ underlineMapGet = field.GetProperty<Property::Map>( TextField::Property::UNDERLINE );
+ DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
// Check the input underline property
field.SetProperty( TextField::Property::INPUT_UNDERLINE, "Underline input properties" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
// Check the shadow property
- field.SetProperty( TextField::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::SHADOW ), std::string("{\"color\":\"green\",\"offset\":\"2 2\"}"), TEST_LOCATION );
+ Property::Map shadowMapSet;
+ Property::Map shadowMapGet;
+
+ shadowMapSet.Insert( "color", "green" );
+ shadowMapSet.Insert( "offset", "2 2" );
+
+ field.SetProperty( TextField::Property::SHADOW, shadowMapSet );
+
+ shadowMapGet = field.GetProperty<Property::Map>( TextField::Property::SHADOW );
+ DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
// Check the input shadow property
field.SetProperty( TextField::Property::INPUT_SHADOW, "Shadow input properties" );
const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
- const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ const Property::Map fontStyleMapGet = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<Property::Map>();
+
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "bold" );
+
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 20.f );
field.SetProperty( TextField::Property::INPUT_UNDERLINE, "underline" );
field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"width\":\"expanded\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"width\":\"expanded\",\"slant\":\"italic\"}", TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( TextField::Property::TEXT_COLOR, Color::RED );
DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::RED, TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "width", "expanded" );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"width\":\"expanded\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"width\":\"expanded\"}", TEST_LOCATION );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
END_TEST;
}
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextLabelConstructorP(void)
// Check font properties.
label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ // Check the old font style format.
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+
+ // Replace 'roman' for 'normal'.
+ Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Toggle multi-line
label.SetProperty( TextLabel::Property::MULTI_LINE, true );
// The underline color is changed as well.
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::UNDERLINE_COLOR ), Color::BLUE, TEST_LOCATION );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::UNDERLINE ), std::string("{\"enable\":\"false\",\"color\":\"blue\",\"height\":\"0\"}"), TEST_LOCATION );
+ Property::Map underlineMapSet;
+ Property::Map underlineMapGet;
+
+ underlineMapSet.Insert( "enable", "false" );
+ underlineMapSet.Insert( "color", "blue" );
+ underlineMapSet.Insert( "height", "0" );
+
+ underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
+ DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
// Check that shadow parameters can be correctly set
label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 3.0f, 3.0f ) );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Check the underline property
- label.SetProperty( TextLabel::Property::UNDERLINE, "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::UNDERLINE ), std::string("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::UNDERLINE, "" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::UNDERLINE ), std::string("{\"enable\":\"false\",\"color\":\"red\",\"height\":\"1\"}"), TEST_LOCATION );
+ underlineMapSet.Clear();
+ underlineMapSet.Insert( "enable", "true" );
+ underlineMapSet.Insert( "color", "red" );
+ underlineMapSet.Insert( "height", "1" );
+
+ label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
+
+ underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
+ DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
+
+ underlineMapSet.Clear();
+
+ Property::Map underlineDisabledMapGet;
+ underlineDisabledMapGet.Insert( "enable", "false" );
+ underlineDisabledMapGet.Insert( "color", "red" );
+ underlineDisabledMapGet.Insert( "height", "1" );
+
+ label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
+ underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
+ DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
// Check the shadow property
- label.SetProperty( TextLabel::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::SHADOW ), std::string("{\"color\":\"green\",\"offset\":\"2 2\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::SHADOW, "" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::SHADOW ), std::string("{\"color\":\"green\",\"offset\":\"0 0\"}"), TEST_LOCATION );
+ Property::Map shadowMapSet;
+ Property::Map shadowMapGet;
+
+ shadowMapSet.Insert( "color", "green" );
+ shadowMapSet.Insert( "offset", "2 2" );
+
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
+
+ shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
+ DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
+
+ shadowMapSet.Clear();
+ Property::Map shadowDisabledMapGet;
+ shadowDisabledMapGet.Insert( "color", "green" );
+ shadowDisabledMapGet.Insert( "offset", "0 0" );
+
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
+
+ shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
+ DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
// Check the emboss property
label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( !anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( !anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( !anim );
visual.SetName( "visual1" );
Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
- dummyImpl.RegisterVisual( visualIndex, actor, visual );
+ dummyImpl.RegisterVisual( visualIndex, visual );
Animation anim = dummyImpl.CreateTransition( transition );
DALI_TEST_CHECK( !anim );
#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/dali-toolkit.h>
#include "dummy-control.h"
namespace
{
-const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.jpg";
const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
}
+} //namespace
+
void dali_visual_startup(void)
{
test_return_value = TET_UNDEF;
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "text", "Hello world" );
propertyMap.Insert( "fontFamily", "TizenSans" );
- propertyMap.Insert( "fontStyle", "{\"weight\":\"bold\"}" );
+
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "bold" );
+ propertyMap.Insert( "fontStyle", fontStyleMapSet );
+
propertyMap.Insert( "pointSize", 12.f );
propertyMap.Insert( "multiLine", true );
propertyMap.Insert( "horizontalAlignment", "CENTER" );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), "TizenSans", TEST_LOCATION );
- value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::STRING );
+ value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::MAP );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "{\"weight\":\"bold\"}", TEST_LOCATION );
+
+ Property::Map fontStyleMapGet = value->Get<Property::Map>();
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
value = resultMap.Find( TextVisual::Property::POINT_SIZE, Property::FLOAT );
DALI_TEST_CHECK( value );
END_TEST;
}
+
+int UtcDaliVisualGetTransform(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualGetTransform: ColorVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base colorVisual = factory.CreateVisual( propertyMap );
+
+ Dali::Property::Map map;
+ Dali::Property::Value transformProperty = colorVisual.GetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM );
+ transformProperty.Get(map);
+
+ //Test default values
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_CHECK( typeValue->Get<Vector2>() == Vector2(0.0f,0.0f) );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::SIZE );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_CHECK( typeValue->Get<Vector2>() == Vector2(1.0f,1.0f) );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_CHECK( typeValue->Get<Vector4>() == Vector4(0.0f,0.0f,0.0f,0.0f) );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
+ }
+
+ END_TEST;
+}
+
+static void TestTransform( ToolkitTestApplication& application, Visual::Base visual )
+{
+ Property::Map transform;
+ transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET, Vector2(10.0f, 10.0f) );
+ transform.Insert( Visual::DevelProperty::Transform::Property::SIZE, Vector2(0.2f, 0.2f) );
+ transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4(1.0f, 1.0f, 0.0f,0.0f) );
+ transform.Insert( Visual::DevelProperty::Transform::Property::ORIGIN, "TOP_BEGIN" );
+ transform.Insert( Visual::DevelProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::BOTTOM_END );
+
+ visual.SetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM, transform );
+
+ Dali::Property::Map map;
+ Dali::Property::Value transformProperty = visual.GetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM );
+ transformProperty.Get(map);
+
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_EQUALS( typeValue->Get<Vector2>(),Vector2(10.0f,10.0f), TEST_LOCATION );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::SIZE );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_EQUALS( typeValue->Get<Vector2>(), Vector2(0.2f,0.2f), TEST_LOCATION );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_EQUALS( typeValue->Get<Vector4>(), Vector4(1.0f,1.0f,0.0f,0.0f), TEST_LOCATION );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::TOP_BEGIN, TEST_LOCATION );
+ }
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT );
+ DALI_TEST_CHECK( typeValue );
+ DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::BOTTOM_END, TEST_LOCATION );
+ }
+
+ //Put the visual on the stage
+ Actor actor = Actor::New();
+ actor.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add( actor );
+ visual.SetOnStage( actor );
+ application.SendNotification();
+ application.Render(0);
+ Renderer renderer( actor.GetRendererAt(0) );
+
+ //Check that the properties have been registered on the Renderer
+ Vector2 offset = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "offset" ) );
+ DALI_TEST_EQUALS( offset, Vector2(10.0f,10.0f), TEST_LOCATION );
+
+ Vector2 size = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "size" ) );
+ DALI_TEST_EQUALS( size, Vector2(0.2f,0.2f), TEST_LOCATION );
+
+ Vector4 offsetSizeMode = renderer.GetProperty<Vector4>( renderer.GetPropertyIndex( "offsetSizeMode" ) );
+ DALI_TEST_EQUALS( offsetSizeMode, Vector4(1.0f,1.0f,0.0f,0.0f), TEST_LOCATION );
+
+ Vector2 parentOrigin = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "origin" ) );
+ DALI_TEST_EQUALS( parentOrigin, Vector2(-0.5f,-0.5f), TEST_LOCATION );
+
+ Vector2 anchorPoint = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "anchorPoint" ) );
+ DALI_TEST_EQUALS( anchorPoint, Vector2(-0.5f,-0.5f), TEST_LOCATION );
+
+ //Set a new transform
+ transform.Clear();
+ transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET, Vector2(20.0f, 20.0f) );
+ transform.Insert( Visual::DevelProperty::Transform::Property::SIZE, Vector2(100.0f, 100.0f) );
+ transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4(0.0f, 0.0f, 1.0f,1.0f) );
+ visual.SetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM, transform );
+ application.SendNotification();
+ application.Render(0);
+
+ //Check that the values have changed in the renderer
+ offset = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "offset" ) );
+ DALI_TEST_EQUALS( offset, Vector2(20.0f,20.0f), TEST_LOCATION );
+
+ size = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "size" ) );
+ DALI_TEST_EQUALS( size, Vector2(100.0f,100.0f), TEST_LOCATION );
+
+ offsetSizeMode = renderer.GetProperty<Vector4>( renderer.GetPropertyIndex( "offsetSizeMode" ) );
+ DALI_TEST_EQUALS( offsetSizeMode, Vector4(0.0f,0.0f,1.0f,1.0f), TEST_LOCATION );
+
+ //Parent origin and anchor point should have default values
+ parentOrigin = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "origin" ) );
+ DALI_TEST_EQUALS( parentOrigin, Vector2(0.0f,0.0f), TEST_LOCATION );
+
+ anchorPoint = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "anchorPoint" ) );
+ DALI_TEST_EQUALS( anchorPoint, Vector2(0.0f,0.0f), TEST_LOCATION );
+}
+
+int UtcDaliVisualSetTransform0(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: ColorVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: PrimitiveVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
+ propertyMap[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4(1.0f,1.0f,1.0f,1.0f);
+ propertyMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
+ propertyMap[ PrimitiveVisual::Property::SLICES ] = 10;
+ propertyMap[ PrimitiveVisual::Property::STACKS ] = 10;
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: GradientVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::GRADIENT );
+ Property::Array stopOffsets;
+ stopOffsets.PushBack( 0.0f );
+ stopOffsets.PushBack( 0.3f );
+ stopOffsets.PushBack( 0.6f );
+ stopOffsets.PushBack( 0.8f );
+ stopOffsets.PushBack( 1.0f );
+ propertyMap.Insert( GradientVisual::Property::STOP_OFFSET, stopOffsets );
+
+ Property::Array stopColors;
+ stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
+ stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f );
+ stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
+ stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
+ stopColors.PushBack( Color::YELLOW );
+ propertyMap.Insert( GradientVisual::Property::STOP_COLOR, stopColors );
+ propertyMap.Insert( GradientVisual::Property::CENTER, Vector2( 0.5f, 0.5f ) );
+ propertyMap.Insert( GradientVisual::Property::RADIUS, 1.414f );
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform3(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: BorderVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::BORDER );
+ propertyMap.Insert( BorderVisual::Property::COLOR, Vector4(0.f, 1.f, 0.f, 0.6f) );
+ propertyMap.Insert( BorderVisual::Property::SIZE, 3.0f );
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform4(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: MeshVisual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_LOCATION );
+ propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 5.0f, 10.0f, 15.0f) );
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform5(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: ImageVisual from Image" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
+ Visual::Base visual = factory.CreateVisual(image);
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform6(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: ImageVisual for URL " );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
+ propertyMap[Toolkit::ImageVisual::Property::URL] = TEST_IMAGE_FILE_NAME;
+ propertyMap[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = 100.0f;
+ propertyMap[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = 100.0f;
+ propertyMap[Toolkit::ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
+ propertyMap[Toolkit::ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
+ propertyMap[Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+int UtcDaliVisualSetTransform7(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetTransform: NPatch visual" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Image image = ResourceImage::New(TEST_NPATCH_FILE_NAME, ImageDimensions(100, 200));
+ Visual::Base visual = factory.CreateVisual(image);
+ TestTransform( application, visual );
+
+ END_TEST;
+}
+
+
--- /dev/null
+#ifndef __DALI_TOOLKIT_DEVEL_API_ALIGN_ENUMS_H__
+#define __DALI_TOOLKIT_DEVEL_API_ALIGN_ENUMS_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Direction
+{
+ enum Type
+ {
+ LEFT_TO_RIGHT = 0,
+ RIGHT_TO_LEFT
+ };
+}
+
+/**
+ * @brief Enum used to describe anchor point and parent origin of visuals
+ */
+namespace Align
+{
+ enum Type
+ {
+ TOP_BEGIN = 0,
+ TOP_CENTER,
+ TOP_END,
+ CENTER_BEGIN,
+ CENTER,
+ CENTER_END,
+ BOTTOM_BEGIN,
+ BOTTOM_CENTER,
+ BOTTOM_END
+ };
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_DEVEL_API_ALIGN_ENUMS_H__
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/rendering/texture.h>
namespace Dali
{
{
/**
- * @brief PageFactory is an abstract interface for providing images to PageTurnView
+ * @brief PageFactory is an abstract interface for providing textures to PageTurnView
* Each page is identified by a unique ID, and has a linear order from 0 to GetNumberOfPages()-1
*
* @SINCE_1_1.4
/**
* @brief Virtual destructor
- * @SINCE_1_1.4
*/
virtual ~PageFactory(){};
* @brief Query the number of pages available from the factory.
*
* The maximum available page has an ID of GetNumberOfPages()-1.
- * @SINCE_1_1.4
* @return The page count.
*/
virtual unsigned int GetNumberOfPages() = 0;
/**
- * @brief Create an actor to represent the page content.
- * @SINCE_1_1.30
+ * @brief Return the texture for the page
*
- * If no valid image provided, a broken image is displayed.
- * For double-sided page( PageTurnLandscapeView ), the left half of image is used as page front side, and the right half as page back side.
+ * For double-sided page( PageTurnLandscapeView ), the left half of texture is used as page front side, and the right half as page back side.
+ *
+ * @note Must return a valid texture handle!
*
* @param[in] pageId The ID of the page to create.
* @return An actor, or an uninitialized pointer if the ID is out of range.
*/
- virtual Image NewPage( unsigned int pageId ) = 0;
+ virtual Texture NewPage( unsigned int pageId ) = 0;
/**
* @brief Retrieve the extension for this factory
- * @SINCE_1_1.30
*
* @return The extension if available, NULL otherwise.
*/
# Add devel header files here
+devel_api_header_files = \
+ $(devel_api_src_dir)/align-enums.h
+
devel_api_controls_header_files = \
$(devel_api_src_dir)/controls/control-depth-index-ranges.h
devel_api_visual_factory_header_files = \
$(devel_api_src_dir)/visual-factory/transition-data.h \
+ $(devel_api_src_dir)/visual-factory/devel-visual-properties.h \
$(devel_api_src_dir)/visual-factory/visual-factory.h \
$(devel_api_src_dir)/visual-factory/visual-base.h
* @details Name "transform", type Property::Map.
* @note Optional.
- * @see Transform::Property
+ * @see DevelProperty::Transform::Property
*/
TRANSFORM = SHADER+1//Dali::Toolkit::Visual::Property::SHADER+1
};
+namespace Transform
+{
+
+namespace Property
+{
+
+enum Type
+{
+ /**
+ * @brief Offset of the visual. It can be either relative (percentage of the parent)
+ * or absolute (in world units).
+ * @details Name "offset", type Property::VECTOR2
+ */
+ OFFSET,
+
+ /**
+ * @brief Size of the visual. It can be either relative (percentage of the parent)
+ * or absolute (in world units).
+ * @details Name "size", type Property::VECTOR2
+ */
+ SIZE,
+
+ /**
+ * @brief The origin of the visual within its control area.
+ * @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
+ * @see Toolkit::Align
+ */
+ ORIGIN,
+
+ /**
+ * @brief The anchor-point of the visual
+ * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
+ * @see Toolkit::Align
+ */
+ ANCHOR_POINT,
+
+ /**
+ * @brief Indicates which components of the offset and size are relative
+ * (percentage of the parent) or absolute (in world units).
+ * 0 indicates the component is relative, and 1 absolute.
+ * @details Name "offsetSizeMode", type Property::VECTOR4
+ */
+ OFFSET_SIZE_MODE
+};
+
+} //namespace Property
+
+} //namespace Transform
+
} // namespace DevelProperty
} // namespace Visual
visual = visualFactory.CreateVisual( map );
- RegisterVisual( visualIndex, placementActor, visual );
+ RegisterVisual( visualIndex, visual );
SetupContent( *contentActor, placementActor ); //
contentActor->SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
}
}
- Image dummyImage; // Dummy image, force creation of an image visual
+ FrameBufferImage dummyImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+
InitializeVisual( self, mVisualPostFilter, dummyImage );
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE;
mImage = image;
- Actor self( Self() );
mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
- RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual );
mImageSize = image ? ImageDimensions( image.GetWidth(), image.GetHeight() ) : ImageDimensions( 0, 0 );
RelayoutRequest();
mImage.Reset();
mPropertyMap = map;
- Actor self( Self() );
mVisual = Toolkit::VisualFactory::Get().CreateVisual( mPropertyMap );
- RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual );
Property::Value* widthValue = mPropertyMap.Find( "width" );
if( widthValue )
mImageSize = size;
}
- Actor self( Self() );
mVisual = Toolkit::VisualFactory::Get().CreateVisual( url, size );
- RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual );
mVisual.SetSize( mSizeSet );
#include <cstring> // for strcmp
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/devel-api/images/texture-set-image.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
namespace //Unnamed namespace
{
-// broken image is loaded if there is no valid image provided for the page
-const char * const BROKEN_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
-
// properties set on shader, these properties have the constant value in regardless of the page status
const char * const PROPERTY_SPINE_SHADOW ( "uSpineShadowParameter" ); // uniform for both spine and turn effect
propertyTurnDirection = actor.RegisterProperty(PROPERTY_TURN_DIRECTION, -1.f);
}
-void PageTurnView::Page::SetImage( Image image )
+void PageTurnView::Page::SetTexture( Texture texture )
{
if( !textureSet )
{
textureSet = TextureSet::New();
}
-
- TextureSetImage( textureSet, 0u, image );
+ textureSet.SetTexture( 0u, texture );
}
void PageTurnView::Page::UseEffect(Shader newShader)
Self().Add( mPages[i].actor );
}
- // create the layer for turning images
+ // create the layer for turning pages
mTurningPageLayer = Layer::New();
mTurningPageLayer.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
mTurningPageLayer.SetBehavior(Layer::LAYER_3D);
{
int index = pageIndex % NUMBER_OF_CACHED_PAGES;
- Image newPageImage;
- newPageImage = mPageFactory->NewPage( pageIndex );
-
- if( !newPageImage ) // load the broken image
- {
- newPageImage = ResourceImage::New( BROKEN_IMAGE_URL );
- }
+ Texture newPage;
+ newPage = mPageFactory->NewPage( pageIndex );
+ DALI_ASSERT_ALWAYS( newPage && "must pass in valid texture" );
bool isLeftSide = ( pageIndex < mCurrentPageIndex );
if( mPages[index].isTurnBack != isLeftSide )
mPages[index].actor.SetOrientation( Degree( degree ), Vector3::YAXIS );
mPages[index].actor.SetVisible( false );
mPages[index].UseEffect( mSpineEffectShader, mGeometry );
- mPages[index].SetImage( newPageImage );
+ mPages[index].SetTexture( newPage );
// For Portrait, nothing to do
// For Landscape, set the parent origin to CENTER
- OnAddPage( mPages[index].actor, isLeftSide );
+ OnAddPage( mPages[index].actor, isLeftSide );
}
}
~Page(){};
/**
- * Set the page image content
- * @param[in] image The content of the page.
+ * Set the page texture content
+ * @param[in] texture The content of the page.
*/
- void SetImage( Image image );
+ void SetTexture( Texture texture );
/**
* Apply an effect onto the page actor.
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "text", STRING, TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "textColor", VECTOR4, TEXT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollThreshold", FLOAT, SCROLL_THRESHOLD )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputColor", VECTOR4, INPUT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", STRING, INPUT_FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", MAP, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineSpacing", FLOAT, LINE_SPACING )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputLineSpacing", FLOAT, INPUT_LINE_SPACING )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", STRING, INPUT_UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", STRING, INPUT_SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", STRING, INPUT_EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", STRING, OUTLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", STRING, INPUT_OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", MAP, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", MAP, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", MAP, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", MAP, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", MAP, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderText", STRING, PLACEHOLDER_TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextFocused", STRING, PLACEHOLDER_TEXT_FOCUSED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "maxLength", INTEGER, MAX_LENGTH )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "exceedPolicy", INTEGER, EXCEED_POLICY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputColor", VECTOR4, INPUT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", STRING, INPUT_FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", MAP, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", STRING, INPUT_UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", STRING, INPUT_SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", STRING, INPUT_EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", STRING, OUTLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", STRING, INPUT_OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", MAP, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", MAP, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", MAP, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", MAP, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", MAP, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", STRING, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", MAP, OUTLINE )
DALI_TYPE_REGISTRATION_END()
Vector4 color;
bool offsetDefined = false;
Vector2 offset;
- const bool empty = Text::ParseProperties( value.Get<std::string>(),
- colorDefined,
- color,
- offsetDefined,
- offset );
+ const bool empty = Text::ParseShadowProperties( value.Get<Property::Map>(),
+ colorDefined,
+ color,
+ offsetDefined,
+ offset );
if( !empty )
{
Vector4 color;
bool offsetDefined = false;
Vector2 offset;
- const bool empty = Text::ParseProperties( value.Get<std::string>(),
- colorDefined,
- color,
- offsetDefined,
- offset );
+ const bool empty = Text::ParseShadowProperties( value.Get<Property::Map>(),
+ colorDefined,
+ color,
+ offsetDefined,
+ offset );
if( !empty )
{
Vector4 color;
bool heightDefined = false;
float height = 0.f;
- const bool empty = Text::ParseProperties( value.Get<std::string>(),
- enabled,
- colorDefined,
- color,
- heightDefined,
- height );
+ const bool empty = Text::ParseUnderlineProperties( value.Get<Property::Map>(),
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height );
if( !empty )
{
Vector4 color;
bool heightDefined = false;
float height = 0.f;
- const bool empty = Text::ParseProperties( value.Get<std::string>(),
- enabled,
- colorDefined,
- color,
- heightDefined,
- height );
+ const bool empty = Text::ParseUnderlineProperties( value.Get<Property::Map>(),
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height );
if( !empty && colorDefined )
{
Vector4 color;
bool heightDefined = false;
float height = 0.f;
- const bool empty = Text::ParseProperties( value.Get<std::string>(),
- enabled,
- colorDefined,
- color,
- heightDefined,
- height );
+ const bool empty = Text::ParseUnderlineProperties( value.Get<Property::Map>(),
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height );
if( !empty && heightDefined )
{
visualMap[Toolkit::TextVisual::Property::RENDERING_BACKEND] = static_cast<int>( DEFAULT_RENDERING_BACKEND );
mVisual = Toolkit::VisualFactory::Get().CreateVisual( visualMap );
- RegisterVisual( Toolkit::TextLabel::Property::TEXT, self, mVisual );
+ RegisterVisual( Toolkit::TextLabel::Property::TEXT, mVisual );
Internal::Visual::Base& visualBase = Toolkit::GetImplementation( mVisual );
TextVisual* textVisual = static_cast<TextVisual*>( &visualBase );
mRootActor.Add( mActorForComposite );
- Image dummyImage; // Dummy image, force creation of an image visual
-
- InitializeVisual( mActorForComposite, mVisualForEmboss1, dummyImage );
+ InitializeVisual( mActorForComposite, mVisualForEmboss1, mImageForEmboss1 );
Toolkit::GetImplementation( mVisualForEmboss1 ).SetCustomShader( customShader );
-
- InitializeVisual( mActorForComposite, mVisualForEmboss2, dummyImage );
- Toolkit::GetImplementation( mVisualForEmboss2 ).SetCustomShader( customShader );
-
- TextureSet textureSet1 = TextureSet::New();
- TextureSetImage( textureSet1, 0, mImageForEmboss1 );
- mActorForComposite.GetRendererAt(0).SetTextures( textureSet1 );
mActorForComposite.GetRendererAt(0).RegisterProperty( COLOR_UNIFORM_NAME, Color::BLACK );
-
- TextureSet textureSet2 = TextureSet::New();
- TextureSetImage( textureSet2, 0, mImageForEmboss2 );
- mActorForComposite.GetRendererAt(1).SetTextures( textureSet2 );
+ InitializeVisual( mActorForComposite, mVisualForEmboss2, mImageForEmboss2 );
+ Toolkit::GetImplementation( mVisualForEmboss2 ).SetCustomShader( customShader );
mActorForComposite.GetRendererAt(1).RegisterProperty( COLOR_UNIFORM_NAME, Color::WHITE );
SetupCamera();
mGrabHandleEnabled( true ),
mGrabHandlePopupEnabled( true ),
mSelectionEnabled( true ),
+ mUpdateCursorHookPosition( false ),
mUpdateCursorPosition( false ),
mUpdateGrabHandlePosition( false ),
mUpdateLeftSelectionPosition( false ),
const std::string HEIGHT_KEY( "height" );
const std::string ENABLE_KEY( "enable" );
const std::string TRUE_TOKEN( "true" );
+const std::string FALSE_TOKEN( "false" );
}
-bool ParseProperties( const std::string& shadowProperties,
- bool& colorDefined,
- Vector4& color,
- bool& offsetDefined,
- Vector2& offset )
+bool ParseShadowProperties( const Property::Map& shadowPropertiesMap,
+ bool& colorDefined,
+ Vector4& color,
+ bool& offsetDefined,
+ Vector2& offset )
{
- // Parses and applies the style.
- Property::Map map;
- Text::ParsePropertyString( shadowProperties, map );
-
- const bool empty = map.Empty();
+ const unsigned int numberOfItems = shadowPropertiesMap.Count();
- if( !empty )
+ // Parses and applies the style.
+ for( unsigned int index = 0u; index < numberOfItems; ++index )
{
- /// Color key.
- Property::Value* colorValue = map.Find( COLOR_KEY );
+ const KeyValuePair& valueGet = shadowPropertiesMap.GetKeyValue( index );
- colorDefined = colorValue != NULL;
- if( colorDefined )
+ if( COLOR_KEY == valueGet.first.stringKey )
{
- const std::string colorStr = colorValue->Get<std::string>();
+ /// Color key.
+ colorDefined = true;
+
+ const std::string colorStr = valueGet.second.Get<std::string>();
Text::ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
}
-
- /// Offset key.
- Property::Value* offsetValue = map.Find( OFFSET_KEY );
-
- offsetDefined = offsetValue != NULL;
- if( offsetDefined )
+ else if( OFFSET_KEY == valueGet.first.stringKey )
{
- const std::string offsetStr = offsetValue->Get<std::string>();
+ /// Offset key.
+ offsetDefined = true;
+
+ const std::string offsetStr = valueGet.second.Get<std::string>();
StringToVector2( offsetStr.c_str(), offsetStr.size(), offset );
}
}
- return empty;
+ return 0u == numberOfItems;
}
-bool ParseProperties( const std::string& underlineProperties,
- bool& enabled,
- bool& colorDefined,
- Vector4& color,
- bool& heightDefined,
- float& height )
+bool ParseUnderlineProperties( const Property::Map& underlinePropertiesMap,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color,
+ bool& heightDefined,
+ float& height )
{
- // Parses and applies the style.
- Property::Map map;
- Text::ParsePropertyString( underlineProperties, map );
+ const unsigned int numberOfItems = underlinePropertiesMap.Count();
- const bool empty = map.Empty();
-
- if( !empty )
+ // Parses and applies the style.
+ for( unsigned int index = 0u; index < numberOfItems; ++index )
{
- /// Enable key.
- Property::Value* enableValue = map.Find( ENABLE_KEY );
+ const KeyValuePair& valueGet = underlinePropertiesMap.GetKeyValue( index );
- enabled = false;
- const bool enabledDefined = enableValue != NULL;
- if( enabledDefined )
+ if( ENABLE_KEY == valueGet.first.stringKey )
{
- const std::string enableStr = enableValue->Get<std::string>();
+ /// Enable key.
+ const std::string enableStr = valueGet.second.Get<std::string>();
enabled = Text::TokenComparison( TRUE_TOKEN, enableStr.c_str(), enableStr.size() );
}
-
- /// Color key.
- Property::Value* colorValue = map.Find( COLOR_KEY );
-
- colorDefined = colorValue != NULL;
- if( colorDefined )
+ else if( COLOR_KEY == valueGet.first.stringKey )
{
- const std::string colorStr = colorValue->Get<std::string>();
+ /// Color key.
+ colorDefined = true;
+
+ const std::string colorStr = valueGet.second.Get<std::string>();
Text::ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
}
-
- /// Height key.
- Property::Value* heightValue = map.Find( HEIGHT_KEY );
-
- height = 0.f;
- heightDefined = heightValue != NULL;
- if( heightDefined )
+ else if( HEIGHT_KEY == valueGet.first.stringKey )
{
- const std::string heightStr = heightValue->Get<std::string>();
+ /// Height key.
+ heightDefined = true;
+
+ const std::string heightStr = valueGet.second.Get<std::string>();
height = StringToFloat( heightStr.c_str() );
}
}
- return empty;
+ return 0u == numberOfItems;
}
bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
if( controller )
{
- const std::string properties = value.Get<std::string>();
-
- bool enabled = false;
- bool colorDefined = false;
- Vector4 color;
- bool heightDefined = false;
- float height = 0.f;
-
- const bool empty = ParseProperties( properties,
- enabled,
- colorDefined,
- color,
- heightDefined,
- height );
-
- if( !empty )
+ switch( type )
{
- switch( type )
+ case EffectStyle::DEFAULT:
{
- case EffectStyle::DEFAULT:
+ const Property::Map& propertiesMap = value.Get<Property::Map>();
+
+ bool enabled = false;
+ bool colorDefined = false;
+ Vector4 color;
+ bool heightDefined = false;
+ float height = 0.f;
+
+ const bool empty = ParseUnderlineProperties( propertiesMap,
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height );
+
+ if( !empty )
{
if( enabled != controller->IsUnderlineEnabled() )
{
controller->SetUnderlineHeight( height );
update = true;
}
- break;
}
- case EffectStyle::INPUT:
- {
- // Sets the input underline values.
- // TODO: to be implemented.
- break;
- }
- }
- }
- else
- {
- switch( type )
- {
- case EffectStyle::DEFAULT:
+ else
{
// Disable underline.
if( controller->IsUnderlineEnabled() )
controller->SetUnderlineEnabled( false );
update = true;
}
- break;
- }
- case EffectStyle::INPUT:
- {
- // Sets the input underline values.
- // TODO: to be implemented.
- controller->SetInputUnderlineProperties( properties );
- break;
}
+ break;
}
- }
- }
+ case EffectStyle::INPUT:
+ {
+ const std::string& underlineProperties = value.Get<std::string>();
+
+ controller->SetInputUnderlineProperties( underlineProperties );
+ break;
+ }
+ } // switch
+ } // if( controller )
return update;
}
const Vector4& color = controller->GetUnderlineColor();
const float height = controller->GetUnderlineHeight();
- std::string underlineProperties = "{\"enable\":";
- const std::string enabledStr = enabled ? "true" : "false";
- underlineProperties += "\"" + enabledStr + "\",";
+ Property::Map map;
+
+ const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN;
+ map.Insert( ENABLE_KEY, enabledStr );
std::string colorStr;
Vector4ToColorString( color, colorStr );
- underlineProperties += "\"color\":\"" + colorStr + "\",";
+ map.Insert( COLOR_KEY, colorStr );
std::string heightStr;
FloatToString( height, heightStr );
- underlineProperties += "\"height\":\"" + heightStr + "\"}";
+ map.Insert( HEIGHT_KEY, heightStr );
- value = underlineProperties;
+ value = map;
break;
}
case EffectStyle::INPUT:
if( controller )
{
- const std::string properties = value.Get< std::string >();
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ const Property::Map& propertiesMap = value.Get<Property::Map>();
- bool colorDefined = false;
- Vector4 color;
- bool offsetDefined = false;
- Vector2 offset;
+ bool colorDefined = false;
+ Vector4 color;
+ bool offsetDefined = false;
+ Vector2 offset;
- const bool empty = ParseProperties( properties,
- colorDefined,
- color,
- offsetDefined,
- offset );
+ const bool empty = ParseShadowProperties( propertiesMap,
+ colorDefined,
+ color,
+ offsetDefined,
+ offset );
- if( !empty )
- {
- switch( type )
- {
- case EffectStyle::DEFAULT:
+ if( !empty )
{
// Sets the default shadow values.
if( colorDefined && ( controller->GetShadowColor() != color ) )
controller->SetShadowOffset( offset );
update = true;
}
- break;
}
- case EffectStyle::INPUT:
- {
- // Sets the input shadow values.
- // TODO: to be implemented.
- break;
- }
- }
- }
- else
- {
- switch( type )
- {
- case EffectStyle::DEFAULT:
+ else
{
// Disable shadow.
if( Vector2::ZERO != controller->GetShadowOffset() )
{
controller->SetShadowOffset( Vector2::ZERO );
}
- break;
- }
- case EffectStyle::INPUT:
- {
- // Sets the input shadow values.
- // TODO: to be implemented.
- controller->SetInputShadowProperties( properties );
- break;
}
+ break;
}
- }
- }
+ case EffectStyle::INPUT:
+ {
+ const std::string& shadowString = value.Get<std::string>();
+
+ controller->SetInputShadowProperties( shadowString );
+ break;
+ }
+ } // switch
+ } // if( controller )
return update;
}
const Vector4& color = controller->GetShadowColor();
const Vector2& offset = controller->GetShadowOffset();
- std::string shadowProperties = "{";
+ Property::Map map;
std::string colorStr;
Vector4ToColorString( color, colorStr );
- shadowProperties += "\"color\":\"" + colorStr + "\",";
+ map.Insert( COLOR_KEY, colorStr );
std::string offsetStr;
Vector2ToString( offset, offsetStr );
- shadowProperties += "\"offset\":\"" + offsetStr + "\"}";
+ map.Insert( OFFSET_KEY, offsetStr );
- value = shadowProperties;
+ value = map;
break;
}
case EffectStyle::INPUT:
/**
* @brief Parses the shadow properties.
*
+ * @param[in] shadowProperties The map with the shadow properties.
* @param[out] colorDefined Whether the shadow's color is defined.
* @param[out] color The shadow's color.
* @param[out] offsetDefined Whether the shadow's offset is defined.
* @param[out] offset The shadow's offset.
*/
-bool ParseProperties( const std::string& shadowProperties,
- bool& colorDefined,
- Vector4& color,
- bool& offsetDefined,
- Vector2& offset );
+bool ParseShadowProperties( const Property::Map& shadowProperties,
+ bool& colorDefined,
+ Vector4& color,
+ bool& offsetDefined,
+ Vector2& offset );
/**
* @brief Parses the underline properties.
*
+ * @param[in] underlineProperties The map with the underline properties.
* @param[out] enabled Whether the underline is enabled.
* @param[out] colorDefined Whether the underline's color is defined.
* @param[out] color The underline's color.
* @param[out] heightDefined Whether the underline's height is defined.
* @param[out] height The underline's height.
*/
-bool ParseProperties( const std::string& underlineProperties,
- bool& enabled,
- bool& colorDefined,
- Vector4& color,
- bool& heightDefined,
- float& height );
+bool ParseUnderlineProperties( const Property::Map& underlineProperties,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color,
+ bool& heightDefined,
+ float& height );
/**
* @brief Sets the underline properties.
{
if( controller )
{
- const std::string style = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "Text Control %p FONT_STYLE %s\n", controller.Get(), style.c_str() );
-
- // Parses and applies the style.
Property::Map map;
- ParsePropertyString( style, map );
+ if( Property::STRING == value.GetType() )
+ {
+ const std::string& fontStyleProperties = value.Get<std::string>();
+
+ ParsePropertyString( fontStyleProperties, map );
+ }
+ else
+ {
+ map = value.Get<Property::Map>();
+ }
if( !map.Empty() )
{
}
}
- if( weightDefined || widthDefined || slantDefined )
+ Property::Map map;
+
+ if( weightDefined )
{
- std::string styleString("{");
- if( weightDefined )
+ if( TextAbstraction::FontWeight::NONE != weight )
{
- if( TextAbstraction::FontWeight::NONE != weight )
- {
- const std::string weightStr( GetEnumerationName( weight,
- FONT_WEIGHT_STRING_TABLE,
- FONT_WEIGHT_STRING_TABLE_COUNT ) );
+ const std::string weightStr( GetEnumerationName( weight,
+ FONT_WEIGHT_STRING_TABLE,
+ FONT_WEIGHT_STRING_TABLE_COUNT ) );
- styleString += "\"weight\":\"" + weightStr + "\"";
- }
- else
- {
- weightDefined = false;
- }
+ map.Insert( WEIGHT_KEY, weightStr );
}
+ }
- if( widthDefined )
+ if( widthDefined )
+ {
+ if( TextAbstraction::FontWidth::NONE != width )
{
- if( TextAbstraction::FontWidth::NONE != width )
- {
- const std::string widthStr( GetEnumerationName( width,
- FONT_WIDTH_STRING_TABLE,
- FONT_WIDTH_STRING_TABLE_COUNT ) );
+ const std::string widthStr( GetEnumerationName( width,
+ FONT_WIDTH_STRING_TABLE,
+ FONT_WIDTH_STRING_TABLE_COUNT ) );
- if( weightDefined )
- {
- styleString += ",";
- }
- styleString += "\"width\":\"" + widthStr + "\"";
- }
- else
- {
- widthDefined = false;
- }
+ map.Insert( WIDTH_KEY, widthStr );
}
+ }
- if( slantDefined )
+ if( slantDefined )
+ {
+ if( TextAbstraction::FontSlant::NONE != slant )
{
- if( TextAbstraction::FontSlant::NONE != slant )
- {
- const std::string slantStr( GetEnumerationName( slant,
- FONT_SLANT_STRING_TABLE,
- FONT_SLANT_STRING_TABLE_COUNT ) );
-
- if( weightDefined || widthDefined )
- {
- styleString += ",";
- }
- styleString += "\"slant\":\"" + slantStr + "\"";
- }
- else
- {
- slantDefined = false;
- }
- }
+ const std::string slantStr( GetEnumerationName( slant,
+ FONT_SLANT_STRING_TABLE,
+ FONT_SLANT_STRING_TABLE_COUNT ) );
- if( weightDefined || widthDefined || slantDefined )
- {
- styleString += "}";
+ map.Insert( SLANT_KEY, slantStr );
}
- else
- {
- styleString.clear();
- }
-
- value = styleString;
}
+
+ value = map;
}
}
uniform mediump vec3 uSize;\n
uniform mediump float borderSize;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec2 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy;\n
+ }\n
+
void main()\n
{\n
- vec2 position = aPosition*uSize.xy + aDrift*borderSize;\n
+ vec2 position = ComputeVertexPosition() + aDrift*borderSize;\n
gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n
}\n
);
return Dali::Property::Value();
}
+void BorderVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
void BorderVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::BORDER_GEOMETRY );
Shader shader = GetBorderShader();
mImpl->mRenderer = Renderer::New( geometry, shader );
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+
}
void BorderVisual::SetBorderColor(const Vector4& color)
*/
virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
public:
/**
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+
void main()\n
{\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
}\n
);
return Dali::Property::Value();
}
+void ColorVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
void ColorVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
void ColorVisual::SetColor(const Vector4& color)
*/
virtual void DoSetOnStage( Actor& actor );
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
public:
/**
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+
void main()\n
{\n
mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
\n
- vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
}\n
),
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+
void main()\n
{\n
mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
\n
vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
}\n
}
}
+void GradientVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
void GradientVisual::SetSize( const Vector2& size )
{
Visual::Base::SetSize( size );
mImpl->mRenderer.SetTextures( textureSet );
mImpl->mRenderer.RegisterProperty( UNIFORM_ALIGNMENT_MATRIX_NAME, mGradientTransform );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
bool GradientVisual::NewGradient(Type gradientType, const Property::Map& propertyMap)
virtual void DoSetProperties( const Property::Map& propertyMap );
/**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
+ /**
* @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
} // unnamed namespace
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache )
+BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url )
{
- return new BatchImageVisual( factoryCache );
+ BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
+ visual->mImageUrl = url;
+ return visual;
}
BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
+ mImageUrl(""),
mDesiredSize()
{
}
void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
- std::string oldImageUrl = mImageUrl;
- Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
+ // url already passed in constructor
- if( imageURLValue )
+ int desiredWidth = 0;
+ Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
+ if( desiredWidthValue )
{
- imageURLValue->Get( mImageUrl );
-
- int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
- if( desiredWidthValue )
- {
- desiredWidthValue->Get( desiredWidth );
- }
-
- int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
- if( desiredHeightValue )
- {
- desiredHeightValue->Get( desiredHeight );
- }
+ desiredWidthValue->Get( desiredWidth );
+ }
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ int desiredHeight = 0;
+ Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
+ if( desiredHeightValue )
+ {
+ desiredHeightValue->Get( desiredHeight );
}
+
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
void BatchImageVisual::SetSize( const Vector2& size )
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @return A smart-pointer to the newly allocated visual.
*/
- static BatchImageVisualPtr New( VisualFactoryCache& factoryCache );
+ static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url );
public: // from Visual
uniform mediump vec4 pixelArea;
varying mediump vec2 vTexCoord;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+
void main()\n
{\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- vertexPosition = uMvpMatrix * vertexPosition;\n
- \n
+ mediump vec4 vertexPosition = uMvpMatrix *ComputeVertexPosition();\n
vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
gl_Position = vertexPosition;\n
}\n
} // unnamed namespace
-ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache )
-{
- return new ImageVisual( factoryCache );
-}
-
ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
const std::string& imageUrl,
ImageDimensions size,
return new ImageVisual( factoryCache, image );
}
-ImageVisual::ImageVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mImage(),
- mPixels(),
- mPixelArea( FULL_TEXTURE_RECT ),
- mPlacementActor(),
- mImageUrl(),
- mDesiredSize(),
- mFittingMode( FittingMode::DEFAULT ),
- mSamplingMode( SamplingMode::DEFAULT ),
- mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT )
-{
-}
-
ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
const std::string& imageUrl,
ImageDimensions size,
void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
- if( imageURLValue )
+ // Url is already received in constructor
+ Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE );
+ if( fittingValue )
{
- imageURLValue->Get( mImageUrl );
- if( !mImageUrl.empty() )
- {
- mImage.Reset();
- }
-
- Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE );
- if( fittingValue )
- {
- int value;
- Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value );
- mFittingMode = Dali::FittingMode::Type( value );
- }
-
- Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE );
- if( samplingValue )
- {
- int value;
- Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value );
- mSamplingMode = Dali::SamplingMode::Type( value );
- }
+ int value;
+ Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value );
+ mFittingMode = Dali::FittingMode::Type( value );
+ }
- int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
- if( desiredWidthValue )
- {
- desiredWidthValue->Get( desiredWidth );
- }
+ Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE );
+ if( samplingValue )
+ {
+ int value;
+ Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value );
+ mSamplingMode = Dali::SamplingMode::Type( value );
+ }
- int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT );
- if( desiredHeightValue )
- {
- desiredHeightValue->Get( desiredHeight );
- }
+ int desiredWidth = 0;
+ Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
+ if( desiredWidthValue )
+ {
+ desiredWidthValue->Get( desiredWidth );
+ }
- Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
- if( pixelAreaValue )
- {
- pixelAreaValue->Get( mPixelArea );
- }
+ int desiredHeight = 0;
+ Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT );
+ if( desiredHeightValue )
+ {
+ desiredHeightValue->Get( desiredHeight );
+ }
- Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U );
- if( wrapModeValueU )
- {
- int value;
- Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
- mWrapModeU = Dali::WrapMode::Type( value );
- }
+ Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
+ if( pixelAreaValue )
+ {
+ pixelAreaValue->Get( mPixelArea );
+ }
- Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V );
- if( wrapModeValueV )
- {
- int value;
- Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
- mWrapModeV = Dali::WrapMode::Type( value );
- }
+ Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U );
+ if( wrapModeValueU )
+ {
+ int value;
+ Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
+ mWrapModeU = Dali::WrapMode::Type( value );
+ }
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V );
+ if( wrapModeValueV )
+ {
+ int value;
+ Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
+ mWrapModeV = Dali::WrapMode::Type( value );
}
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+
Property::Value* syncLoading = propertyMap.Find( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING );
if( syncLoading )
{
mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
// if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage
// ( for on-stage actor with image url unchanged, resource loading is already finished)
- if( imageURLValue )
+ if( mImageUrl.size() > 0u )
{
LoadResourceSynchronously();
}
mImpl->mRenderer = Renderer::New( geometry, shader );
DALI_ASSERT_DEBUG( textures );
mImpl->mRenderer.SetTextures( textures );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
void ImageVisual::CreateNativeImageRenderer( NativeImage& nativeImage )
}
mImpl->mRenderer = Renderer::New( geometry, shader );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
{
- if( imageUrl.empty() )
- {
- return;
- }
+ mImpl->mRenderer.Reset();
mImageUrl = imageUrl;
- mImpl->mRenderer.Reset();
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
if( !mImpl->mCustomShader &&
( strncasecmp( imageUrl.c_str(), HTTPS_URL, sizeof(HTTPS_URL) -1 ) != 0 ) )
{
bool defaultWrapMode = mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE;
- bool cacheable = defaultWrapMode && mPixelArea == FULL_TEXTURE_RECT;
+ bool defaultTransform = mImpl->mTransform.mSize == Vector2::ONE &&
+ mImpl->mTransform.mOffset == Vector2::ZERO &&
+ mImpl->mTransform.mOffsetSizeMode == Vector4::ZERO &&
+ mImpl->mTransform.mOrigin == Toolkit::Align::CENTER &&
+ mImpl->mTransform.mAnchorPoint == Toolkit::Align::CENTER;
+
+ bool cacheable = defaultWrapMode && defaultTransform && mPixelArea == FULL_TEXTURE_RECT;
+
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
if( cacheable ) // fetch the renderer from cache if exist
void ImageVisual::InitializeRenderer( const Image& image )
{
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
+ mImpl->mRenderer.Reset();
// don't reuse CreateTextureSet
TextureSet textures = TextureSet::New();
// reuse existing code for regular images
CreateRenderer( textures );
}
-
- if( image )
- {
- ApplyImageToSampler( image );
- }
+ ApplyImageToSampler( image );
}
void ImageVisual::UploadCompleted()
void ImageVisual::DoSetOnStage( Actor& actor )
{
- mPlacementActor = actor;
-
if( !mImageUrl.empty() )
{
InitializeRenderer( mImageUrl );
}
- else
+ else if ( mImage )
{
InitializeRenderer( mImage );
}
+ if ( !mImpl->mRenderer)
+ {
+ return;
+ }
+
+ mPlacementActor = actor;
+
if( mPixelArea != FULL_TEXTURE_RECT )
{
mImpl->mRenderer.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, mPixelArea );
void ImageVisual::DoSetOffStage( Actor& actor )
{
+ // Visual::Base::SetOffStage only calls DoSetOffStage if mRenderer exists (is on onstage)
+
//If we own the image then make sure we release it when we go off stage
+ actor.RemoveRenderer( mImpl->mRenderer);
if( !mImageUrl.empty() )
{
- actor.RemoveRenderer( mImpl->mRenderer );
CleanCache(mImageUrl);
mImage.Reset();
}
- else
- {
- actor.RemoveRenderer( mImpl->mRenderer );
- mImpl->mRenderer.Reset();
- }
+
+ mImpl->mRenderer.Reset();
mPlacementActor.Reset();
}
return Dali::Property::Value();
}
+void ImageVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping )
{
Shader shader;
public:
/**
- * @brief Create a new image visual.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @return A smart-pointer to the newly allocated visual.
- */
- static ImageVisualPtr New( VisualFactoryCache& factoryCache );
-
- /**
* @brief Create a new image visual with a URL.
*
* The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
protected:
/**
- * @brief Constructor.
- *
- * @param[in] factoryCache The VisualFactoryCache object
- */
- ImageVisual( VisualFactoryCache& factoryCache );
-
- /**
* @brief Constructor with a URL.
*
* The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
*/
virtual void DoSetOffStage( Actor& actor );
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
public:
/**
//INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
uniform mediump vec3 lightPosition;\n
uniform mediump vec2 uStageOffset;\n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ float scaleFactor = min( visualSize.x, visualSize.y );\n
+ vec3 originFlipY = vec3(origin.x, -origin.y, 0.0);
+ vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
+ vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);\n
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );\n
+ }\n
+
void main()\n
{\n
- vec4 normalisedVertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+ vec4 normalisedVertexPosition = ComputeVertexPosition();\n
vec4 vertexPosition = uObjectMatrix * normalisedVertexPosition;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
uniform mediump vec3 lightPosition;\n
uniform mediump vec2 uStageOffset;\n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ float scaleFactor = min( visualSize.x, visualSize.y );\n
+ vec3 originFlipY = vec3(origin.x, -origin.y, 0.0);
+ vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
+ vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);\n
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );\n
+ }\n
+
void main()
{\n
- vec4 normalisedVertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+ vec4 normalisedVertexPosition = ComputeVertexPosition();\n
vec4 vertexPosition = uObjectMatrix * normalisedVertexPosition;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
uniform mediump mat4 uObjectMatrix;\n
uniform mediump vec3 lightPosition;\n
uniform mediump vec2 uStageOffset;\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ float scaleFactor = min( visualSize.x, visualSize.y );\n
+ vec3 originFlipY = vec3(origin.x, -origin.y, 0.0);
+ vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
+ vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);\n
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );\n
+ }\n
+
void main()
{\n
- vec4 normalisedVertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+ vec4 normalisedVertexPosition = ComputeVertexPosition();\n
vec4 vertexPosition = uObjectMatrix * normalisedVertexPosition;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
}
}
+void MeshVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
void MeshVisual::SetSize( const Vector2& size )
{
Visual::Base::SetSize( size );
mImpl->mRenderer.SetTextures( mTextureSet );
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
void MeshVisual::SupplyEmptyGeometry()
virtual void DoSetProperties( const Property::Map& propertyMap );
/**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
+ /**
* @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/images/texture-set-image.h>
-// INTERNAL IINCLUDES
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
uniform mediump vec2 uNinePatchFactorsX[ FACTOR_SIZE_X ];\n
uniform mediump vec2 uNinePatchFactorsY[ FACTOR_SIZE_Y ];\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
void main()\n
{\n
mediump vec2 fixedFactor = vec2( uNinePatchFactorsX[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uNinePatchFactorsY[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].x );\n
mediump vec2 fixedTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );\n
mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );\n
\n
- mediump vec4 vertexPosition = vec4( ( fixedFactor + ( uSize.xy - fixedTotal ) * stretch / stretchTotal ), 0.0, 1.0 );\n
- vertexPosition.xy -= uSize.xy * vec2( 0.5, 0.5 );\n
+
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+
+ mediump vec4 vertexPosition = vec4( ( fixedFactor + ( visualSize.xy - fixedTotal ) * stretch / stretchTotal ) + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ vertexPosition.xy -= visualSize.xy * vec2( 0.5, 0.5 );\n
+
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );\n
uniform mediump vec2 uFixed[ 3 ];\n
uniform mediump vec2 uStretchTotal;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
void main()\n
{\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+
mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
- mediump vec2 size = uSize.xy * scale;\n
+ mediump vec2 size = visualSize.xy * scale;\n
\n
mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
mediump vec2 stretch = floor( aPosition * 0.5 );\n
mediump vec2 fixedTotal = uFixed[ 2 ];\n
\n
- mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );\n
+ mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
- vertexPosition.xy = vertexPosition.xy / scale;\n
+ vertexPosition.xy = vertexPosition.xy / scale + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
/////////////////NPatchVisual////////////////
-NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache )
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
{
- return new NPatchVisual( factoryCache );
-}
-
-NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly )
-{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache, borderOnly );
+ NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
nPatchVisual->mImageUrl = imageUrl;
NinePatchImage image = NinePatchImage::New( imageUrl );
return nPatchVisual;
}
-NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly )
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache, borderOnly );
+ NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
nPatchVisual->mImage = image;
nPatchVisual->InitializeFromImage( image );
return nPatchVisual;
}
-NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, bool borderOnly )
+NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mImage(),
mCroppedImage(),
mStretchPixelsX(),
mStretchPixelsY(),
mImageSize(),
- mBorderOnly( borderOnly )
+ mBorderOnly( false )
{
}
void NPatchVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
- if( imageURLValue )
+ // URL is already passed in via constructor
+ //Read the borderOnly property first since InitialiseFromImage relies on mBorderOnly to be properly set
+ Property::Value* borderOnlyValue = propertyMap.Find( Toolkit::ImageVisual::Property::BORDER_ONLY, BORDER_ONLY );
+ if( borderOnlyValue )
{
- //Read the borderOnly property first since InitialiseFromImage relies on mBorderOnly to be properly set
- Property::Value* borderOnlyValue = propertyMap.Find( Toolkit::ImageVisual::Property::BORDER_ONLY, BORDER_ONLY );
- if( borderOnlyValue )
- {
- borderOnlyValue->Get( mBorderOnly );
- }
-
- if( imageURLValue->Get( mImageUrl ) )
- {
- NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
- InitializeFromImage( nPatch );
- }
- else
- {
- InitializeFromBrokenImage();
- DALI_LOG_ERROR( "The property '%s' is not a string\n", IMAGE_URL_NAME );
- }
+ borderOnlyValue->Get( mBorderOnly );
}
}
TextureSet textureSet = TextureSet::New();
mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetTextures( textureSet );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
return Dali::Property::Value();
}
+void NPatchVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
+
void NPatchVisual::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t oldGridY )
{
//check to see if the border style has changed
public:
/**
- * @brief Create a new n-patch visual.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @return A smart-pointer to the newly allocated visual.
- */
- static NPatchVisualPtr New( VisualFactoryCache& factoryCache );
-
- /**
* @brief Create an N-patch visual using an image URL.
*
* The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] imageUrl The URL to 9 patch image resource to use
- * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
*/
- static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly = false );
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
/**
* @brief Create an N-patch visual with a NinePatchImage resource.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] image The NinePatchImage to use
- * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
*/
- static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly = false );
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image );
public: // from Visual
/**
* @brief Constructor.
*
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
+ * @param[in] factoryCache Reference to the VisualFactoryCache object
*/
- NPatchVisual( VisualFactoryCache& factoryCache, bool borderOnly = false );
+ NPatchVisual( VisualFactoryCache& factoryCache );
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual void DoSetOffStage( Actor& actor );
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
private:
/**
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
uniform mediump vec3 lightPosition;\n
uniform mediump vec2 uStageOffset;\n
- void main()\n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
{\n
- float xRatio = uSize.x / uObjectDimensions.x;\n
- float yRatio = uSize.y / uObjectDimensions.y;\n
- float scaleFactor = min( xRatio, yRatio );\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ float scaleFactor = min( visualSize.x / uObjectDimensions.x, visualSize.y / uObjectDimensions.y );\n
+ vec3 originFlipY = vec3(origin.x, -origin.y, 0.0);
+ vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
+ vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);\n
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );\n
+ }\n
- vec4 normalisedVertexPosition = vec4( aPosition * scaleFactor, 1.0 );\n
+ void main()\n
+ {\n
+ vec4 normalisedVertexPosition = ComputeVertexPosition();\n
vec4 vertexPosition = uObjectMatrix * normalisedVertexPosition;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
return Dali::Property::Value();
}
+void PrimitiveVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
void PrimitiveVisual::InitializeRenderer()
{
if( !mGeometry )
mImpl->mRenderer = Renderer::New( mGeometry, mShader );
mImpl->mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
+
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
void PrimitiveVisual::UpdateShaderUniforms()
*/
virtual void DoSetOnStage( Actor& actor );
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
private:
//Simple struct to store the position and normal of a single vertex.
namespace Internal
{
-SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache )
-{
- return new SvgVisual( factoryCache );
-}
-
SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size )
{
SvgVisual* svgVisual = new SvgVisual( factoryCache );
void SvgVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
- if( imageURLValue )
- {
- std::string imageUrl;
- if( imageURLValue->Get( imageUrl ) )
- {
- ParseFromUrl( imageUrl );
- }
- else
- {
- DALI_LOG_ERROR( "The property '%s' is not a string\n", IMAGE_URL_NAME );
- }
- }
+ // url already passed in from constructor
}
void SvgVisual::DoSetOnStage( Actor& actor )
public:
/**
- * @brief Create a new SVG visual.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @return A smart-pointer to the newly allocated visual.
- */
- static SvgVisualPtr New( VisualFactoryCache& factoryCache );
-
- /**
* @brief Create the SVG Visual using the image URL.
*
* The visual will parse the SVG image once it is set.
case Toolkit::TextVisual::Property::UNDERLINE:
{
// TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
- // Only the code for the STRING case should be kept.
+ // Only the code for the MAP case should be kept.
switch( propertyValue.GetType() )
{
case Property::VECTOR4:
}
break;
}
- case Property::STRING:
+ case Property::MAP:
{
const bool update = SetUnderlineProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
if( update )
case Toolkit::TextVisual::Property::SHADOW:
{
// TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
- // Only the code for the STRING case should be kept.
+ // Only the code for the MAP case should be kept.
switch( propertyValue.GetType() )
{
case Property::VECTOR2:
}
break;
}
- case Property::STRING:
+ case Property::MAP:
{
const bool update = SetShadowProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
if( update )
DALI_ENUM_TO_STRING_WITH_SCOPE( Shader::Hint, MODIFIES_GEOMETRY )
DALI_ENUM_TO_STRING_TABLE_END( SHADER_HINT )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( ALIGN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, TOP_BEGIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, TOP_CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, TOP_END )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, CENTER_BEGIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, CENTER_END )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, BOTTOM_BEGIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, BOTTOM_CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Align, BOTTOM_END )
+DALI_ENUM_TO_STRING_TABLE_END( ALIGN )
+
+Dali::Vector2 PointToVector2( Toolkit::Align::Type point, Toolkit::Direction::Type direction )
+{
+ static const float pointToVector2[] = { 0.0f,0.0f,
+ 0.5f,0.0f,
+ 1.0f,0.0f,
+ 0.0f,0.5f,
+ 0.5f,0.5f,
+ 1.0f,0.5f,
+ 0.0f,1.0f,
+ 0.5f,1.0f,
+ 1.0f,1.0f };
+
+ Vector2 result( &pointToVector2[point*2] );
+ if( direction == Direction::RIGHT_TO_LEFT )
+ {
+ result.x = 1.0f - result.x;
+ }
+
+ return result;
+}
+
} // unnamed namespace
Internal::Visual::Base::Impl::Impl()
: mCustomShader(NULL),
+ mTransform(),
mDepthIndex( 0.0f ),
mFlags( 0 )
{
}
}
+Internal::Visual::Base::Impl::Transform::Transform()
+: mOffset(0.0f,0.0f),
+ mSize(1.0f,1.0f),
+ mOffsetSizeMode(0.0f,0.0f,0.0f,0.0f),
+ mOrigin(Toolkit::Align::CENTER),
+ mAnchorPoint(Toolkit::Align::CENTER)
+{
+}
+
+void Internal::Visual::Base::Impl::Transform::SetPropertyMap( const Property::Map& map )
+{
+ //Set default values
+ mOffset = Vector2(0.0f,0.0f);
+ mSize = Vector2(1.0f,1.0f);
+ mOffsetSizeMode = Vector4(0.0f,0.0f,0.0f,0.0f);
+ mOrigin = Toolkit::Align::CENTER;
+ mAnchorPoint = Toolkit::Align::CENTER;
+
+ for( Property::Map::SizeType i(0); i<map.Count(); ++i )
+ {
+ KeyValuePair keyValue = map.GetKeyValue( i );
+ if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::OFFSET )
+ {
+ keyValue.second.Get( mOffset );
+ }
+ else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::SIZE )
+ {
+ keyValue.second.Get( mSize );
+ }
+ else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN )
+ {
+ Toolkit::Align::Type align(Toolkit::Align::CENTER);
+ if( Scripting::GetEnumerationProperty< Toolkit::Align::Type >( keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, align ) )
+ {
+ mOrigin = align;
+ }
+ }
+ else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT )
+ {
+ Toolkit::Align::Type align(Toolkit::Align::CENTER);
+ if( Scripting::GetEnumerationProperty< Toolkit::Align::Type >( keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, align ) )
+ {
+ mAnchorPoint = align;
+ }
+ }
+ else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE )
+ {
+ keyValue.second.Get( mOffsetSizeMode );
+ }
+ }
+}
+
+void Internal::Visual::Base::Impl::Transform::GetPropertyMap( Property::Map& map ) const
+{
+ map.Clear();
+ map.Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET, mOffset )
+ .Add( Toolkit::Visual::DevelProperty::Transform::Property::SIZE, mSize )
+ .Add( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN, mOrigin )
+ .Add( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT, mAnchorPoint )
+ .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, mOffsetSizeMode );
+}
+
+void Internal::Visual::Base::Impl::Transform::RegisterUniforms( Dali::Renderer renderer, Toolkit::Direction::Type direction )
+{
+ renderer.RegisterProperty( SIZE, mSize );
+ renderer.RegisterProperty( OFFSET, direction == Toolkit::Direction::LEFT_TO_RIGHT ? mOffset : mOffset * Vector2(-1.0f,1.0f));
+ renderer.RegisterProperty( OFFSET_SIZE_MODE, mOffsetSizeMode );
+ renderer.RegisterProperty( ORIGIN, PointToVector2( mOrigin, direction ) - Vector2(0.5,0.5) );
+ renderer.RegisterProperty( ANCHOR_POINT, Vector2(0.5,0.5) - PointToVector2( mAnchorPoint, direction ) );
+}
+
} // namespace Internal
} // namespace Toolkit
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/devel-api/align-enums.h>
namespace Dali
{
void CreatePropertyMap( Property::Map& map ) const;
};
+ struct Transform
+ {
+ Vector2 mOffset;
+ Vector2 mSize;
+ Vector4 mOffsetSizeMode;
+ Toolkit::Align::Type mOrigin;
+ Toolkit::Align::Type mAnchorPoint;
+
+ Transform();
+ void SetPropertyMap( const Property::Map& map );
+ void GetPropertyMap( Property::Map& map ) const;
+ void RegisterUniforms( Renderer renderer, Toolkit::Direction::Type direction );
+ };
+
Renderer mRenderer;
CustomShader* mCustomShader;
std::string mName;
+ Transform mTransform;
Vector2 mSize;
float mDepthIndex;
int mFlags;
}
}
+ Property::Value* transform = propertyMap.Find( Toolkit::Visual::DevelProperty::TRANSFORM, TRANSFORM );
+ if( transform )
+ {
+ Property::Map map;
+ if( transform->Get( map ) )
+ {
+ mImpl->mTransform.SetPropertyMap( map );
+ }
+ }
+
DoSetProperties( propertyMap );
}
// Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing.
DoSetOnStage( actor );
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
- mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
- mImpl->mFlags |= Impl::IS_ON_STAGE;
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
+ mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
+ mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists
+ }
}
void Visual::Base::SetOffStage( Actor& actor )
{
mImpl->mCustomShader->CreatePropertyMap( map );
}
+
+ Property::Map transform;
+ mImpl->mTransform.GetPropertyMap( transform );
+ map.Insert( Toolkit::Visual::DevelProperty::TRANSFORM, transform );
}
void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
void Visual::Base::DoSetOffStage( Actor& actor )
{
- actor.RemoveRenderer( mImpl->mRenderer );
- mImpl->mRenderer.Reset();
+ actor.RemoveRenderer( mImpl->mRenderer );
+ mImpl->mRenderer.Reset();
}
bool Visual::Base::IsOnStage() const
if( index < VISUAL_PROPERTY_START_INDEX )
{
+ if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM )
+ {
+ Property::Map* map = propertyValue.GetMap();
+ if( map )
+ {
+ mImpl->mTransform.SetPropertyMap( *map );
+ OnSetTransform();
+ }
+ }
+
// TODO set the properties of the visual base.
}
else
if( index < VISUAL_PROPERTY_START_INDEX )
{
+ if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM )
+ {
+ Property::Map map;
+ mImpl->mTransform.GetPropertyMap( map );
+ return map;
+ }
// TODO retrieve the properties of the visual base.
}
else
*/
virtual void DoSetProperties( const Property::Map& propertyMap ) = 0;
+ /**
+ * @brief Called when transform property changes
+ */
+ virtual void OnSetTransform(){}
+
protected:
/**
UrlType::Type type = ResolveUrlType( imageUrl );
if( UrlType::N_PATCH == type )
{
- visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl );
}
else if( UrlType::SVG == type )
{
- visualPtr = SvgVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl );
}
else // Regular image
{
if( batchingEnabled )
{
- visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
break;
}
else
{
- visualPtr = ImageVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
}
}
}
const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivideGridY" );
const char * const CUSTOM_SHADER_HINTS( "hints" );
+// Transform
+extern const char * const TRANSFORM( "transform" );
+extern const char * const SIZE( "size" );
+extern const char * const OFFSET( "offset" );
+extern const char * const OFFSET_SIZE_MODE( "offsetSizeMode" );
+extern const char * const ORIGIN( "origin" );
+extern const char * const ANCHOR_POINT( "anchorPoint" );
+
// Image visual
const char * const IMAGE_URL_NAME( "url" );
const char * const ATLAS_RECT_UNIFORM_NAME ( "uAtlasRect" );
extern const char * const CUSTOM_SUBDIVIDE_GRID_Y;
extern const char * const CUSTOM_SHADER_HINTS;
+//Transform
+extern const char * const TRANSFORM;
+extern const char * const SIZE;
+extern const char * const OFFSET;
+extern const char * const OFFSET_SIZE_MODE;
+extern const char * const ORIGIN;
+extern const char * const ANCHOR_POINT;
+
+
// Image visual
extern const char * const IMAGE_URL_NAME;
extern const char * const ATLAS_RECT_UNIFORM_NAME;
{
Property::Index index;
Toolkit::Visual::Base visual;
- Actor placementActor;
bool enabled;
- RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, Actor &aPlacementActor, bool aEnabled) :
- index(aIndex), visual(aVisual), placementActor(aPlacementActor), enabled(aEnabled) {}
+ RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled) :
+ index(aIndex), visual(aVisual), enabled(aEnabled) {}
};
struct HandleIndex
}
}
- // Does either it's renderer or placement actor have an associated property?
+ // Does it's renderer have an associated property?
if( iter != visuals.End() )
{
- Actor placementActor = (*iter)->placementActor;
- if( !placementActor )
- {
- placementActor = controlImpl.Self();
- }
-
- Property::Index index = placementActor.GetPropertyIndex( propertyKey );
+ Actor self = controlImpl.Self();
+ Property::Index index = self.GetPropertyIndex( propertyKey );
if( index != Property::INVALID_INDEX )
{
- // It's a placement actor property:
- return HandleIndex( placementActor, index );
+ // It's an actor property:
+ return HandleIndex( self, index );
}
else
{
// Check if it is a renderer property:
- if( placementActor.GetRendererCount() > 0 )
+ if( self.GetRendererCount() > 0 )
{
- // @todo Need to use correct renderer index when placement actors
- // are removed
- Renderer renderer = placementActor.GetRendererAt(0);
+ // @todo Need to use correct renderer index
+ Renderer renderer = self.GetRendererAt(0);
Property::Index index = renderer.GetPropertyIndex( propertyKey );
if( index != Property::INVALID_INDEX )
{
void Control::SetBackgroundColor( const Vector4& color )
{
- Actor self( Self() );
mImpl->mBackgroundColor = color;
Property::Map map;
map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
void Control::SetBackground( const Property::Map& map )
{
- Actor self( Self() );
mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
void Control::SetBackgroundImage( Image image )
{
- Actor self( Self() );
mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
OnKeyboardEnter();
}
-void Control::RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual )
+void Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
{
- RegisterVisual( index, placementActor, visual, true );
+ RegisterVisual( index, visual, true );
}
-void Control::RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual, bool enabled )
+void Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
{
bool visualReplaced ( false );
- Actor actorToRegister; // Null actor, replaced if placement actor not Self
Actor self = Self();
- if ( placementActor != self ) // Prevent increasing ref count if actor self
- {
- actorToRegister = placementActor;
- }
-
if ( !mImpl->mVisuals.Empty() )
{
RegisteredVisualContainer::Iterator iter;
{
if( (*iter)->visual && self.OnStage() )
{
- if( (*iter)->placementActor )
- {
- (*iter)->visual.SetOffStage( (*iter)->placementActor );
- }
- else
- {
- (*iter)->visual.SetOffStage( self );
- }
+ (*iter)->visual.SetOffStage( self );
}
(*iter)->visual = visual;
- (*iter)->placementActor = actorToRegister;
visualReplaced = true;
}
}
if ( !visualReplaced ) // New registration entry
{
- mImpl->mVisuals.PushBack( new RegisteredVisual( index, visual, actorToRegister, enabled ) );
+ mImpl->mVisuals.PushBack( new RegisteredVisual( index, visual, enabled ) );
}
if( visual && self.OnStage() && enabled )
{
- visual.SetOnStage( placementActor );
+ visual.SetOnStage( self );
}
}
(*iter)->enabled = enable;
Actor parentActor = Self();
- if ( (*iter)->placementActor )
- {
- parentActor = (*iter)->placementActor;
- }
-
if ( Self().OnStage() ) // If control not on Stage then Visual will be added when StageConnection is called.
{
if ( enable )
return false;
}
-Actor Control::GetPlacementActor( Property::Index index ) const
-{
- RegisteredVisualContainer::Iterator iter;
- if ( FindVisual( index, mImpl->mVisuals, iter ) )
- {
- if( (*iter)->placementActor )
- {
- return (*iter)->placementActor;
- }
- else
- {
- return Self();
- }
- }
-
- return Actor();
-}
-
Dali::Animation Control::CreateTransition( const Toolkit::TransitionData& handle )
{
Dali::Animation transition;
}
else
{
- // Is it a placement actor/visual pair?;
handleIndex = GetVisualProperty( *this, mImpl->mVisuals,
animator->objectName,
animator->propertyKey );
{
for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
- // Check whether the visual is empty, as it is allowed to register a placement actor without visual.
+ // Check whether the visual is empty and enabled
if( (*iter)->visual && (*iter)->enabled )
{
- if( (*iter)->placementActor )
- {
- (*iter)->visual.SetOnStage( (*iter)->placementActor );
- }
- else
- {
- Actor self( Self() );
- (*iter)->visual.SetOnStage( self );
- }
+ Actor self( Self() );
+ (*iter)->visual.SetOnStage( self );
}
}
}
{
for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
- // Check whether the visual is empty, as it is allowed to register a placement actor without visual.
+ // Check whether the visual is empty
if( (*iter)->visual )
{
- if( (*iter)->placementActor )
- {
- (*iter)->visual.SetOffStage( (*iter)->placementActor );
- }
- else
- {
- Actor self( Self() );
- (*iter)->visual.SetOffStage( self );
- }
+ Actor self( Self() );
+ (*iter)->visual.SetOffStage( self );
}
}
}
* @SINCE_1_2.0
*
* @param[in] index The Property index of the visual, used to reference visual
- * @param[in] placementActor The actor used to by the visual.
* @param[in] visual The visual to register
- * @note Derived class should not call visual.SetOnStage(placementActor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
+ * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
* Use below API with enabled set to false if derived class wishes to control when visual is staged.
*/
- void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual );
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual );
/**
* @brief Register a visual by Property Index, linking an Actor to visual when required.
* @SINCE_1_2.11
*
* @param[in] index The Property index of the visual, used to reference visual
- * @param[in] placementActor The actor used to by the visual.
* @param[in] visual The visual to register
* @param[in] enabled false if derived class wants to control when visual is set on stage.
*
*/
- void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual, bool enabled );
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
/**
* @brief Erase the entry matching the given index from the list of registered visuals
bool IsVisualEnabled( Property::Index index ) const;
/**
- * @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 ) const;
-
- /**
* @brief Create a transition effect on the control.
*
* @SINCE_1_2.12
TEXT, ///< name "text", The text to display in UTF-8 format, type STRING @SINCE_1_1.37
TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4 @SINCE_1_1.37
FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_1.37
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_1.37
+ FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING or MAP @SINCE_1_2.13
POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_1.37
HORIZONTAL_ALIGNMENT, ///< name "horizontalAlignment", The text horizontal alignment, type STRING, values "BEGIN", "CENTER", "END" @SINCE_1_1.37
SCROLL_THRESHOLD, ///< name "scrollThreshold" Vertical scrolling will occur if the cursor is this close to the control border, type FLOAT @SINCE_1_1.37
ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_1.37
INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4 @SINCE_1_1.37
INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_1.37
- INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_1.37
+ INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING or MAP @SINCE_1_2.13
INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_1.37
LINE_SPACING, ///< name "lineSpacing", The default extra space between lines in points, type FLOAT @SINCE_1_1.37
INPUT_LINE_SPACING, ///< name "inputLineSpacing" The extra space between lines in points. It affects the whole paragraph where the new input text is inserted, type FLOAT @SINCE_1_1.37
- UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
- INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
- SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
- INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
- EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
- INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
- OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
- INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
};
};
PLACEHOLDER_TEXT, ///< name "placeholderText", The text to display when the TextField is empty and inactive, type STRING @SINCE_1_0.0
PLACEHOLDER_TEXT_FOCUSED, ///< name "placeholderTextFocused", The text to display when the TextField is empty with key-input focus, type STRING @SINCE_1_0.0
FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_0.0
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_0.0
+ FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING or MAP @SINCE_1_2.13
POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_0.0
MAX_LENGTH, ///< name "maxLength" The maximum number of characters that can be inserted, type INTEGER @SINCE_1_0.0
EXCEED_POLICY, ///< name "exceedPolicy" Specifies how the text is truncated when it does not fit, type INTEGER @SINCE_1_0.0
INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4 @SINCE_1_0.0
ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_0.0
INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_0.0
- INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_0.0
+ INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING or MAP @SINCE_1_2.13
INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_0.0
- UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
- INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
- SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
- INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
- EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
- INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
- OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
- INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
};
};
* Text labels are lightweight, non-editable and do not respond to user input.
*
* @section TextLabelProperties Properties
- * |%Property enum |String name |Type |Writable|Animatable|
- * |----------------------------------|---------------------|--------------|--------|----------|
- * | Property::RENDERING_BACKEND | renderingBackend | INTEGER | O | X |
- * | Property::TEXT | text | STRING | O | X |
- * | Property::FONT_FAMILY | fontFamily | STRING | O | X |
- * | Property::FONT_STYLE | fontStyle | STRING | O | X |
- * | Property::POINT_SIZE | pointSize | FLOAT | O | X |
- * | Property::MULTI_LINE | multiLine | BOOLEAN | O | X |
- * | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
- * | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
- * | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
- * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
- * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
- * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
- * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
- * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
- * | Property::SHADOW | shadow | STRING | O | X |
- * | Property::UNDERLINE | underline | STRING | O | X |
+ * |%Property enum |String name |Type |Writable|Animatable|
+ * |----------------------------------|---------------------|----------------|--------|----------|
+ * | Property::RENDERING_BACKEND | renderingBackend | INTEGER | O | X |
+ * | Property::TEXT | text | STRING | O | X |
+ * | Property::FONT_FAMILY | fontFamily | STRING | O | X |
+ * | Property::FONT_STYLE | fontStyle | STRING or MAP | O | X |
+ * | Property::POINT_SIZE | pointSize | FLOAT | O | X |
+ * | Property::MULTI_LINE | multiLine | BOOLEAN | O | X |
+ * | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
+ * | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
+ * | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
+ * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
+ * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
+ * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
+ * | Property::SHADOW | shadow | STRING or MAP | O | X |
+ * | Property::UNDERLINE | underline | STRING or MAP | O | X |
*
* @SINCE_1_0.0
*/
/**
* @brief The requested font style to use,
- * @details name "fontStyle", type STRING
- * @SINCE_1_0.0
+ * @details name "fontStyle", type STRING or MAP
+ * @SINCE_1_2.13
*/
FONT_STYLE,
/**
* @brief The default underline parameters.
- * @details name "underline", type STRING.
- * @SINCE_1_1.37
+ * @details name "underline", type MAP.
+ * @SINCE_1_2.13
*/
UNDERLINE,
/**
* @brief The default shadow parameters.
- * @details name "shadow", type STRING.
- * @SINCE_1_1.37
+ * @details name "shadow", type MAP.
+ * @SINCE_1_2.13
*/
SHADOW,
/**
* @brief The default emboss parameters.
- * @details name "emboss", type STRING.
- * @SINCE_1_1.37
+ * @details name "emboss", type MAP.
+ * @SINCE_1_2.13
*/
EMBOSS,
/**
* @brief The default outline parameters.
- * @details name "outline", type STRING.
- * @SINCE_1_1.37
+ * @details name "outline", type MAP.
+ * @SINCE_1_2.13
*/
OUTLINE,
};
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 11;
+const unsigned int TOOLKIT_MICRO_VERSION = 12;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
/**
* @brief The requested font style to use,
- * @details name "fontStyle", type STRING
- * @SINCE_1_2.11
+ * @details name "fontStyle", type STRING or MAP
+ * @SINCE_1_2.13
*/
FONT_STYLE,
/**
* @brief The default underline parameters.
- * @details name "underline", type STRING.
- * @SINCE_1_2.11
+ * @details name "underline", type STRING or MAP.
+ * @SINCE_1_2.13
*/
UNDERLINE,
/**
* @brief The default shadow parameters.
- * @details name "shadow", type STRING.
- * @SINCE_1_2.11
+ * @details name "shadow", type STRING or MAP.
+ * @SINCE_1_2.13
*/
SHADOW,
/**
* @brief The default emboss parameters.
- * @details name "emboss", type STRING.
- * @SINCE_1_2.11
+ * @details name "emboss", type STRING or MAP.
+ * @SINCE_1_2.13
*/
EMBOSS,
/**
* @brief The default outline parameters.
- * @details name "outline", type STRING.
- * @SINCE_1_2.11
+ * @details name "outline", type STRING or MAP.
+ * @SINCE_1_2.13
*/
OUTLINE,
"label":
{
"pointSize":120,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":
"label":
{
"pointSize":8,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":
"label":
{
"pointSize":8,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: NDalic
Summary: dali wrapper
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: uifw/graphic
License: TO_BE_FILLED_IN
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
%rename(IMAGE_VISUAL_DESIRED_HEIGHT) Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT;
%rename(IMAGE_VISUAL_SYNCHRONOUS_LOADING) Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING;
%rename(IMAGE_VISUAL_BORDER_ONLY) Dali::Toolkit::ImageVisual::Property::BORDER_ONLY;
+%rename(IMAGE_VISUAL_BATCHING_ENABLED) Dali::Toolkit::ImageVisual::Property::BATCHING_ENABLED;
+%rename(IMAGE_VISUAL_PIXEL_AREA) Dali::Toolkit::ImageVisual::Property::PIXEL_AREA;
+%rename(IMAGE_VISUAL_WRAP_MODE_U) Dali::Toolkit::ImageVisual::Property::WRAP_MODE_U;
+%rename(IMAGE_VISUAL_WRAP_MODE_V) Dali::Toolkit::ImageVisual::Property::WRAP_MODE_V;
%rename(COLOR_VISUAL_MIX_COLOR) Dali::Toolkit::Color::Visual::Property::MIX_COLOR;
+%rename(TEXT_VISUAL_RENDERING_BACKEND) Dali::Toolkit::Text::Visual::Property::RENDERING_BACKEND;
+%rename(TEXT_VISUAL_TEXT) Dali::Toolkit::Text::Visual::Property::TEXT;
+%rename(TEXT_VISUAL_FONT_FAMILY) Dali::Toolkit::Text::Visual::Property::FONT_FAMILY;
+%rename(TEXT_VISUAL_FONT_STYLE) Dali::Toolkit::Text::Visual::Property::FONT_STYLE;
+%rename(TEXT_VISUAL_POINT_SIZE) Dali::Toolkit::Text::Visual::Property::POINT_SIZE;
+%rename(TEXT_VISUAL_MULTI_LINE) Dali::Toolkit::Text::Visual::Property::MULTI_LINE;
+%rename(TEXT_VISUAL_HORIZONTAL_ALIGNMENT) Dali::Toolkit::Text::Visual::Property::HORIZONTAL_ALIGNMENT;
+%rename(TEXT_VISUAL_VERTICAL_ALIGNMENT) Dali::Toolkit::Text::Visual::Property::VERTICAL_ALIGNMENT;
+%rename(TEXT_VISUAL_TEXT_COLOR) Dali::Toolkit::Text::Visual::Property::TEXT_COLOR;
+%rename(TEXT_VISUAL_ENABLE_MARKUP) Dali::Toolkit::Text::Visual::Property::ENABLE_MARKUP;
+%rename(TEXT_VISUAL_ENABLE_AUTO_SCROLL) Dali::Toolkit::Text::Visual::Property::ENABLE_AUTO_SCROLL;
+%rename(TEXT_VISUAL_AUTO_SCROLL_SPEED) Dali::Toolkit::Text::Visual::Property::AUTO_SCROLL_SPEED;
+%rename(TEXT_VISUAL_AUTO_SCROLL_LOOP_COUNT) Dali::Toolkit::Text::Visual::Property::AUTO_SCROLL_LOOP_COUNT;
+%rename(TEXT_VISUAL_AUTO_SCROLL_GAP) Dali::Toolkit::Text::Visual::Property::AUTO_SCROLL_GAP;
+%rename(TEXT_VISUAL_LINE_SPACING) Dali::Toolkit::Text::Visual::Property::LINE_SPACING;
+%rename(TEXT_VISUAL_UNDERLINE) Dali::Toolkit::Text::Visual::Property::UNDERLINE;
+%rename(TEXT_VISUAL_SHADOW) Dali::Toolkit::Text::Visual::Property::SHADOW;
+%rename(TEXT_VISUAL_EMBOSS) Dali::Toolkit::Text::Visual::Property::EMBOSS;
+%rename(TEXT_VISUAL_OUTLINE) Dali::Toolkit::Text::Visual::Property::OUTLINE;
+%rename(TEXT_VISUAL_BATCHING_ENABLED) Dali::Toolkit::Text::Visual::Property::BATCHING_ENABLED;
%csconstvalue("PropertyRanges.PROPERTY_REGISTRATION_START_INDEX") PROPERTY_START_INDEX;
%csconstvalue("View.PropertyRange.PROPERTY_START_INDEX+1000") PROPERTY_END_INDEX;
%include <dali-toolkit/public-api/visuals/image-visual-properties.h>
%include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
%include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/text-visual-properties.h>
%include <dali-toolkit/devel-api/builder/builder.h>
+%include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+
%include <dali-toolkit/public-api/controls/control-impl.h>
%include <dali-toolkit/public-api/controls/control.h>
+%include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
+
%include <dali-toolkit/public-api/controls/alignment/alignment.h>
%include <dali-toolkit/public-api/controls/buttons/button.h>
%include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
#include <dali/devel-api/images/nine-patch-image.h>
#include <dali-toolkit/devel-api/builder/builder.h>
+
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>