{
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
-const unsigned int EMOJI_FONT_SIZE = 3968u;
+const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
const unsigned int NON_DEFAULT_FONT_SIZE = 40u;
struct MergeFontDescriptionsData
// Load some fonts.
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf", EMOJI_FONT_SIZE );
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf", pointSize01 );
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf", pointSize02 );
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf", pointSize01 );
// Font id 1 --> TizenSansArabicRegular.ttf
// Font id 2 --> TizenSansHebrewRegular.ttf
- // Font id 3 --> TizenColorEmoji.ttf
+ // Font id 3 --> BreezeColorEmoji.ttf
// Font id 4 --> TizenSansRegular.ttf, size 8
// Font id 5 --> TizenSansRegular.ttf, size 16
// Font id 6 --> TizenSansHebrewRegular.ttf, size 8
0u,
4u
},
- const_cast<char*>( "TizenColorEmoji" ),
- 15u,
+ const_cast<char*>( "BreezeColorEmoji" ),
+ 16u,
TextAbstraction::FontWeight::NORMAL,
TextAbstraction::FontWidth::NORMAL,
TextAbstraction::FontSlant::NORMAL,
{
"Emojis",
"\xF0\x9F\x98\x81\xF0\x9F\x98\x82\xF0\x9F\x98\x83\xF0\x9F\x98\x84",
- "/tizen/TizenColorEmoji.ttf",
+ "/tizen/BreezeColorEmoji.ttf",
EMOJI_FONT_SIZE,
0u,
4u,
namespace
{
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
-const PointSize26Dot6 EMOJI_FONT_SIZE = 62u * 64u;
+const PointSize26Dot6 EMOJI_FONT_SIZE = 3840u; // 60 * 64
} // namespace
int UtcDaliTextTypesetter(void)
const std::string pathName( pathNamePtr );
free( pathNamePtr );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf", EMOJI_FONT_SIZE );
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
// Creates a text controller.
// Sets the text.
controller->SetMarkupProcessorEnabled( true );
- controller->SetText( "<font family='TizenSansRegular'>Hello world </font><font family='TizenColorEmoji'>\xF0\x9F\x98\x81</font>" );
+ controller->SetText( "<font family='TizenSansRegular'>Hello world </font><font family='BreezeColorEmoji'>\xF0\x9F\x98\x81</font>" );
// Creates the text's model and relais-out the text.
const Size relayoutSize( 120.f, 60.f );
{
"visuals":
{
- "foregroundVisual":
+ "testVisual":
+ {
+ "visualType":"IMAGE",
+ "url":"0001.png"
+ },
+ "testVisual2":
{
"visualType":"GRADIENT",
"startPosition": [-1, -1],
"spreadMethod": "REPEAT",
"stopOffset": [0.2, 0.8],
"stopColor": [ [ 1,0,0,1], [0,1,0,1] ]
+ },
+ "foregroundVisual":
+ {
+ "visualType":"IMAGE",
+ "url":"theSameImage.png"
+ },
+ "labelVisual":
+ {
+ "visualType":"TEXT",
+ "pointSize":8,
+ "text":"Some text"
}
}
},
{
"visuals":
{
- "foregroundVisual":
+ "testVisual":
+ {
+ "visualType":"IMAGE",
+ "url":"0002.png"
+ },
+ "testVisual2":
{
"visualType":"COLOR",
"mixColor": [ 1,0,0,1]
+ },
+ "foregroundVisual":
+ {
+ "visualType":"IMAGE",
+ "url":"theSameImage.png"
+ },
+ "labelVisual":
+ {
+ "visualType":"TEXT",
+ "pointSize":8,
+ "text":"Some different text"
}
}
}
},
"focusVisual":
{
- "visualType":"IMAGE",
- "url": "focus.png"
+ "visualType":"NPATCH",
+ "url": "focus.9.png"
}
},
"entryTransition":
},
"DISABLED":
{
+ "states":
+ {
+ "SELECTED":
+ {
+ "visuals":
+ {
+ "testVisual":
+ {
+ "visualType":"IMAGE",
+ "url":"0001.png"
+ },
+ "testVisual2":
+ {
+ "visualType":"GRADIENT",
+ "startPosition": [-1, -1],
+ "endPosition": [1, 1],
+ "spreadMethod": "REPEAT",
+ "stopOffset": [0.2, 0.8],
+ "stopColor": [ [ 1,0,0,1], [0,1,0,1] ]
+ }
+ }
+ }
+ },
"visuals":
{
"foregroundVisual":
"spreadMethod": "REPEAT",
"stopOffset": [0.2, 0.8],
"stopColor": [ [ 1,0,0,1], [0,1,0,1] ]
+ },
+ "labelVisual":
+ {
+ "visualType":"TEXT",
+ "pointSize":8,
+ "textColor":[1,0,1,1]
}
}
},
"stopOffset": [0.3, 0.9],
"stopColor": [ [ 0,0,1,1], [0,1,1,1] ]
},
+ "labelVisual":
+ {
+ "visualType":"TEXT",
+ "pointSize":10
+ },
"focusVisual":
{
"visualType":"IMAGE",
{
"visualType":"COLOR",
"mixColor": [1,0,0,1]
+ },
+ "labelVisual":
+ {
+ "visualType":"TEXT",
+ "pointSize":9,
+ "textColor":[1,1,1,1]
}
}
}
}
}
]
+ },
+ "NoStateStyle":
+ {
+ "testVisual2":
+ {
+ "visualType":"COLOR",
+ "mixColor":[1,1,1,1]
+ }
}
}
}
#include <toolkit-style-monitor.h>
#include <dummy-control.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
using namespace Dali;
test_return_value = TET_PASS;
}
+
+Visual::Base CheckVisual( Impl::DummyControl& dummyImpl, Property::Index visualId, int type, const char* location )
+{
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(visualId), true, location);
+ Visual::Base visual = dummyImpl.GetVisual(visualId);
+ DALI_TEST_EQUALS( (bool)visual, true, location );
+ Property::Map map;
+ visual.CreatePropertyMap( map );
+ Property::Value* value = map.Find( Visual::Property::TYPE );
+ DALI_TEST_EQUALS( value != NULL, true, location );
+
+ int visualType;
+ value->Get( visualType );
+ DALI_TEST_EQUALS( visualType, type, location );
+ return visual;
+}
+
+
+Integration::Bitmap* CreateBitmap( unsigned int imageWidth, unsigned int imageHeight, unsigned int initialColor, Pixel::Format pixelFormat )
+{
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+ Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
+ unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
+
+ memset( pixbuffer, initialColor, imageHeight * imageWidth * bytesPerPixel );
+
+ return bitmap;
+}
+
+Integration::ResourcePointer CustomizeNinePatch( TestApplication& application,
+ unsigned int ninePatchImageWidth,
+ unsigned int ninePatchImageHeight)
+{
+ TestPlatformAbstraction& platform = application.GetPlatform();
+
+ Pixel::Format pixelFormat = Pixel::RGBA8888;
+
+ tet_infoline("Create Bitmap");
+ platform.SetClosestImageSize(Vector2( ninePatchImageWidth, ninePatchImageHeight));
+ Integration::Bitmap* bitmap = CreateBitmap( ninePatchImageWidth, ninePatchImageHeight, 0xFF, pixelFormat );
+
+ tet_infoline("Getting resource");
+ Integration::ResourcePointer resourcePtr(bitmap);
+ platform.SetSynchronouslyLoadedResource( resourcePtr);
+
+ return resourcePtr;
+}
+
int UtcDaliStyleManagerConstructorP(void)
{
ToolkitTestApplication application;
Stage::GetCurrent().Add(actor);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ Integration::ResourcePointer ninePatch = CustomizeNinePatch( application, 30, 30 );
DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
Visual::Base visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+ Visual::Base labelVisual1 = dummyImpl.GetVisual(DummyControl::Property::LABEL_VISUAL);
+ Property::Map labelMap;
+ labelVisual1.CreatePropertyMap( labelMap );
+ labelMap[TextVisual::Property::TEXT] = "New text";
+ VisualFactory factory = VisualFactory::Get();
+ labelVisual1 = factory.CreateVisual(labelMap);
+ dummyImpl.UnregisterVisual(DummyControl::Property::LABEL_VISUAL );
+ dummyImpl.RegisterVisual(DummyControl::Property::LABEL_VISUAL, labelVisual1 );
actor.SetProperty( DevelControl::Property::STATE, DevelControl::FOCUSED );
DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::LABEL_VISUAL), true, TEST_LOCATION);
Visual::Base visual2 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+ Visual::Base labelVisual2 = dummyImpl.GetVisual(DummyControl::Property::LABEL_VISUAL);
DALI_TEST_CHECK( visual1 != visual2 );
+ DALI_TEST_CHECK( labelVisual1 != labelVisual2 );
+ labelMap.Clear();
+ labelVisual2.CreatePropertyMap( labelMap );
+ Property::Value* textValue = labelMap.Find( Toolkit::TextVisual::Property::TEXT, "text");
+ DALI_TEST_CHECK( textValue );
+ Property::Value* pointSizeValue = labelMap.Find( Toolkit::TextVisual::Property::POINT_SIZE, "pointSize");
+ tet_infoline( "Check that the instance data has been copied to the new text visual\n");
+ DALI_TEST_EQUALS( textValue->Get<std::string>(), "New text", TEST_LOCATION );
+ DALI_TEST_EQUALS( pointSizeValue->Get<int>(), 10, TEST_LOCATION );
+
actor.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED );
DALI_TEST_CHECK( visual1 != visual3 );
DALI_TEST_CHECK( visual2 != visual3 );
+ Visual::Base labelVisual3 = dummyImpl.GetVisual(DummyControl::Property::LABEL_VISUAL);
+ DALI_TEST_CHECK( labelVisual2 != labelVisual3 );
+
+ labelVisual2.CreatePropertyMap( labelMap );
+ textValue = labelMap.Find(Toolkit::TextVisual::Property::TEXT, "text");
+ DALI_TEST_CHECK( textValue );
+ pointSizeValue = labelMap.Find(Toolkit::TextVisual::Property::POINT_SIZE, "pointSize");
+ tet_infoline( "Check that the instance data has been copied to the new text visual\n");
+ DALI_TEST_EQUALS( textValue->Get<std::string>(), "New text", TEST_LOCATION );
+ DALI_TEST_EQUALS( pointSizeValue->Get<int>(), 10, TEST_LOCATION );
+
END_TEST;
}
Stage::GetCurrent().Add(actor);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ Integration::ResourcePointer ninePatch = CustomizeNinePatch( application, 30, 30 );
int state = actor.GetProperty<int>( DevelControl::Property::STATE );
DALI_TEST_EQUALS( state, (int) DevelControl::NORMAL, TEST_LOCATION );
DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
Visual::Base visual3 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
- Visual::Base focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
- DALI_TEST_CHECK( !focusVisual );
- DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), false, TEST_LOCATION);
+
+ Visual::Base testVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+ DALI_TEST_CHECK( !testVisual );
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL);
+ DALI_TEST_CHECK( !testVisual );
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL2);
+ DALI_TEST_CHECK( !testVisual );
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::LABEL_VISUAL);
+ DALI_TEST_CHECK( testVisual );
+
DALI_TEST_CHECK( visual1 != visual3 );
DALI_TEST_CHECK( visual2 != visual3 );
visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
DALI_TEST_CHECK( visual1 );
- focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+ Visual::Base focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
DALI_TEST_CHECK( !focusVisual );
DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), false, TEST_LOCATION);
}
-int UtcDaliStyleManagerSetSubState(void)
+int UtcDaliStyleManagerSetState03N(void)
+{
+ tet_infoline("Instantiate dummy control and test state transition without state style" );
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+ defaultTheme );
+
+ ToolkitTestApplication application;
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ DummyControl actor = DummyControl::New(true);
+ actor.SetStyleName("NoStyles");
+ Stage::GetCurrent().Add(actor);
+
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ int state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::NORMAL, TEST_LOCATION );
+
+ actor.SetProperty( DevelControl::Property::STATE,
+ Property::Map().Add( "state", "FOCUSED" ).Add("withTransitions", false));
+
+ Visual::Base testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL);
+ DALI_TEST_CHECK( testVisual = visual );
+
+ state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::FOCUSED, TEST_LOCATION );
+
+ actor.SetProperty( DevelControl::Property::STATE,
+ Property::Map().Add( "state", "DISABLED" ).Add("withTransitions", false));
+
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL);
+ DALI_TEST_CHECK( testVisual = visual );
+
+ state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::DISABLED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliStyleManagerSetState04N(void)
+{
+ tet_infoline("Instantiate dummy control and test state transition with style without state" );
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+ defaultTheme );
+
+ ToolkitTestApplication application;
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ DummyControl actor = DummyControl::New(true);
+ actor.SetStyleName("NoStateStyle");
+ Stage::GetCurrent().Add(actor);
+
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ int state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::NORMAL, TEST_LOCATION );
+
+ actor.SetProperty( DevelControl::Property::STATE,
+ Property::Map().Add( "state", "FOCUSED" ).Add("withTransitions", false));
+
+ Visual::Base testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL);
+ DALI_TEST_CHECK( testVisual = visual );
+
+ state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::FOCUSED, TEST_LOCATION );
+
+ actor.SetProperty( DevelControl::Property::STATE,
+ Property::Map().Add( "state", "DISABLED" ).Add("withTransitions", false));
+
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::TEST_VISUAL);
+ DALI_TEST_CHECK( testVisual = visual );
+
+ state = actor.GetProperty<int>( DevelControl::Property::STATE );
+ DALI_TEST_EQUALS( state, (int) DevelControl::DISABLED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliStyleManagerSetSubState01(void)
{
tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
actor.SetStyleName("ComplexControl");
Stage::GetCurrent().Add(actor);
+ Integration::ResourcePointer ninePatch = CustomizeNinePatch( application, 30, 30 );
+
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
- {
- DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
- Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
- DALI_TEST_CHECK( visual );
- Property::Map map;
- visual.CreatePropertyMap( map );
- Property::Value* value = map.Find( Visual::Property::TYPE );
- DALI_TEST_CHECK( value );
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::GRADIENT, TEST_LOCATION);
- int visualType;
- value->Get( visualType );
- DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
- }
+ actor.SetProperty(DevelControl::Property::SUB_STATE, "UNSELECTED");
+
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::COLOR, TEST_LOCATION);
+
+ actor.SetProperty(DevelControl::Property::SUB_STATE, "SELECTED");
+
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::GRADIENT, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+int UtcDaliStyleManagerSetSubState02(void)
+{
+ tet_infoline("Instantiate complex control and test state/substate change" );
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+ defaultTheme );
+
+ ToolkitTestApplication application;
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ DummyControl actor = DummyControl::New(true);
+ actor.SetProperty(DevelControl::Property::STATE, "NORMAL");
+ actor.SetProperty(DevelControl::Property::SUB_STATE, "SELECTED");
+ tet_infoline( "Setting state to NORMAL/SELECTED before re-styling\n");
+
+ actor.SetStyleName("ComplexControl");
+ Stage::GetCurrent().Add(actor);
+
+ Integration::ResourcePointer ninePatch = CustomizeNinePatch( application, 30, 30 );
+
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::GRADIENT, TEST_LOCATION);
actor.SetProperty(DevelControl::Property::SUB_STATE, "UNSELECTED");
+ tet_infoline( "Changing substate to UNSELECTED - check visual changes\n");
- {
- DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
- Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
- DALI_TEST_CHECK( visual );
- Property::Map map;
- visual.CreatePropertyMap( map );
- Property::Value* value = map.Find( Visual::Property::TYPE );
- DALI_TEST_CHECK( value );
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::COLOR, TEST_LOCATION);
- int visualType;
- value->Get( visualType );
- DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::COLOR, TEST_LOCATION );
- }
+ actor.SetProperty(DevelControl::Property::STATE, "FOCUSED");
+ tet_infoline( "Changing state to FOCUSED - check visual changes\n");
+
+ Visual::Base fgVisual1 = CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::GRADIENT, TEST_LOCATION);
+ Visual::Base focusVisual1 = CheckVisual( dummyImpl, DummyControl::Property::FOCUS_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
actor.SetProperty(DevelControl::Property::SUB_STATE, "SELECTED");
+ tet_infoline( "Changing substate to SELECTED - Expect no change\n");
- {
- Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
- DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
- Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
- DALI_TEST_CHECK( visual );
- Property::Map map;
- visual.CreatePropertyMap( map );
- Property::Value* value = map.Find( Visual::Property::TYPE );
- DALI_TEST_CHECK( value );
+ Visual::Base fgVisual2 = CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::GRADIENT, TEST_LOCATION);
+ Visual::Base focusVisual2 = CheckVisual( dummyImpl, DummyControl::Property::FOCUS_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+
+ DALI_TEST_CHECK( fgVisual1 == fgVisual2 );
+ DALI_TEST_CHECK( focusVisual1 == focusVisual2 );
+
+ actor.SetProperty(DevelControl::Property::STATE, "NORMAL");
+ tet_infoline( "Changing state to NORMAL - Expect to change to NORMAL/SELECTED \n");
+
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, Toolkit::Visual::GRADIENT, TEST_LOCATION);
+
+ Visual::Base focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+ DALI_TEST_CHECK( ! focusVisual );
+
+ actor.SetProperty(DevelControl::Property::STATE, "DISABLED");
+ tet_infoline( "Changing state to DISABLED - Expect to change to DISABLED/SELECTED \n");
+
+ CheckVisual( dummyImpl, DummyControl::Property::FOREGROUND_VISUAL, Toolkit::Visual::COLOR, TEST_LOCATION);
+ CheckVisual( dummyImpl, DummyControl::Property::TEST_VISUAL, Toolkit::Visual::IMAGE, TEST_LOCATION);
+
+ Visual::Base testVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+ DALI_TEST_CHECK( ! testVisual );
+ testVisual = dummyImpl.GetVisual(DummyControl::Property::LABEL_VISUAL);
+ DALI_TEST_CHECK( ! testVisual );
- int visualType;
- value->Get( visualType );
- DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
- }
END_TEST;
}
typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty02(
- typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL2, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+ typeRegistration, "testVisual2", Dali::Toolkit::DummyControl::Property::TEST_VISUAL2, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty03(
typeRegistration, "foregroundVisual", Dali::Toolkit::DummyControl::Property::FOREGROUND_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty04(
typeRegistration, "focusVisual", Dali::Toolkit::DummyControl::Property::FOCUS_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+Dali::PropertyRegistration dummyControlVisualProperty05(
+ typeRegistration, "labelVisual", Dali::Toolkit::DummyControl::Property::LABEL_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+
}
DummyControl DummyControlImpl::New()
void DummyControlImpl::UnregisterVisual( Property::Index index )
{
Control::UnregisterVisual( index );
+
+ VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index );
+ if( iter != mRegisteredVisualIndices.end() )
+ {
+ mRegisteredVisualIndices.erase(iter);
+ }
}
Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index )
return Control::IsVisualEnabled( index );
}
-
Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
{
return Control::CreateTransition( transition );
case Toolkit::DummyControl::Property::TEST_VISUAL2:
case Toolkit::DummyControl::Property::FOREGROUND_VISUAL:
case Toolkit::DummyControl::Property::FOCUS_VISUAL:
+ case Toolkit::DummyControl::Property::LABEL_VISUAL:
{
Property::Map* map = value.GetMap();
if( map != NULL )
TEST_VISUAL = PROPERTY_START_INDEX,
TEST_VISUAL2,
FOREGROUND_VISUAL,
- FOCUS_VISUAL
+ FOCUS_VISUAL,
+ LABEL_VISUAL
};
};
void UnregisterVisual( Property::Index index );
void EnableVisual( Property::Index index, bool enabled );
bool IsVisualEnabled( Property::Index index );
-
+ int GetVisualCount();
Toolkit::Visual::Base GetVisual( Property::Index index );
Animation CreateTransition( const Toolkit::TransitionData& transition );
mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
}
- inline void Uniform1f(GLint location, GLfloat x)
+ inline void Uniform1f(GLint location, GLfloat value )
{
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) )
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
+ if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, value ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params;
+ for( int i = 0; i < count; ++i )
+ {
+ params = params + ToString( v[i] ) + ",";
+ }
+
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
inline void Uniform1i(GLint location, GLint x)
{
+ std::string params = ToString( x );
+
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
inline void Uniform1iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
inline void Uniform2f(GLint location, GLfloat x, GLfloat y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
location,
Vector2( x, y ) ) )
inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
inline void Uniform2i(GLint location, GLint x, GLint y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform2iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
location,
Vector3( x, y, z ) ) )
inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms3f.SetUniformValue(
inline void Uniform3i(GLint location, GLint x, GLint y, GLint z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
location,
Vector4( x, y, z, w ) ) )
inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms4f.SetUniformValue(
inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat3.SetUniformValue(
inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat4.SetUniformValue(
{
}
+private:
+
+ inline void AddUniformCallToTraceStack( GLint location, std::string& value )
+ {
+ std::string name = "<not found>";
+ bool matched = false;
+
+ UniformIDMap& map = mUniforms[mCurrentProgram];
+ for (UniformIDMap::iterator it=map.begin(); it!=map.end(); ++it)
+ {
+ if( it->second == location )
+ {
+ name = it->first;
+ matched = true;
+ break;
+ }
+ }
+
+ if ( matched )
+ {
+ mSetUniformTrace.PushCall( name, value );
+ }
+ }
+
+
public: // TEST FUNCTIONS
inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+ //Methods for Uniform function verification
+ inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
+ inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
+ inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
+
template <typename T>
inline bool GetUniformValue( const char* name, T& value ) const
{
TraceCallStack mDrawTrace;
TraceCallStack mDepthFunctionTrace;
TraceCallStack mStencilFunctionTrace;
+ TraceCallStack mSetUniformTrace;
// Shaders & Uniforms
GLuint mLastShaderIdUsed;
ProgramUniformValue<Matrix> mProgramUniformsMat4;
ProgramUniformValue<Matrix3> mProgramUniformsMat3;
-
-
-
inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
{
return mProgramUniforms1i;
TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
mIsLoadingResult( false ),
- mGetDefaultFontSizeResult( 0 ),
- mLoadedResourcesQueue(),
- mFailedLoadQueue(),
- mResourceRequests(),
mSize(),
mClosestSize(),
mLoadFileResult(),
TestPlatformAbstraction::~TestPlatformAbstraction()
{
- DiscardRequest();
-}
-
-void TestPlatformAbstraction::Suspend()
-{
- mTrace.PushCall("Suspend", "");
-}
-
-void TestPlatformAbstraction::Resume()
-{
- mTrace.PushCall("Resume", "");
}
ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
return closestSize;
}
-void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
-{
- std::ostringstream out;
- out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
-
- mTrace.PushCall("LoadResource", out.str());
-
- mResourceRequests.PushBack( new Integration::ResourceRequest(request) );
-}
-
Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
{
mTrace.PushCall("LoadResourceSynchronously", "");
return mDecodedBitmap;
}
-void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
- mTrace.PushCall("CancelLoad", "");
-}
-
-void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
-{
- mTrace.PushCall("GetResources", "");
-
- while( !mLoadedResourcesQueue.empty() )
- {
- LoadedResource loaded( *mLoadedResourcesQueue.begin() );
- mLoadedResourcesQueue.erase( mLoadedResourcesQueue.begin() );
- cache.LoadResponse( loaded.id, loaded.type, loaded.resource, Integration::RESOURCE_COMPLETELY_LOADED );
- }
-
- // iterate through the resources which failed to load
- while( !mFailedLoadQueue.empty() )
- {
- FailedLoad failed( *mFailedLoadQueue.begin() );
- mFailedLoadQueue.erase( mFailedLoadQueue.begin() );
- cache.LoadFailed( failed.id, failed.failure );
- }
-}
-
-bool TestPlatformAbstraction::IsLoading()
-{
- mTrace.PushCall("IsLoading", "");
- return mIsLoadingResult;
-}
-
-int TestPlatformAbstraction::GetDefaultFontSize() const
-{
- mTrace.PushCall("GetDefaultFontSize", "");
- return mGetDefaultFontSizeResult;
-}
-
-void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
-{
- mTrace.PushCall("SetDpi", "");
-}
-
-bool TestPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
-{
- mTrace.PushCall("LoadFile", "");
- if( mLoadFileResult.loadResult )
- {
- buffer = mLoadFileResult.buffer;
- }
-
- return mLoadFileResult.loadResult;
-}
-
bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
{
mTrace.PushCall("LoadShaderBinaryFile", "");
return mLoadFileResult.loadResult;
}
-bool TestPlatformAbstraction::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const
-{
- mTrace.PushCall("SaveFile", "");
- return false;
-}
-
-void TestPlatformAbstraction::JoinLoaderThreads()
-{
- mTrace.PushCall("JoinLoaderThreads", "");
-}
/** Call this every test */
void TestPlatformAbstraction::Initialize()
{
mTrace.Reset();
mTrace.Enable(true);
- mLoadedResourcesQueue.clear();
- mFailedLoadQueue.clear();
- mResourceRequests.Clear();
mIsLoadingResult=false;
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
{
switch(func)
{
- case SuspendFunc: return mTrace.FindMethod("Suspend");
- case ResumeFunc: return mTrace.FindMethod("Resume");
- case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
case LoadResourceSynchronouslyFunc: return mTrace.FindMethod("LoadResourceSynchronously");
- case LoadFileFunc: return mTrace.FindMethod("LoadFile");
case LoadShaderBinaryFileFunc: return mTrace.FindMethod("LoadShaderBinaryFile");
case SaveShaderBinaryFileFunc: return mTrace.FindMethod("SaveShaderBinaryFile");
- case SaveFileFunc: return mTrace.FindMethod("SaveFile");
- case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
- case GetResourcesFunc: return mTrace.FindMethod("GetResources");
- case IsLoadingFunc: return mTrace.FindMethod("IsLoading");
- case SetDpiFunc: return mTrace.FindMethod("SetDpi");
- case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads");
}
return false;
}
void TestPlatformAbstraction::ClearReadyResources()
{
- mLoadedResourcesQueue.clear();
- mFailedLoadQueue.clear();
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
}
-void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId,
- Integration::ResourceTypeId loadedType,
- Integration::ResourcePointer loadedResource)
-{
- LoadedResource loadedInfo;
- loadedInfo.id = loadedId;
- loadedInfo.type = loadedType;
- loadedInfo.resource = loadedResource;
- mLoadedResourcesQueue.push_back( loadedInfo );
-}
-
-void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId id,
- Integration::ResourceFailure failure)
-{
- FailedLoad failedInfo;
- failedInfo.id = id;
- failedInfo.failure = failure;
- mFailedLoadQueue.push_back( failedInfo );
-}
-
-Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
-{
- Integration::ResourceRequest* request = NULL;
-
- // Return last request
- if( ! mResourceRequests.Empty() )
- {
- request = *( mResourceRequests.End() - 1 );
- }
-
- return request;
-}
-
-const TestPlatformAbstraction::ResourceRequestContainer& TestPlatformAbstraction::GetAllRequests() const
-{
- return mResourceRequests;
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsLoaded()
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
- Integration::ResourcePointer resource(bitmap);
- bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
- SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
- delete request;
- }
- mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure )
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- SetResourceLoadFailed( (*iter)->GetId(), failure);
- delete request;
- }
- mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::DiscardRequest()
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- delete request;
- }
- mResourceRequests.Clear();
-}
-
void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
{
mClosestSize = size;
public:
- typedef Vector< Integration::ResourceRequest* > ResourceRequestContainer;
-
/**
* Constructor
*/
virtual ~TestPlatformAbstraction();
/**
- * @copydoc PlatformAbstraction::Suspend()
- */
- virtual void Suspend();
-
- /**
- * @copydoc PlatformAbstraction::Resume()
- */
- virtual void Resume();
-
- /**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
virtual ImageDimensions GetClosestImageSize( const std::string& filename,
bool orientationCorrection );
/**
- * @copydoc PlatformAbstraction::LoadResource()
- */
- virtual void LoadResource(const Integration::ResourceRequest& request);
-
- /**
* @copydoc PlatformAbstraction::LoadResourceSynchronously()
*/
virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
/**
- * @copydoc PlatformAbstraction::CancelLoad()
- */
- virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
- /**
- * @copydoc PlatformAbstraction::GetResources()
- */
- virtual void GetResources(Integration::ResourceCache& cache);
-
- /**
- * @copydoc PlatformAbstraction::IsLoading()
- */
- virtual bool IsLoading();
-
- /**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
- virtual int GetDefaultFontSize() const;
-
- /**
- * @copydoc PlatformAbstraction::SetDpi()
- */
- virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
-
- /**
- * @copydoc PlatformAbstraction::LoadFile()
- */
- virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
- /**
* @copydoc PlatformAbstraction::LoadShaderBinaryFile()
*/
virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
/**
- * @copydoc PlatformAbstraction::SaveFile()
+ * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
*/
- virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
-
- /**
- * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
- */
virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
- virtual void JoinLoaderThreads();
public: // TEST FUNCTIONS
// Enumeration of Platform Abstraction methods
typedef enum
{
- SuspendFunc,
- ResumeFunc,
- LoadResourceFunc,
LoadResourceSynchronouslyFunc,
- SaveFileFunc,
- LoadFileFunc,
LoadShaderBinaryFileFunc,
- SaveShaderBinaryFileFunc,
- CancelLoadFunc,
- GetResourcesFunc,
- IsLoadingFunc,
- SetDpiFunc,
- JoinLoaderThreadsFunc,
+ SaveShaderBinaryFileFunc
} TestFuncEnum;
/** Call this every test */
void SetIsLoadingResult(bool result);
/**
- * @brief Sets the value returned by GetDefaultFontSize
- * @param[in] result The value to return
- */
- void SetGetDefaultFontSizeResult(float result);
-
- /**
* @brief Clears all resource queues
*/
void ClearReadyResources();
/**
- * @brief Sets a particular resource request as loaded.
- * @param[in] loadedId The ResourceID of the resource that has been loaded.
- * @param[in] loadedType The type of resource that has been loaded.
- * @param[in] loadedResource A pointer to the resource that has been loaded.
- */
- void SetResourceLoaded(Integration::ResourceId loadedId,
- Integration::ResourceTypeId loadedType,
- Integration::ResourcePointer loadedResource);
-
- /**
- * @brief Sets a particular resource request as load failure.
- * @param[in] id The ID of the failed resource request.
- * @param[in] failure The type of failure.
- */
- void SetResourceLoadFailed(Integration::ResourceId id,
- Integration::ResourceFailure failure);
-
- /**
- * @brief Retrieves the latest resource request
- * @return A pointer to the latest resource request.
- */
- Integration::ResourceRequest* GetRequest();
-
- /**
- * @brief Retrieves a reference to a container of all the resource requests.
- * @return A reference to a container of all the resource requests.
- */
- const ResourceRequestContainer& GetAllRequests() const;
-
- /**
- * @brief Sets all resource requests as loaded.
- */
- void SetAllResourceRequestsAsLoaded();
-
- /**
- * @brief Sets all resource requests as loaded.
- * @param[in] failure The failure type
- */
- void SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure );
-
- /**
- * @brief Discards all current resource requests.
- */
- void DiscardRequest();
-
- /**
* @brief Sets the value returned by GetClosestImageSize.
* @param[in] size The size that should be returned.
*/
private:
- struct LoadedResource
- {
- Integration::ResourceId id;
- Integration::ResourceTypeId type;
- Integration::ResourcePointer resource;
- };
-
- struct FailedLoad
- {
- Integration::ResourceId id;
- Integration::ResourceFailure failure;
- };
-
struct LoadFileResult
{
inline LoadFileResult()
Dali::Vector< unsigned char> buffer;
};
- typedef std::vector< LoadedResource > LoadedResourceContainer;
- typedef std::vector< FailedLoad > FailedLoadContainer;
-
mutable TraceCallStack mTrace;
bool mIsLoadingResult;
- int mGetDefaultFontSizeResult;
- LoadedResourceContainer mLoadedResourcesQueue;
- FailedLoadContainer mFailedLoadQueue;
- ResourceRequestContainer mResourceRequests;
Vector2 mSize;
Vector2 mClosestSize;
namespace Dali
{
+
+template<typename T>
+std::string ToString(const T& x)
+{
+ return "undefined";
+}
+
std::string ToString(int x);
std::string ToString(unsigned int x);
std::string ToString(float x);
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar-devel.h>
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+int UtcDaliToolkitScrollBarActionShowIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a scroll bar
+ ScrollBar scrollBar = ScrollBar::New();
+ DALI_TEST_CHECK( scrollBar );
+
+ Stage::GetCurrent().Add( scrollBar );
+
+ Actor indicator = scrollBar.GetScrollIndicator();
+ DALI_TEST_CHECK( indicator );
+
+ // Get the default duration to hide the indicator
+ float duration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_SHOW_DURATION );
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( duration > 0.0f );
+
+ // Make the indicator invisible
+ indicator.SetOpacity(0.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ // Do the "ShowIndicator" action
+ Property::Map emptyMap;
+ scrollBar.DoAction( "ShowIndicator", emptyMap );
+
+ // Wait for the specified duration
+ Wait(application, duration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollBarActionHideIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a scroll bar
+ ScrollBar scrollBar = ScrollBar::New();
+ DALI_TEST_CHECK( scrollBar );
+
+ Stage::GetCurrent().Add( scrollBar );
+
+ Actor indicator = scrollBar.GetScrollIndicator();
+ DALI_TEST_CHECK( indicator );
+
+ // Get the default duration to hide the indicator
+ float duration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_HIDE_DURATION );
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( duration > 0.0f );
+
+ // Make the indicator visible
+ indicator.SetOpacity(1.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ // Do the "HideIndicator" action
+ Property::Map emptyMap;
+ scrollBar.DoAction( "HideIndicator", emptyMap );
+
+ // Wait for the specified duration
+ Wait(application, duration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollBarActionShowTransientIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a scroll bar
+ ScrollBar scrollBar = ScrollBar::New();
+ DALI_TEST_CHECK( scrollBar );
+
+ Stage::GetCurrent().Add( scrollBar );
+
+ Actor indicator = scrollBar.GetScrollIndicator();
+ DALI_TEST_CHECK( indicator );
+
+ // Get the default duration to hide the indicator
+ float duration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_SHOW_DURATION );
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( duration > 0.0f );
+
+ // Make the indicator invisible
+ indicator.SetOpacity(0.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ // Do the "ShowIndicator" action
+ Property::Map emptyMap;
+ scrollBar.DoAction( "ShowTransientIndicator", emptyMap );
+
+ // Wait for the specified duration
+ Wait(application, duration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ // Get the default duration to hide the indicator
+ float hideDuration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_HIDE_DURATION );
+ float transientDuration = scrollBar.GetProperty<float>( DevelScrollBar::Property::INDICATOR_TRANSIENT_DURATION );
+ float totalVisibleDuration = hideDuration + transientDuration;
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( totalVisibleDuration > 0.0f );
+
+ // Wait for the specified duration
+ Wait(application, totalVisibleDuration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollBarActionShowTransientIndicatorImmediate(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a scroll bar
+ ScrollBar scrollBar = ScrollBar::New();
+ DALI_TEST_CHECK( scrollBar );
+
+ Stage::GetCurrent().Add( scrollBar );
+
+ Actor indicator = scrollBar.GetScrollIndicator();
+ DALI_TEST_CHECK( indicator );
+
+ // Make the indicator invisible
+ indicator.SetOpacity(0.0f);
+
+ // Don't use a show animation; the indicator should appear immediately
+ scrollBar.SetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION, 0.0f );
+ float duration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_SHOW_DURATION );
+ DALI_TEST_EQUALS( duration, 0.0f, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Do the "ShowIndicator" action
+ Property::Map emptyMap;
+ scrollBar.DoAction( "ShowTransientIndicator", emptyMap );
+
+ // Wait for the specified duration
+ Wait(application);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ // Get the default duration to hide the indicator
+ float hideDuration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_HIDE_DURATION );
+ float transientDuration = scrollBar.GetProperty<float>( DevelScrollBar::Property::INDICATOR_TRANSIENT_DURATION );
+ float totalVisibleDuration = hideDuration + transientDuration;
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( totalVisibleDuration > 0.0f );
+
+ // Wait for the specified duration
+ Wait(application, totalVisibleDuration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollBarActionShowTransientIndicatorDuringHide(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a scroll bar
+ ScrollBar scrollBar = ScrollBar::New();
+ DALI_TEST_CHECK( scrollBar );
+
+ Stage::GetCurrent().Add( scrollBar );
+
+ Actor indicator = scrollBar.GetScrollIndicator();
+ DALI_TEST_CHECK( indicator );
+
+ // Get the default duration to hide the indicator
+ float duration = scrollBar.GetIndicatorHideDuration();
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( duration > 0.0f );
+
+ // Make the indicator visible
+ indicator.SetOpacity(1.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ // Hide the indicator
+ scrollBar.HideIndicator();
+
+ // Wait for half the specified duration
+ Wait(application, duration * 0.5f * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now partially hidden
+ DALI_TEST_CHECK( indicator.GetCurrentOpacity() < 1.0f );
+
+ // Now interrupt the Hide with a DoAction( "ShowTransientIndicator" )
+
+ // Get the default duration to hide the indicator
+ duration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_SHOW_DURATION );
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( duration > 0.0f );
+
+ // Do the "ShowIndicator" action
+ Property::Map emptyMap;
+ scrollBar.DoAction( "ShowTransientIndicator", emptyMap );
+
+ // Wait for the specified duration
+ Wait(application, duration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now visible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
+
+ // Get the default duration to hide the indicator
+ float hideDuration = scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_HIDE_DURATION );
+ float transientDuration = scrollBar.GetProperty<float>( DevelScrollBar::Property::INDICATOR_TRANSIENT_DURATION );
+ float totalVisibleDuration = hideDuration + transientDuration;
+
+ // Check that the default duration is greater than 0
+ DALI_TEST_CHECK( totalVisibleDuration > 0.0f );
+
+ // Wait for the specified duration
+ Wait(application, totalVisibleDuration * 1000);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check that the indicator is now invisible
+ DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
{
ToolkitTestApplication application;
void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
{
- Integration::ResourceRequest* request = platform.GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
-
- if(request)
- {
- platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
- }
}
class SignalHandler : public Dali::ConnectionTracker
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
+ // Press Escape to increase coverage
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up ) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !editor.HasKeyInputFocus() );
+
END_TEST;
}
static void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
{
- Integration::ResourceRequest* request = platform.GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
-
- if(request)
- {
- platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
- }
}
static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField)
DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+ // Press Escape to increase coverage
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up ) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !field.HasKeyInputFocus() );
+
END_TEST;
}
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
-const unsigned int EMOJI_FONT_SIZE = 3968u;
+const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
{
application.SendNotification();
application.Render();
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelEmojisP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK( label );
+
+ Stage::GetCurrent().Add( label );
+
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
char* pathNamePtr = get_current_dir_name();
const std::string pathName( pathNamePtr );
free( pathNamePtr );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
+ TextAbstraction::FontDescription fontDescription;
+ fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
+ fontDescription.family = "BreezeColorEmoji";
+ fontDescription.width = TextAbstraction::FontWidth::NONE;
+ fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
+ fontDescription.slant = TextAbstraction::FontSlant::NONE;
+
+ fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
- const std::string emojis = "<font family='TizenColorEmoji'>\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84</font>";
+ const std::string emojis = "<font family='BreezeColorEmoji' size='60'>\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84</font>";
label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
label.SetProperty( TextLabel::Property::TEXT, emojis );
application.SendNotification();
application.Render();
- if( resourcePtr )
- {
- Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
- if(request)
- {
- application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resourcePtr );
- }
- }
-
application.Render();
application.SendNotification();
if( resourcePtr )
{
- DALI_TEST_EQUALS( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) ||
- application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ), true, TEST_LOCATION);
+ DALI_TEST_EQUALS( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ), true, TEST_LOCATION);
}
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
application.SendNotification();
application.Render( 0 );
- //Tell the platform abstraction that the required resources have been loaded.
- TestPlatformAbstraction& platform = application.GetPlatform();
- platform.SetAllResourceRequestsAsLoaded();
-
//Render again to upload the now-loaded textures.
application.SendNotification();
application.Render( 0 );
application.SendNotification();
application.Render( 0 );
- //Tell the platform abstraction that the required resources have been loaded.
- TestPlatformAbstraction& platform = application.GetPlatform();
- platform.SetAllResourceRequestsAsLoaded();
-
//Render again to upload the now-loaded textures.
application.SendNotification();
application.Render( 0 );
develapigaussianblurviewdir = $(develapicontrolsdir)/gaussian-blur-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
develapiitemviewdir = $(develapicontrolsdir)/scrollable/item-view
+develapiscrollbardir = $(develapicontrolsdir)/scroll-bar
develapinavigationviewdir = $(develapicontrolsdir)/navigation-view
develapipageturnviewdir = $(develapicontrolsdir)/page-turn-view
develapipopupdir = $(develapicontrolsdir)/popup
develapigaussianblurview_HEADERS = $(devel_api_gaussian_blur_view_header_files)
develapiimageloader_HEADERS = $(devel_api_image_loader_header_files)
develapiitemview_HEADERS = $(devel_api_item_view_header_files)
+develapiscrollbar_HEADERS = $(devel_api_scroll_bar_header_files)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
develapinavigationview_HEADERS = $(devel_api_navigation_view_header_files)
develapipageturnview_HEADERS = $(devel_api_page_turn_view_header_files)
--- /dev/null
+#ifndef DALI_TOOLKIT_SCROLL_BAR_DEVEL_H
+#define DALI_TOOLKIT_SCROLL_BAR_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelScrollBar
+{
+
+namespace Property
+{
+
+/**
+ * @brief ScrollBar is a UI component that can be linked to the scrollable objects
+ * indicating the current scroll position of the scrollable object.
+ *
+ * Actions
+ * | %Action Name | Attributes | Description |
+ * |------------------------|-------------------------|-------------------------------------------|
+ * | ShowIndicator | Doesn't have attributes | Shows the scroll-indicator |
+ * | HideIndicator | Doesn't have attributes | Hides the scroll-indicator |
+ * | ShowTransientIndicator | Doesn't have attributes | Shows the scroll-indicator for short time |
+ */
+
+/**
+ * @brief Enumeration for the instance of properties belonging to the ScrollBar class.
+ */
+enum
+{
+ SCROLL_DIRECTION = Dali::Toolkit::ScrollBar::Property::SCROLL_DIRECTION,
+ INDICATOR_HEIGHT_POLICY = Dali::Toolkit::ScrollBar::Property::INDICATOR_HEIGHT_POLICY,
+ INDICATOR_FIXED_HEIGHT = Dali::Toolkit::ScrollBar::Property::INDICATOR_FIXED_HEIGHT,
+ INDICATOR_SHOW_DURATION = Dali::Toolkit::ScrollBar::Property::INDICATOR_SHOW_DURATION,
+ INDICATOR_HIDE_DURATION = Dali::Toolkit::ScrollBar::Property::INDICATOR_HIDE_DURATION,
+ SCROLL_POSITION_INTERVALS = Dali::Toolkit::ScrollBar::Property::SCROLL_POSITION_INTERVALS,
+ INDICATOR_MINIMUM_HEIGHT = Dali::Toolkit::ScrollBar::Property::INDICATOR_MINIMUM_HEIGHT,
+ INDICATOR_START_PADDING = Dali::Toolkit::ScrollBar::Property::INDICATOR_START_PADDING,
+ INDICATOR_END_PADDING = Dali::Toolkit::ScrollBar::Property::INDICATOR_END_PADDING,
+
+ /**
+ * @brief The duration that transient indicators will remain fully visible.
+ * @details name "indicatorTransientDuration", type float.
+ */
+ INDICATOR_TRANSIENT_DURATION = INDICATOR_END_PADDING + 1
+};
+
+} // namespace Property
+
+} // namespace DevelScrollBar
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_SCROLL_BAR_DEVEL_H
$(devel_api_src_dir)/controls/scrollable/item-view/default-item-layout-property.h \
$(devel_api_src_dir)/controls/scrollable/item-view/item-view-devel.h
+devel_api_scroll_bar_header_files = \
+ $(devel_api_src_dir)/controls/scroll-bar/scroll-bar-devel.h
+
devel_api_magnifier_header_files = \
$(devel_api_src_dir)/controls/magnifier/magnifier.h
if( matchedStyle )
{
StylePtr style( *matchedStyle );
- style->ApplyVisualsAndPropertiesRecursively( handle ); // (recurses through states)
+ Dictionary<Property::Map> instancedProperties;
+ style->ApplyVisualsAndPropertiesRecursively( handle, instancedProperties );
}
else // If there were no styles, instead set properties
{
*
* It enables lookup of keys via case-insensitive match.
*/
+
+
+typedef std::vector<std::string> DictionaryKeys;
+inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict )
+{
+ for( DictionaryKeys::const_iterator fromIter = fromDict.begin(); fromIter != fromDict.end(); ++fromIter )
+ {
+ const std::string& fromKey = (*fromIter);
+ DictionaryKeys::iterator toIter = std::find( toDict.begin(), toDict.end(), fromKey );
+ if( toIter == toDict.end() )
+ {
+ toDict.push_back( fromKey );
+ }
+ }
+}
+
+
template<typename EntryType>
class Dictionary
{
*/
typedef typename Elements::const_iterator iterator;
-
/**
* Constructor
*/
}
/**
+ * Remove a key value pair from the dictionary.
+ */
+ void Remove( const std::string& name )
+ {
+ for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ if( iter->key == name )
+ {
+ container.erase( iter );
+ break;
+ }
+ }
+ }
+
+ /**
+ * Remove a key value pair from the dictionary.
+ */
+ void Remove( const char* name )
+ {
+ if( name != NULL )
+ {
+ std::string theName(name);
+ Remove(theName);
+ }
+ }
+
+ void Merge( const Dictionary<EntryType>& dictionary )
+ {
+ for( typename Elements::const_iterator fromIter = dictionary.container.begin(); fromIter != dictionary.container.end(); ++fromIter )
+ {
+ bool found=false;
+ for( typename Elements::iterator toIter = container.begin(); toIter != container.end(); ++toIter )
+ {
+ if( fromIter->key == toIter->key )
+ {
+ found=true;
+ toIter->entry = fromIter->entry;
+ }
+ }
+ if( !found )
+ {
+ container.push_back( Element(fromIter->key, fromIter->entry) );
+ }
+ }
+ }
+
+ /**
* Find the element in the dictionary pointed at by key, and
* insensitive search, and return a const pointer to it, or NULL
*/
{
return container.end();
}
+
+ void GetKeys( DictionaryKeys& keys ) const
+ {
+ keys.clear();
+ for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ keys.push_back( (*iter).key );
+ }
+ }
+
+ void Clear()
+ {
+ container.clear();
+ }
};
#include <dali/devel-api/scripting/scripting.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/builder/style.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
return stylePtr;
}
-void Style::ApplyVisualsAndPropertiesRecursively( Handle handle ) const
+void Style::ApplyVisualsAndPropertiesRecursively(
+ Handle handle,
+ const Dictionary<Property::Map>& instancedProperties ) const
{
- ApplyVisuals( handle );
+ ApplyVisuals( handle, instancedProperties );
ApplyProperties( handle );
Toolkit::Control control = Toolkit::Control::DownCast(handle);
const StylePtr statePtr(*stylePtr);
// We have a state match.
- statePtr->ApplyVisuals( handle );
+ statePtr->ApplyVisuals( handle, instancedProperties );
statePtr->ApplyProperties( handle );
// Apply substate visuals
{
const StylePtr subStatePtr(*stylePtr);
// We have a sub-state match.
- subStatePtr->ApplyVisuals( handle );
+ subStatePtr->ApplyVisuals( handle, instancedProperties );
subStatePtr->ApplyProperties( handle );
}
}
}
}
-void Style::ApplyVisuals( Handle handle ) const
+void Style::ApplyVisuals(
+ Handle handle,
+ const Dictionary<Property::Map>& instancedProperties ) const
{
- for( Dictionary<Property::Map>::iterator iter = visuals.Begin(); iter != visuals.End() ; ++iter )
+ ApplyVisuals( handle, visuals, instancedProperties );
+}
+
+void Style::ApplyVisuals(
+ Handle handle,
+ const Dictionary<Property::Map>& visualMaps,
+ const Dictionary<Property::Map>& instancedProperties )
+{
+ for( Dictionary<Property::Map>::iterator iter = visualMaps.Begin(); iter != visualMaps.End() ; ++iter )
{
const std::string& visualName = (*iter).key;
- const Property::Map& map = (*iter).entry;
- Dali::Property::Index index = handle.GetPropertyIndex( visualName );
- if( index != Property::INVALID_INDEX )
+ Property::Map map = (*iter).entry;
+ Property::Map* instancedMap = instancedProperties.Find( visualName );
+ ApplyVisual( handle, visualName, map, instancedMap );
+ }
+}
+
+void Style::ApplyVisual(
+ Handle handle,
+ const std::string& visualName,
+ const Property::Map& visualMap,
+ const Property::Map* instancedProperties )
+{
+ // Check if this visual name is a valid property of handle
+ Dali::Property::Index index = handle.GetPropertyIndex( visualName );
+ if( index != Property::INVALID_INDEX )
+ {
+ const Property::Map* applyMap = &visualMap;
+ Property::Map mergedMap;
+
+ // If there are instanced properties, and the visual types match,
+ // merge them into the visual map
+ if( instancedProperties )
{
- const Property::Value value(const_cast<Property::Map&>(map));
- handle.SetProperty( index, value );
+ Property::Value* instanceTypeValue = instancedProperties->Find( Toolkit::DevelVisual::Property::TYPE);
+ Property::Value* newTypeValue = visualMap.Find( Toolkit::DevelVisual::Property::TYPE, VISUAL_TYPE );
+ if( instanceTypeValue && newTypeValue )
+ {
+ int instanceVisualType=-1;
+ int newVisualType=-1;
+ Scripting::GetEnumerationProperty( *instanceTypeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, instanceVisualType );
+ Scripting::GetEnumerationProperty( *newTypeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, newVisualType );
+
+ if( instanceVisualType == newVisualType )
+ {
+ // Same type - merge remaining instance data
+ mergedMap.Merge( visualMap );
+ mergedMap.Merge( *instancedProperties );
+ applyMap = &mergedMap;
+ }
+ }
}
+
+ // Apply the visual property map to the handle
+ const Property::Value value(const_cast<Property::Map&>(*applyMap));
+ handle.SetProperty( index, value );
}
}
* through sub-states.
*
* @param[in] handle The handle to apply the visuals to
+ * @param[in] instancedProperties The maps from which to get instanced properties
*/
- void ApplyVisualsAndPropertiesRecursively( Handle handle ) const;
+ void ApplyVisualsAndPropertiesRecursively( Handle handle,
+ const Dictionary<Property::Map>& instancedProperties ) const;
/**
* Apply the visuals of the style to the control pointed at by
* handle.
*
* @param[in] handle The handle to apply the visuals to
+ * @param[in] instancedProperties The maps from which to get instanced properties
*/
- void ApplyVisuals( Handle handle ) const;
+ void ApplyVisuals( Handle handle,
+ const Dictionary<Property::Map>& instancedProperties ) const;
+
+ /**
+ * Apply the properties from the visualMaps and the instancedProperties
+ * to the control pointed at by handle.
+ *
+ * @param[in] handle The handle to apply the properties to
+ * @param[in] visualMaps The visual maps from which to get the styled properties
+ * @param[in] instancedProperties The maps from which to get instanced properties
+ */
+ static void ApplyVisuals( Handle handle,
+ const Dictionary<Property::Map>& visualMaps,
+ const Dictionary<Property::Map>& instancedProperties );
+
+ /**
+ * Apply the properties from the visualMap and optional instancedProperties
+ * to the control pointed at by handle.
+ */
+ static void ApplyVisual( Handle handle,
+ const std::string& visualName,
+ const Property::Map& visualMap,
+ const Property::Map* instancedProperties );
/**
* Apply the properties of the style to the control pointed at by
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
+#include <dali/devel-api/object/property-helper-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar-devel.h>
using namespace Dali;
const float DEFAULT_INDICATOR_MINIMUM_HEIGHT(0.0f);
const float DEFAULT_INDICATOR_START_PADDING(0.0f);
const float DEFAULT_INDICATOR_END_PADDING(0.0f);
+const float DEFAULT_INDICATOR_TRANSIENT_DURATION(1.0f);
/**
* Indicator size constraint
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ScrollBar, Toolkit::Control, Create );
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "scrollDirection", STRING, SCROLL_DIRECTION )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorHeightPolicy", STRING, INDICATOR_HEIGHT_POLICY )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorFixedHeight", FLOAT, INDICATOR_FIXED_HEIGHT )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorShowDuration", FLOAT, INDICATOR_SHOW_DURATION )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorHideDuration", FLOAT, INDICATOR_HIDE_DURATION )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "scrollPositionIntervals", ARRAY, SCROLL_POSITION_INTERVALS )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorMinimumHeight", FLOAT, INDICATOR_MINIMUM_HEIGHT )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorStartPadding", FLOAT, INDICATOR_START_PADDING )
-DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorEndPadding", FLOAT, INDICATOR_END_PADDING )
-
-DALI_SIGNAL_REGISTRATION( Toolkit, ScrollBar, "panFinished", PAN_FINISHED_SIGNAL )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "scrollDirection", STRING, SCROLL_DIRECTION )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorHeightPolicy", STRING, INDICATOR_HEIGHT_POLICY )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorFixedHeight", FLOAT, INDICATOR_FIXED_HEIGHT )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorShowDuration", FLOAT, INDICATOR_SHOW_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorHideDuration", FLOAT, INDICATOR_HIDE_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "scrollPositionIntervals", ARRAY, SCROLL_POSITION_INTERVALS )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorMinimumHeight", FLOAT, INDICATOR_MINIMUM_HEIGHT )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorStartPadding", FLOAT, INDICATOR_START_PADDING )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorEndPadding", FLOAT, INDICATOR_END_PADDING )
+
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorTransientDuration", FLOAT, INDICATOR_TRANSIENT_DURATION )
+
+DALI_SIGNAL_REGISTRATION( Toolkit, ScrollBar, "panFinished", PAN_FINISHED_SIGNAL )
DALI_SIGNAL_REGISTRATION( Toolkit, ScrollBar, "scrollPositionIntervalReached", SCROLL_POSITION_INTERVAL_REACHED_SIGNAL )
+DALI_ACTION_REGISTRATION( Toolkit, ScrollBar, "ShowIndicator", ACTION_SHOW_INDICATOR )
+DALI_ACTION_REGISTRATION( Toolkit, ScrollBar, "HideIndicator", ACTION_HIDE_INDICATOR )
+DALI_ACTION_REGISTRATION( Toolkit, ScrollBar, "ShowTransientIndicator", ACTION_SHOW_TRANSIENT_INDICATOR )
+
DALI_TYPE_REGISTRATION_END()
const char* SCROLL_DIRECTION_NAME[] = {"Vertical", "Horizontal"};
mPropertyScrollContentSize(Property::INVALID_INDEX),
mIndicatorShowDuration(DEFAULT_INDICATOR_SHOW_DURATION),
mIndicatorHideDuration(DEFAULT_INDICATOR_HIDE_DURATION),
+ mTransientIndicatorDuration(DEFAULT_INDICATOR_TRANSIENT_DURATION),
mScrollStart(0.0f),
mCurrentScrollPosition(0.0f),
mIndicatorHeightPolicy(Toolkit::ScrollBar::Variable),
}
}
+void ScrollBar::ShowTransientIndicator()
+{
+ // Cancel any animation
+ if(mAnimation)
+ {
+ mAnimation.Clear();
+ mAnimation.Reset();
+ }
+
+ mAnimation = Animation::New( mIndicatorShowDuration + mTransientIndicatorDuration + mIndicatorHideDuration );
+ if(mIndicatorShowDuration > 0.0f)
+ {
+ mAnimation.AnimateTo( Property( mIndicator, Actor::Property::COLOR_ALPHA ),
+ mIndicatorShowAlpha, AlphaFunction::EASE_IN, TimePeriod(0, mIndicatorShowDuration) );
+ }
+ else
+ {
+ mIndicator.SetOpacity(mIndicatorShowAlpha);
+ }
+ mAnimation.AnimateTo( Property( mIndicator, Actor::Property::COLOR_ALPHA ),
+ 0.0f, AlphaFunction::EASE_IN, TimePeriod((mIndicatorShowDuration + mTransientIndicatorDuration), mIndicatorHideDuration) );
+ mAnimation.Play();
+}
+
bool ScrollBar::OnPanGestureProcessTick()
{
// Update the scroll position property.
scrollBarImpl.ApplyConstraints();
break;
}
+ case Toolkit::DevelScrollBar::Property::INDICATOR_TRANSIENT_DURATION:
+ {
+ scrollBarImpl.mTransientIndicatorDuration = value.Get<float>();
+ break;
+ }
}
}
}
value = scrollBarImpl.mIndicatorEndPadding;
break;
}
+ case Toolkit::DevelScrollBar::Property::INDICATOR_TRANSIENT_DURATION:
+ {
+ value = scrollBarImpl.mTransientIndicatorDuration;
+ break;
+ }
}
}
return value;
}
+bool ScrollBar::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+{
+ bool ret = false;
+
+ Dali::BaseHandle handle( object );
+
+ Toolkit::ScrollBar scrollBar = Toolkit::ScrollBar::DownCast( handle );
+
+ DALI_ASSERT_DEBUG( scrollBar );
+
+ if( scrollBar )
+ {
+ if( 0 == strcmp( actionName.c_str(), ACTION_SHOW_INDICATOR ) )
+ {
+ GetImpl( scrollBar ).ShowIndicator();
+ ret = true;
+ }
+ else if( 0 == strcmp( actionName.c_str(), ACTION_HIDE_INDICATOR ) )
+ {
+ GetImpl( scrollBar ).HideIndicator();
+ ret = true;
+ }
+ else if( 0 == strcmp( actionName.c_str(), ACTION_SHOW_TRANSIENT_INDICATOR ) )
+ {
+ GetImpl( scrollBar ).ShowTransientIndicator();
+ ret = true;
+ }
+ }
+
+ return ret;
+}
+
Toolkit::ScrollBar ScrollBar::New(Toolkit::ScrollBar::Direction direction)
{
// Create the implementation, temporarily owned by this handle on stack
/**
* @copydoc Toolkit::ScrollBar::HideIndicator()
*/
- void HideIndicator();
+ void HideIndicator();
+
+ /**
+ * @brief Shows indicator until the transient duration has expired
+ */
+ void ShowTransientIndicator();
/**
* @copydoc Toolkit::ScrollBar::PanFinishedSignal()
*/
static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ /**
+ * Performs actions as requested using the action name.
+ * @param[in] object The object on which to perform the action.
+ * @param[in] actionName The action to perform.
+ * @param[in] attributes The attributes with which to perfrom this action.
+ * @return true if action has been accepted by this control
+ */
+ static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+
private: // from Control
/**
float mIndicatorShowDuration; ///< The duration of scroll indicator show animation
float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation
+ float mTransientIndicatorDuration; ///< The duration before hiding transient indicator
float mScrollStart; ///< Scroll Start position (start of drag)
Vector3 mGestureDisplacement; ///< Gesture Displacement.
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
if( mTransientScrollBar )
{
- scrollBar.SetVisible( false );
- scrollBar.HideIndicator();
+ // Show the scroll-indicator for a brief period
+ Property::Map emptyMap;
+ scrollBar.DoAction( "ShowTransientIndicator", emptyMap );
}
}
else if(mAlterChild)
if( ( rulerDomainX.max > size.width ) || ( rulerDomainY.max > size.height ) )
{
- scrollBar.SetVisible( true );
scrollBar.ShowIndicator();
}
}
if( Dali::DALI_KEY_ESCAPE == event.keyCode ) // Make a Dali key code for this
{
- ClearKeyInputFocus();
+ // Make sure ClearKeyInputFocus when only key is up
+ if( event.state == KeyEvent::Up )
+ {
+ ClearKeyInputFocus();
+ }
+
return true;
}
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
- if( Dali::DALI_KEY_ESCAPE == event.keyCode ||
- "Return" == event.keyPressedName ) // Make a Dali key code for this
+ if( Dali::DALI_KEY_ESCAPE == event.keyCode || "Return" == event.keyPressedName ) // Make a Dali key code for this
{
- ClearKeyInputFocus();
+ // Make sure ClearKeyInputFocus when only key is up
+ if( event.state == KeyEvent::Up )
+ {
+ ClearKeyInputFocus();
+ }
+
return true;
}
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
#endif
-#define MAKE_SHADER(A)#A
-
-const char* VERTEX_SHADER = MAKE_SHADER(
-attribute mediump vec2 aPosition;
-attribute mediump vec2 aTexCoord;
-attribute mediump vec4 aColor;
-uniform mediump vec2 uOffset;
-uniform mediump mat4 uMvpMatrix;
-varying mediump vec2 vTexCoord;
-varying mediump vec4 vColor;
-
-void main()
-{
- mediump vec4 position = vec4( aPosition.xy + uOffset, 0.0, 1.0 );
- gl_Position = uMvpMatrix * position;
- vTexCoord = aTexCoord;
- vColor = aColor;
-}
-);
-
-const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
-uniform lowp vec4 uColor;
-uniform sampler2D sTexture;
-varying mediump vec2 vTexCoord;
-varying mediump vec4 vColor;
-
-void main()
-{
- mediump vec4 color = texture2D( sTexture, vTexCoord );
- gl_FragColor = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a * color.r );
-}
-);
-
-const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER(
-uniform lowp vec4 uColor;
-uniform sampler2D sTexture;
-varying mediump vec2 vTexCoord;
-
-void main()
-{
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
-}
-);
-
} // unnamed namespace
namespace Dali
AtlasGlyphManager::AtlasGlyphManager()
{
- mShaderL8 = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_L8 );
- mShaderRgba = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_RGBA );
mAtlasManager = Dali::Toolkit::AtlasManager::New();
}
return mAtlasManager.GetTextures( atlasId );
}
-Shader AtlasGlyphManager::GetShader( uint32_t atlasId ) const
-{
- Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( atlasId );
- return pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba;
-}
-
AtlasGlyphManager::~AtlasGlyphManager()
{
// mAtlasManager handle is automatically released here
TextureSet GetTextures( uint32_t atlasId ) const;
/**
- * @copydoc Toolkit::AtlasGlyphManager::GetShader
- */
- Shader GetShader( uint32_t atlasId ) const;
-
- /**
* @copydoc Toolkit::AtlasGlyphManager::GetMetrics
*/
const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
std::vector< FontGlyphRecord > mFontGlyphRecords;
Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
-
- Shader mShaderL8;
- Shader mShaderRgba;
};
} // namespace Internal
return GetImplementation(*this).GetTextures( atlasId );
}
-Shader AtlasGlyphManager::GetShader( uint32_t atlasId ) const
-{
- return GetImplementation(*this).GetShader( atlasId );
-}
-
const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics()
{
return GetImplementation(*this).GetMetrics();
TextureSet GetTextures( uint32_t atlasId ) const;
/**
- * @brief Get the shader used by an atlas
- *
- * @param[in] atlasId Id of an atlas
- *
- * @return The shader used by the atlas
- */
- Shader GetShader( uint32_t atlasId ) const;
-
- /**
* @brief Get Glyph Manager metrics
*
* @return const reference to glyph manager metrics
}
Dali::Texture atlas = Dali::Texture::New( TextureType::TEXTURE_2D, pixelformat, width, height );
+
+ // Clear the background
+ unsigned int bufferSize( width * height * Dali::Pixel::GetBytesPerPixel( pixelformat ) );
+ unsigned char* background = new unsigned char[bufferSize];
+ memset( background, 0, bufferSize );
+ PixelData backgroundPixels = PixelData::New( background, bufferSize, width, height, pixelformat, PixelData::DELETE_ARRAY );
+ atlas.Upload( backgroundPixels, 0u, 0u, 0u, 0u, width, height );
+
AtlasDescriptor atlasDescriptor;
atlasDescriptor.mAtlas = atlas;
atlasDescriptor.mSize = size;
atlasDescriptor.mTotalBlocks = ( ( width - 1u ) / blockWidth ) * ( ( height - 1u ) / blockHeight );
atlasDescriptor.mAvailableBlocks = atlasDescriptor.mTotalBlocks;
- unsigned int bufferSize( blockWidth * SINGLE_PIXEL_PADDING * Dali::Pixel::GetBytesPerPixel(pixelformat) );
+ bufferSize = blockWidth * SINGLE_PIXEL_PADDING * Dali::Pixel::GetBytesPerPixel(pixelformat);
unsigned char* bufferHorizontalStrip = new unsigned char[bufferSize];
memset( bufferHorizontalStrip, 0, bufferSize );
atlasDescriptor.mHorizontalStrip = PixelData::New( bufferHorizontalStrip, bufferSize, blockWidth, SINGLE_PIXEL_PADDING, pixelformat, PixelData::DELETE_ARRAY );
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_RENDERING");
#endif
+#define MAKE_SHADER(A)#A
+
+const char* VERTEX_SHADER = MAKE_SHADER(
+attribute mediump vec2 aPosition;
+attribute mediump vec2 aTexCoord;
+attribute mediump vec4 aColor;
+uniform mediump vec2 uOffset;
+uniform mediump mat4 uMvpMatrix;
+varying mediump vec2 vTexCoord;
+varying mediump vec4 vColor;
+
+void main()
+{
+ mediump vec4 position = vec4( aPosition.xy + uOffset, 0.0, 1.0 );
+ gl_Position = uMvpMatrix * position;
+ vTexCoord = aTexCoord;
+ vColor = aColor;
+}
+);
+
+const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
+uniform lowp vec4 uColor;
+uniform sampler2D sTexture;
+varying mediump vec2 vTexCoord;
+varying mediump vec4 vColor;
+
+void main()
+{
+ mediump vec4 color = texture2D( sTexture, vTexCoord );
+ gl_FragColor = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a * color.r );
+}
+);
+
+const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER(
+uniform lowp vec4 uColor;
+uniform sampler2D sTexture;
+varying mediump vec2 vTexCoord;
+
+void main()
+{
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
+}
+);
+
const float ZERO( 0.0f );
const float HALF( 0.5f );
const float ONE( 1.0f );
}
// Create a new image for the glyph
- PixelData bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
+ PixelData bitmap;
+
+ // Whether the current glyph is a color one.
+ const bool isColorGlyph = mFontClient.IsColorGlyph( glyph.fontId, glyph.index );
+
+ // Retrieve the emoji's bitmap.
+ TextAbstraction::FontClient::GlyphBufferData glyphBufferData;
+ glyphBufferData.width = isColorGlyph ? glyph.width : 0; // Desired width and height.
+ glyphBufferData.height = isColorGlyph ? glyph.height : 0;
+
+ mFontClient.CreateBitmap( glyph.fontId,
+ glyph.index,
+ glyphBufferData );
+
+ // Create the pixel data.
+ bitmap = PixelData::New( glyphBufferData.buffer,
+ glyph.width * glyph.height * GetBytesPerPixel( glyphBufferData.format ),
+ glyph.width,
+ glyph.height,
+ glyphBufferData.format,
+ PixelData::DELETE_ARRAY );
+
if( bitmap )
{
MaxBlockSize& blockSize = mBlockSizes[currentBlockSize];
AtlasManager::Vertex2D* verticesBuffer = newMesh.mVertices.Begin();
- // Adjust the vertices if the fixed-size font should be down-scaled
- if( glyph.scaleFactor > 0 )
- {
- for( unsigned int index = 0u, size = newMesh.mVertices.Count();
- index < size;
- ++index )
- {
- AtlasManager::Vertex2D& vertex = *( verticesBuffer + index );
-
- // Set the position of the vertex.
- vertex.mPosition.x = position.x + ( ( vertex.mPosition.x - position.x ) * glyph.scaleFactor );
- vertex.mPosition.y = position.y + ( ( vertex.mPosition.y - position.y ) * glyph.scaleFactor );
- }
- }
-
// Get the color of the character.
const ColorIndex colorIndex = useDefaultColor ? 0u : *( colorIndicesBuffer + i );
const Vector4& color = ( useDefaultColor || ( 0u == colorIndex ) ) ? defaultColor : *( colorsBuffer + colorIndex - 1u );
{
MeshRecord& meshRecord = *it;
- Actor actor = CreateMeshActor( meshRecord, textSize );
+ Actor actor = CreateMeshActor( meshRecord, textSize, STYLE_NORMAL );
// Whether the actor has renderers.
const bool hasRenderer = actor.GetRendererCount() > 0u;
vertex.mColor = shadowColor;
}
- Actor shadowActor = CreateMeshActor( meshRecord, textSize );
+ Actor shadowActor = CreateMeshActor( meshRecord, textSize, STYLE_DROP_SHADOW );
#if defined(DEBUG_ENABLED)
shadowActor.SetName( "Text Shadow renderable actor" );
#endif
mTextCache.Resize( 0 );
}
- Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize )
+ Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize, Style style )
{
PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat );
quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ), meshRecord.mMesh.mVertices.Size() );
quadGeometry.SetIndexBuffer( &meshRecord.mMesh.mIndices[0], meshRecord.mMesh.mIndices.Size() );
TextureSet textureSet( mGlyphManager.GetTextures( meshRecord.mAtlasId ) );
- Shader shader( mGlyphManager.GetShader( meshRecord.mAtlasId ) );
+
+ // Choose the shader to use.
+ const bool isColorShader = ( STYLE_DROP_SHADOW != style ) && ( Pixel::BGRA8888 == mGlyphManager.GetPixelFormat( meshRecord.mAtlasId ) );
+ Shader shader;
+ if( isColorShader )
+ {
+ // The glyph is an emoji and is not a shadow.
+ if( !mShaderRgba )
+ {
+ mShaderRgba = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_RGBA );
+ }
+ shader = mShaderRgba;
+ }
+ else
+ {
+ // The glyph is text or a shadow.
+ if( !mShaderL8 )
+ {
+ mShaderL8 = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_L8 );
+ }
+ shader = mShaderL8;
+ }
+
Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, shader );
renderer.SetTextures( textureSet );
renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
Actor mActor; ///< The actor parent which renders the text
AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
- TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information
- std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas
- Vector< TextCacheEntry > mTextCache; ///> Caches data from previous render
- Property::Map mQuadVertexFormat; ///> Describes the vertex format for text
- int mDepth; ///> DepthIndex passed by control when connect to stage
+ TextAbstraction::FontClient mFontClient; ///< The font client used to supply glyph information
+ Shader mShaderL8; ///< The shader for glyphs and emoji's shadows.
+ Shader mShaderRgba; ///< The shader for emojis.
+ std::vector< MaxBlockSize > mBlockSizes; ///< Maximum size needed to contain a glyph in a block within a new atlas
+ Vector< TextCacheEntry > mTextCache; ///< Caches data from previous render
+ Property::Map mQuadVertexFormat; ///< Describes the vertex format for text
+ int mDepth; ///< DepthIndex passed by control when connect to stage
};
Text::RendererPtr AtlasRenderer::New()
// Retrieves the glyph's bitmap.
glyphData.glyphBitmap.buffer = NULL;
+ glyphData.glyphBitmap.width = glyphInfo->width; // Desired width and height.
+ glyphData.glyphBitmap.height = glyphInfo->height;
fontClient.CreateBitmap( glyphInfo->fontId,
glyphInfo->index,
glyphData.glyphBitmap );
mEventData->mUpdateRightSelectionPosition = true;
mEventData->mUpdateHighlightBox = true;
+ // It may happen an IMF commit event arrives before the selection event
+ // if the IMF manager is in pre-edit state. The commit event will set the
+ // mEventData->mUpdateCursorPosition flag to true. If it's not set back
+ // to false, the highlight box won't be updated.
+ mEventData->mUpdateCursorPosition = false;
+
mEventData->mScrollAfterUpdatePosition = ( mEventData->mLeftSelectionPosition != mEventData->mRightSelectionPosition );
}
else
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
}
+void AnimatedImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void AnimatedImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
// url already passed in from constructor
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
}
+void BorderVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void BorderVisual::OnSetTransform()
{
if( mImpl->mRenderer )
virtual void DoCreatePropertyMap( Property::Map& map ) const;
/**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
+ /**
* @copydoc Visual::Base::OnSetTransform
*/
virtual void OnSetTransform();
map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mImpl->mMixColor );
}
+void ColorVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
+
void ColorVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
}
}
+void GradientVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void GradientVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
}
+void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ map.Clear();
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
+ if( !mImageUrl.empty() )
+ {
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
+ }
+ else if( mImage )
+ {
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, static_cast<int>(mImage.GetWidth()) );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, static_cast<int>(mImage.GetHeight()) );
+ }
+}
+
void ImageVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::MeshVisual::Property::LIGHT_POSITION, mLightPosition );
}
+void MeshVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void MeshVisual::InitializeRenderer()
{
//Try to load the geometry from the file.
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
}
+void NPatchVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mLoader( factoryCache.GetNPatchLoader() ),
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::PrimitiveVisual::Property::LIGHT_POSITION, mLightPosition );
}
+void PrimitiveVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void PrimitiveVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
}
}
+void SvgVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void SvgVisual::ParseFromUrl( const std::string& imageUrl )
{
mImageUrl = imageUrl;
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( Toolkit::TextVisual::Property::ENABLE_MARKUP, mController->IsMarkupProcessorEnabled() );
}
+void TextVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ map.Clear();
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::DevelVisual::TEXT );
+ std::string text;
+ mController->GetText( text );
+ map.Insert( Toolkit::TextVisual::Property::TEXT, text );
+}
+
+
TextVisual::TextVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mController( Text::Controller::New() ),
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ /**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
protected:
/**
map.Insert( DevelVisual::Property::OPACITY, mImpl->mMixColor.a );
}
+void Visual::Base::CreateInstancePropertyMap( Property::Map& map ) const
+{
+ DoCreateInstancePropertyMap( map );
+
+ if( mImpl->mCustomShader )
+ {
+ mImpl->mCustomShader->CreatePropertyMap( map );
+ }
+
+ //map.Insert( DevelVisual::Property::DEPTH_INDEX, mImpl->mDepthIndex );
+ //map.Insert( DevelVisual::Property::ENABLED, (bool) mImpl->mRenderer );
+}
+
+
void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
{
if( preMultipled )
void CreatePropertyMap( Property::Map& map ) const;
/**
+ * @brief Create a property map containing per-instance visual properties.
+ *
+ * This will enable creation of new visuals on control state change with
+ * any alternative style properties and the relevant instance properties
+ * (e.g. for image visual, the desired size, and for text visual, the actual text).
+ * @param[in] map The property map into which to write
+ */
+ void CreateInstancePropertyMap( Property::Map& map ) const;
+
+ /**
* @brief Set whether the Pre-multiplied Alpha Blending is required
*
* @param[in] preMultipled whether alpha is pre-multiplied.
virtual void DoCreatePropertyMap( Property::Map& map ) const = 0;
/**
+ * @brief Called by CreateInstancePropertyMap() allowing derived
+ * classes to store instanced data (separate to styled data) that
+ * needs copying between visuals on state change.
+ *
+ * @param[out] map The visual property map
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const = 0;
+
+ /**
* @brief Called by SetProperties() allowing sub classes to set their properties
*
* @param[in] propertyMap The properties for the requested Visual object.
}
}
+void WireframeVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void WireframeVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* mixValue = propertyMap.Find( Toolkit::DevelVisual::Property::MIX_COLOR, MIX_COLOR );
virtual void DoCreatePropertyMap( Property::Map& map ) const;
/**
+ * @copydoc Visual::Base::CreateInstancePropertyMap
+ */
+ virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+
+ /**
* @copydoc Visual::Base::DoSetProperties()
*/
virtual void DoSetProperties( const Property::Map& propertyMap );
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
return value;
}
- void SetState( DevelControl::State state, bool withTransitions=true )
+
+ void CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary<Property::Map>& instancedProperties )
+ {
+ for(RegisteredVisualContainer::Iterator iter = visuals.Begin(); iter!= visuals.End(); iter++)
+ {
+ if( (*iter)->visual )
+ {
+ Property::Map instanceMap;
+ Toolkit::GetImplementation((*iter)->visual).CreateInstancePropertyMap(instanceMap);
+ instancedProperties.Add( (*iter)->visual.GetName(), instanceMap );
+ }
+ }
+ }
+
+ template<typename T>
+ void Remove( Dictionary<T>& keyValues, const std::string& name )
+ {
+ keyValues.Remove(name);
+ }
+
+ void Remove( DictionaryKeys& keys, const std::string& name )
+ {
+ DictionaryKeys::iterator iter = std::find( keys.begin(), keys.end(), name );
+ if( iter != keys.end())
+ {
+ keys.erase(iter);
+ }
+ }
+
+ void FindChangableVisuals( Dictionary<Property::Map>& stateVisualsToAdd,
+ Dictionary<Property::Map>& stateVisualsToChange,
+ DictionaryKeys& stateVisualsToRemove)
+ {
+ DictionaryKeys copyOfStateVisualsToRemove = stateVisualsToRemove;
+
+ for( DictionaryKeys::iterator iter = copyOfStateVisualsToRemove.begin();
+ iter != copyOfStateVisualsToRemove.end(); ++iter )
+ {
+ const std::string& visualName = (*iter);
+ Property::Map* toMap = stateVisualsToAdd.Find( visualName );
+ if( toMap )
+ {
+ stateVisualsToChange.Add( visualName, *toMap );
+ stateVisualsToAdd.Remove( visualName );
+ Remove( stateVisualsToRemove, visualName );
+ }
+ }
+ }
+
+ void RemoveVisual( RegisteredVisualContainer& visuals, const std::string& visualName )
+ {
+ Actor self( mControlImpl.Self() );
+
+ for ( RegisteredVisualContainer::Iterator visualIter = visuals.Begin();
+ visualIter != visuals.End(); ++visualIter )
+ {
+ Toolkit::Visual::Base visual = (*visualIter)->visual;
+ if( visual && visual.GetName() == visualName )
+ {
+ Toolkit::GetImplementation(visual).SetOffStage( self );
+ (*visualIter)->visual.Reset();
+ visuals.Erase( visualIter );
+ break;
+ }
+ }
+ }
+
+ void RemoveVisuals( RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals )
+ {
+ Actor self( mControlImpl.Self() );
+ for( DictionaryKeys::iterator iter = removeVisuals.begin(); iter != removeVisuals.end(); ++iter )
+ {
+ const std::string visualName = *iter;
+ RemoveVisual( visuals, visualName );
+ }
+ }
+
+ Toolkit::Visual::Type GetVisualTypeFromMap( const Property::Map& map )
+ {
+ Property::Value* typeValue = map.Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
+ Toolkit::Visual::Type type = Toolkit::Visual::IMAGE;
+ if( typeValue )
+ {
+ Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, type );
+ }
+ return type;
+ }
+
+ /**
+ * Go through the list of visuals that are common to both states.
+ * If they are different types, or are both image types with different
+ * URLs, then the existing visual needs moving and the new visual creating
+ */
+ void RecreateChangedVisuals( Dictionary<Property::Map>& stateVisualsToChange,
+ Dictionary<Property::Map>& instancedProperties )
+ {
+ Dali::CustomActor handle( mControlImpl.GetOwner() );
+ for( Dictionary<Property::Map>::iterator iter = stateVisualsToChange.Begin();
+ iter != stateVisualsToChange.End(); ++iter )
+ {
+ const std::string& visualName = (*iter).key;
+ const Property::Map& toMap = (*iter).entry;
+
+ // is it a candidate for re-creation?
+ bool recreate = false;
+
+ Toolkit::Visual::Base visual = GetVisualByName( mVisuals, visualName );
+ if( visual )
+ {
+ Property::Map fromMap;
+ visual.CreatePropertyMap( fromMap );
+
+ Toolkit::Visual::Type fromType = GetVisualTypeFromMap( fromMap );
+ Toolkit::Visual::Type toType = GetVisualTypeFromMap( toMap );
+
+ if( fromType != toType )
+ {
+ recreate = true;
+ }
+ else
+ {
+ if( fromType == Toolkit::Visual::IMAGE )
+ {
+ Property::Value* fromUrl = fromMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
+ Property::Value* toUrl = toMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
+
+ if( fromUrl && toUrl )
+ {
+ std::string fromUrlString;
+ std::string toUrlString;
+ fromUrl->Get(fromUrlString);
+ toUrl->Get(toUrlString);
+
+ if( fromUrlString != toUrlString )
+ {
+ recreate = true;
+ }
+ }
+ }
+ }
+
+ const Property::Map* instancedMap = instancedProperties.FindConst( visualName );
+ if( recreate || instancedMap )
+ {
+ RemoveVisual( mVisuals, visualName );
+ Style::ApplyVisual( handle, visualName, toMap, instancedMap );
+ }
+ else
+ {
+ // @todo check to see if we can apply toMap without recreating the visual
+ // e.g. by setting only animatable properties
+ // For now, recreate all visuals, but merge in instance data.
+ RemoveVisual( mVisuals, visualName );
+ Style::ApplyVisual( handle, visualName, toMap, instancedMap );
+ }
+ }
+ }
+ }
+
+ void ReplaceStateVisualsAndProperties( const StylePtr oldState, const StylePtr newState, const std::string& subState )
+ {
+ // Collect all old visual names
+ DictionaryKeys stateVisualsToRemove;
+ if( oldState )
+ {
+ oldState->visuals.GetKeys( stateVisualsToRemove );
+ if( ! subState.empty() )
+ {
+ const StylePtr* oldSubState = oldState->subStates.FindConst(subState);
+ if( oldSubState )
+ {
+ DictionaryKeys subStateVisualsToRemove;
+ (*oldSubState)->visuals.GetKeys( subStateVisualsToRemove );
+ Merge( stateVisualsToRemove, subStateVisualsToRemove );
+ }
+ }
+ }
+
+ // Collect all new visual properties
+ Dictionary<Property::Map> stateVisualsToAdd;
+ if( newState )
+ {
+ stateVisualsToAdd = newState->visuals;
+ if( ! subState.empty() )
+ {
+ const StylePtr* newSubState = newState->subStates.FindConst(subState);
+ if( newSubState )
+ {
+ stateVisualsToAdd.Merge( (*newSubState)->visuals );
+ }
+ }
+ }
+
+ // If a name is in both add/remove, move it to change list.
+ Dictionary<Property::Map> stateVisualsToChange;
+ FindChangableVisuals( stateVisualsToAdd, stateVisualsToChange, stateVisualsToRemove);
+
+ // Copy instanced properties (e.g. text label) of current visuals
+ Dictionary<Property::Map> instancedProperties;
+ CopyInstancedProperties( mVisuals, instancedProperties );
+
+ // For each visual in remove list, remove from mVisuals
+ RemoveVisuals( mVisuals, stateVisualsToRemove );
+
+ // For each visual in add list, create and add to mVisuals
+ Dali::CustomActor handle( mControlImpl.GetOwner() );
+ Style::ApplyVisuals( handle, stateVisualsToAdd, instancedProperties );
+
+ // For each visual in change list, if it requires a new visual,
+ // remove old visual, create and add to mVisuals
+ RecreateChangedVisuals( stateVisualsToChange, instancedProperties );
+ }
+
+ void SetState( DevelControl::State newState, bool withTransitions=true )
{
- if( mState != state )
+ DevelControl::State oldState = mState;
+ Dali::CustomActor handle( mControlImpl.GetOwner() );
+ DALI_LOG_INFO(gLogFilter, Debug::Concise, "Control::Impl::SetState: %s\n",
+ (mState == DevelControl::NORMAL ? "NORMAL" :(
+ mState == DevelControl::FOCUSED ?"FOCUSED" : (
+ mState == DevelControl::DISABLED?"DISABLED":"NONE" ))));
+
+ if( mState != newState )
{
// If mState was Disabled, and new state is Focused, should probably
// store that fact, e.g. in another property that FocusManager can access.
- mState = state;
+ mState = newState;
// Trigger state change and transitions
// Apply new style, if stylemanager is available
if( styleManager )
{
const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
+
if( stylePtr )
{
- for( int i=mVisuals.Count()-1; i >= 0; i-- )
+ std::string oldStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( oldState, ControlStateTable, ControlStateTableCount );
+ std::string newStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( newState, ControlStateTable, ControlStateTableCount );
+
+ const StylePtr* newStateStyle = stylePtr->subStates.Find( newStateName );
+ const StylePtr* oldStateStyle = stylePtr->subStates.Find( oldStateName );
+ if( oldStateStyle && newStateStyle )
{
- mControlImpl.UnregisterVisual( mVisuals[i]->index );
+ // Only change if both state styles exist
+ ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, mSubStateName );
}
-
- Dali::CustomActor handle( mControlImpl.GetOwner() );
- stylePtr->ApplyVisualsAndPropertiesRecursively( handle );
}
}
}
{
StylePtr stateStyle(*state);
- // Unregister existing visuals of this substate
- const StylePtr* subState = stateStyle->subStates.Find( mSubStateName );
- if( subState )
- {
- StylePtr subStateStyle(*subState);
-
- for( Dictionary<Property::Map>::iterator iter = subStateStyle->visuals.Begin(); iter != subStateStyle->visuals.End(); ++iter )
- {
- const std::string& visualName = (*iter).key;
- Dali::Property::Index index = handle.GetPropertyIndex( visualName );
- if( index != Property::INVALID_INDEX )
- {
- mControlImpl.UnregisterVisual( index );
- }
- }
- }
-
- // Register visuals of the new substate
- const StylePtr* newSubState = stateStyle->subStates.Find( subStateName );
- if( newSubState )
+ const StylePtr* newStateStyle = stateStyle->subStates.Find( subStateName );
+ const StylePtr* oldStateStyle = stateStyle->subStates.Find( mSubStateName );
+ if( oldStateStyle && newStateStyle )
{
- StylePtr newSubStateStyle(*newSubState);
- newSubStateStyle->ApplyVisuals( handle );
- newSubStateStyle->ApplyProperties( handle );
+ std::string empty;
+ ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, empty );
}
}
}
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 27;
+const unsigned int TOOLKIT_MICRO_VERSION = 29;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
"TextSelectionScrollBar":
{
"indicatorShowDuration":0.25,
- "indicatorHideDuration":0.25
+ "indicatorHideDuration":0.25,
+ "indicatorTransientDuration":1.0
},
"TextSelectionScrollIndicator":
{
"TextSelectionScrollBar":
{
"indicatorShowDuration":0.25,
- "indicatorHideDuration":0.25
+ "indicatorHideDuration":0.25,
+ "indicatorTransientDuration":1.0
},
"TextSelectionScrollIndicator":
{
"TextSelectionScrollBar":
{
"indicatorShowDuration":0.25,
- "indicatorHideDuration":0.25
+ "indicatorHideDuration":0.25,
+ "indicatorTransientDuration":1.0
},
"TextSelectionScrollIndicator":
{
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.27
+Version: 1.2.29
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.27
+Version: 1.2.29
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
%apply float& OUTPUT { float& viewportX };
%apply float& OUTPUT { float& viewportY };
-#if defined(SWIGCSHARP)
-
%include arrays_csharp.i
%apply unsigned char INPUT[] { unsigned char* pixelBuffer}
%apply unsigned char INPUT[] { unsigned char* buffer}
%apply unsigned short INPUT[] { unsigned short* indices}
%apply float INPUT[] { float* array }
-#endif
-
%ignore *::Animation(Internal::Animation*);
%ignore *::Actor(Internal::Actor*);
%ignore *::BufferImage(Internal::BufferImage*);
%ignore *::GetKeyValue(SizeType) const;
%ignore *::TypeInfo::GetCreator() const;
%ignore Dali::Stage::TouchedSignal;
+%ignore Dali::DevelActor::Property::Type;
%rename(ParentOriginTop) Dali::ParentOrigin::TOP;
%rename(ParentOriginBottom) Dali::ParentOrigin::BOTTOM;
%rename(Z) Dali::Vector4::z;
%rename(W) Dali::Vector4::w;
-
typedef std::pair<std::string, Dali::Property::Value> StringValuePair;
typedef std::vector<Dali::TouchPoint> TouchPointContainer;
typedef std::pair< Dali::Radian, Dali::Radian > AngleThresholdPair;
%include <dali/public-api/events/wheel-event.h>
%include <dali/public-api/actors/actor.h>
+%include <dali/devel-api/actors/actor-devel.h>
%include <dali/public-api/actors/layer.h>
%include <dali/public-api/common/stage.h>
%include <dali/public-api/size-negotiation/relayout-container.h>
%template(VectorUnsignedChar) Dali::Vector<unsigned char>;
%template(VectorUint16Pair) Dali::Vector<Dali::Uint16Pair>;
%template(VoidSignal) Dali::Signal<void()>;
-%template(BoolSignal) Dali::Signal<bool()>;
%template(FloatSignal) Dali::Signal<void(float)>;
%template(ObjectCreatedSignal) Dali::Signal<void(Dali::BaseHandle)>;
%template(ObjectDestroyedSignal) Dali::Signal<void(const Dali::RefObject*)>;
//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, (std::pair< Dali::Radian, Dali::Radian >), AngleThresholdPair);
//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, (std::pair< Dali::Radian, Dali::Radian >), AngleThresholdPair);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::ProgressBar, float, float)>, ProgressBarValueChangedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::ProgressBar, float, float)>, ProgressBarValueChangedSignal);
+
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ApplicationExtensions );
DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, ApplicationExtensions );
%template(GaussianBlurViewSignal) Dali::Signal<void (Dali::Toolkit::GaussianBlurView)>;
%template(PageTurnSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>;
%template(PagePanSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView)>;
+%template(ProgressBarValueChangedSignal) Dali::Signal<void(Dali::Toolkit::ProgressBar, float, float)>;
%template(ScrollViewSnapStartedSignal) Dali::Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>;
%template(ScrollableSignal) Dali::Signal< void(const Dali::Vector2&)>;
%template(TextEditorSignal) Dali::Signal<void(Dali::Toolkit::TextEditor)>;
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali/devel-api/actors/actor-devel.h>
+
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/viewport.h>
%include events/pinchgesture-event.i
%include events/pageturnview-event.i
%include events/pangesture-event.i
+%include events/progress-bar-event.i
%include events/propertynotification-event.i
%include events/longpressgesture-event.i
%include events/rectangle.i
{
SetVisible(false);
}
+
+ public void Raise()
+ {
+ NDalicPINVOKE.Raise(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void Lower()
+ {
+ NDalicPINVOKE.Lower(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void RaiseToTop()
+ {
+ NDalicPINVOKE.RaiseToTop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void LowerToBottom()
+ {
+ NDalicPINVOKE.LowerToBottom(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void RaiseAbove(Actor target)
+ {
+ NDalicPINVOKE.RaiseAbove(swigCPtr, Actor.getCPtr(target));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void LowerBelow(Actor target)
+ {
+ NDalicPINVOKE.RaiseAbove(swigCPtr, Actor.getCPtr(target));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
%}
%enddef
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+%define PROGRESS_BAR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define PROGRESS_BAR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class ValueChangedEventArgs : EventArgs
+{
+ private ProgressBar _progressBar;
+ private float _progressValue;
+ private float _secondaryProgressValue;
+
+ public ProgressBar ProgressBar
+ {
+ get
+ {
+ return _progressBar;
+ }
+ set
+ {
+ _progressBar = value;
+ }
+ }
+
+ public float ProgressValue
+ {
+ get
+ {
+ return _progressValue;
+ }
+ set
+ {
+ _progressValue = value;
+ }
+ }
+
+ public float SecondaryProgressValue
+ {
+ get
+ {
+ return _secondaryProgressValue;
+ }
+ set
+ {
+ _secondaryProgressValue = value;
+ }
+ }
+
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ValueChangedCallbackDelegate(IntPtr progressBar, float progressValue, float secondaryProgressValue);
+ private DaliEventHandler<object,ValueChangedEventArgs> _progressBarValueChangedEventHandler;
+ private ValueChangedCallbackDelegate _progressBarValueChangedCallbackDelegate;
+
+ public event DaliEventHandler<object,ValueChangedEventArgs> ValueChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_progressBarValueChangedEventHandler == null)
+ {
+ _progressBarValueChangedEventHandler += value;
+
+ _progressBarValueChangedCallbackDelegate = new ValueChangedCallbackDelegate(OnValueChanged);
+ this.ValueChangedSignal().Connect(_progressBarValueChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_progressBarValueChangedEventHandler != null)
+ {
+ this.ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
+ }
+
+ _progressBarValueChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ProgressBar ValueChanged signal
+ private void OnValueChanged(IntPtr progressBar, float progressValue, float secondaryProgressValue)
+ {
+ ValueChangedEventArgs e = new ValueChangedEventArgs();
+
+ // Populate all members of "e" (ValueChangedEventArgs) with real page
+ e.ProgressBar = ProgressBar.GetProgressBarFromPtr( progressBar );
+ e.ProgressValue = progressValue;
+ e.SecondaryProgressValue = secondaryProgressValue;
+
+ if (_progressBarValueChangedEventHandler != null)
+ {
+ _progressBarValueChangedEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_PROGRESS_BAR_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ PROGRESS_BAR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ PROGRESS_BAR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_PROGRESS_BAR_EVENTHANDLER_PARAM( Dali::Toolkit, ProgressBar);
+}
* (in the type of TickEventHandler-DaliEventHandlerWithReturnType<object,TickEventArgs,bool>)
* provided by the user. Ticked signal is emitted after specified time interval.
*/
- public event DaliEventHandlerWithReturnType<object,TickEventArgs,bool> Ticked
+ public event DaliEventHandlerWithReturnType<object,TickEventArgs,bool> Tick
{
add
{
namespace Dali
{
- DALI_TIMER_EVENTHANDLER_PARAM( Dali::Adaptor, Timer);
+ DALI_TIMER_EVENTHANDLER_PARAM( Dali, Timer);
}
Macros for signals with return values
*****************/
+// 0 param signals ( with return )
+%define DALI_SIGNAL_0_PARAM_RETURN( returnType )
+
+ SIGNAL_TYPEMAP_HELPER( returnType (*func) () );
+ SIGNAL_TEMPLATE_HELPER_0( returnType, return);
+%enddef
+
// 1 param signals ( with return )
%define DALI_SIGNAL_1_PARAM_RETURN( returnType, argumentType1 )
// Signal< void () >
DALI_SIGNAL_0_PARAM();
+// Signal< bool () >
+DALI_SIGNAL_0_PARAM_RETURN( bool );
+
// Signal< void (Actor) >
DALI_SIGNAL_1_PARAM( Dali::Actor );
// void Signal< Dali::Toolkit::PageTurnView >;
DALI_SIGNAL_1_PARAM( Dali::Toolkit::PageTurnView );
+// void Signal< Dali::Toolkit::ProgressBar, float, float >;
+DALI_SIGNAL_3_PARAM( Dali::Toolkit::ProgressBar, float, float );
+
// void Signal< const Dali::Toolkit::ScrollView::SnapEvent& >;
DALI_SIGNAL_1_PARAM( const Dali::Toolkit::ScrollView::SnapEvent& );
private Dali.Application _application;
private TableView _contentContainer;
+ private Timer _timer;
private Stage _stage;
private Popup _popup;
+ private ProgressBar _progressBar;
// List of items
private Item[] mViewList = {
new Item("PushButton", true), new Item("DropDown", false), new Item("Toggle", true),
new Item("InputField", false), new Item("AnimateGif", false), new Item("Loading", false),
- new Item("ProgressBar", false), new Item("CheckBox", false), new Item("RadioButton", true),
+ new Item("ProgressBar", true), new Item("CheckBox", false), new Item("RadioButton", true),
new Item("Tooltip", true), new Item("Popup", true), new Item("Toast", true),
new Item("ItemView", false), new Item("CheckBox", true)
};
}
if (item.name.CompareTo("ProgressBar") == 0)
{
+ _progressBar = new ProgressBar();
+ _progressBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ _progressBar.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT);
+ _progressBar.SetSize( 0, 50 );
+ _progressBar.ValueChanged += OnProgressBarValueChanged;
+
+ _timer = new Timer( 100 );
+ _timer.Tick += ( obj, e ) =>
+ {
+ float progress = (float)Math.Round( _progressBar.ProgressValue , 2 );
+
+ if( progress == 1.0f )
+ {
+ _progressBar.ProgressValue = 0.0f;
+ _progressBar.SecondaryProgressValue = 0.01f;
+ }
+ else
+ {
+ _progressBar.ProgressValue = progress + 0.01f;
+ _progressBar.SecondaryProgressValue = progress + 0.21f;
+ }
+ return true;
+ };
+ _timer.Start();
+
+ _contentContainer.AddChild(_progressBar, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
if (item.name.CompareTo("ScrollBar") == 0)
{
return cancelButton;
}
+ void OnProgressBarValueChanged( object source, ProgressBar.ValueChangedEventArgs e )
+ {
+ Property.Map labelVisual = new Property.Map();
+ labelVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) )
+ .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value( Math.Round( e.ProgressBar.ProgressValue, 2 ) +" / "+Math.Round( e.ProgressBar.SecondaryProgressValue, 2 )) );
+ e.ProgressBar.LabelVisual = labelVisual;
+ return;
+ }
+
public void MainLoop()
{
_application.MainLoop();
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
constants.Insert( "CONFIG_SCRIPT_LOG_LEVEL", new Property.Value( "Verbose") );
_builder.AddConstants( constants );
- _builder.LoadFromFile( "./json/date-picker.json" );
+ _builder.LoadFromFile( "./json/date-picker-template.json" );
// create the date-picker from the template in the json file
BaseHandle handle = _builder.Create( "date-picker");
void SwigDirector_ViewWrapperImpl::OnStageConnection(int depth) {
- Dali::Toolkit::Internal::Control::OnStageConnection(depth);
swig_callbackOnStageConnection(depth);
+
+ Dali::Toolkit::Internal::Control::OnStageConnection(depth);
}
void SwigDirector_ViewWrapperImpl::OnStageDisconnection() {
swig_callbackOnStageDisconnection();
+
Dali::Toolkit::Internal::Control::OnStageDisconnection();
}
void SwigDirector_ViewWrapperImpl::OnChildAdd(Dali::Actor &child) {
- Dali::Toolkit::Internal::Control::OnChildAdd( child );
void * jchild = (Dali::Actor *) &child;
swig_callbackOnChildAdd(jchild);
+
+ Dali::Toolkit::Internal::Control::OnChildAdd( child );
}
void SwigDirector_ViewWrapperImpl::OnChildRemove(Dali::Actor &child) {
void * jchild = (Dali::Actor *) &child;
swig_callbackOnChildRemove(jchild);
+
Dali::Toolkit::Internal::Control::OnChildRemove( child );
}
int jindex ;
void * jpropertyValue ;
- if (!swig_callbackOnPropertySet) {
- Dali::Toolkit::Internal::ControlWrapper::OnPropertySet(index,propertyValue);
- return;
- } else {
- jindex = index;
- jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue);
- swig_callbackOnPropertySet(jindex, jpropertyValue);
- }
+ jindex = index;
+ jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue);
+ swig_callbackOnPropertySet(jindex, jpropertyValue);
+
+ Dali::Toolkit::Internal::ControlWrapper::OnPropertySet(index,propertyValue);
}
void SwigDirector_ViewWrapperImpl::OnSizeSet(Dali::Vector3 const &targetSize) {
- Dali::Toolkit::Internal::Control::OnSizeSet(targetSize);
swig_callbackOnSizeSet((Dali::Vector3 *) &targetSize);
+
+ Dali::Toolkit::Internal::Control::OnSizeSet(targetSize);
}
void SwigDirector_ViewWrapperImpl::OnSizeAnimation(Dali::Animation &animation, Dali::Vector3 const &targetSize) {
- Dali::Toolkit::Internal::Control::OnSizeAnimation(animation,targetSize);
swig_callbackOnSizeAnimation(&animation, (Dali::Vector3 *) &targetSize);
+
+ Dali::Toolkit::Internal::Control::OnSizeAnimation(animation,targetSize);
}
bool SwigDirector_ViewWrapperImpl::OnTouchEvent(Dali::TouchEvent const &event) {
void * jsize = 0 ;
void * jcontainer = 0 ;
- if (!swig_callbackOnRelayout) {
- Dali::Toolkit::Internal::Control::OnRelayout(size,container);
- return;
- } else {
- jsize = (Dali::Vector2 *) &size;
- jcontainer = (Dali::RelayoutContainer *) &container;
- swig_callbackOnRelayout(jsize, jcontainer);
- }
+ jsize = (Dali::Vector2 *) &size;
+ jcontainer = (Dali::RelayoutContainer *) &container;
+ swig_callbackOnRelayout(jsize, jcontainer);
+
+ Dali::Toolkit::Internal::Control::OnRelayout(size,container);
}
void SwigDirector_ViewWrapperImpl::OnSetResizePolicy(Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension) {
int jpolicy ;
int jdimension ;
- if (!swig_callbackOnSetResizePolicy) {
- Dali::Toolkit::Internal::Control::OnSetResizePolicy(policy,dimension);
- return;
- } else {
- jpolicy = (int)policy;
- jdimension = (int)dimension;
- swig_callbackOnSetResizePolicy(jpolicy, jdimension);
- }
+ jpolicy = (int)policy;
+ jdimension = (int)dimension;
+ swig_callbackOnSetResizePolicy(jpolicy, jdimension);
+
+ Dali::Toolkit::Internal::Control::OnSetResizePolicy(policy,dimension);
}
Dali::Vector3 SwigDirector_ViewWrapperImpl::GetNaturalSize() {
void SwigDirector_ViewWrapperImpl::OnCalculateRelayoutSize(Dali::Dimension::Type dimension) {
int jdimension ;
- if (!swig_callbackOnCalculateRelayoutSize) {
- Dali::Toolkit::Internal::Control::OnCalculateRelayoutSize(dimension);
- return;
- } else {
- jdimension = (int)dimension;
- swig_callbackOnCalculateRelayoutSize(jdimension);
- }
+ jdimension = (int)dimension;
+ swig_callbackOnCalculateRelayoutSize(jdimension);
+
+ Dali::Toolkit::Internal::Control::OnCalculateRelayoutSize(dimension);
}
void SwigDirector_ViewWrapperImpl::OnLayoutNegotiated(float size, Dali::Dimension::Type dimension) {
float jsize ;
int jdimension ;
- if (!swig_callbackOnLayoutNegotiated) {
- Dali::Toolkit::Internal::Control::OnLayoutNegotiated(size,dimension);
- return;
- } else {
- jsize = size;
- jdimension = (int)dimension;
- swig_callbackOnLayoutNegotiated(jsize, jdimension);
- }
+ jsize = size;
+ jdimension = (int)dimension;
+ swig_callbackOnLayoutNegotiated(jsize, jdimension);
+
+ Dali::Toolkit::Internal::Control::OnLayoutNegotiated(size,dimension);
}
void SwigDirector_ViewWrapperImpl::OnInitialize() {
- if (!swig_callbackOnInitialize) {
- Dali::Toolkit::Internal::Control::OnInitialize();
- return;
- } else {
- swig_callbackOnInitialize();
- }
+ swig_callbackOnInitialize();
+
+ Dali::Toolkit::Internal::Control::OnInitialize();
}
void SwigDirector_ViewWrapperImpl::OnControlChildAdd(Dali::Actor &child) {
- Dali::Toolkit::Internal::Control::OnControlChildAdd(child);
swig_callbackOnControlChildAdd(&child);
+
+ Dali::Toolkit::Internal::Control::OnControlChildAdd(child);
}
void SwigDirector_ViewWrapperImpl::OnControlChildRemove(Dali::Actor &child) {
swig_callbackOnControlChildRemove(&child);
+
Dali::Toolkit::Internal::Control::OnControlChildRemove(child);
}
void * jstyleManager ;
int jchange ;
- if (!swig_callbackOnStyleChange) {
- Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change);
- return;
- } else {
- jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager);
- jchange = (int)change;
- swig_callbackOnStyleChange(jstyleManager, jchange);
- }
+ jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager);
+ jchange = (int)change;
+ swig_callbackOnStyleChange(jstyleManager, jchange);
+
+ Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change);
}
bool SwigDirector_ViewWrapperImpl::OnAccessibilityActivated() {
}
void SwigDirector_ViewWrapperImpl::OnKeyInputFocusGained() {
- if (!swig_callbackOnKeyInputFocusGained) {
- Dali::Toolkit::Internal::Control::OnKeyInputFocusGained();
- return;
- } else {
- swig_callbackOnKeyInputFocusGained();
- }
+ swig_callbackOnKeyInputFocusGained();
+
+ Dali::Toolkit::Internal::Control::OnKeyInputFocusGained();
}
void SwigDirector_ViewWrapperImpl::OnKeyInputFocusLost() {
- if (!swig_callbackOnKeyInputFocusLost) {
- Dali::Toolkit::Internal::Control::OnKeyInputFocusLost();
- return;
- } else {
- swig_callbackOnKeyInputFocusLost();
- }
+ swig_callbackOnKeyInputFocusLost();
+
+ Dali::Toolkit::Internal::Control::OnKeyInputFocusLost();
}
Dali::Actor SwigDirector_ViewWrapperImpl::GetNextKeyboardFocusableActor(Dali::Actor currentFocusedActor, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) {
void SwigDirector_ViewWrapperImpl::OnKeyboardFocusChangeCommitted(Dali::Actor commitedFocusableActor) {
void * jcommitedFocusableActor ;
+ jcommitedFocusableActor = (void *)new Dali::Actor((const Dali::Actor &)commitedFocusableActor);
+ swig_callbackOnKeyboardFocusChangeCommitted(jcommitedFocusableActor);
- if (!swig_callbackOnKeyboardFocusChangeCommitted) {
- Dali::Toolkit::Internal::Control::OnKeyboardFocusChangeCommitted(commitedFocusableActor);
- return;
- } else {
- jcommitedFocusableActor = (void *)new Dali::Actor((const Dali::Actor &)commitedFocusableActor);
- swig_callbackOnKeyboardFocusChangeCommitted(jcommitedFocusableActor);
- }
+ Dali::Toolkit::Internal::Control::OnKeyboardFocusChangeCommitted(commitedFocusableActor);
}
bool SwigDirector_ViewWrapperImpl::OnKeyboardEnter() {
void SwigDirector_ViewWrapperImpl::OnPinch(Dali::PinchGesture const &pinch) {
void * jpinch = 0 ;
+ jpinch = (Dali::PinchGesture *) &pinch;
+ swig_callbackOnPinch(jpinch);
- if (!swig_callbackOnPinch) {
- Dali::Toolkit::Internal::Control::OnPinch(pinch);
- return;
- } else {
- jpinch = (Dali::PinchGesture *) &pinch;
- swig_callbackOnPinch(jpinch);
- }
+ Dali::Toolkit::Internal::Control::OnPinch(pinch);
}
void SwigDirector_ViewWrapperImpl::OnPan(Dali::PanGesture const &pan) {
void * jpan = 0 ;
+ jpan = (Dali::PanGesture *) &pan;
+ swig_callbackOnPan(jpan);
- if (!swig_callbackOnPan) {
- Dali::Toolkit::Internal::Control::OnPan(pan);
- return;
- } else {
- jpan = (Dali::PanGesture *) &pan;
- swig_callbackOnPan(jpan);
- }
+ Dali::Toolkit::Internal::Control::OnPan(pan);
}
void SwigDirector_ViewWrapperImpl::OnTap(Dali::TapGesture const &tap) {
void * jtap = 0 ;
+ jtap = (Dali::TapGesture *) &tap;
+ swig_callbackOnTap(jtap);
- if (!swig_callbackOnTap) {
- Dali::Toolkit::Internal::Control::OnTap(tap);
- return;
- } else {
- jtap = (Dali::TapGesture *) &tap;
- swig_callbackOnTap(jtap);
- }
+ Dali::Toolkit::Internal::Control::OnTap(tap);
}
void SwigDirector_ViewWrapperImpl::OnLongPress(Dali::LongPressGesture const &longPress) {
void * jlongPress = 0 ;
- if (!swig_callbackOnLongPress) {
- Dali::Toolkit::Internal::Control::OnLongPress(longPress);
- return;
- } else {
- jlongPress = (Dali::LongPressGesture *) &longPress;
- swig_callbackOnLongPress(jlongPress);
- }
-}
-
-void SwigDirector_ViewWrapperImpl::SignalConnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback) {
- void * jslotObserver = 0 ;
- void * jcallback = 0 ;
-
- if (!swig_callbackSignalConnected) {
- Dali::Toolkit::Internal::Control::SignalConnected(slotObserver,callback);
- return;
- } else {
- jslotObserver = (void *) slotObserver;
- jcallback = (void *) callback;
- swig_callbackSignalConnected(jslotObserver, jcallback);
- }
-}
-
-void SwigDirector_ViewWrapperImpl::SignalDisconnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback) {
- void * jslotObserver = 0 ;
- void * jcallback = 0 ;
+ jlongPress = (Dali::LongPressGesture *) &longPress;
+ swig_callbackOnLongPress(jlongPress);
- if (!swig_callbackSignalDisconnected) {
- Dali::Toolkit::Internal::Control::SignalDisconnected(slotObserver,callback);
- return;
- } else {
- jslotObserver = (void *) slotObserver;
- jcallback = (void *) callback;
- swig_callbackSignalDisconnected(jslotObserver, jcallback);
- }
+ Dali::Toolkit::Internal::Control::OnLongPress(longPress);
}
Dali::Toolkit::Internal::Control::Extension *SwigDirector_ViewWrapperImpl::GetControlExtension() {
virtual void OnPan(Dali::PanGesture const &pan);
virtual void OnTap(Dali::TapGesture const &tap);
virtual void OnLongPress(Dali::LongPressGesture const &longPress);
- virtual void SignalConnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback);
- virtual void SignalDisconnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback);
virtual Dali::Toolkit::Internal::Control::Extension *GetControlExtension();
typedef void (SWIGSTDCALL* SWIG_Callback0_t)(int);
viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
- viewWrapperImpl.SignalConnected = new ViewWrapperImpl.SignalConnectedDelegate(SignalConnected);
- viewWrapperImpl.SignalDisconnected = new ViewWrapperImpl.SignalDisconnectedDelegate(SignalDisconnected);
// Make sure CustomView is initialized.
OnInitialize();
- // Make sure the style of actors/visuals initialized above are applied by the style manager.
- viewWrapperImpl.ApplyThemeStyle();
+ // Set the StyleName the name of the View
+ // We have to do this because the StyleManager on Native side can't workout it out
+ // This will also ensure that the style of actors/visuals initialized above are applied by the style manager.
+ SetStyleName( this.GetType().Name );
}
/**
{
}
- private void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback)
- {
- }
-
- private void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback)
- {
- }
-
private void OnControlChildAdd(Actor child)
{
}
public delegate void OnPanDelegate(PanGesture pan);
public delegate void OnTapDelegate(TapGesture tap);
public delegate void OnLongPressDelegate(LongPressGesture longPress);
- public delegate void SignalConnectedDelegate(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback);
- public delegate void SignalDisconnectedDelegate(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback);
public OnStageConnectionDelegate OnStageConnection;
public OnStageDisconnectionDelegate OnStageDisconnection;
public OnPanDelegate OnPan;
public OnTapDelegate OnTap;
public OnLongPressDelegate OnLongPress;
- public SignalConnectedDelegate SignalConnected;
- public SignalDisconnectedDelegate SignalDisconnected;
internal ViewWrapperImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ViewWrapperImpl_SWIGUpcast(cPtr), cMemoryOwn)
{
private void DirectorOnStyleChange(global::System.IntPtr styleManager, int change)
{
- OnStyleChange(new StyleManager(styleManager, false), (StyleChangeType)change);
+ if (OnStyleChange != null)
+ {
+ OnStyleChange(new StyleManager(styleManager, false), (StyleChangeType)change);
+ }
}
private bool DirectorOnAccessibilityActivated()
OnLongPress(new LongPressGesture(longPress, false));
}
- private void DirectorSignalConnected(global::System.IntPtr slotObserver, global::System.IntPtr callback)
- {
- SignalConnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false));
- }
-
- private void DirectorSignalDisconnected(global::System.IntPtr slotObserver, global::System.IntPtr callback)
- {
- SignalDisconnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false));
- }
-
public delegate void DelegateViewWrapperImpl_0(int depth);
public delegate void DelegateViewWrapperImpl_1();
public delegate void DelegateViewWrapperImpl_2(global::System.IntPtr child);
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) );
}
- public Spin() : base(typeof(Spin).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT | ViewWrapperImpl.CustomViewBehaviour.DISABLE_STYLE_CHANGE_SIGNALS)
+ public Spin() : base(typeof(Spin).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT)
{
}