if( options.align )
{
+ float alignmentOffset = 0.f;
layoutEngine.Align( textArea,
0u,
numberOfCharacters,
Layout::HORIZONTAL_ALIGN_BEGIN,
- lines );
+ lines,
+ alignmentOffset );
}
}
Layout::Engine engine;
engine.SetMetrics( metrics );
+ float alignmentOffset = 0.f;
engine.Align( data.textArea,
data.startIndex,
data.numberOfCharacters,
data.horizontalAlignment,
- visualModel->mLines );
+ visualModel->mLines,
+ alignmentOffset );
// Compare results.
if( data.numberOfLines != visualModel->mLines.Count() )
DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.jpeg"), TEST_LOCATION );
- DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.gif"), TEST_LOCATION );
-
DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.PNG"), TEST_LOCATION );
DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.Png123"), TEST_LOCATION );
{
tet_infoline( "UtcDaliResolveUrl N_PATCH" );
- DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.gif"), TEST_LOCATION );
-
DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.#.png"), TEST_LOCATION );
DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.9.bmp"), TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliResolveUrlGif(void)
+{
+ tet_infoline( "UtcDaliResolveUrl GIF" );
+
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType("foobar.gif"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType("foobar.gif.gif"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType("foobar.giF"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType("foobar.GIF"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType(".GiF"), TEST_LOCATION );
+
+ // GIFs aren't N-patch
+ DALI_TEST_EQUALS( UrlType::GIF, ResolveUrlType("foobar.9.gif"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("gif.png"), TEST_LOCATION );
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("gif.gif1"), TEST_LOCATION );
+
+ END_TEST;
+}
utc-Dali-TextLabel.cpp
utc-Dali-TextSelectionPopup.cpp
utc-Dali-ToolBar.cpp
+ utc-Dali-Tooltip.cpp
utc-Dali-TransitionData.cpp
utc-Dali-Button.cpp
utc-Dali-Control.cpp
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
typedef IntrusivePtr<Timer> TimerPtr;
Dali::Timer::TimerSignalType gTickSignal;
+int gTimerCount = 0;
/**
* Implementation of the timer
Timer::Timer( unsigned int milliSec )
: mInterval( milliSec )
{
+ ++gTimerCount;
}
Timer::~Timer()
{
+ --gTimerCount;
}
void Timer::Start()
void Timer::MockEmitSignal()
{
- gTickSignal.Emit();
+ if( gTimerCount > 1 )
+ {
+ // Only emit the signal if we have more than just the timer created in the test function
+ gTickSignal.Emit();
+ }
}
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+PixelData CreatePixelData( unsigned int width, unsigned int height )
+{
+ unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGBA8888 );
+
+ unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
+ PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
+
+ return pixelData;
+}
+
Rect<int> TextureCoordinateToPixelArea( const Vector4& textureCoordinate, float size )
{
Vector4 temp = textureCoordinate * size;
Rect<int> pixelArea;
pixelArea.x = static_cast<int>( temp.x );
pixelArea.y = static_cast<int>( temp.y );
- pixelArea.width = static_cast<int>( temp.z-temp.x+1.f );
- pixelArea.height = static_cast<int>( temp.w-temp.y+1.f );
+ pixelArea.width = static_cast<int>( temp.z-temp.x+1.01f );
+ pixelArea.height = static_cast<int>( temp.w-temp.y+1.01f );
+
+ return pixelArea;
+}
+
+Rect<int> TextureCoordinateToPixelArea( const Vector4& textureCoordinate, float width, float height )
+{
+ Rect<int> pixelArea;
+ pixelArea.x = static_cast<int>( textureCoordinate.x*width );
+ pixelArea.y = static_cast<int>( textureCoordinate.y*height);
+ pixelArea.width = static_cast<int>( (textureCoordinate.z-textureCoordinate.x)*width+1.01f );
+ pixelArea.height = static_cast<int>( (textureCoordinate.w-textureCoordinate.y)*height+1.01f );
return pixelArea;
}
END_TEST;
}
+
+int UtcDaliImageAtlasPackToAtlas(void)
+{
+ ToolkitTestApplication application;
+
+ std::vector<PixelData> pixelDataContainer;
+ pixelDataContainer.push_back( CreatePixelData( 20, 30 ) );
+ pixelDataContainer.push_back( CreatePixelData( 10, 10 ) );
+ pixelDataContainer.push_back( CreatePixelData( 45, 30 ) );
+ pixelDataContainer.push_back( CreatePixelData( 20, 20 ) );
+
+ Dali::Vector<Vector4> textureRects;
+ Texture texture = ImageAtlas::PackToAtlas( pixelDataContainer, textureRects );
+
+ // --------------
+ // | |
+ // | 45*30 |
+// | |
+// --------------
+// | 20 | | 20*20
+// | * |____|
+// | 30 | | 10*10
+// --------
+
+ DALI_TEST_EQUALS( texture.GetWidth(), 45, TEST_LOCATION );
+ DALI_TEST_EQUALS( texture.GetHeight(), 60, TEST_LOCATION );
+
+ Rect<int> pixelArea = TextureCoordinateToPixelArea(textureRects[0], texture.GetWidth(), texture.GetHeight());
+ DALI_TEST_EQUALS( pixelArea.x, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.y, 30, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.width, 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.height, 30, TEST_LOCATION );
+
+ pixelArea = TextureCoordinateToPixelArea(textureRects[1], texture.GetWidth(), texture.GetHeight());
+ DALI_TEST_EQUALS( pixelArea.x, 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.y, 50, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.width, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.height, 10, TEST_LOCATION );
+
+ pixelArea = TextureCoordinateToPixelArea(textureRects[2], texture.GetWidth(), texture.GetHeight());
+ DALI_TEST_EQUALS( pixelArea.x, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.y, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.width, 45, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.height, 30, TEST_LOCATION );
+
+ pixelArea = TextureCoordinateToPixelArea(textureRects[3], texture.GetWidth(), texture.GetHeight());
+ DALI_TEST_EQUALS( pixelArea.x, 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.y, 30, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.width, 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( pixelArea.height, 20, TEST_LOCATION );
+
+ END_TEST;
+}
#include <dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+int UtcDaliItemLayoutSetAndGetLayoutProperties(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+
+ // Set the property of the grid layout
+ Property::Map gridLayoutProperty;
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_TOP_MARGIN, Dali::Property::Value(95.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN, Dali::Property::Value(20.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SIDE_MARGIN, Dali::Property::Value(20.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.03f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.015f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(100.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
+ gridLayout->SetLayoutProperties(gridLayoutProperty);
+
+ view.AddLayout(*gridLayout);
+ ItemLayoutPtr layout = view.GetLayout(0);
+ DALI_TEST_CHECK(gridLayout == layout);
+ Property::Map firstLayout = gridLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( gridLayoutProperty.Count(), firstLayout.Count(), TEST_LOCATION );
+
+ for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( rowSpacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
+ {
+ int number = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_SPACING)
+ {
+ float columnSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(columnSpacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_TOP_MARGIN)
+ {
+ float topMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(topMargin, 95.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN)
+ {
+ float bottomMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(bottomMargin, 20.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SIDE_MARGIN)
+ {
+ float sideMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(sideMargin, 20.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.03f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.015f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 100.0f, TEST_LOCATION );
+ }
+ }
+ ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+
+ // Set the property of the depth layout
+ Property::Map depthLayoutProperty;
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_SPACING, Dali::Property::Value(55.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_TILT_ANGLE, Dali::Property::Value(Math::PI*0.15f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE, Dali::Property::Value(-Math::PI*0.025f ) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.02f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.03f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(50.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
+ depthLayout->SetLayoutProperties(depthLayoutProperty);
+
+ view.AddLayout(*depthLayout);
+ layout = view.GetLayout(1);
+ DALI_TEST_CHECK(depthLayout == layout);
+
+ Property::Map secondLayout = depthLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( depthLayoutProperty.Count(), secondLayout.Count(), TEST_LOCATION );
+ for( unsigned int mapIdx = 0, mapCount = secondLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( secondLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::DEPTH, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ORIENTATION)
+ {
+ int orientation = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(orientation, (int)ControlOrientation::Up, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER)
+ {
+ int columnNumber = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( columnNumber, 3, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_NUMBER)
+ {
+ float rowNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowNumber, 26.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_SPACING)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowSpacing, 55.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_TILT_ANGLE)
+ {
+ float tiltAngle = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(tiltAngle, Math::PI*0.15f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE)
+ {
+ float itemTiltAngle = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(itemTiltAngle, -Math::PI*0.025f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.02f, TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.03f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 50.0f, TEST_LOCATION );
+ }
+ }
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+
+ // Set the property of the spiral layout
+ Property::Map spiralLayoutPrperty;
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE, Dali::Property::Value(190.0f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.01f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.1f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(30.0f) );
+ spiralLayout->SetLayoutProperties(spiralLayoutPrperty);
+
+ view.AddLayout(*spiralLayout);
+ layout = view.GetLayout(2);
+ DALI_TEST_CHECK(spiralLayout == layout);
+
+ Property::Map thridLayout = spiralLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( spiralLayoutPrperty.Count(), thridLayout.Count(), TEST_LOCATION );
+
+ for( unsigned int mapIdx = 0, mapCount = thridLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( thridLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::SPIRAL, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING)
+ {
+ float columnNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( columnNumber, (Math::PI*2.0f)/9.5f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT)
+ {
+ float rowNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowNumber, -0.125f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowSpacing, 190.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.01f, TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.1f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 30.0f, TEST_LOCATION );
+ }
+ }
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+ Vector3 stageSize(stage.GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+ view.ActivateLayout(1, stageSize, 0.5f);
+ view.ActivateLayout(2, stageSize, 0.5f);
+ END_TEST;
+
+}
+
+int UtcDaliItemLayoutSetandGetLayoutChangedFlag(void)
+{
+ ToolkitTestApplication application;
+
+ TestItemLayoutPtr layout = TestItemLayout::New();
+ DALI_TEST_CHECK( layout );
+ layout->ResetLayoutChangedFlag();
+ DALI_TEST_CHECK(layout->HasLayoutChanged() == false);
+
+ END_TEST;
+}
+
int UtcDaliItemRangeIntersection(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
using namespace Dali;
view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
+ // Test "layout" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("layout") == DevelItemView::Property::LAYOUT );
+ Property::Map gridLayoutProperty;
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
+
+ Property::Map depthLayoutProperty;
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
+
+ Property::Map spiralLayoutPrperty;
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
+
+ Property::Map listLayoutPrperty;
+ listLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::LIST) );
+ listLayoutPrperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(100, 100,50)) );
+
+
+ Property::Array layoutArray;
+ layoutArray.PushBack(gridLayoutProperty);
+ layoutArray.PushBack(depthLayoutProperty);
+ layoutArray.PushBack(spiralLayoutPrperty);
+ layoutArray.PushBack(listLayoutPrperty);
+
+ view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
+
+ Property::Array getLayoutArray;
+ DALI_TEST_CHECK( view.GetProperty(DevelItemView::Property::LAYOUT ).Get( getLayoutArray ) );
+
+ //Check that the result is the same as
+ DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION );
+ Property::Map firstLayout = *((getLayoutArray.GetElementAt( 0 )).GetMap());
+
+ for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
+ {
+ float spacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
+ {
+ int number = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
+ }
+ }
+ view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
+
+
// Test "overshootEnabled" property
DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
tet_result(TET_FAIL);
}
+ try
+ {
+ // Render some text with the shared atlas backend
+ label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_VECTOR_BASED );
+ application.SendNotification();
+ application.Render();
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
END_TEST;
}
--- /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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+#include <toolkit-timer.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali/integration-api/events/hover-event-integ.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+void utc_dali_toolkit_tooltip_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_tooltip_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+
+Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
+{
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point;
+ point.SetState( static_cast< PointState::Type >( state ) );
+ point.SetScreenPosition( screenPosition );
+ hoverEvent.points.push_back( point );
+ return hoverEvent;
+}
+
+} // unnamed namespace
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+int UtcDaliTooltipGetWithoutSetting(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map is empty" );
+ DALI_TEST_EQUALS( true, map->Empty(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithString(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Hello Test" );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map contains the content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+
+ tet_infoline( "Check content is a property map" );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+
+ tet_infoline( "Check that the map contains the text item" );
+ Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
+ DALI_TEST_CHECK( textStringValue );
+
+ tet_infoline( "Ensure it matches what we set" );
+ DALI_TEST_EQUALS( "Hello Test", textStringValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "We sent valid text, so ensure the hover signal has been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithTextVisualMap(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT,
+ Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+ .Add( TextVisual::Property::TEXT, "Hello TextVisual Test" ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map contains the content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+
+ tet_infoline( "Check content is a property map" );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+
+ tet_infoline( "Check that the map contains the text item" );
+ Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
+ DALI_TEST_CHECK( textStringValue );
+
+ tet_infoline( "Ensure it matches what we set" );
+ DALI_TEST_EQUALS( "Hello TextVisual Test", textStringValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "We sent a text visual with TEXT property set, so ensure the hover signal has been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithTextVisualMapWithoutString(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT,
+ Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+ .Add( TextVisual::Property::POINT_SIZE, 20 ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map contains the content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+
+ tet_infoline( "Check content is a property map" );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+
+ tet_infoline( "Check that the map contains the point-size item" );
+ Property::Value* pointSizeValue = contentMap->Find( TextVisual::Property::POINT_SIZE );
+ DALI_TEST_CHECK( pointSizeValue );
+
+ tet_infoline( "Ensure it matches what we set" );
+ DALI_TEST_EQUALS( 20, pointSizeValue->Get< int >(), TEST_LOCATION );
+
+ tet_infoline( "We sent a text visual without a TEXT property set, so ensure the hover signal has NOT been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithImageVisualMap(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT,
+ Property::Map().Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map contains the content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+
+ tet_infoline( "Check content is a property map" );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+
+ tet_infoline( "Check that the map contains the url item" );
+ Property::Value* urlValue = contentMap->Find( ImageVisual::Property::URL );
+ DALI_TEST_CHECK( urlValue );
+
+ tet_infoline( "Ensure it matches what we set" );
+ DALI_TEST_EQUALS( "dummy-url.png", urlValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "We sent an ImageVisual, so ensure the hover signal has been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithArray(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Array().Add( Property::Map().Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
+ .Add( Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+ .Add( TextVisual::Property::TEXT, "Hello Array Test" ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Ensure map contains the content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+
+ tet_infoline( "Check content is a property array" );
+ Property::Array* contentArray = contentValue->GetArray();
+ DALI_TEST_CHECK( contentArray );
+
+ tet_infoline( "Ensure the array contains two items" );
+ DALI_TEST_EQUALS( 2u, contentArray->Count(), TEST_LOCATION );
+
+ tet_infoline( "Ensure first value is a map and contains the right item" );
+ const Property::Value mapValue1 = contentArray->GetElementAt( 0 );
+ Property::Map* map1 = mapValue1.GetMap();
+ DALI_TEST_CHECK( map1 );
+ Property::Value* urlValue = map1->Find( ImageVisual::Property::URL );
+ DALI_TEST_CHECK( urlValue );
+ DALI_TEST_EQUALS( "dummy-url.png", urlValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "Ensure second value is a map and contains the right item" );
+ const Property::Value mapValue2 = contentArray->GetElementAt( 1 );
+ Property::Map* map2 = mapValue2.GetMap();
+ DALI_TEST_CHECK( map2 );
+ Property::Value* textValue = map2->Find( TextVisual::Property::TEXT );
+ DALI_TEST_CHECK( textValue );
+ DALI_TEST_EQUALS( "Hello Array Test", textValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "We sent an array, so ensure the hover signal has been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithFullMap(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT,
+ Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+ .Add( TextVisual::Property::TEXT, "Hello TextVisual Test" ) )
+ .Add( Tooltip::Property::LAYOUT, Vector2( 1.0f, 2.0f ) )
+ .Add( Tooltip::Property::WAIT_TIME, 2.5f )
+ .Add( Tooltip::Property::BACKGROUND, "tooltip-background.png" )
+ .Add( Tooltip::Property::TAIL, true )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
+ .Add( Tooltip::Property::HOVER_POINT_OFFSET, Vector2( 100.0f, 50.f ) )
+ .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 50 )
+ .Add( Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Check content" );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+
+ tet_infoline( "Check layout" );
+ Property::Value* layoutValue = map->Find( Tooltip::Property::LAYOUT );
+ DALI_TEST_CHECK( layoutValue );
+ DALI_TEST_EQUALS( layoutValue->Get< Vector2 >(), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
+
+ tet_infoline( "Check wait time" );
+ Property::Value* waitTimeValue = map->Find( Tooltip::Property::WAIT_TIME );
+ DALI_TEST_CHECK( waitTimeValue );
+ DALI_TEST_EQUALS( waitTimeValue->Get< float >(), 2.5f, TEST_LOCATION );
+
+ tet_infoline( "Check background" );
+ Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
+ DALI_TEST_CHECK( backgroundMapValue );
+ Property::Map* backgroundMap = backgroundMapValue->GetMap();
+ DALI_TEST_CHECK( backgroundMap );
+ Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
+ DALI_TEST_CHECK( backgroundStringValue );
+ DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
+
+ tet_infoline( "Check Tail" );
+ Property::Value* tailMapValue = map->Find( Tooltip::Property::TAIL );
+ DALI_TEST_CHECK( tailMapValue );
+ Property::Map* tailMap = tailMapValue->GetMap();
+ DALI_TEST_CHECK( tailMap );
+ Property::Value* tailVisibilityValue = tailMap->Find( Tooltip::Tail::Property::VISIBILITY );
+ DALI_TEST_CHECK( tailVisibilityValue );
+ DALI_TEST_EQUALS( tailVisibilityValue->Get< bool >(), true, TEST_LOCATION );
+
+ tet_infoline( "Check position" );
+ Property::Value* positionValue = map->Find( Tooltip::Property::POSITION );
+ DALI_TEST_CHECK( positionValue );
+ DALI_TEST_EQUALS( positionValue->Get< int >(), static_cast< int >( Tooltip::Position::HOVER_POINT ), TEST_LOCATION );
+
+ tet_infoline( "Check hover point offset" );
+ Property::Value* hoverPointOffsetValue = map->Find( Tooltip::Property::HOVER_POINT_OFFSET );
+ DALI_TEST_CHECK( hoverPointOffsetValue );
+ DALI_TEST_EQUALS( hoverPointOffsetValue->Get< Vector2 >(), Vector2( 100.0f, 50.f ), TEST_LOCATION );
+
+ tet_infoline( "Check movement threshold" );
+ Property::Value* movementThresholdValue = map->Find( Tooltip::Property::MOVEMENT_THRESHOLD );
+ DALI_TEST_CHECK( movementThresholdValue );
+ DALI_TEST_EQUALS( movementThresholdValue->Get< int >(), 50, TEST_LOCATION );
+
+ tet_infoline( "Check disappear on movement" );
+ Property::Value* disappearOnMovementValue = map->Find( Tooltip::Property::DISAPPEAR_ON_MOVEMENT );
+ DALI_TEST_CHECK( disappearOnMovementValue );
+ DALI_TEST_EQUALS( disappearOnMovementValue->Get< bool >(), true, TEST_LOCATION );
+
+ tet_infoline( "We sent a text visual with TEXT property set, so ensure the hover signal has been connected to" );
+ DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithBackgroundMap(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
+ .Add( Tooltip::Property::BACKGROUND,
+ Property::Map().Add( Tooltip::Background::Property::VISUAL, "tooltip-background.png" )
+ .Add( Tooltip::Background::Property::BORDER, Rect< int >( 10, 20, 30, 40 ) ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Check background map" );
+ Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
+ DALI_TEST_CHECK( backgroundMapValue );
+ Property::Map* backgroundMap = backgroundMapValue->GetMap();
+ DALI_TEST_CHECK( backgroundMap );
+
+ tet_infoline( "Check visual" );
+ Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
+ DALI_TEST_CHECK( backgroundStringValue );
+ DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
+
+ tet_infoline( "Check border" );
+ Property::Value* borderValue = backgroundMap->Find( Tooltip::Background::Property::BORDER );
+ DALI_TEST_CHECK( borderValue );
+ DALI_TEST_EQUALS( borderValue->Get< Rect< int > >(), Rect< int >( 10, 20, 30, 40 ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithBackgroundMapVector4(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
+ .Add( Tooltip::Property::BACKGROUND,
+ Property::Map().Add( Tooltip::Background::Property::VISUAL, "tooltip-background.png" )
+ .Add( Tooltip::Background::Property::BORDER, Vector4( 40.0f, 30.0f, 20.0f, 10.0f ) ) )
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Check background map" );
+ Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
+ DALI_TEST_CHECK( backgroundMapValue );
+ Property::Map* backgroundMap = backgroundMapValue->GetMap();
+ DALI_TEST_CHECK( backgroundMap );
+
+ tet_infoline( "Check visual" );
+ Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
+ DALI_TEST_CHECK( backgroundStringValue );
+ DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
+
+ tet_infoline( "Check border" );
+ Property::Value* borderValue = backgroundMap->Find( Tooltip::Background::Property::BORDER );
+ DALI_TEST_CHECK( borderValue );
+ DALI_TEST_EQUALS( borderValue->Get< Rect< int > >(), Rect< int >( 40, 30, 20, 10 ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipCreateWithTailMap(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
+ );
+
+ tet_infoline( "Check if Property::MAP is returned" );
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+
+ tet_infoline( "Ensure map is valid" );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ tet_infoline( "Check Tail" );
+ Property::Value* tailMapValue = map->Find( Tooltip::Property::TAIL );
+ DALI_TEST_CHECK( tailMapValue );
+ Property::Map* tailMap = tailMapValue->GetMap();
+ DALI_TEST_CHECK( tailMap );
+
+ tet_infoline( "Check visibility" );
+ Property::Value* tailVisibilityValue = tailMap->Find( Tooltip::Tail::Property::VISIBILITY );
+ DALI_TEST_CHECK( tailVisibilityValue );
+ DALI_TEST_EQUALS( tailVisibilityValue->Get< bool >(), true, TEST_LOCATION );
+
+ tet_infoline( "Check above visual" );
+ Property::Value* aboveVisualValue = tailMap->Find( Tooltip::Tail::Property::ABOVE_VISUAL );
+ DALI_TEST_CHECK( aboveVisualValue );
+ DALI_TEST_EQUALS( aboveVisualValue->Get< std::string >(), "above-visual.png", TEST_LOCATION );
+
+ tet_infoline( "Check below visual" );
+ Property::Value* belowVisualValue = tailMap->Find( Tooltip::Tail::Property::BELOW_VISUAL );
+ DALI_TEST_CHECK( belowVisualValue );
+ DALI_TEST_EQUALS( belowVisualValue->Get< std::string >(), "below-visual.png", TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplay(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Stationary, centerPoint ) ); // Emit for code coverage, will have no effect
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplayWithTail(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplayWithContentArray(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT,
+ Property::Array().Add( Property::Map().Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
+ .Add( Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+ .Add( TextVisual::Property::TEXT, "Hello Array Test" ) ))
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplayBelow(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+
+ tet_infoline( "Ensure tooltip is below control" );
+ DALI_TEST_CHECK( ( control.GetCurrentWorldPosition().y + 50.0f /* Half Size */) < tooltip.GetCurrentWorldPosition().y );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplayAbove(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+
+ tet_infoline( "Ensure tooltip is above control" );
+ DALI_TEST_CHECK( ( control.GetCurrentWorldPosition().y - 50.0f /* Half Size */) >= ( tooltip.GetCurrentWorldPosition().y + 0.5f * tooltip.GetCurrentSize().height ) );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipDisplayAtHoverPoint(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 hoverPoint = stageSize * 0.5f;
+ hoverPoint.x -= 10.0f;
+ hoverPoint.y -= 10.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+
+ tet_infoline( "Ensure tooltip is below and to the right of control" );
+ DALI_TEST_CHECK( ( hoverPoint.y - stageSize.height * 0.5f ) < tooltip.GetCurrentWorldPosition().y );
+ DALI_TEST_CHECK( ( hoverPoint.x - stageSize.width * 0.5f ) < tooltip.GetCurrentWorldPosition().x );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipExceedThreshold(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ tet_infoline( "Start hover" );
+ Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Emit a value which exceeds threshold, timer should start again" );
+ hoverPoint.x += 10.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Emit Timer signal - timeout at new point which is still within bounds" );
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipGoOutOfBounds(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ tet_infoline( "Start hover" );
+ Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Emit a value which goes out of bounds" );
+ hoverPoint.x += 100.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Emit Timer signal - nothing should happen" );
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should be the same as before" );
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ hoverPoint.x += 100.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should be back to what was there before the tooltip was shown" );
+ --rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true )
+ .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ hoverPoint.x += 10.0f; // Stay within bounds but exceed threshold
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should be back to what was there before the tooltip was shown" );
+ --rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipChangeContent(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control = Control::New();
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetSize( 100.0f, 100.0f );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ int rootChildCount = rootActor.GetChildCount();
+
+ Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ tet_infoline( "Change content while timer is running and ensure it matches the new value" );
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Second Value" );
+
+ Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+ Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+ Property::Map* contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+ Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
+ DALI_TEST_CHECK( textStringValue );
+ DALI_TEST_EQUALS( "Second Value", textStringValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "Emit signal, nothing should happen as everything has been reset" );
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, there should NOT be any new actors" );
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ tet_infoline( "More movement at same point, and emit signal, we should get the tooltip" );
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, centerPoint ) );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
+ ++rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ tet_infoline( "Change content while tooltip is showing, current one should be removed from the stage and ensure it matches new value" );
+ control.SetProperty( DevelControl::Property::TOOLTIP, "Third Value" );
+
+ value = control.GetProperty( DevelControl::Property::TOOLTIP );
+ DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
+ map = value.GetMap();
+ DALI_TEST_CHECK( map );
+ contentValue = map->Find( Tooltip::Property::CONTENT );
+ DALI_TEST_CHECK( contentValue );
+ contentMap = contentValue->GetMap();
+ DALI_TEST_CHECK( contentMap );
+ textStringValue = contentMap->Find( TextVisual::Property::TEXT );
+ DALI_TEST_CHECK( textStringValue );
+ DALI_TEST_EQUALS( "Third Value", textStringValue->Get< std::string >(), TEST_LOCATION );
+
+ tet_infoline( "Emit signal, nothing should happen as everything has been reset" );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Get number of actors on the Stage, there should be one less actor on the stage" );
+ --rootChildCount;
+ DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipEnsureRemainsOnStage1(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+
+ tet_infoline( "Create a control and place it at the bottom of the screen, setting the tooltip to appear below" );
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ control.SetSize( stageSize );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 centerPoint = stageSize * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Ensure tooltip is still on the screen" );
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+ DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().y + tooltip.GetCurrentSize().height * 0.5f ) <= centerPoint.height );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipEnsureRemainsOnStage2(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+
+ tet_infoline( "Create a control and place it at the top of the screen, setting the tooltip to appear above" );
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ control.SetParentOrigin( ParentOrigin::TOP_CENTER );
+ control.SetSize( stageSize );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
+ );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 centerPoint = stageSize * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Ensure tooltip is still on the screen" );
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+ DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().y - tooltip.GetCurrentSize().height * 0.5f ) >= -centerPoint.height );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipEnsureRemainsOnStage3(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 centerPoint = stageSize * 0.5f;
+
+ tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the left of the screen" );
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ control.SetSize( stageSize );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
+ );
+ control.SetX( -centerPoint.x );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 hoverPoint( centerPoint );
+ hoverPoint.x = 1.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Ensure tooltip is still on the screen" );
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+ DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().x - tooltip.GetCurrentSize().width * 0.5f ) >= -centerPoint.width );
+
+ END_TEST;
+}
+
+int UtcDaliTooltipEnsureRemainsOnStage4(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 centerPoint = stageSize * 0.5f;
+
+ tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the right of the screen" );
+ Control control = Control::New();
+ control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ control.SetSize( stageSize );
+ control.SetProperty( DevelControl::Property::TOOLTIP,
+ Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
+ .Add( Tooltip::Property::TAIL,
+ Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
+ .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
+ .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
+ .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
+ );
+ control.SetX( centerPoint.x );
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ rootActor.Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 hoverPoint( centerPoint );
+ hoverPoint.x = 1.0f;
+ application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+
+ Dali::Timer timer = Timer::New( 1u );
+ timer.MockEmitSignal();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Ensure tooltip is still on the screen" );
+ Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
+ DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().x + tooltip.GetCurrentSize().width * 0.5f ) <= centerPoint.width );
+
+ END_TEST;
+}
const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.jpg";
const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
+const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
const float height = textVisual.GetHeightForWidth( 40.f );
DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ //AnimatedImageVisual
+ Visual::Base animatedImageVisual = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );
+ animatedImageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
+ animatedImageVisual.GetNaturalSize(naturalSize);
+ // TEST_GIF_FILE: anim.gif
+ // resolution: 50*50, frame count: 4, frame delay: 0.2 second for each frame
+ DALI_TEST_EQUALS( naturalSize, Vector2(50.f, 50.f), TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+int UtcDaliVisualGetPropertyMap11(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualGetPropertyMap7: AnimatedImageVisual" );
+
+ // request SvgVisual with a property map
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ Visual::Base svgVisual = factory.CreateVisual( Property::Map()
+ .Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) );
+
+ Property::Map resultMap;
+ svgVisual.CreatePropertyMap( resultMap );
+ // check the property values from the returned map from a visual
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
+
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<std::string>() == TEST_GIF_FILE_NAME );
+
+ // request SvgVisual with an URL
+ Visual::Base svgVisual2 = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );
+ resultMap.Clear();
+ svgVisual2.CreatePropertyMap( resultMap );
+ // check the property values from the returned map from a visual
+ value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
+
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<std::string>() == TEST_GIF_FILE_NAME );
+
+ END_TEST;
+}
+
int UtcDaliVisualGetPropertyMapBatchImageVisualNoAtlas(void)
{
ToolkitTestApplication application;
#include <iostream>
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
+#include <toolkit-timer.h>
#include <toolkit-bitmap-loader.h>
#include <toolkit-event-thread-callback.h>
#include <dali/public-api/rendering/renderer.h>
const char* TEST_SIMPLE_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube-Points-Only.obj";
const char* TEST_SIMPLE_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal-Simple.mtl";
+// resolution: 50*50, frame count: 4, frame delay: 0.2 second for each frame
+const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
+
// resolution: 34*34, pixel format: RGBA8888
static const char* gImage_34_RGBA = TEST_RESOURCE_DIR "/icon-edit.png";
// resolution: 600*600, pixel format: RGB888
END_TEST;
}
+
+int UtcDaliVisualFactoryGetAnimatedImageVisual(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualFactoryGetAnimatedImageVisual: Request animated image visual with a gif url" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base visual = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );
+ DALI_TEST_CHECK( visual );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // renderer is added to actor
+ DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+ // test the uniforms which used to handle the atlas rect
+ // the four frames should be located inside atlas as follows: atlas size 100*100
+ // -------------
+ // | | |
+ // | 0 | 1 |
+ // -------------
+ // | | |
+ // | 2 | 3 |
+ // -------------
+
+ Renderer renderer = actor.GetRendererAt( 0u );
+ DALI_TEST_CHECK( renderer );
+
+ Property::Value atlasRectValue = renderer.GetProperty( renderer.GetPropertyIndex( "uAtlasRect" ) );
+ // take into consideration the half pixel correction
+ DALI_TEST_EQUALS( atlasRectValue.Get<Vector4>(), Vector4(0.5f, 0.5f, 49.5f, 49.5f)/100.f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ // waiting for the resource uploading
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+ // Force the timer used by the animatedImageVisual to tick,
+ Dali::Timer timer = Timer::New( 0 );
+ timer.MockEmitSignal();
+ application.SendNotification();
+ application.Render();
+ atlasRectValue = renderer.GetProperty( renderer.GetPropertyIndex( "uAtlasRect" ) );
+ // take into consideration the half pixel correction
+ DALI_TEST_EQUALS( atlasRectValue.Get<Vector4>(), Vector4(50.5f, 0.5f, 99.5f, 49.5f)/100.f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ // Force the timer used by the animatedImageVisual to tick,
+ timer.MockEmitSignal();
+ application.SendNotification();
+ application.Render();
+ atlasRectValue = renderer.GetProperty( renderer.GetPropertyIndex( "uAtlasRect" ) );
+ // take into consideration the half pixel correction
+ DALI_TEST_EQUALS( atlasRectValue.Get<Vector4>(), Vector4(0.5f, 50.5f, 49.5f, 99.5f)/100.f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ // Force the timer used by the animatedImageVisual to tick,
+ timer.MockEmitSignal();
+ application.SendNotification();
+ application.Render();
+ atlasRectValue = renderer.GetProperty( renderer.GetPropertyIndex( "uAtlasRect" ) );
+ // take into consideration the half pixel correction
+ DALI_TEST_EQUALS( atlasRectValue.Get<Vector4>(), Vector4(50.5f, 50.5f, 99.5f, 99.5f)/100.f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ // Test SetOffStage().
+ actor.Unparent();
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+ END_TEST;
+}
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
develapigaussianblurviewdir = $(develapicontrolsdir)/gaussian-blur-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
+develapiitemviewdir = $(develapicontrolsdir)/scrollable/item-view
develapinavigationviewdir = $(develapicontrolsdir)/navigation-view
develapipageturnviewdir = $(develapicontrolsdir)/page-turn-view
develapipopupdir = $(develapicontrolsdir)/popup
develapishadereffectsdir = $(develapidir)/shader-effects
develapitransitioneffectsdir = $(develapidir)/transition-effects
develapitoolbardir = $(develapicontrolsdir)/tool-bar
+develapitooltipdir = $(develapicontrolsdir)/tooltip
develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
develapivisualfactorydir = $(develapidir)/visual-factory
develapivisualsdir = $(develapidir)/visuals
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
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)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
develapinavigationview_HEADERS = $(devel_api_navigation_view_header_files)
develapipageturnview_HEADERS = $(devel_api_page_turn_view_header_files)
develapishadereffects_HEADERS = $(devel_api_shader_effects_header_files)
develapisuperblurview_HEADERS = $(devel_api_super_blur_view_header_files)
develapitoolbar_HEADERS = $(devel_api_tool_bar_header_files)
+develapitooltip_HEADERS = $(devel_api_tooltip_header_files)
develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
develapitextselectionpopup_HEADERS = $(devel_api_text_controls_header_files)
--- /dev/null
+#ifndef DALI_TOOLKIT_CONTROL_DEVEL_H
+#define DALI_TOOLKIT_CONTROL_DEVEL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelControl
+{
+
+namespace Property
+{
+
+enum
+{
+ STYLE_NAME = Control::Property::STYLE_NAME,
+ BACKGROUND_COLOR = Control::Property::BACKGROUND_COLOR,
+ BACKGROUND_IMAGE = Control::Property::BACKGROUND_IMAGE,
+ KEY_INPUT_FOCUS = Control::Property::KEY_INPUT_FOCUS,
+ BACKGROUND = Control::Property::BACKGROUND,
+
+ /**
+ * @brief Displays a tooltip when the control is hovered over.
+ * @details Name "tooltip", type Property::STRING, Property::ARRAY or Property::MAP.
+ * If Property::STRING, then the style specified in the stylesheet is used.
+ * If Property::ARRAY of Visuals then all are displayed in one row.
+ * If Property::MAP, then it should be a map of Tooltip properties.
+ * @note The tooltip is only activated if display content is received, i.e. a string (text) or visual to show.
+ * The rest is used to just build up the style of the tooltip (i.e. background, text color/point-size etc.)
+ * @note When retrieved, a Property::MAP is returned.
+ * @see Toolkit::Tooltip
+ */
+ TOOLTIP = BACKGROUND + 1,
+};
+
+} // namespace Property
+
+} // namespace DevelControl
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_CONTROL_DEVEL_H
--- /dev/null
+#ifndef DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+#define DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @brief Default item layout property.
+ */
+namespace DefaultItemLayoutProperty
+{
+
+/**
+ * @brief The properties of each type of item layout.
+ */
+enum Property
+{
+ /**
+ * @brief The type of the Layout.
+ * @details Name "type", type(Dali::Toolkit::DefaultItemLayout::Type),Property::INTEGER
+ * @note Mandatory.
+ */
+ TYPE = 0,
+
+ /**
+ * @brief The size of each item in the Layout.
+ * @details Name "itemSize",Property::VECTOR3
+ * @note Optional.
+ * @note If not supplied, see ItemLayout::GetDefaultItemSize().
+ */
+ ITEM_SIZE,
+
+ /**
+ * @brief The internal orientation of the Layout.
+ * @details Name "orientation",type(@ref Dali::Toolkit::ControlOrientation::Type),Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is ControlOrientation::Up, The contents of control are in a vertical layout, from top to bottom.
+ */
+ ORIENTATION,
+
+ /**
+ * @brief The number of columns in the GridLayout.
+ * @details Name "gridColumnNumber",Property::INTEGER.
+ * @note Optional.
+ * @note If not supplied, the default is 4.
+ */
+ GRID_COLUMN_NUMBER,
+
+ /**
+ * @brief The spacing between rows in the GridLayout.
+ * @details Name "gridRowSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_ROW_SPACING,
+
+ /**
+ * @brief The spacing between columns in the GridLayout.
+ * @details Name "gridColumnSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_COLUMN_SPACING,
+
+ /**
+ * @brief The margin in the top of the GridLayout.
+ * @details Name "gridTopMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 95.0f.
+ */
+ GRID_TOP_MARGIN,
+
+ /**
+ * @brief The margin in the bottom of the GridLayout.
+ * @details Name "gridBottomMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_BOTTOM_MARGIN,
+
+ /**
+ * @brief The margin in the left and right of the GridLayout.
+ * @details Name "gridSideMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_SIDE_MARGIN,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the GridLayout.
+ * @details Name "gridScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.03f.
+ */
+ GRID_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximum swipe speed in pixels per second of GridLayout.
+ * @details Name "gridMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 100.0f.
+ */
+ GRID_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of GridLayout.
+ * @details Name "gridItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note This is the time taken to animate each item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered by a swipe gesture.
+ * @note Must be greater than zero;If not supplied, the default is 0.015f.
+ */
+ GRID_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The number of columns in the DepthLayout.
+ * @details Name "depthColumnNumber",Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is 3.
+ */
+ DEPTH_COLUMN_NUMBER,
+
+ /**
+ * @brief The number of rows in the DepthLayout.
+ * @details Name "depthRowNumber",Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is 26.
+ */
+ DEPTH_ROW_NUMBER,
+
+ /**
+ * @brief The spacing between rows in the DepthLayout.
+ * @details Name "depthRowSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 55.0f.
+ */
+ DEPTH_ROW_SPACING,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the DepthLayout.
+ * @details Name "depthScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.02f.
+ */
+ DEPTH_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximumSwipSpeed of the DepthLayout.
+ * @details Name "depthMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 50.0f.
+ */
+ DEPTH_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of DepthLayout.
+ * @details Name "depthItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note This is the time taken to animate each item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered by a swipe gesture.
+ * @note Must be greater than zero; If not supplied, the default is 0.03f.
+ */
+ DEPTH_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The tilt angle of DepthLayout.
+ * @details Name "depthTiltAngle",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is (Math::PI)*0.15f.
+ * @note This is clamped between -45 & 45 degrees.
+ */
+ DEPTH_TILT_ANGLE,
+
+ /**
+ * @brief The tilt angle of the individual items in the DepthLayout.
+ * @details Name "depthItemTiltAngle",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is -(Math::PI)*0.025f.
+ */
+ DEPTH_ITEM_TILT_ANGLE,
+
+ /**
+ * @brief The spacing angle between items in the SpiralLayout.
+ * @details Name "spiralItemSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 9.5f.
+ */
+ SPIRAL_ITEM_SPACING,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the SpiralLayout.
+ * @details Name "spiralScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.01f.
+ */
+ SPIRAL_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximum swipe speed in pixels per second of the SpiralLayout.
+ * @details Name "spiralMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 30.0f.
+ */
+ SPIRAL_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of the SpiralLayout.
+ * @details Name "spiralItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note This is the time taken to animate each item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered by a swipe gesture.
+ * @note Must be greater than zero; If not supplied, the default is 0.1f.
+ */
+ SPIRAL_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The vertical distance for one revolution of the SpiralLayout.
+ * @details Name "spiralRevolutionDistance",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 190.0f.
+ */
+ SPIRAL_REVOLUTION_DISTANCE,
+
+ /**
+ * @brief The alignment of the top-item, when at the beginning of the SpiralLayout.
+ * @details Name "spiralTopItemAlignment",Property::FLOAT
+ * @note Optional.
+ * @note When at the beginning of the spiral (with a first-item layout-position of zero).A value of 0 indicates that the top-item is centered in the middle of the layout.
+ * A value of -0.5 or 0.5 indicates that the top-item is centred at the top or bottom of the layout respectively.
+ * @note If not supplied, the default is (-0.125f).
+ */
+ SPIRAL_TOP_ITEM_ALIGNMENT,
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+}
+
+#endif // DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+
--- /dev/null
+#ifndef DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
+#define DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelItemView
+{
+
+namespace Property
+{
+
+enum
+{
+ // Event side properties
+ MINIMUM_SWIPE_SPEED = Dali::Toolkit::ItemView::Property::MINIMUM_SWIPE_SPEED,
+ MINIMUM_SWIPE_DISTANCE = Dali::Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE,
+ WHEEL_SCROLL_DISTANCE_STEP = Dali::Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP,
+ SNAP_TO_ITEM_ENABLED = Dali::Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED,
+ REFRESH_INTERVAL = Dali::Toolkit::ItemView::Property::REFRESH_INTERVAL,
+
+ /**
+ * @brief The layout used.
+ * @details Name "layout", type Property::ARRAY
+ * @see SetLayout()
+ */
+ LAYOUT = REFRESH_INTERVAL + 1,
+
+ // Animatable properties
+ LAYOUT_POSITION = Dali::Toolkit::ItemView::Property::LAYOUT_POSITION,
+ SCROLL_SPEED = Dali::Toolkit::ItemView::Property::SCROLL_SPEED,
+ OVERSHOOT = Dali::Toolkit::ItemView::Property::OVERSHOOT,
+ SCROLL_DIRECTION = Dali::Toolkit::ItemView::Property::SCROLL_DIRECTION,
+ LAYOUT_ORIENTATION = Dali::Toolkit::ItemView::Property::LAYOUT_ORIENTATION,
+ SCROLL_CONTENT_SIZE = Dali::Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE
+};
+
+} // namespace Property
+
+} // namespace DevelItemView
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
--- /dev/null
+#ifndef DALI_TOOLKIT_TOOLTIP_PROPERTIES_H
+#define DALI_TOOLKIT_TOOLTIP_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-index-ranges.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Tooltip
+{
+
+/**
+ * @brief The properties used for a Tooltip.
+ */
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The content to display.
+ * @details Name "content", type Property::STRING, Property::MAP or Property::ARRAY.
+ * If Property::STRING is used, then the string is shown as a text and the default font style for a Tooltip will be used.
+ * This can be overridden by passing in a Property::MAP of TextVisual properties. For text styling purposes, a Property::MAP excluding the TEXT property can be sent.
+ * If a different Visual is required, then a Property::MAP defining that visual can be set.
+ * If more than one visual is required, then a Property::ARRAY can be used. The contents are added to the layout as per their order in the array. Text has to be styled in the visual passed in (default toolkit style will not be used).
+ * @note Mandatory.
+ * @note If set using Property::STRING, then when retrieved, a Property::MAP is returned.
+ * If set using a Property::MAP or Property::ARRAY, then the appropriate type is returned.
+ * @see Toolkit::TextVisual
+ */
+ CONTENT = CORE_PROPERTY_MAX_INDEX + 1,
+
+ /**
+ * @brief The layout of the content.
+ * @details Name "layout", type Property::VECTOR2.
+ * The number of rows and columns expected.
+ * ( 1, 2 ) means 1 row, 2 columns so the content will have two items placed on one row.
+ * ( 2, 2 ) means 2 rows, 2 columns so the content will have 4 items with two items placed on each row.
+ * @note Optional.
+ * @note If not provided, the default is to put all items in the same row.
+ */
+ LAYOUT,
+
+ /**
+ * @brief Time to wait in seconds before a tooltip is shown while the is movement is within the allowed threshold.
+ * @details Name "waitTime", type Property::FLOAT.
+ * @note Optional.
+ * @note If not provided, the default is 0.5 seconds.
+ */
+ WAIT_TIME,
+
+ /**
+ * @brief The background of the tooltip.
+ * @details Name "background", type Property::STRING or Property::MAP.
+ * If Property::STRING, then the path to the image is required and it's assumed that there are no borders.
+ * @note Optional.
+ * @note If not provided, the default is taken from the stylesheet.
+ * @note When retrieved, a Property::MAP is returned.
+ * @see Tooltip::Background
+ */
+ BACKGROUND,
+
+ /**
+ * @brief The tail used by the tooltip.
+ * @details Name "tail", type Property::BOOLEAN or Property::MAP.
+ * If Property::BOOLEAN and true, then the default visuals are used for the tail.
+ * A Property::MAP can be used to override the visuals for the tail.
+ * @note Optional.
+ * @note The default is false, i.e. to not show a tail.
+ * @note When retrieved, a Property::MAP is returned.
+ * @note If the popup has to be moved because it goes out of bounds, then the tail is not shown regardless of whether it is set or not.
+ * @see Tooltip::Tail
+ */
+ TAIL,
+
+ /**
+ * @brief The position of the tooltip in relation to the control.
+ * @details Name "position", type Tooltip::Position::Type (Property::INTEGER) or Property::STRING.
+ * @note Optional.
+ * @note If not provided, the default is Tooltip::Position::BELOW.
+ * @note When retrieved, a Tooltip::Position::Type (Property::INTEGER) is returned.
+ */
+ POSITION,
+
+ /**
+ * @brief If Tooltip::Position::HOVER_POINT is used for the POSITION, then this is the offset the tooltip is displayed at from the hover point.
+ * @details Name "hoverPointOffset", type Property::VECTOR2.
+ * @note Optional.
+ * @note If not provided, the default is Vector2( 10.0f, 10.0f ).
+ */
+ HOVER_POINT_OFFSET,
+
+ /**
+ * @brief The movement threshold allowed before showing (or hiding a popup).
+ * @details Name "movementThreshold", type Property::INTEGER.
+ * This value is used as the threshold to hide the popup as well if DISAPPEAR_ON_MOVEMENT is set to true.
+ * @note Optional.
+ * @note If not provided, the default is 5.
+ */
+ MOVEMENT_THRESHOLD,
+
+ /**
+ * @brief If true, the tooltip will disappear after hover movement beyond a certain distance.
+ * @details Name "disappearOnMovement", type Property::BOOLEAN.
+ * @note Optional.
+ * @note If not provided, the default is to disappear only when moving out of bounds of the control.
+ */
+ DISAPPEAR_ON_MOVEMENT,
+};
+
+} // namespace Property
+
+namespace Background
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The image to use as the background.
+ * @details Name "visual", type Property::STRING.
+ */
+ VISUAL,
+
+ /**
+ * @brief The size of the borders in the order: left, right, bottom, top.
+ * @details Name "border", type Property::RECTANGLE.
+ * This is different from the nPatch border as the it will place the content within the bounds specified.
+ * For example, there could be some round corners in the image used and we may not want the content going over the rounded corners.
+ * @note Optional.
+ * @note If not provided, then then it is assumed that the image does not have a border.
+ */
+ BORDER
+};
+
+} // namespace Property
+
+} // namespace Background
+
+/**
+ * @brief The tail used by the tooltip.
+ */
+namespace Tail
+{
+
+/**
+ * @brief The properties of the tail used by the tooltip.
+ */
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief Whether to show the tail or not.
+ * @details Name "visibility", type Property::BOOLEAN.
+ * @note Optional.
+ * @note If the popup has to be moved because it goes out of bounds, then the tail is not shown regardless of whether it is set or not.
+ */
+ VISIBILITY,
+
+ /**
+ * @brief The image used for the tail if it is above the tooltip.
+ * @details Name "aboveVisual", type Property::STRING.
+ */
+ ABOVE_VISUAL,
+
+ /**
+ * @brief The image used for the tail if it is below the tooltip.
+ * @details Name "belowVisual", type Property::STRING.
+ */
+ BELOW_VISUAL
+};
+
+} // namespace Property
+
+} // namespace Tail
+
+namespace Position
+{
+
+/**
+ * @brief The position of the tooltip in relation to the control.
+ */
+enum Type
+{
+ ABOVE, ///< The tooltip will appear above the control.
+ BELOW, ///< The tooltip will appear below the control.
+ HOVER_POINT ///< The tooltip will appear near the hover point.
+};
+
+} // namespace Position
+
+} // namespace Tooltip
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TOOLTIP_PROPERTIES_H
devel_api_controls_header_files = \
$(devel_api_src_dir)/controls/control-depth-index-ranges.h \
+ $(devel_api_src_dir)/controls/control-devel.h \
$(devel_api_src_dir)/controls/control-wrapper.h \
$(devel_api_src_dir)/controls/control-wrapper-impl.h
devel_api_effects_view_header_files = \
$(devel_api_src_dir)/controls/effects-view/effects-view.h
+devel_api_item_view_header_files = \
+ $(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_magnifier_header_files = \
$(devel_api_src_dir)/controls/magnifier/magnifier.h
devel_api_tool_bar_header_files = \
$(devel_api_src_dir)/controls/tool-bar/tool-bar.h
+devel_api_tooltip_header_files = \
+ $(devel_api_src_dir)/controls/tooltip/tooltip-properties.h
+
devel_api_transition_effects_header_files = \
$(devel_api_src_dir)/transition-effects/cube-transition-effect.h \
$(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.h \
{
}
+Texture ImageAtlas::PackToAtlas( const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects )
+{
+ return Internal::ImageAtlas::PackToAtlas( pixelData, textureRects );
+}
+
ImageAtlas::ImageAtlas(Internal::ImageAtlas* internal)
: BaseHandle( internal )
{
// EXTERNAL INCLUDES
#include <string>
#include <stdint.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/images/pixel.h>
namespace Toolkit
{
+
namespace Internal DALI_INTERNAL
{
class ImageAtlas;
public:
/**
+ * @brief Pack a group of pixel data into atlas.
+ * @param[in] pixelData The group of the pixel data to be packed into the atlas.
+ * @param[out] textureRects The list of texture areas where each frame is located inside the atlas.
+ * @return The atlas texture.
+ */
+ static Texture PackToAtlas( const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects );
+
+ /**
* @brief Create a new ImageAtlas.
*
* @param [in] width The atlas width in pixels.
} while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().IsKeyboardFocusable() );
break;
}
+ default:
+ {
+ break;
+ }
}
if( nextFocusedActorIndex != currentFocusedActorIndex )
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
using namespace Dali;
Toolkit::Control Popup::CreateBacking()
{
Toolkit::Control backing = Control::New();
- backing.SetBackgroundColor( Vector4( mBackingColor.r, mBackingColor.g, mBackingColor.b, 1.0f ) );
+ backing.SetProperty( Toolkit::Control::Property::BACKGROUND,
+ Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR )
+ .Add( Toolkit::ColorVisual::Property::MIX_COLOR, Vector4( mBackingColor.r, mBackingColor.g, mBackingColor.b, 1.0f ) ) );
backing.SetName( "popupBacking" );
// Must always be positioned top-left of stage, regardless of parent.
nextFocusableActor = *( endIterator - 1 );
break;
}
+
+ default:
+ {
+ break;
+ }
}
if( !nextFocusableActor )
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void DepthLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+
+ if(HasLayoutChanged())
+ {
+ SetDepthLayoutProperties(GetLayoutProperties());
+ }
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
if( itemView )
{
}
}
+void DepthLayout::SetDepthLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for DepthLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER:
+ {
+ SetNumberOfColumns(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ROW_NUMBER:
+ {
+ SetNumberOfRows(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ROW_SPACING:
+ {
+ SetRowSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_TILT_ANGLE:
+ {
+ SetTiltAngle(Degree(Radian(propertyPair.second.Get<float>())));
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE:
+ {
+ SetItemTiltAngle(Degree(Radian(propertyPair.second.Get<float>())));
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 DepthLayout::GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const
{
Vector3 itemPosition = Vector3::ZERO;
}
break;
}
+ default:
+ {
+ break;
+ }
}
return itemID;
}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+
+
namespace Dali
{
virtual ~DepthLayout();
/**
+ * Apply depth layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetDepthLayoutProperties(const Property::Map& properties);
+
+ /**
* Set the number of columns in the layout.
* @param[in] columns The number of columns.
*/
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void GridLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+ if(HasLayoutChanged())
+ {
+ SetGridLayoutProperties(GetLayoutProperties());
+ }
// This just implements the default behaviour of constraint application.
// Custom layouts can override this function to apply their custom constraints.
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
}
}
+void GridLayout::SetGridLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for gridLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::GRID_COLUMN_NUMBER:
+ {
+ SetNumberOfColumns(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_ROW_SPACING:
+ {
+ SetRowSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_COLUMN_SPACING:
+ {
+ SetColumnSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_TOP_MARGIN:
+ {
+ SetTopMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN:
+ {
+ SetBottomMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_SIDE_MARGIN:
+ {
+ SetSideMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 GridLayout::GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
{
Vector3 itemPosition = Vector3::ZERO;
}
break;
}
+ default:
+ {
+ break;
+ }
}
return itemID;
}
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+#include <dali/public-api/common/dali-common.h>
+
+
namespace Dali
{
virtual ~GridLayout();
/**
+ * Apply grid layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetGridLayoutProperties(const Property::Map& properties);
+
+ /**
* @brief Set the number of columns in the layout.
*
* @param[in] columns The number of columns.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <algorithm>
+#include <dali/public-api/actors/layer.h>
+
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/devel-api/common/set-wrapper.h>
#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/devel-api/object/property-helper-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/grid-layout.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/depth-layout.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.h>
#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
using std::string;
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "wheelScrollDistanceStep", FLOAT, WHEEL_SCROLL_DISTANCE_STEP )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "snapToItemEnabled", BOOLEAN, SNAP_TO_ITEM_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "refreshInterval", FLOAT, REFRESH_INTERVAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout", ARRAY, LAYOUT )
+
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layoutPosition", FLOAT, LAYOUT_POSITION)
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "scrollSpeed", FLOAT, SCROLL_SPEED)
// Remove constraints from previous layout
actor.RemoveConstraints();
+ mActiveLayout->ApplyConstraints(actor, itemId, targetSize, Self() );
+
Vector3 size;
mActiveLayout->GetItemSize( itemId, targetSize, size );
actor.SetSize( size.GetVectorXY() );
-
- mActiveLayout->ApplyConstraints(actor, itemId, targetSize, Self() );
}
// Refresh the new layout
itemViewImpl.SetRefreshInterval( value.Get<float>() );
break;
}
+ case Toolkit::DevelItemView::Property::LAYOUT:
+ {
+ // Get a Property::Array from the property if possible.
+ Property::Array layoutArray;
+ if( value.Get( layoutArray ) )
+ {
+ itemViewImpl.SetLayoutArray( layoutArray );
+ }
+ break;
+ }
+ }
+ }
+}
+
+Property::Array ItemView::GetLayoutArray()
+{
+ return mlayoutArray;
+}
+
+void ItemView::SetLayoutArray( const Property::Array& layouts )
+{
+ mlayoutArray = layouts;
+ const int layoutCount = GetLayoutCount();
+ if( layoutCount > 0 )
+ {
+ for(int index = layoutCount - 1; index >= 0; --index)
+ {
+ RemoveLayout(index);
+ if(index == 0) break;
+ }
+ }
+
+ for( unsigned int arrayIdx = 0, arrayCount = layouts.Count(); arrayIdx < arrayCount; ++arrayIdx )
+ {
+ const Property::Value& element = layouts.GetElementAt( arrayIdx );
+
+ Property::Map* layout = element.GetMap();
+ if( layout != NULL )
+ {
+ for( unsigned int mapIdx = 0, mapCount = (*layout).Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( (*layout).GetKeyValue( mapIdx ) );
+
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ if(layoutType <= DefaultItemLayout::SPIRAL && layoutType >= DefaultItemLayout::DEPTH)
+ {
+ //DEPTH, GRID, LIST, SPIRAL
+ switch(DefaultItemLayout::Type(layoutType))
+ {
+ case DefaultItemLayout::DEPTH:
+ {
+ Internal::DepthLayoutPtr depthLayout = Internal::DepthLayout::New();
+ (*depthLayout).SetLayoutProperties(*layout);
+ AddLayout(*depthLayout);
+ break;
+ }
+ case DefaultItemLayout::GRID:
+ {
+ Internal::GridLayoutPtr gridLayout = Internal::GridLayout::New();
+ (*gridLayout).SetLayoutProperties(*layout);
+ AddLayout(*gridLayout);
+ break;
+ }
+ case DefaultItemLayout::LIST:
+ {
+ Internal::GridLayoutPtr listLayout = Internal::GridLayout::New();
+ listLayout->SetNumberOfColumns( 1 );
+ (*listLayout).SetLayoutProperties(*layout);
+ AddLayout(*listLayout);
+ break;
+ }
+ case DefaultItemLayout::SPIRAL:
+ {
+ Internal::SpiralLayoutPtr spiralLayout = Internal::SpiralLayout::New();
+ (*spiralLayout).SetLayoutProperties(*layout);
+ AddLayout(*spiralLayout);
+ break;
+ }
+ }
+ }
+ }
+ }
}
}
}
value = itemViewImpl.GetRefreshInterval();
break;
}
+ case Toolkit::DevelItemView::Property::LAYOUT:
+ {
+ Property::Array layouts= itemViewImpl.GetLayoutArray();
+ value = layouts;
+ break;
+ }
+
}
}
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/property-notification.h>
#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-array.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
private:
/**
+ * Get all the layouts used in the ItemView.
+ * @return The layout array
+ */
+ Property::Array GetLayoutArray();
+
+ /**
+ * Set all the layouts. that will be used in the ItemView.
+ * @param[in] layouts The layouts used in the itemView.
+ */
+ void SetLayoutArray( const Property::Array& layouts );
+
+ /**
* Remove an Actor if found in the ItemPool.
* @param[in] itemId The item to remove.
* @return True if the remaining actors were reordered.
typedef ItemPool::iterator ItemPoolIter;
typedef ItemPool::const_iterator ConstItemPoolIter;
+ Property::Array mlayoutArray;
+
ItemPool mItemPool;
ItemFactory& mItemFactory;
std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void SpiralLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+
+ if(HasLayoutChanged())
+ {
+ SetSpiralLayoutProperties(GetLayoutProperties());
+ }
// This just implements the default behaviour of constraint application.
// Custom layouts can override this function to apply their custom constraints.
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
}
}
+void SpiralLayout::SetSpiralLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for SpiralLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING:
+ {
+ SetItemSpacing(Radian(propertyPair.second.Get<float>()));
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT:
+ {
+ SetTopItemAlignment(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE:
+ {
+ SetRevolutionDistance(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 SpiralLayout::GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
{
Vector3 itemPosition = Vector3::ZERO;
{
positionConstraint.OrientationDown( itemPosition, currentLayoutPosition + itemID, layoutSize );
}
- else // orientation == ControlOrientation::Right
+ else //orientation == ControlOrientation::Right
{
positionConstraint.OrientationRight( itemPosition, currentLayoutPosition + itemID, layoutSize );
}
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+
namespace Dali
{
virtual ~SpiralLayout();
/**
+ * Apply spiral layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetSpiralLayoutProperties(const Property::Map& properties);
+
+ /**
* Set spacing angle between items.
* @param[in] itemSpacing The angle in radians.
*/
void SuperBlurView::SetImage(Image inputImage)
{
- if( mTargetSize == Vector2::ZERO || mInputImage == inputImage)
+ mInputImage = inputImage;
+ if( mTargetSize == Vector2::ZERO )
{
return;
}
ClearBlurResource();
- mInputImage = inputImage;
Actor self( Self() );
mVisuals[0] = Toolkit::VisualFactory::Get().CreateVisual( mInputImage );
RegisterVisual( 0, mVisuals[0] ); // Will clean up previously registered visuals for this index.
mVisuals[0].SetDepthIndex(0);
- SetShaderEffect( mVisuals[0] );
+ // custom shader is not applied on the original image.
BlurImage( 0, inputImage);
for(unsigned int i=1; i<mBlurLevels;i++)
std::stringstream verterShaderString;
shaderMap[ "fragmentShader" ] = FRAGMENT_SHADER;
- Internal::Visual::Base& rendererImpl = Toolkit::GetImplementation( visual );
- rendererImpl.SetCustomShader( shaderMap );
+ Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
+ visualImpl.SetCustomShader( shaderMap );
}
void SuperBlurView::OnSizeSet( const Vector3& targetSize )
void SuperBlurView::OnStageConnection( int depth )
{
- // Chaining up first ensures visuals have SetOnStage called to create their renderers
- Control::OnStageConnection( depth );
-
if( mTargetSize == Vector2::ZERO )
{
return;
}
+ // Chaining up first ensures visuals have SetOnStage called to create their renderers
+ Control::OnStageConnection( depth );
+
Actor self = Self();
- for(unsigned int i=1; i<=mBlurLevels;i++)
+ for(unsigned int i=0; i<=mBlurLevels;i++)
{
+ // Note that the renderer indices are depending on the order they been added to the actor
+ // which might be different from the blur level of its texture.
+ // We can check the depth index of the renderer to know which blurred image it renders.
Renderer renderer = self.GetRendererAt( i );
- Property::Index index = renderer.RegisterProperty( ALPHA_UNIFORM_NAME, 0.f );
- Constraint constraint = Constraint::New<float>( renderer, index, ActorOpacityConstraint(mBlurLevels, i-1) );
- constraint.AddSource( Source( self, mBlurStrengthPropertyIndex ) );
- constraint.Apply();
+ int depthIndex = renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX);
+ if( depthIndex > 0 )
+ {
+ Property::Index index = renderer.RegisterProperty( ALPHA_UNIFORM_NAME, 0.f );
+ Constraint constraint = Constraint::New<float>( renderer, index, ActorOpacityConstraint(mBlurLevels, depthIndex-1) );
+ constraint.AddSource( Source( self, mBlurStrengthPropertyIndex ) );
+ constraint.Apply();
+ }
}
}
int numberOfColumns = GetColumns();
int numberOfRows = GetRows();
+ bool lastCell = false;
+ Actor nextValidActor;
+
switch ( direction )
{
case Toolkit::Control::KeyboardFocus::LEFT:
{
- if(--currentColumn < 0)
+ do
{
- currentColumn = numberOfColumns - 1;
- if(--currentRow < 0)
+ if(--currentColumn < 0)
{
- currentRow = loopEnabled ? numberOfRows - 1 : 0;
- focusLost = (currentRow == 0);
+ currentColumn = numberOfColumns - 1;
+ if(--currentRow < 0)
+ {
+ lastCell = true;
+ currentRow = loopEnabled ? numberOfRows - 1 : 0;
+ focusLost = (currentRow == 0);
+ }
}
- }
+ nextValidActor = GetChildAt(Toolkit::TableView::CellPosition(currentRow, currentColumn));
+ } while ( !nextValidActor && !lastCell );
break;
}
case Toolkit::Control::KeyboardFocus::RIGHT:
{
- if(++currentColumn > numberOfColumns - 1)
+ do
{
- currentColumn = 0;
- if(++currentRow > numberOfRows - 1)
+ if(++currentColumn > numberOfColumns - 1)
{
- currentRow = loopEnabled ? 0 : numberOfRows - 1;
- focusLost = (currentRow == numberOfRows - 1);
+ currentColumn = 0;
+ if(++currentRow > numberOfRows - 1)
+ {
+ lastCell = true;
+ currentRow = loopEnabled ? 0 : numberOfRows - 1;
+ focusLost = (currentRow == numberOfRows - 1);
+ }
}
- }
+ nextValidActor = GetChildAt(Toolkit::TableView::CellPosition(currentRow, currentColumn));
+ } while ( !nextValidActor && !lastCell );
break;
}
case Toolkit::Control::KeyboardFocus::UP:
{
- if(--currentRow < 0)
+ do
{
- currentRow = loopEnabled ? numberOfRows - 1 : 0;
- focusLost = (currentRow == 0);
- }
+ if(--currentRow < 0)
+ {
+ lastCell = true;
+ currentRow = loopEnabled ? numberOfRows - 1 : 0;
+ focusLost = (currentRow == 0);
+ }
+ nextValidActor = GetChildAt(Toolkit::TableView::CellPosition(currentRow, currentColumn));
+ } while ( !nextValidActor && !lastCell );
break;
}
case Toolkit::Control::KeyboardFocus::DOWN:
{
- if(++currentRow > numberOfRows - 1)
+ do
{
- currentRow = loopEnabled ? 0 : numberOfRows - 1;
- focusLost = (currentRow == numberOfRows - 1);
- }
+ if(++currentRow > numberOfRows - 1)
+ {
+ lastCell = true;
+ currentRow = loopEnabled ? 0 : numberOfRows - 1;
+ focusLost = (currentRow == numberOfRows - 1);
+ }
+ nextValidActor = GetChildAt(Toolkit::TableView::CellPosition(currentRow, currentColumn));
+ } while ( !nextValidActor && !lastCell );
+ break;
+ }
+ default:
+ {
break;
}
}
{
if( mRenderer )
{
- renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
+ renderableActor = mRenderer->Render( mController->GetView(),
+ mAlignmentOffset,
+ DepthIndex::TEXT );
}
if( renderableActor != mRenderableActor )
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
- mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
+ mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
// Make sure the actors are parented correctly with/without clipping
Actor self = mStencil ? mStencil : Self();
TextEditor::TextEditor()
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mIdleCallback( NULL ),
+ mAlignmentOffset( 0.f ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
mHasBeenStaged( false )
{
Actor mRenderableActor;
CallbackBase* mIdleCallback;
+ float mAlignmentOffset;
int mRenderingBackend;
bool mHasBeenStaged:1;
};
{
if( mRenderer )
{
- renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
+ renderableActor = mRenderer->Render( mController->GetView(),
+ mAlignmentOffset,
+ DepthIndex::TEXT );
}
if( renderableActor != mRenderableActor )
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
- mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
+ mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
// Make sure the actors are parented correctly with/without clipping
Actor self = mStencil ? mStencil : Self();
mStencil.SetParentOrigin( ParentOrigin::CENTER );
// Creates a background visual. Even if the color is transparent it updates the stencil.
- // Property::Map backgroundMap;
mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND,
Property::Map().Add( Toolkit::Visual::Property::TYPE, DevelVisual::COLOR ).
Add( ColorVisual::Property::MIX_COLOR, Color::TRANSPARENT ) );
TextField::TextField()
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mIdleCallback( NULL ),
+ mAlignmentOffset( 0.f ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ),
mHasBeenStaged( false )
Actor mRenderableActor;
CallbackBase* mIdleCallback;
+ float mAlignmentOffset;
int mRenderingBackend;
int mExceedPolicy;
bool mHasBeenStaged:1;
Actor self = Self();
Actor renderableActor;
+ float alignmentOffset = 0.f;
if( mRenderer )
{
- renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
+ renderableActor = mRenderer->Render( mController->GetView(),
+ alignmentOffset,
+ DepthIndex::TEXT );
}
if( renderableActor != mRenderableActor )
if( renderableActor )
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
- renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
+ renderableActor.SetPosition( scrollOffset.x + alignmentOffset, scrollOffset.y );
self.Add( renderableActor );
}
--- /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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/controls/tooltip/tooltip.h>
+
+// EXTERNAL INCLUDES
+#include <cmath>
+
+#include <dali/public-api/events/hover-event.h>
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/controls/popup/popup-impl.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( TOOLTIP_POSITION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Tooltip::Position, ABOVE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Tooltip::Position, BELOW )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Tooltip::Position, HOVER_POINT )
+DALI_ENUM_TO_STRING_TABLE_END( TOOLTIP_POSITION )
+
+const float MILLISECONDS_PER_SECOND = 1000.0f;
+
+const char * const PROPERTY_CONTENT_NAME = "content";
+const char * const PROPERTY_LAYOUT_NAME = "layout";
+const char * const PROPERTY_WAIT_TIME_NAME = "waitTime";
+const char * const PROPERTY_BACKGROUND_NAME = "background";
+const char * const PROPERTY_TAIL_NAME = "tail";
+const char * const PROPERTY_POSITION_NAME = "position";
+const char * const PROPERTY_HOVER_POINT_OFFSET_NAME = "hoverPointOffset";
+const char * const PROPERTY_MOVEMENT_THRESHOLD = "movementThreshold";
+const char * const PROPERTY_DISAPPEAR_ON_MOVEMENT = "disappearOnMovement";
+
+const char * const PROPERTY_BACKGROUND_VISUAL = "visual";
+const char * const PROPERTY_BACKGROUND_BORDER = "border";
+
+const char * const PROPERTY_TAIL_VISIBILITY = "visibility";
+const char * const PROPERTY_TAIL_ABOVE_VISUAL = "aboveVisual";
+const char * const PROPERTY_TAIL_BELOW_VISUAL = "belowVisual";
+
+} // unnamed namespace
+
+TooltipPtr Tooltip::New( Toolkit::Control control )
+{
+ return new Tooltip( control );
+}
+
+void Tooltip::SetProperties( const Property::Value& value )
+{
+ Toolkit::Control control = mControl.GetHandle();
+ if( control )
+ {
+ Property::Map* properties = value.GetMap();
+ if( properties )
+ {
+ const Property::Map::SizeType count = properties->Count();
+ for( Property::Map::SizeType position = 0; position < count; ++position )
+ {
+ KeyValuePair keyValue = properties->GetKeyValue( position );
+ Property::Key& key = keyValue.first;
+ Property::Value& value = keyValue.second;
+
+ if( key == Toolkit::Tooltip::Property::CONTENT || key == PROPERTY_CONTENT_NAME )
+ {
+ SetContent( control, value );
+ }
+ else if( key == Toolkit::Tooltip::Property::LAYOUT || key == PROPERTY_LAYOUT_NAME )
+ {
+ value.Get( mLayout );
+ }
+ else if( key == Toolkit::Tooltip::Property::WAIT_TIME || key == PROPERTY_WAIT_TIME_NAME )
+ {
+ float waitTime = 0.0f;
+ if( value.Get( waitTime ) )
+ {
+ mWaitTime = waitTime * MILLISECONDS_PER_SECOND;
+ }
+ }
+ else if( key == Toolkit::Tooltip::Property::BACKGROUND || key == PROPERTY_BACKGROUND_NAME )
+ {
+ SetBackground( value );
+ }
+ else if( key == Toolkit::Tooltip::Property::TAIL || key == PROPERTY_TAIL_NAME )
+ {
+ SetTail( value );
+ }
+ else if( key == Toolkit::Tooltip::Property::POSITION || key == PROPERTY_POSITION_NAME )
+ {
+ Scripting::GetEnumerationProperty< Toolkit::Tooltip::Position::Type >( value, TOOLTIP_POSITION_TABLE, TOOLTIP_POSITION_TABLE_COUNT, mPositionType );
+ }
+ else if( key == Toolkit::Tooltip::Property::HOVER_POINT_OFFSET || key == PROPERTY_HOVER_POINT_OFFSET_NAME )
+ {
+ value.Get( mHoverPointOffset );
+ }
+ else if( key == Toolkit::Tooltip::Property::MOVEMENT_THRESHOLD || key == PROPERTY_MOVEMENT_THRESHOLD )
+ {
+ value.Get( mMovementThreshold );
+ }
+ else if( key == Toolkit::Tooltip::Property::DISAPPEAR_ON_MOVEMENT || key == PROPERTY_DISAPPEAR_ON_MOVEMENT )
+ {
+ value.Get( mDisappearOnMovement );
+ }
+ }
+ }
+ else
+ {
+ Property::Type type = value.GetType();
+ if( ( value.GetType() == Property::STRING ) || ( type == Property::ARRAY ) )
+ {
+ SetContent( control, value );
+ }
+ }
+ }
+}
+
+void Tooltip::CreatePropertyMap( Property::Map& map ) const
+{
+ if( ! mContentTextVisual.Empty() )
+ {
+ Property::Map content = mContentTextVisual; // Need this copy as there's no Value constructor which takes in a 'const Property::Map&'.
+ map.Insert( Toolkit::Tooltip::Property::CONTENT, content );
+ }
+ else if( ! mContentArray.Empty() )
+ {
+ Property::Array content = mContentArray; // Need this copy as there's no Value constructor which takes in a 'const Property::Array&'.
+ map.Insert( Toolkit::Tooltip::Property::CONTENT, content );
+ }
+
+ map.Insert( Toolkit::Tooltip::Property::LAYOUT, mLayout );
+ map.Insert( Toolkit::Tooltip::Property::WAIT_TIME, static_cast<float>( mWaitTime ) / MILLISECONDS_PER_SECOND );
+ map.Insert( Toolkit::Tooltip::Property::BACKGROUND,
+ Property::Map().Add( Toolkit::Tooltip::Background::Property::VISUAL, mBackgroundImage )
+ .Add( Toolkit::Tooltip::Background::Property::BORDER, mBackgroundBorder ) );
+ map.Insert( Toolkit::Tooltip::Property::TAIL,
+ Property::Map().Add( Toolkit::Tooltip::Tail::Property::VISIBILITY, mTailVisibility )
+ .Add( Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL, mTailImages[ Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL ])
+ .Add( Toolkit::Tooltip::Tail::Property::BELOW_VISUAL, mTailImages[ Toolkit::Tooltip::Tail::Property::BELOW_VISUAL ]) );
+ map.Insert( Toolkit::Tooltip::Property::POSITION, mPositionType );
+ map.Insert( Toolkit::Tooltip::Property::HOVER_POINT_OFFSET, mHoverPointOffset );
+ map.Insert( Toolkit::Tooltip::Property::MOVEMENT_THRESHOLD, mMovementThreshold );
+ map.Insert( Toolkit::Tooltip::Property::DISAPPEAR_ON_MOVEMENT, mDisappearOnMovement );
+}
+
+Tooltip::Tooltip( Toolkit::Control control )
+: mPopup(),
+ mTooltipTimer(),
+ mControl( control ),
+ mContentTextVisual(),
+ mTailImages(),
+ mContentArray(),
+ mBackgroundBorder( 0, 0, 0, 0 ),
+ mLayout( 1, 1 ),
+ mHoverPoint(),
+ mHoverPointOffset( 10.0f, 10.0f ),
+ mBackgroundImage(),
+ mMovementThreshold( 5.0f ),
+ mWaitTime( 500 ),
+ mPositionType( Toolkit::Tooltip::Position::ABOVE ),
+ mTailVisibility( false ),
+ mDisappearOnMovement( false ),
+ mSignalsConnected( false )
+{
+ mTailImages[ Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL ] = "";
+ mTailImages[ Toolkit::Tooltip::Tail::Property::BELOW_VISUAL ] = "";
+}
+
+Tooltip::~Tooltip()
+{
+ if( mPopup )
+ {
+ mPopup.Unparent();
+ mPopup.Reset();
+ }
+}
+
+void Tooltip::SetContent( Toolkit::Control& control, const Property::Value& value )
+{
+ // Delete popup & timer
+
+ if( mTooltipTimer )
+ {
+ mTooltipTimer.Stop();
+ mTooltipTimer.Reset();
+ }
+
+ if( mPopup )
+ {
+ mPopup.Unparent();
+ mPopup.Reset();
+ }
+
+ bool connectSignals = false;
+
+ Property::Type type = value.GetType();
+ if( type == Property::MAP )
+ {
+ Property::Map* map = value.GetMap();
+ if( map )
+ {
+ mContentTextVisual.Merge( *map );
+
+ Property::Value* typeValue = map->Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
+ if( typeValue )
+ {
+ // Set to an invalid value so it definitely changes if set in Scripting::GetEnumerationProperty
+ Toolkit::DevelVisual::Type visualType = static_cast< Toolkit::DevelVisual::Type >( -1 );
+
+ if( Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType ) )
+ {
+ if( visualType == Toolkit::DevelVisual::TEXT )
+ {
+ // Visual Type is text, ensure we have a the TEXT property set before we connect to the signals.
+
+ if( map->Find( Toolkit::TextVisual::Property::TEXT, TEXT_PROPERTY ) )
+ {
+ mContentArray.Clear();
+ connectSignals = true;
+ }
+ }
+ else
+ {
+ // Visual Type is not text, so connect to the signals as we're displaying a non text visual.
+
+ mContentArray.Clear();
+ connectSignals = true;
+ }
+ }
+ }
+ }
+ }
+ else if( type == Property::ARRAY )
+ {
+ if( value.Get( mContentArray ) )
+ {
+ mContentTextVisual.Clear();
+ connectSignals = true;
+ }
+ }
+ else if( type == Property::STRING )
+ {
+ std::string text;
+ if( value.Get( text ) )
+ {
+ mContentTextVisual[ Toolkit::TextVisual::Property::TEXT ] = text;
+ mContentTextVisual[ Toolkit::Visual::Property::TYPE ] = DevelVisual::TEXT;
+ mContentArray.Clear();
+ connectSignals = true;
+ }
+ }
+
+ if( connectSignals && ! mSignalsConnected )
+ {
+ control.HoveredSignal().Connect( this, &Tooltip::OnHovered );
+ control.SetLeaveRequired( true );
+ mSignalsConnected = true;
+ }
+}
+
+void Tooltip::SetBackground( const Property::Value& value )
+{
+ Property::Type type = value.GetType();
+
+ if( type == Property::STRING )
+ {
+ value.Get( mBackgroundImage );
+ mBackgroundBorder.Set( 0, 0, 0, 0 );
+ }
+ else if( type == Property::MAP )
+ {
+ Property::Map* map = value.GetMap();
+ if( map )
+ {
+ const Property::Map::SizeType count = map->Count();
+ for( Property::Map::SizeType position = 0; position < count; ++position )
+ {
+ KeyValuePair keyValue = map->GetKeyValue( position );
+ Property::Key& key = keyValue.first;
+ Property::Value& value = keyValue.second;
+
+ if( key == Toolkit::Tooltip::Background::Property::VISUAL || key == PROPERTY_BACKGROUND_VISUAL )
+ {
+ value.Get( mBackgroundImage );
+ }
+ else if( key == Toolkit::Tooltip::Background::Property::BORDER || key == PROPERTY_BACKGROUND_BORDER )
+ {
+ if( ! value.Get( mBackgroundBorder ) )
+ {
+ // If not a Property::RECTANGLE, then check if it's a Vector4 and set it accordingly
+ Vector4 valueVector4;
+ if( value.Get( valueVector4 ) )
+ {
+ mBackgroundBorder.left = valueVector4.x;
+ mBackgroundBorder.right = valueVector4.y;
+ mBackgroundBorder.bottom = valueVector4.z;
+ mBackgroundBorder.top = valueVector4.w;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void Tooltip::SetTail( const Property::Value& value )
+{
+ Property::Type type = value.GetType();
+
+ if( type == Property::BOOLEAN )
+ {
+ value.Get( mTailVisibility );
+ }
+ else if( type == Property::MAP )
+ {
+ Property::Map map;
+ if( value.Get( map ) )
+ {
+ const Property::Map::SizeType count = map.Count();
+ for( Property::Map::SizeType position = 0; position < count; ++position )
+ {
+ KeyValuePair keyValue = map.GetKeyValue( position );
+ Property::Key& key = keyValue.first;
+ Property::Value& value = keyValue.second;
+
+ // Set the values manually rather than merging so that we only have to deal with Property indices when creating the actual tooltip.
+
+ if( key == Toolkit::Tooltip::Tail::Property::VISIBILITY || key == PROPERTY_TAIL_VISIBILITY )
+ {
+ value.Get( mTailVisibility );
+ }
+ else if( key == Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL || key == PROPERTY_TAIL_ABOVE_VISUAL )
+ {
+ std::string path;
+ if( value.Get( path ) )
+ {
+ mTailImages[ Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL ] = path;
+ }
+ }
+ else if( key == Toolkit::Tooltip::Tail::Property::BELOW_VISUAL || key == PROPERTY_TAIL_BELOW_VISUAL )
+ {
+ std::string path;
+ if( value.Get( path ) )
+ {
+ mTailImages[ Toolkit::Tooltip::Tail::Property::BELOW_VISUAL ] = path;
+ }
+ }
+ }
+ }
+ }
+}
+
+bool Tooltip::OnHovered( Actor /* actor */, const HoverEvent& hover )
+{
+ const TouchPoint::State state = hover.points[0].state;
+ switch( state )
+ {
+ case TouchPoint::Started:
+ case TouchPoint::Motion:
+ {
+ if( ! mPopup )
+ {
+ if( ! mTooltipTimer )
+ {
+ mHoverPoint = hover.points[ 0 ].screen;
+ mTooltipTimer = Timer::New( mWaitTime );
+ mTooltipTimer.TickSignal().Connect( this, &Tooltip::OnTimeout );
+ mTooltipTimer.Start();
+ }
+ else
+ {
+ Vector2 movement = mHoverPoint - hover.points[ 0 ].screen;
+ if( std::abs( movement.Length() ) > mMovementThreshold )
+ {
+ mTooltipTimer.Stop();
+ mTooltipTimer.Reset();
+
+ mHoverPoint = hover.points[ 0 ].screen;
+ mTooltipTimer = Timer::New( mWaitTime );
+ mTooltipTimer.TickSignal().Connect( this, &Tooltip::OnTimeout );
+ mTooltipTimer.Start();
+ }
+ }
+ }
+ else if( mDisappearOnMovement )
+ {
+ // Popup is showing, and we're set to disappear on excessive movement so make sure we're still within the threshold.
+
+ Vector2 movement = mHoverPoint - hover.points[ 0 ].screen;
+ if( std::abs( movement.Length() ) > mMovementThreshold )
+ {
+ // Exceeding the threshold, hide the popup.
+
+ if( mTooltipTimer )
+ {
+ mTooltipTimer.Stop();
+ mTooltipTimer.Reset();
+ }
+ if( mPopup )
+ {
+ mPopup.Unparent();
+ mPopup.Reset();
+ }
+ }
+ }
+ break;
+ }
+ case TouchPoint::Finished:
+ case TouchPoint::Leave:
+ case TouchPoint::Interrupted:
+ {
+ if( mTooltipTimer )
+ {
+ mTooltipTimer.Stop();
+ mTooltipTimer.Reset();
+ }
+ if( mPopup )
+ {
+ mPopup.Unparent();
+ mPopup.Reset();
+ }
+ break;
+ }
+
+ case TouchPoint::Stationary:
+ case TouchPoint::Last:
+ {
+ break;
+ }
+ }
+
+ return true;
+}
+
+bool Tooltip::OnTimeout()
+{
+ Toolkit::Control control = mControl.GetHandle();
+ if( ! mPopup && control )
+ {
+ mPopup = Toolkit::Popup::New();
+
+ // General set up of popup
+ mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+ mPopup.SetProperty( Toolkit::Popup::Property::CONTEXTUAL_MODE, "NON_CONTEXTUAL" );
+ mPopup.SetProperty( Toolkit::Popup::Property::ANIMATION_MODE, "NONE" );
+ mPopup.SetProperty( Toolkit::Popup::Property::BACKING_ENABLED, false ); // Disable the dimmed backing.
+ mPopup.SetProperty( Toolkit::Popup::Property::TOUCH_TRANSPARENT, true ); // Let events pass through the popup
+ mPopup.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mPopup.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Background
+ mPopup.SetProperty( Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE, mBackgroundImage );
+ mPopup.SetProperty( Toolkit::Popup::Property::POPUP_BACKGROUND_BORDER, mBackgroundBorder );
+
+ // Tail
+ mPopup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, mTailVisibility );
+ mPopup.SetProperty( Toolkit::Popup::Property::TAIL_UP_IMAGE, mTailImages[ Toolkit::Tooltip::Tail::Property::ABOVE_VISUAL ] );
+ mPopup.SetProperty( Toolkit::Popup::Property::TAIL_DOWN_IMAGE, mTailImages[ Toolkit::Tooltip::Tail::Property::BELOW_VISUAL ] );
+
+ Vector3 tailPosition;
+ switch( mPositionType )
+ {
+ case Toolkit::Tooltip::Position::HOVER_POINT:
+ case Toolkit::Tooltip::Position::BELOW:
+ {
+ tailPosition = Vector3( 0.5f, 0.0f, 0.0 );
+ break;
+ }
+
+ case Toolkit::Tooltip::Position::ABOVE:
+ {
+ tailPosition = Vector3( 0.5f, 1.0f, 0.0 );
+ break;
+ }
+ }
+ mPopup.SetProperty( Toolkit::Popup::Property::TAIL_POSITION, tailPosition );
+
+ // Content
+ Actor content;
+ if( ! mContentTextVisual.Empty() )
+ {
+ content = Toolkit::Control::New();
+ content.SetProperty( Toolkit::Control::Property::BACKGROUND, mContentTextVisual );
+ }
+ else if( ! mContentArray.Empty() )
+ {
+ const unsigned int visuals = mContentArray.Size();
+ unsigned int rows = mLayout.x;
+ unsigned int columns = mLayout.y;
+ if( Equals( mLayout.x, 1.0f, Math::MACHINE_EPSILON_1 ) &&
+ Equals( mLayout.y, 1.0f, Math::MACHINE_EPSILON_1 ) &&
+ visuals > 1 )
+ {
+ rows = mLayout.x;
+ columns = visuals;
+ }
+
+ Toolkit::TableView tableView = Toolkit::TableView::New( rows, columns );
+ tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+
+ for( unsigned int currentContent = 0, currentRow = 0; currentRow < rows && currentContent < visuals; ++currentRow )
+ {
+ tableView.SetFitHeight( currentRow );
+ for( unsigned int currentColumn = 0; currentColumn < columns && currentContent < visuals; ++currentColumn )
+ {
+ Actor child = Toolkit::Control::New();
+ child.SetProperty( Toolkit::Control::Property::BACKGROUND, mContentArray[ currentContent ] );
+
+ Toolkit::TableView::CellPosition cellPosition( currentRow, currentColumn );
+ tableView.AddChild( child, cellPosition );
+ tableView.SetCellAlignment( cellPosition, HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
+ tableView.SetFitWidth( currentColumn );
+
+ ++currentContent;
+ }
+ }
+ content = tableView;
+ }
+ mPopup.SetContent( content );
+
+ // Connect to the relayout signal of the background of the popup as at that point we have the full size
+ Actor popupBackground = GetImpl( mPopup ).GetPopupBackgroundImage();
+ if( popupBackground )
+ {
+ popupBackground.OnRelayoutSignal().Connect( this, &Tooltip::OnRelayout );
+ }
+
+ mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
+
+ Stage::GetCurrent().Add( mPopup );
+ }
+
+ return false;
+}
+
+void Tooltip::OnRelayout( Actor actor )
+{
+ if( mPopup && actor )
+ {
+ float popupWidth = actor.GetRelayoutSize( Dimension::WIDTH );
+ float popupHeight = actor.GetRelayoutSize( Dimension::HEIGHT );
+ float tailHeight = 0.0f;
+ Actor tail;
+
+ if( mTailVisibility )
+ {
+ // Popup's background has the tail, we want to know the tail size as well.
+ if( actor.GetChildCount() )
+ {
+ tail = actor.GetChildAt( 0 );
+ if( tail )
+ {
+ tailHeight = tail.GetRelayoutSize( Dimension::HEIGHT );
+ }
+ }
+ }
+
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector3 position;
+
+ switch( mPositionType )
+ {
+ case Toolkit::Tooltip::Position::HOVER_POINT:
+ {
+ position = mHoverPoint + mHoverPointOffset;
+ position.y += tailHeight;
+ break;
+ }
+
+ case Toolkit::Tooltip::Position::ABOVE:
+ {
+ Toolkit::Control control = mControl.GetHandle();
+ if( control )
+ {
+ Vector3 worldPos = control.GetCurrentWorldPosition();
+ float height = control.GetRelayoutSize( Dimension::HEIGHT );
+
+ position.x = stageSize.width * 0.5f + worldPos.x - popupWidth * 0.5f;
+ position.y = stageSize.height * 0.5f + worldPos.y - height * 0.5f - popupHeight * 1.0f - tailHeight;
+ }
+ break;
+ }
+
+ case Toolkit::Tooltip::Position::BELOW:
+ {
+ Toolkit::Control control = mControl.GetHandle();
+ if( control )
+ {
+ Vector3 worldPos = control.GetCurrentWorldPosition();
+ float height = control.GetRelayoutSize( Dimension::HEIGHT );
+
+ position.x = stageSize.width * 0.5f + worldPos.x - popupWidth * 0.5f;
+ position.y = stageSize.height * 0.5f + worldPos.y + height * 0.5f + tailHeight;
+ }
+ break;
+ }
+ }
+
+ // Ensure the Popup is still on the screen
+
+ if( position.x < 0.0f )
+ {
+ position.x = 0.0f;
+ }
+ else if( ( position.x + popupWidth ) > stageSize.width )
+ {
+ position.x -= position.x + popupWidth - stageSize.width;
+ }
+
+ bool yPosChanged = false;
+ if( position.y < 0.0f )
+ {
+ yPosChanged = true;
+ position.y = 0.0f;
+ }
+ else if( ( position.y + popupHeight ) > stageSize.height )
+ {
+ yPosChanged = true;
+ position.y -= position.y + popupHeight - stageSize.height;
+ }
+
+ if( yPosChanged && tail )
+ {
+ // If we change the y position, then the tail may be shown pointing to the wrong control so just hide it.
+ tail.SetVisible( false );
+ }
+
+ mPopup.SetPosition( position );
+ }
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_TOOLTIP_H
+#define DALI_INTERNAL_TOOLTIP_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/signals/connection-tracker.h>
+#include <dali/devel-api/object/weak-handle.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+class Tooltip;
+typedef IntrusivePtr< Tooltip > TooltipPtr;
+
+/**
+ * @brief Handles all the required tooltip related functionality for a control.
+ *
+ * Connects to the Hovered signal of the control.
+ * Styling is achieved by merging the properties set so that new properties override previous but existing properties are still kept.
+ */
+class Tooltip : public RefObject, public ConnectionTracker
+{
+public:
+
+ /**
+ * @brief Creates an instance of the Tooltip class.
+ * @param[in] control The control the tooltip should be shown on.
+ */
+ static TooltipPtr New( Toolkit::Control control );
+
+ /**
+ * @brief Sets the properties of the Tooltip.
+ * @details The properties are merged over the currently stored properties.
+ * If a Property::STRING is passed, then the style set previously by the stylesheet is used.
+ * If a Property::MAP then the map is merged.
+ * If a Property::ARRAY of Visuals then all are displayed in one row.
+ * @param[in] value This can either be a Property::STRING, Property::MAP or Property::ARRAY.
+ */
+ void SetProperties( const Property::Value& value );
+
+ /**
+ * @brief Creates a property map of the tooltip properties.
+ * @param[out] map Filled with all the properties of the tooltip.
+ * @note map should be empty.
+ */
+ void CreatePropertyMap( Property::Map& map ) const;
+
+private:
+
+ /**
+ * @brief Private constructor.
+ */
+ Tooltip( Toolkit::Control control );
+
+ /**
+ * @brief Private destructor.
+ */
+ ~Tooltip();
+
+ Tooltip( const Tooltip& ); ///< Undefined
+ Tooltip& operator=( const Tooltip& ); ///< ///< Undefined
+
+ /**
+ * @brief Sets the content of the tooltip.
+ * @details Connects to the signals if there is real content to display.
+ * @param[in] control Is used to connect to this control's signals.
+ * @param[in] value The content property value.
+ */
+ void SetContent( Toolkit::Control& control, const Property::Value& value );
+
+ /**
+ * @brief Sets the background properties of the tooltip.
+ * @param[in] value The background property value.
+ */
+ void SetBackground( const Property::Value& value );
+
+ /**
+ * @brief Sets the tail properties of the tooltip.
+ * @param[in] value The tail property value.
+ */
+ void SetTail( const Property::Value& value );
+
+ /**
+ * @brief Method used to connect to the control's Hovered signal.
+ * @param[in] hover The hover event.
+ */
+ bool OnHovered( Actor /* actor */, const HoverEvent& hover );
+
+ /**
+ * @brief Method used to connect to the internal timer used by Tooltip.
+ * @return Always return false as we're only interested in one timeout.
+ */
+ bool OnTimeout();
+
+ /**
+ * @brief Used to know when the we're laying out the actor used to display the tooltip.
+ * @details This is required so we can appropriately position it.
+ * @param[in] actor The actor being laid out.
+ */
+ void OnRelayout( Actor actor );
+
+ // Data
+
+ Toolkit::Popup mPopup; ///< The Popup class is used to display the actual tooltip.
+ Timer mTooltipTimer; ///< Timer used to wait a certain length of time before we display the tooltip.
+
+ WeakHandle< Toolkit::Control > mControl; ///< A weak handle to the control we are setting the tooltip on.
+
+ Property::Map mContentTextVisual; ///< If using just one visual, then this is set.
+ Property::Map mTailImages; ///< The different images used by the tail.
+ Property::Array mContentArray; ///< If using an array of visuals, then this is used.
+
+ Rect< int > mBackgroundBorder; ///< The size of the background border in the order: left, right, bottom, top. @see Toolkit::Tooltip::Border::Property::BORDER
+
+ Vector2 mLayout; ///< The layout of the content if using an array.
+ Vector2 mHoverPoint; ///< The first point where hover starts.
+ Vector2 mHoverPointOffset; ///< The tooltip is displayed with this offset from hover point if using Toolkit::Tooltip::Position::HOVER_POINT.
+
+ std::string mBackgroundImage; ///< The path to the background image used for the tooltip.
+
+ float mMovementThreshold; ///< This is the allowable movement of the hover before the tooltip processing is cancelled.
+
+ int mWaitTime; ///< Time in milliseconds to wait before we display the tooltip.
+
+ Toolkit::Tooltip::Position::Type mPositionType; ///< The position of the tooltip.
+ bool mTailVisibility; ///< Whether we are showing a tail or not.
+ bool mDisappearOnMovement; ///< Whether the tooltip is set to disappear on movement or when we go out of the bounds of mControl.
+ bool mSignalsConnected; ///< Whether any signals required for Tooltip functionality have been connected.
+};
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TOOLTIP_H
$(toolkit_src_dir)/visuals/visual-factory-cache.cpp \
$(toolkit_src_dir)/visuals/visual-factory-impl.cpp \
$(toolkit_src_dir)/visuals/visual-string-constants.cpp \
+ $(toolkit_src_dir)/visuals/animated-image/animated-image-visual.cpp \
$(toolkit_src_dir)/visuals/border/border-visual.cpp \
$(toolkit_src_dir)/visuals/color/color-visual.cpp \
$(toolkit_src_dir)/visuals/gradient/gradient.cpp \
$(toolkit_src_dir)/controls/text-controls/text-selection-popup-impl.cpp \
$(toolkit_src_dir)/controls/text-controls/text-selection-toolbar-impl.cpp \
$(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \
+ $(toolkit_src_dir)/controls/tooltip/tooltip.cpp \
$(toolkit_src_dir)/controls/video-view/video-view-impl.cpp \
$(toolkit_src_dir)/accessibility-manager/accessibility-manager-impl.cpp \
\
}
KeyboardFocusManager::KeyboardFocusManager()
-: mCurrentFocusActor(0),
+: mPreFocusChangeSignal(),
+ mFocusChangedSignal(),
+ mFocusGroupChangedSignal(),
+ mFocusedActorEnterKeySignal(),
+ mCurrentFocusActor( 0 ),
mFocusIndicatorActor(),
- mFocusGroupLoopEnabled(false),
- mIsKeyboardFocusEnabled(false),
- mIsFocusIndicatorEnabled(false),
- mIsWaitingKeyboardFocusChangeCommit(false),
- mSlotDelegate(this)
+ mFocusGroupLoopEnabled( false ),
+ mIsKeyboardFocusEnabled( false ),
+ mIsFocusIndicatorEnabled( false ),
+ mIsWaitingKeyboardFocusChangeCommit( false ),
+ mFocusHistory(),
+ mSlotDelegate( this )
{
OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
FocusStack mFocusHistory; ///< Stack to contain pre-focused actor's BaseObject*
- FocusStackIterator mFocusHistoryIter; ///< Iterator for mFocusHistory
-
SlotDelegate< KeyboardFocusManager > mSlotDelegate;
};
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL HEADER
#include <stdlib.h> // For abs()
+#include <dali/integration-api/debug.h>
namespace Dali
{
return abs( a-b ) <= 1;
}
+uint16_t MaxDimension( const Uint16Pair& dimensions )
+{
+ return dimensions.GetWidth() >= dimensions.GetHeight() ? dimensions.GetWidth() : dimensions.GetHeight();
+}
+
+void Swap( Uint16Pair& first, Uint16Pair& second )
+{
+ Uint16Pair temp = first;
+ first = second;
+ second = temp;
+}
+
}
AtlasPacker::Node::Node( Node* parent, SizeType x, SizeType y, SizeType width, SizeType height )
}
}
+Uint16Pair AtlasPacker::GroupPack( const Dali::Vector<Uint16Pair>& blockSizes, Dali::Vector<Uint16Pair>& packPositions )
+{
+ uint16_t count = blockSizes.Count();
+ packPositions.Resize( count );
+
+ // Sort the blocks according to its maximum dimension. The bigger blocks are packed first.
+ Dali::Vector<Uint16Pair> packOrder;
+ packOrder.Resize( count );
+ for( uint16_t i = 0; i < count; i++ )
+ {
+ packOrder[i].SetX( MaxDimension( blockSizes[i] ) );
+ packOrder[i].SetY( i );
+ }
+ for( uint16_t i = 0; i < count-1; i++ )
+ for( uint16_t j = 0; j < count-i-1; j++ )
+ {
+ if( packOrder[j].GetX() < packOrder[j+1].GetX() )
+ {
+ Swap( packOrder[j], packOrder[j+1] );
+ }
+ }
+
+ int index = packOrder[0].GetY();
+ AtlasPacker packer( blockSizes[index].GetWidth(), blockSizes[index].GetHeight() );
+
+ SizeType packPositionX, packPositionY;
+ // pack the blocks one by one with descending size, grows as necessary to accommodate each subsequent block.
+ for( uint16_t i = 0; i < count; i++ )
+ {
+ index = packOrder[i].GetY();
+ packer.GrowPack( blockSizes[index].GetWidth(), blockSizes[index].GetHeight(),
+ packPositionX, packPositionY );
+ packPositions[index].SetX( packPositionX );
+ packPositions[index].SetY( packPositionY );
+ }
+
+ return Uint16Pair( packer.mRoot->rectArea.width, packer.mRoot->rectArea.height );
+}
+
+void AtlasPacker::GrowPack( SizeType blockWidth, SizeType blockHeight,
+ SizeType& packPositionX, SizeType& packPositionY )
+{
+ Node* firstFit = InsertNode( mRoot, blockWidth, blockHeight );
+ if( firstFit == NULL )
+ {
+ // Could fit in the current left space, grow the partition tree to get more space.
+ GrowNode( blockWidth, blockHeight );
+ firstFit = InsertNode( mRoot->child[1], blockWidth, blockHeight );
+ }
+
+ if( firstFit != NULL )
+ {
+ firstFit->occupied = true;
+ packPositionX = firstFit->rectArea.x;
+ packPositionY = firstFit->rectArea.y;
+ }
+}
+
+void AtlasPacker::GrowNode( SizeType blockWidth, SizeType blockHeight )
+{
+ // Attempts to maintain a roughly square ratio when choosing the growing direction: right or down
+ bool canGrowRight = blockWidth <= mRoot->rectArea.width;
+ bool canGrowDown = blockHeight <= mRoot->rectArea.height;
+
+ bool shouldGrowRight = canGrowRight && mRoot->rectArea.height >= mRoot->rectArea.width+blockWidth;
+ bool shouldGrowDown = canGrowDown && mRoot->rectArea.width >= mRoot->rectArea.height+blockHeight;
+
+ if( canGrowRight && canGrowDown )
+ {
+ shouldGrowRight = mRoot->rectArea.width+blockWidth <= mRoot->rectArea.height+blockHeight;
+ shouldGrowDown = !shouldGrowRight;
+ }
+
+ if( shouldGrowRight || ( canGrowRight && !shouldGrowDown ) )
+ {
+ Node* newRoot = new Node( NULL, 0u, 0u, mRoot->rectArea.width+blockWidth, mRoot->rectArea.height );
+ newRoot->occupied = true;
+ newRoot->child[0] = mRoot;
+ newRoot->child[1] = new Node( newRoot, mRoot->rectArea.width, 0u, blockWidth, mRoot->rectArea.height );
+
+ mRoot = newRoot;
+ }
+ else if( shouldGrowDown || ( canGrowDown && !shouldGrowRight ) )
+ {
+ Node* newRoot = new Node( NULL, 0u, 0u, mRoot->rectArea.width, mRoot->rectArea.height+blockHeight );
+ newRoot->occupied = true;
+ newRoot->child[0] = mRoot;
+ newRoot->child[1] = new Node( newRoot, 0u, mRoot->rectArea.height, mRoot->rectArea.width, blockHeight );
+
+ mRoot = newRoot;
+ }
+ else
+ {
+ DALI_LOG_ERROR( " Atlas Packer failed to grow: make sure the packing order is sorted with the block size to avoid this happening");
+ }
+}
+
} // namespace Internal
} // namespace Toolkit
*/
#include <stdint.h>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/uint-16-pair.h>
namespace Dali
{
*/
unsigned int GetAvailableArea() const;
+ /**
+ * Pack a group of blocks with different sizes, calculate the required packing size and the position of each block.
+ * @param[in] blockSizes The size list of the blocks .
+ * @param[out] packPositions The packing position of each block.
+ * @return The required size to accommodate all the blocks.
+ */
+ static Uint16Pair GroupPack( const Dali::Vector<Uint16Pair>& blockSizes, Dali::Vector<Uint16Pair>& packPositions );
+
private:
/*
*/
void DeleteNode( Node* node );
+ /**
+ * Pack a block into the atlas. If there is no enough room, grow the partition tree.
+ *
+ * @param[in] blockWidth The width of the block to pack.
+ * @param[in] blockHeight The height of the block to pack.
+ * @param[out] packPositionX The x coordinate of the position to pack the block.
+ * @param[out] packPositionY The y coordinate of the position to pack the block.
+ */
+ void GrowPack( SizeType blockWidth, SizeType blockHeight,
+ SizeType& packPositionX, SizeType& packPositionY );
+
+ /**
+ * Add extra node into the partition tree to accommodate the given block.
+ *
+ * @param[in] blockWidth The width of the block to pack.
+ * @param[in] blockHeight The height of the block to pack.
+ */
+ void GrowNode( SizeType blockWidth, SizeType blockHeight );
+
// Undefined
- AtlasPacker( const AtlasPacker& imageAtlas);
+ AtlasPacker( const AtlasPacker& atlasPacker);
// Undefined
- AtlasPacker& operator=( const AtlasPacker& imageAtlas );
+ AtlasPacker& operator=( const AtlasPacker& atlasPacker );
private:
namespace Internal
{
+Texture ImageAtlas::PackToAtlas( const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects )
+{
+ // Record each block size
+ Dali::Vector<Uint16Pair> blockSizes;
+ SizeType count = pixelData.size();
+ for( SizeType index = 0; index < count; index++ )
+ {
+ blockSizes.PushBack( ImageDimensions( pixelData[index].GetWidth(), pixelData[index].GetHeight() ) );
+ }
+
+ // Ask atlasPacker for packing position of each block
+ Dali::Vector<Uint16Pair> packPositions;
+ ImageDimensions atlasSize = AtlasPacker::GroupPack( blockSizes, packPositions );
+
+ // Prepare for outout texture rect array
+ textureRects.Clear();
+ textureRects.Resize( count );
+
+ // create the texture for uploading the multiple pixel data
+ Texture atlasTexture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, atlasSize.GetWidth(), atlasSize.GetHeight() );
+
+ float atlasWidth = static_cast<float>( atlasTexture.GetWidth() );
+ float atlasHeight = static_cast<float>( atlasTexture.GetHeight() );
+ int packPositionX, packPositionY;
+ // Upload the pixel data one by one to its packing position, and record the texture rects
+ for( SizeType index = 0; index < count; index++ )
+ {
+ packPositionX = packPositions[index].GetX();
+ packPositionY = packPositions[index].GetY();
+ atlasTexture.Upload( pixelData[index], 0u, 0u,
+ packPositionX, packPositionY,
+ pixelData[index].GetWidth(), pixelData[index].GetHeight() );
+
+ // Apply the half pixel correction to avoid the color bleeding between neighbour blocks
+ textureRects[index].x = ( static_cast<float>( packPositionX ) +0.5f ) / atlasWidth; // left
+ textureRects[index].y = ( static_cast<float>( packPositionY ) +0.5f ) / atlasHeight; // right
+ textureRects[index].z = ( static_cast<float>( packPositionX + pixelData[index].GetWidth() )-0.5f ) / atlasWidth; // right
+ textureRects[index].w = ( static_cast<float>( packPositionY + pixelData[index].GetHeight() )-0.5f ) / atlasHeight;// bottom
+ }
+
+ return atlasTexture;
+}
+
ImageAtlas::ImageAtlas( SizeType width, SizeType height, Pixel::Format pixelFormat )
: mAtlas( Texture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height ) ),
mPacker( width, height ),
typedef Toolkit::ImageAtlas::SizeType SizeType;
/**
+ * @copydoc ImageAtlas::PackToAtlas( const std::vector<PixelData>&, Dali::Vector<Vector4>& )
+ */
+ static Texture PackToAtlas( const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects );
+
+ /**
* Constructor
* @param [in] width The atlas width in pixels.
* @param [in] height The atlas height in pixels.
CharacterIndex startIndex,
Length numberOfCharacters,
HorizontalAlignment horizontalAlignment,
- Vector<LineRun>& lines )
+ Vector<LineRun>& lines,
+ float& alignmentOffset )
{
const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
+ alignmentOffset = MAX_FLOAT;
// Traverse all lines and align the glyphs.
for( Vector<LineRun>::Iterator it = lines.Begin(), endIt = lines.End();
it != endIt;
CalculateHorizontalAlignment( size.width,
horizontalAlignment,
line );
+
+ // Updates the alignment offset.
+ alignmentOffset = std::min( alignmentOffset, line.alignmentOffset );
}
}
CharacterIndex startIndex,
Length numberOfCharacters,
Layout::HorizontalAlignment horizontalAlignment,
- Vector<LineRun>& lines )
+ Vector<LineRun>& lines,
+ float& alignmentOffset )
{
mImpl->Align( size,
startIndex,
numberOfCharacters,
horizontalAlignment,
- lines );
+ lines,
+ alignmentOffset );
}
void Engine::SetDefaultLineSpacing( float lineSpacing )
* @param[in] numberOfCharacters The number of characters.
* @param[in] horizontalAlignment The horizontal alignment.
* @param[in,out] lines The laid-out lines.
+ * @param[out] alignmentOffset The alignment offset.
*/
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
Layout::HorizontalAlignment horizontalAlignment,
- Vector<LineRun>& lines );
+ Vector<LineRun>& lines,
+ float& alignmentOffset );
/**
* @brief Sets the default line spacing.
const Vector4& defaultColor,
const Vector4* const colorsBuffer,
const ColorIndex* const colorIndicesBuffer,
- int depth )
+ int depth,
+ float minLineOffset )
{
AtlasManager::AtlasSlot slot;
std::vector< MeshRecord > meshContainer;
Vector< TextCacheEntry > newTextCache;
const GlyphInfo* const glyphsBuffer = glyphs.Begin();
const Vector2* const positionsBuffer = positions.Begin();
+ const Vector2 lineOffsetPosition( minLineOffset, 0.f );
for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
{
const GlyphInfo& glyph = *( glyphsBuffer + i );
-
const bool underlineGlyph = underlineEnabled || IsGlyphUnderlined( i, underlineRuns );
thereAreUnderlinedGlyphs = thereAreUnderlinedGlyphs || underlineGlyph;
}
// Move the origin (0,0) of the mesh to the center of the actor
- const Vector2 position = *( positionsBuffer + i ) - halfTextSize;
+ const Vector2 position = *( positionsBuffer + i ) - halfTextSize - lineOffsetPosition;
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
return Text::RendererPtr( new AtlasRenderer() );
}
-Actor AtlasRenderer::Render( Text::ViewInterface& view, int depth )
+Actor AtlasRenderer::Render( Text::ViewInterface& view,
+ float& alignmentOffset,
+ int depth )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "Text::AtlasRenderer::Render()\n" );
numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
positions.Begin(),
+ alignmentOffset,
0u,
numberOfGlyphs );
defaultColor,
colorsBuffer,
colorIndicesBuffer,
- depth );
+ depth,
+ alignmentOffset );
/* In the case where AddGlyphs does not create a renderable Actor for example when glyphs are all whitespace create a new Actor. */
/* This renderable actor is used to position the text, other "decorations" can rely on there always being an Actor regardless of it is whitespace or regular text. */
static RendererPtr New();
/**
- * @brief Render the glyphs from a ViewInterface.
- *
- * @param[in] view The interface to a view.
- * @param[in] depth The depth in the tree of the parent.
- * @return The Renderable actor used to position the text.
+ * @copydoc Renderer::Render()
*/
- virtual Actor Render( ViewInterface& view, int depth );
+ virtual Actor Render( ViewInterface& view,
+ float& alignmentOffset,
+ int depth );
protected:
* @brief Render the glyphs from a ViewInterface.
*
* @param[in] view The interface to a view.
+ * @param[out] alignmentOffset Offset used to internally align the placement actor.
* @param[in] depth The depth in the tree of the parent.
* @return The Renderable actor used to position the text.
*/
- virtual Actor Render( ViewInterface& view, int depth ) = 0;
+ virtual Actor Render( ViewInterface& view,
+ float& alignmentOffset,
+ int depth ) = 0;
protected:
return Text::RendererPtr( new VectorBasedRenderer() );
}
-Actor VectorBasedRenderer::Render( Text::ViewInterface& view, int /*depth*/ )
+Actor VectorBasedRenderer::Render( Text::ViewInterface& view,
+ float& alignmentOffset,
+ int /*depth*/ )
{
UnparentAndReset( mImpl->mActor );
numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
positions.Begin(),
+ alignmentOffset,
0u,
numberOfGlyphs );
+
glyphs.Resize( numberOfGlyphs );
positions.Resize( numberOfGlyphs );
Vector< unsigned short > indices;
const Vector2& controlSize = view.GetControlSize();
- float xOffset = controlSize.width * -0.5f;
+ float xOffset = -alignmentOffset + controlSize.width * -0.5f;
float yOffset = controlSize.height * -0.5f;
if( ! mImpl->mAtlas ||
static RendererPtr New();
/**
- * @brief Render the glyphs from a ViewInterface.
- *
- * @param[in] view The interface to a view.
- * @param[in] depth The depth in the tree of the parent.
- * @return The Renderable actor used to position the text.
+ * @copydoc Renderer::Render()
*/
- virtual Actor Render( ViewInterface& view, int depth );
+ virtual Actor Render( ViewInterface& view,
+ float& alignmentOffset,
+ int depth );
protected:
void Controller::Impl::ClampHorizontalScroll( const Vector2& layoutSize )
{
- // Clamp between -space & 0.
+ // Clamp between -space & -alignment offset.
if( layoutSize.width > mModel->mVisualModel->mControlSize.width )
{
- const float space = ( layoutSize.width - mModel->mVisualModel->mControlSize.width );
+ const float space = ( layoutSize.width - mModel->mVisualModel->mControlSize.width ) + mModel->mAlignmentOffset;
mModel->mScrollPosition.x = ( mModel->mScrollPosition.x < -space ) ? -space : mModel->mScrollPosition.x;
- mModel->mScrollPosition.x = ( mModel->mScrollPosition.x > 0.f ) ? 0.f : mModel->mScrollPosition.x;
+ mModel->mScrollPosition.x = ( mModel->mScrollPosition.x > -mModel->mAlignmentOffset ) ? -mModel->mAlignmentOffset : mModel->mScrollPosition.x;
mEventData->mDecoratorUpdated = true;
}
// The laid-out lines.
Vector<LineRun>& lines = mImpl->mModel->mVisualModel->mLines;
+ // Need to align with the control's size as the text may contain lines
+ // starting either with left to right text or right to left.
mImpl->mLayoutEngine.Align( size,
startIndex,
requestedNumberOfCharacters,
mImpl->mModel->mHorizontalAlignment,
- lines );
+ lines,
+ mImpl->mModel->mAlignmentOffset );
viewUpdated = true;
}
mScrollPosition(),
mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
+ mAlignmentOffset( 0.0f ),
mElideEnabled( false )
{
mLogicalModel = LogicalModel::New();
Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
Layout::HorizontalAlignment mHorizontalAlignment; ///< The layout's horizontal alignment.
Layout::VerticalAlignment mVerticalAlignment; ///< The layout's vertical alignment.
+ float mAlignmentOffset; ///< The alignment offset.
bool mElideEnabled:1; ///< Whether the text's elide is enabled.
};
*
* @param[out] glyphs Pointer to a buffer where the glyphs are copied.
* @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
+ * @param[out] minLineOffset The minimum line offset.
* @param[in] glyphIndex Index to the first glyph.
* @param[in] numberOfGlyphs Number of glyphs to be copied.
*
*/
virtual Length GetGlyphs( GlyphInfo* glyphs,
Vector2* glyphPositions,
+ float& minLineOffset,
GlyphIndex glyphIndex,
Length numberOfGlyphs ) const = 0;
Length View::GetGlyphs( GlyphInfo* glyphs,
Vector2* glyphPositions,
+ float& minLineOffset,
GlyphIndex glyphIndex,
Length numberOfGlyphs ) const
{
// Add the alignment offset to the glyph's position.
+ minLineOffset = line->alignmentOffset;
float penY = line->ascender;
for( Length index = 0u; index < numberOfLaidOutGlyphs; ++index )
{
if( lineIndex < numberOfLines )
{
line = lineBuffer + lineIndex;
+ minLineOffset = std::min( minLineOffset, line->alignmentOffset );
lastGlyphIndexOfLine = line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs - 1u;
*/
virtual Length GetGlyphs( GlyphInfo* glyphs,
Vector2* glyphPositions,
+ float& minLineOffset,
GlyphIndex glyphIndex,
Length numberOfGlyphs ) const;
--- /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.
+ *
+ */
+
+// CLASS HEADER
+#include "animated-image-visual.h"
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/gif-loading.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
+#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
+#include <dali-toolkit/internal/visuals/image/image-visual.h>
+#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+ AnimatedImageVisual* visual = new AnimatedImageVisual( factoryCache );
+ visual->mImageUrl = imageUrl;
+ visual->SetProperties( properties );
+
+ return visual;
+}
+
+AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
+{
+ AnimatedImageVisual* visual = new AnimatedImageVisual( factoryCache );
+ visual->mImageUrl = imageUrl;
+
+ return visual;
+}
+
+AnimatedImageVisual::AnimatedImageVisual( VisualFactoryCache& factoryCache )
+: Visual::Base( factoryCache ),
+ mFrameDelayTimer(),
+ mImageUrl(),
+ mImageSize(),
+ mCurrentFrameIndex( 0 )
+{}
+
+AnimatedImageVisual::~AnimatedImageVisual()
+{
+}
+
+void AnimatedImageVisual::GetNaturalSize( Vector2& naturalSize )
+{
+ if( mImageSize.GetWidth() == 0 && mImageSize.GetHeight() == 0)
+ {
+ mImageSize = Dali::GetGifImageSize( mImageUrl );
+ }
+
+ naturalSize.width = mImageSize.GetWidth();
+ naturalSize.height = mImageSize.GetHeight();
+}
+
+void AnimatedImageVisual::DoCreatePropertyMap( Property::Map& map ) const
+{
+ map.Clear();
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
+ if( !mImageUrl.empty() )
+ {
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
+ }
+}
+
+void AnimatedImageVisual::DoSetProperties( const Property::Map& propertyMap )
+{
+ // url already passed in from constructor
+}
+
+void AnimatedImageVisual::DoSetOnStage( Actor& actor )
+{
+ Texture texture = PrepareAnimatedImage();
+ if( texture ) // if the image loading is successful
+ {
+ Shader shader = ImageVisual::GetImageShader( mFactoryCache, true, true );
+ Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
+ TextureSet textureSet = TextureSet::New();
+ mImpl->mRenderer = Renderer::New( geometry, shader );
+ mImpl->mRenderer.SetTextures( textureSet );
+ textureSet.SetTexture( 0u, PrepareAnimatedImage() );
+ mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, mTextureRectContainer[0] );
+
+ // Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+
+ mCurrentFrameIndex = 0;
+ if( mFrameDelayContainer.Count() > 1 )
+ {
+ mFrameDelayTimer = Timer::New( mFrameDelayContainer[0] );
+ mFrameDelayTimer.TickSignal().Connect( this, &AnimatedImageVisual::DisplayNextFrame );
+ mFrameDelayTimer.Start();
+ }
+
+ actor.AddRenderer( mImpl->mRenderer );
+ }
+}
+
+void AnimatedImageVisual::DoSetOffStage( Actor& actor )
+{
+ if( !mImpl->mRenderer )
+ {
+ return;
+ }
+
+ if( mFrameDelayTimer )
+ {
+ mFrameDelayTimer.Stop();
+ mFrameDelayTimer.Reset();
+ }
+
+ mTextureRectContainer.Clear();
+ mFrameDelayContainer.Clear();
+
+ actor.RemoveRenderer( mImpl->mRenderer );
+ mImpl->mRenderer.Reset();
+}
+
+void AnimatedImageVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
+
+Texture AnimatedImageVisual::PrepareAnimatedImage()
+{
+ // load from image file
+ std::vector<Dali::PixelData> pixelDataList;
+ if( Dali::LoadAnimatedGifFromFile( mImageUrl.c_str() , pixelDataList, mFrameDelayContainer ) )
+ {
+ mImageSize.SetWidth( pixelDataList[0].GetWidth() );
+ mImageSize.SetHeight( pixelDataList[0].GetHeight() );
+
+ return Toolkit::ImageAtlas::PackToAtlas( pixelDataList, mTextureRectContainer );
+ }
+
+ return Texture();
+}
+
+bool AnimatedImageVisual::DisplayNextFrame()
+{
+ mCurrentFrameIndex = (mCurrentFrameIndex+1) % mFrameDelayContainer.Count();
+ mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, mTextureRectContainer[mCurrentFrameIndex] );
+ if( mFrameDelayTimer.GetInterval() != mFrameDelayContainer[mCurrentFrameIndex] )
+ {
+ mFrameDelayTimer.SetInterval( mFrameDelayContainer[mCurrentFrameIndex] );
+ }
+
+ return true;
+}
+
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H
+#define DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/adaptor-framework/timer.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+class AnimatedImageVisual;
+typedef IntrusivePtr< AnimatedImageVisual > AnimatedImageVisualPtr;
+
+/**
+ * The visual which renders an animated image
+ *
+ * The following property is essential
+ *
+ * | %Property Name | Type |
+ * |--------------------------|------------------|
+ * | url | STRING |
+ *
+ */
+
+class AnimatedImageVisual : public Visual::Base, public ConnectionTracker
+{
+
+public:
+
+ /**
+ * @brief Create the animated image Visual using the image URL.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] imageUrl The URL to svg resource to use
+ * @param[in] properties A Property::Map containing settings for this visual
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties );
+
+ /**
+ * @brief Create the animated image visual using the image URL.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] imageUrl The URL to animated image resource to use
+ */
+ static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
+
+public: // from Visual
+
+ /**
+ * @copydoc Visual::Base::GetNaturalSize
+ */
+ virtual void GetNaturalSize( Vector2& naturalSize );
+
+ /**
+ * @copydoc Visual::Base::CreatePropertyMap
+ */
+ virtual void DoCreatePropertyMap( Property::Map& map ) const;
+
+protected:
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ AnimatedImageVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~AnimatedImageVisual();
+
+ /**
+ * @copydoc Visual::Base::DoSetProperties
+ */
+ virtual void DoSetProperties( const Property::Map& propertyMap );
+
+ /**
+ * @copydoc Visual::Base::DoSetOnStage
+ */
+ virtual void DoSetOnStage( Actor& actor );
+
+ /**
+ * @copydoc Visual::Base::DoSetOffStage
+ */
+ virtual void DoSetOffStage( Actor& actor );
+
+ /**
+ * @copydoc Visual::Base::OnSetTransform
+ */
+ virtual void OnSetTransform();
+
+private:
+
+ /**
+ * Load the animated image and pack the frames into atlas.
+ * @return That atlas texture.
+ */
+ Texture PrepareAnimatedImage();
+
+ /**
+ * Display the next frame. It is called when the mFrameDelayTimes ticks.
+ */
+ bool DisplayNextFrame();
+
+ // Undefined
+ AnimatedImageVisual( const AnimatedImageVisual& animatedImageVisual );
+
+ // Undefined
+ AnimatedImageVisual& operator=( const AnimatedImageVisual& animatedImageVisual );
+
+private:
+
+ Timer mFrameDelayTimer;
+ Dali::Vector<Vector4> mTextureRectContainer;
+ Dali::Vector<uint32_t> mFrameDelayContainer;
+ std::string mImageUrl;
+ ImageDimensions mImageSize;
+ uint32_t mCurrentFrameIndex;
+};
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+#endif /* DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H */
void ColorVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
Shader shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER );
if( !shader )
void GradientVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits();
VisualFactoryCache::ShaderType shaderType = GetShaderType( mGradientType, gradientUnits );
if( gridSize == ImageDimensions( 1, 1 ) )
{
geometry = factoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- factoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
}
else
{
{
Shader shader = ImageVisual::GetImageShader( mFactoryCache, true, true );
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = mFactoryCache.CreateQuadGeometry();
- mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
TextureSet textureSet = TextureSet::New();
mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetTextures( textureSet );
namespace
{
-// Property names.
-const char * const TEXT_PROPERTY( "text" );
+// Property names - common properties defined in visual-string-constants.h/cpp
const char * const FONT_FAMILY_PROPERTY( "fontFamily" );
const char * const FONT_STYLE_PROPERTY( "fontStyle" );
const char * const POINT_SIZE_PROPERTY( "pointSize" );
mControl = actor;
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY , geometry );
- }
Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
mFactoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
Geometry VisualFactoryCache::GetGeometry( GeometryType type )
{
+ if( !mGeometry[type] && type == QUAD_GEOMETRY )
+ {
+ mGeometry[type] = CreateQuadGeometry();
+ }
+
return mGeometry[type];
}
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/primitive/primitive-visual.h>
#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
#include <dali-toolkit/internal/visuals/text/text-visual.h>
+#include <dali-toolkit/internal/visuals/animated-image/animated-image-visual.h>
#include <dali-toolkit/internal/visuals/wireframe/wireframe-visual.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-factory-resolve-url.h>
namespace
{
-DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_TYPE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BORDER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, COLOR )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, GRADIENT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::DevelVisual, TEXT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, WIREFRAME )
-DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE )
-
-const char * const VISUAL_TYPE( "visualType" );
const char * const BATCHING_ENABLED( "batchingEnabled" );
BaseHandle Create()
{
{
visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
+ else if( UrlType::GIF == type )
+ {
+ visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
+ }
else // Regular image
{
bool batchingEnabled( false );
{
visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), url );
}
+ else if( UrlType::GIF == type )
+ {
+ visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), url );
+ }
else // Regular image
{
visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), url, size );
{
REGULAR_IMAGE,
N_PATCH,
- SVG
+ SVG,
+ GIF
};
}
// parsing from the end for better chance of early outs
enum { SUFFIX, HASH, HASH_DOT } state = SUFFIX;
char SVG[ 4 ] = { 'g', 'v', 's', '.' };
+ char GIF[ 4 ] = { 'f', 'i', 'g', '.' };
unsigned int svgScore = 0;
+ unsigned int gifScore = 0;
int index = count;
while( --index >= 0 )
{
return UrlType::SVG;
}
}
+ if( ( offsetFromEnd < sizeof(GIF) )&&( tolower( currentChar ) == GIF[ offsetFromEnd ] ) )
+ {
+ // early out if GIF
+ if( ++gifScore == sizeof(GIF) )
+ {
+ return UrlType::GIF;
+ }
+ }
switch( state )
{
case SUFFIX:
// CLASS HEADER
#include "visual-string-constants.h"
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+
namespace Dali
{
namespace Internal
{
+DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_TYPE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BORDER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, GRADIENT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::DevelVisual, TEXT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, WIREFRAME )
+DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE )
+
+// Visual Type
+const char * const VISUAL_TYPE( "visualType" );
+
// Custom shader
const char * const CUSTOM_SHADER( "shader" );
const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
const char * const IMAGE_URL_NAME( "url" );
const char * const ATLAS_RECT_UNIFORM_NAME ( "uAtlasRect" );
+// Text visual
+const char * const TEXT_PROPERTY( "text" );
+
} // namespace Internal
} // namespace Toolkit
*
*/
+// EXTERNAL INCLUDES
+#include <dali/devel-api/scripting/enum-helper.h>
+
namespace Dali
{
namespace Internal
{
+// Visual type
+extern const char * const VISUAL_TYPE;
+extern const Dali::Scripting::StringEnum VISUAL_TYPE_TABLE[];
+extern const unsigned int VISUAL_TYPE_TABLE_COUNT;
+
// Custom shader
extern const char * const CUSTOM_SHADER;
extern const char * const CUSTOM_VERTEX_SHADER;
extern const char * const IMAGE_URL_NAME;
extern const char * const ATLAS_RECT_UNIFORM_NAME;
+// Text visual
+extern const char * const TEXT_PROPERTY;
+
} // namespace Internal
} // namespace Toolkit
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "সকলো চয়ন কৰক"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "প্ৰতিলিপি"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "চয়ন কৰক"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "কাটক"
+msgid "IDS_COM_BODY_PASTE"
+msgstr "লেপন কৰক"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ক্লিপব'ৰ্ড"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Вылучыць усё"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Скапіраваць"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Выразаць"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Буфер абмену"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Выбраць"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Уставіць"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "সমস্ত নির্বাচন করুন"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "অনুলিপি করুন"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "নির্বাচন"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "কাট"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "প্রতিলেপন"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ক্লিপবোর্ড"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "সমস্ত নির্বাচন করুন"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "কপি করুন"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "নির্বাচন"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "কাট"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "পেস্ট করুন"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ক্লিপবোর্ড"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "انتخاب همه"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "کپی"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "انتخاب"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "برش"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "الحاق"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "کلیپ بورد"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "બધું પસંદ કરો"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "કૉપિ કરો"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "પસંદ કરો"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "કટ કરો"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ચોંટાડો"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ક્લિપબોર્ડ"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Pilih semua"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Salin"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Pilih"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Memotong"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Kutip"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Papan klip"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "ជ្រើសទាំងអស់"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "ចម្លង"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ជ្រើស"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "កាត់"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "បិទភ្ជាប់"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ក្ដារតម្បៀតខ្ទាស់"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "ಎಲ್ಲಾ ಆಯ್ಕೆಮಾಡಿ"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "ನಕಲಿಸಿ"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ಆಯ್ಕೆ"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "ಕತ್ತರಿಸು"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ಅಂಟಿಸಿರಿ"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ಕ್ಲಿಪ್ಬೋರ್ಡ್"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Баарын тандоо"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Көчүрүү"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Тандоо"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Кесүү"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Коюу"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Буфер"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "ເລືອກທັງໝົດ"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "ອັດສຳເນົາ"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ເລືອກ"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "ຕັດ"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ວາງໃສ່"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ກະດານເກັບຄວາມຈໍາ"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "എല്ലാം തിരഞ്ഞെടുക്കുക"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "പകര്ത്തുക"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "തിരഞ്ഞെ."
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "മുറിക്കുക"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ഒട്ടിക്കുക"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ക്ലിപ്ബോര്ഡ്"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Бүгдийг сонгох"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Хуулах"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Сонгох"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Хайчлах"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Буулгах"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Түр санах ой"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "सर्व निवडा"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "कॉपी"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "निवडा"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "कट"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "पेस्ट"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "क्लिपबोर्ड"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Pilih semua"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Salin"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Pilih"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Potong"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Tampal"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Papan klip"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "အားလုံးကုိ ေရြးပါ"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "ကူးပါ"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ေရြးခ်ယ္"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "ျဖတ္ေတာက္ပါ"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ကူးထည့္ပါ"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ကလစ္ဘုတ္"
+
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "सबै छान्नुहोस्"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "कपी गर्नुहोस्"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "चयन गर"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "काट्नुहोस्"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "पेस्ट गर्नुहोस्"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "क्लिपबोर्ड"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "ସମସ୍ତ ଚୟନ"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "କପି"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ଚୟନ"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "କଟ୍"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ଲେପନ"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "କ୍ଲିପବୋର୍ଡ"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "ਸਭ ਚੁਣੋ"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "ਕਾਪੀ ਕਰੋ"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ਚੁਣੋ"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "ਕੱਟੋ"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ਪੇਸਟ ਕਰੋ"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ਕਲਿਪਬੋਰਡ"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "සියල්ල තෝරන්න"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "පිටපත් කරන්න"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "තෝරන්න"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "කපන්න"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "අලවන්න"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "ක්ලිප් පුවරුව"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "எல்லாம் தேர்வு"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "நகல்"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "தேர்வு"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "வெட்டு"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "ஒட்டு"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "கிளிப்போர்டு"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "అన్నీ ఎంచుకోండి"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "కాపీ"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "ఎంచు."
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "కట్"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "అతికించు"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "క్లిప్బోర్డ్"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Ҳамаро интихоб кардан"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Нусха"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Интихоб кардан"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Бурида гирифтан"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Гузоштан"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Планшет"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "เลือกทั้งหมด"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "คัดลอก"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "เลือก"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "ตัด"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "วาง"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "คลิปบอร์ด"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Ählisini saýla"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Nusga"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Saýla"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Kes"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Goýmak"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Alyş-çalyş buferi"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Piliin lahat"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Kopyahin"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Piliin"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "I-cut"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "I-paste"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Clipboard"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "تمام منتخب کریں"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "کاپی"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "انتخاب"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "کٹ"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "جوڑ دیں"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "کلپ بورڈ"
+
--- /dev/null
+msgid "IDS_COM_BODY_SELECT_ALL"
+msgstr "Chọn tất cả"
+
+msgid "IDS_COM_BODY_COPY"
+msgstr "Chép"
+
+msgid "IDS_COM_SK_SELECT"
+msgstr "Chọn"
+
+msgid "IDS_COM_BODY_CUT"
+msgstr "Cắt"
+
+msgid "IDS_COM_BODY_PASTE"
+msgstr "Dán"
+
+msgid "IDS_COM_BODY_CLIPBOARD"
+msgstr "Bộ nhớ tạm"
+
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/visuals/color-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/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>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/transition-data-impl.h>
#include <dali-toolkit/devel-api/align-enums.h>
+#include <dali-toolkit/internal/controls/tooltip/tooltip.h>
namespace Dali
{
}
break;
}
+
+ case Toolkit::DevelControl::Property::TOOLTIP:
+ {
+ TooltipPtr& tooltipPtr = controlImpl.mImpl->mTooltip;
+ if( ! tooltipPtr )
+ {
+ tooltipPtr = Tooltip::New( control );
+ }
+ tooltipPtr->SetProperties( value );
+ }
}
}
}
break;
}
+ case Toolkit::DevelControl::Property::TOOLTIP:
+ {
+ Property::Map map;
+ if( controlImpl.mImpl->mTooltip )
+ {
+ controlImpl.mImpl->mTooltip->CreatePropertyMap( map );
+ }
+ value = map;
+ break;
+ }
+
}
}
TapGestureDetector mTapGestureDetector;
LongPressGestureDetector mLongPressGestureDetector;
+ // Tooltip
+ TooltipPtr mTooltip;
+
ControlBehaviour mFlags : CONTROL_BEHAVIOUR_FLAG_COUNT; ///< Flags passed in from constructor.
bool mIsKeyboardNavigationSupported :1; ///< Stores whether keyboard navigation is supported by the control.
bool mIsKeyboardFocusGroup :1; ///< Stores whether the control is a focus group.
- // Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
+ // Properties - these need to be members of Internal::Control::Impl as they access private methods/data of Internal::Control and Internal::Control::Impl.
static const PropertyRegistration PROPERTY_1;
static const PropertyRegistration PROPERTY_2;
static const PropertyRegistration PROPERTY_3;
static const PropertyRegistration PROPERTY_4;
static const PropertyRegistration PROPERTY_5;
+ static const PropertyRegistration PROPERTY_6;
};
// Properties registered without macro to use specific member variables.
const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
Toolkit::Control Control::New()
{
void Control::OnControlChildAdd( Actor& child )
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: OnControlChildAdd() is deprecated and will be removed from next release. Override OnChildAdd instead.\n" );
}
void Control::OnControlChildRemove( Actor& child )
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: OnControlChildRemove() is deprecated and will be removed from next release. Override OnChildRemove instead.\n" );
}
void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
*/
static Toolkit::Control New();
+protected:
+ /**
+ * @brief Virtual destructor.
+ * @SINCE_1_0.0
+ */
+ virtual ~Control();
+
+public:
// Styling
/**
Control( ControlBehaviour behaviourFlags );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
- */
- virtual ~Control();
-
- /**
* @brief Second phase initialization.
* @SINCE_1_0.0
*/
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
void Control::SetBackgroundColor( const Vector4& color )
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
Internal::GetImplementation(*this).SetBackgroundColor( color );
}
#define __DALI_TOOLKIT_CONTROL_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
LEFT, ///< Move keyboard focus towards the left direction @SINCE_1_0.0
RIGHT, ///< Move keyboard focus towards the right direction @SINCE_1_0.0
UP, ///< Move keyboard focus towards the up direction @SINCE_1_0.0
- DOWN ///< Move keyboard focus towards the down direction @SINCE_1_0.0
+ DOWN, ///< Move keyboard focus towards the down direction @SINCE_1_0.0
+ PAGE_UP, ///< Move keyboard focus towards the previous page direction @SINCE_1_2.14
+ PAGE_DOWN ///< Move keyboard focus towards the next page direction @SINCE_1_2.14
};
};
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
namespace Dali
{
{
Vector3 mItemSize; ///< The size of an item in the layout
ControlOrientation::Type mOrientation; ///< the orientation of the layout.
+ Property::Map mProperties;
+ bool mHasLayoutChanged;
};
ItemLayout::ItemLayout()
}
break;
}
+ default:
+ {
+ break;
+ }
}
return itemID;
}
return GetScrollSpeedFactor();
}
+void ItemLayout::SetLayoutProperties(const Property::Map& properties)
+{
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair( properties.GetKeyValue( idx ) );
+
+ if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ SetItemSize(propertyPair.second.Get<Vector3>());
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ORIENTATION)
+ {
+ //Up, Left, Down, Right
+ int orientationType = propertyPair.second.Get<int>();
+ if(orientationType <= ControlOrientation::Right && orientationType >= ControlOrientation::Up)
+ {
+ SetOrientation(ControlOrientation::Type(orientationType));
+ }
+ }
+ }
+ mImpl->mHasLayoutChanged = true;
+ mImpl->mProperties = properties;
+}
+
+Property::Map ItemLayout::GetLayoutProperties()
+{
+ return mImpl->mProperties;
+}
+
+bool ItemLayout::HasLayoutChanged()
+{
+ return mImpl->mHasLayoutChanged;
+}
+
+void ItemLayout::ResetLayoutChangedFlag()
+{
+ mImpl->mHasLayoutChanged = false;
+}
+
} // namespace Toolkit
} // namespace Dali
// EXTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/object/property-key.h>
+#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/enums.h>
DALI_IMPORT_API ControlOrientation::Type GetOrientation() const;
/**
+ * @brief Apply the layout Properties.
+ * @SINCE_1_2.20
+ * @param[in] properties The properties the layout.
+ */
+ void SetLayoutProperties(const Property::Map& properties);
+
+ /**
+ * @brief Get the layout Properties.
+ * @SINCE_1_2.20
+ * @return the property of the layout.
+ */
+ Property::Map GetLayoutProperties();
+
+ /**
+ * @brief Check if the Property has been changed.
+ * @SINCE_1_2.20
+ * @return whether the layout has been changed or not.if changed, return true.
+ */
+ bool HasLayoutChanged();
+
+ /**
+ * @brief Set the layout changed flag to false.
+ * @SINCE_1_2.20
+ */
+ void ResetLayoutChangedFlag();
+
+ /**
* @brief Retrieve the target size of an item in the layout.
*
* This will return the default size for the layout unless overridden by calling SetItemSize().
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 19;
+const unsigned int TOOLKIT_MICRO_VERSION = 20;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace BorderVisual
{
} // namespace BorderVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace ColorVisual
{
} // namespace ColorVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace GradientVisual
{
} // namespace GradientVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace ImageVisual
{
} // namespace ImageVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace MeshVisual
{
} // namespace MeshVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace PrimitiveVisual
{
} // namespace PrimitiveVisual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
namespace Toolkit
{
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
namespace Visual
{
} // namespace Visual
+/**
+ * @}
+ */
+
} // namespace Toolkit
} // namespace Dali
{
"styles":
{
+ "Tooltip":
+ {
+ "tooltip":
+ {
+ "content":
+ {
+ "pointSize":84
+ },
+ "waitTime":0.5,
+ "background":
+ {
+ "visual":"{DALI_IMAGE_DIR}tooltip.9.png",
+ "border":[1,5,5,1]
+ },
+ "tail":
+ {
+ "visibility":false,
+ "aboveVisual":"{DALI_IMAGE_DIR}tooltip-tail-above.png",
+ "belowVisual":"{DALI_IMAGE_DIR}tooltip-tail-below.png"
+ },
+ "position":"BELOW",
+ "hoverPointOffset":[10,10],
+ "movementThreshold":5,
+ "disappearOnMovement":false
+ }
+ },
"TextLabel":
{
"pointSize":108,
},
"Button":
{
+ "styles":["Tooltip"],
"initialAutoRepeatingDelay":2.0,
"nextAutoRepeatingDelay":0.9
// Note: Visuals added to Button will be used in all derived buttons unless overridden.
{
"styles":
{
+ "Tooltip":
+ {
+ "tooltip":
+ {
+ "content":
+ {
+ "pointSize":12
+ },
+ "waitTime":0.5,
+ "background":
+ {
+ "visual":"{DALI_IMAGE_DIR}tooltip.9.png",
+ "border":[1,5,5,1]
+ },
+ "tail":
+ {
+ "visibility":false,
+ "aboveVisual":"{DALI_IMAGE_DIR}tooltip-tail-above.png",
+ "belowVisual":"{DALI_IMAGE_DIR}tooltip-tail-below.png"
+ },
+ "position":"BELOW",
+ "hoverPointOffset":[10,10],
+ "movementThreshold":5,
+ "disappearOnMovement":false
+ }
+ },
"TextLabel":
{
"pointSize":18,
},
"Button":
{
+ "styles":["Tooltip"],
"initialAutoRepeatingDelay":2.0,
"nextAutoRepeatingDelay":0.9
// Note: Visuals added to Button will be used in all derived buttons unless overridden.
* <td>@ref dali_toolkit_managers</td>
* <td>Singleton classes for managing application-wide functionalities.</td>
* </tr>
+ * <tr>
+ * <td>@ref dali_toolkit_visuals</td>
+ * <td>Visuals can control rendering the contents as using Property.</td>
+ * </tr>
* </table>
*
* \ifnot show_tizen_feature
* @defgroup dali_toolkit_managers Managers
* @brief Singleton classes for managing application-wide functionalities.
+ * @defgroup dali_toolkit_visuals Visuals
+ * @brief Visuals can control rendering the contents as using Property.
+
* @}
*/
| Dali::Toolkit::Visual::Transform::Property::OFFSET | offset | VECTOR2 | No | The offset of the visual. |
| Dali::Toolkit::Visual::Transform::Property::SIZE | size | VECTOR2 | No | The size of the visual. |
| Dali::Toolkit::Visual::Transform::Property::OFFSET_SIZE_MODE | offsetSizeMode | VECTOR4 | No | Whether the size or offset components are Relative or Absolute [More info](@ref offset-size-mode)|
-| Dali::Toolkit::Visual::Transform::Property::ORIGIN | origin | INTEGER or STRING | No | The origin of the visual within the control's area. [More info](@ref align-type)] |
+| Dali::Toolkit::Visual::Transform::Property::ORIGIN | origin | INTEGER or STRING | No | The origin of the visual within the control's area. [More info](@ref align-type) |
| Dali::Toolkit::Visual::Transform::Property::ANCHOR_POINT | anchorPoint | INTEGER or STRING | No | The anchor point of the visual. [More info](@ref align-type)|
+ [Normal (Quad)](@ref image-visual)
+ [N-Patch](@ref n-patch-visual)
+ [SVG](@ref svg-visual)
+ + [Animated Image]( @ref animated-image-visual )
___________________________
url : "path-to-image.svg"
};
~~~
+
+___________________________________________________________________________________________________
+
+## Animated Image Visual {#animated-image-visual}
+
+Renders an animated image into the visual's quad geometry. Currently, only the GIF format is supported.
+
+![ ](../assets/img/visuals/animated-image-visual.gif)
+![ ](animated-image-visual.gif)
+
+#### Properties Supported
+
+**VisualType:** Dali::Toolkit::Visual::IMAGE, "IMAGE"
+
+| Property | String | Type | Required | Description |
+|-------------------------------------------|--------|:-------:|:--------:|----------------------------------|
+| Dali::Toolkit::ImageVisual::Property::URL | url | STRING | Yes | The URL of the animated image. |
+
+#### Usage
+
+~~~{.cpp}
+// C++
+Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
+
+control.SetProperty( Control::Property::BACKGROUND,
+ Property::Map().Add( Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE )
+ .Add( Dali::Toolkit::ImageVisual::Property::URL, "path-to-image.gif" ) );
+~~~
+
+~~~{.js}
+// JavaScript
+var control = new dali.Control( "Control" );
+
+control.background =
+{
+ visualType : "IMAGE",
+ url : "path-to-image.gif"
+};
+~~~
___________________________________________________________________________________________________
## Border Visual {#border-visual}
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.19
+Version: 1.2.20
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
+++ /dev/null
-Name: NDalic
-Summary: dali wrapper
-Version: 1.2.19
-Release: 1
-Group: uifw/graphic
-License: TO_BE_FILLED_IN
-Source0: %{name}-%{version}.tar.gz
-BuildRequires: cmake
-BuildRequires: swig
-#BuildRequires: ruby
-#BuildRequires: ruby-devel
-
-#BuildRequires: mono-core
-#BuildRequires: mono-compat
-#BuildRequires: mono-data
-#BuildRequires: mono-compiler
-#BuildRequires: mono-wcf
-#BuildRequires: mono-web
-
-BuildRequires: pkgconfig
-
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(dali-core)
-BuildRequires: pkgconfig(dali-adaptor)
-BuildRequires: pkgconfig(dali-toolkit)
-
-BuildRequires: dali-devel
-BuildRequires: dali-integration-devel
-BuildRequires: dali-adaptor-devel
-BuildRequires: dali-adaptor-integration-devel
-BuildRequires: dali-toolkit-devel
-
-
-%description
-dali wrapper
-
-%package dali-wrapper
-
-Summary: Development dali-wrapper
-Group: Development/Libraries/Other
-Requires: %{name} = %{version}
-
-%description dali-wrapper
-Development .so for dali wrapper
-%define daliSwigDir %{_builddir}/%{name}-%{version}/build/tizen
-%define daliToolkitDir %{_builddir}/dali-toolkit-%{version}/build/tizen
-%define daliPluginsDir %{_builddir}/%{name}-%{version}/build/tizen/plugins/csharp
-
-#############################
-# profile setup
-#############################
-
-
-%define dali_toolkit_profile MOBILE
-
-%define dali_style_folder 720x1280
-# dali_style to be provided by build system as with dali_toolkit_profile or by passing --define 'dali_style 470x800' to the rpm build command
-
-%if "%{?dali_style}"
- %define dali_style_folder %{dali_style}
-%endif
-
-# Further resource locations profiles can be provided here otherwise MOBILE will be used
-%if "%{tizen_profile_name}" == "mobile"
- %define dali_toolkit_profile MOBILE
-%endif
-
-%description
-The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
-user interface functionality.
-
-##############################
-# Preparation
-##############################
-%prep
-%setup -q
-
-#Use TZ_PATH when tizen version is 3.x
-
-%if "%{tizen_version_major}" == "2"
-%define ndali_data_rw_dir /opt/usr/share/dali/
-%define ndali_data_ro_dir /usr/share/dali/
-%else
-%define ndali_data_rw_dir %TZ_SYS_SHARE/dali/
-%define ndali_data_ro_dir %TZ_SYS_RO_SHARE/dali/
-%endif
-##############################
-# Build
-##############################
-%build
-echo "----------------" %{_builddir}
-echo "----------------" %{daliSwigDir}
-echo "----------------" %{_libdir}
-echo "----------------" %{daliPluginsDir}
-
-PREFIX="/usr"
-CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
-LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
-
-%if 0%{?enable_coverage}
-CXXFLAGS+=" --coverage "
-LDFLAGS+=" --coverage "
-%endif
-
-
-##############################
-# Build dali-wrap
-##############################
-
-libtoolize --force
-cd %{daliSwigDir}
-autoreconf --install
-NDALI_DATA_RW_DIR="%{ndali_data_rw_dir}" ; export NDALI_DATA_RW_DIR
-NDALI_DATA_RO_DIR="%{ndali_data_ro_dir}" ; export NDALI_DATA_RO_DIR
-%configure --enable-profile=%{dali_toolkit_profile} \
- --with-style=%{dali_style_folder} \
- --enable-csharp=yes \
-%if 0%{?enable_debug}
- --enable-debug \
-%endif
- --enable-i18n=yes
-cd %{daliPluginsDir}
-make gbs-local
-
-##############################
-# Installation
-##############################
-echo "----------------" %{_buildrootdir}
-%install
-cd "%{daliPluginsDir}"
-make DESTDIR=%{_buildrootdir}/%{name}-%{version}-%{release}.arm/usr/lib/ gbs-install
-
-#mv %{_builddir}/%{name}-%{version}/plugins/dali-swig/NDali.dll %{_buildrootdir}/%{name}-%{version}-%{release}.arm/usr/lib/
-
-##############################
-# Post Install
-##############################
-%post
-
-
-##############################
-# Files in Binary Packages
-##############################
-%files
-%manifest dali-csharp-wrapper.manifest
-%defattr(-,root,root,-)
-%{_libdir}/lib*
-%{_libdir}/NDali.dll
-
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.19
+Version: 1.2.20
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
return "down";
break;
}
+ case Dali::Toolkit::Control::KeyboardFocus::PAGE_UP:
+ {
+ return "pageUp";
+ break;
+ }
+ case Dali::Toolkit::Control::KeyboardFocus::PAGE_DOWN:
+ {
+ return "pageDown";
+ break;
+ }
}
return "unknown direction";
}
examples/scroll-view.exe \
examples/custom-control.exe \
examples/spin-control.exe \
+ examples/control-dashboard.exe \
+ examples/user-alphafunction.exe \
examples/libNDalic.so examples/NDali.dll
examples/%.exe: examples/%.cs
*/
%typemap(cscode) Dali::AlphaFunction %{
- public AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true){
+ public AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public AlphaFunction(System.Delegate func) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(new SWIGTYPE_p_f_float__float(System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func), true))), true)
+ {
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
%}
%rename(BlendingEquationType) Dali::BlendingEquation::Type;
%rename(CameraType) Dali::Camera::Type;
%rename(LayerBehavior) Dali::Layer::Behavior;
+%rename(DaliEndAction) Dali::Animation::EndAction;
typedef std::pair<std::string, Dali::Property::Value> StringValuePair;
typedef std::vector<Dali::TouchPoint> TouchPointContainer;
%include <dali/public-api/object/property-notification.h>
%include <dali/public-api/object/handle.h>
%include <dali/public-api/object/type-info.h>
+%include <dali/public-api/object/type-registry.h>
%include <dali/public-api/common/constants.h>
%include <dali/public-api/actors/actor-enumerations.h>
%template(ImageSignal) Dali::Signal<void(Dali::Image)>;
%template(RenderTaskSignal) Dali::Signal<void(Dali::RenderTask&)>;
%template(LongPressGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::LongPressGesture&)>;
-%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
+//%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
%template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
%template(ActorHoverEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
%template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
%template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
%template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
-%template(TouchEventSignal) Dali::Signal<void (const Dali::TouchEvent&)>;
+//%template(TouchEventSignal) Dali::Signal<void (const Dali::TouchEvent&)>;
%template(TouchSignal) Dali::Signal<void (const Dali::TouchData&)>;
%template(StageWheelEventSignal) Dali::Signal<void (const Dali::WheelEvent&)>;
%template(AngleThresholdPair) std::pair<Dali::Radian, Dali::Radian>;
%rename(LoadImageSynchronously) Dali::Toolkit::SyncImageLoader::Load;
%rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type;
%rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type;
+%rename(DefaultItemLayoutProperty) Dali::Toolkit::DefaultItemLayoutProperty::Property;
%rename(NewItemLayout) Dali::Toolkit::DefaultItemLayout::New;
%rename(ContentDirectionType) Dali::Toolkit::FlexContainer::ContentDirection;
%rename(FlexDirectionType) Dali::Toolkit::FlexContainer::FlexDirection;
%include <dali-toolkit/public-api/enums.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+%include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
%include events/gaussian-blur-view-event.i
%include events/image-event.i
%include events/itemview-event.i
-%include events/keyboardFocusManager-event.i
%include events/objectregistry-event.i
%include events/popup-event.i
%include events/pinchgesture-event.i
{
get
{
- Actor parent = GetParent();
- return parent;
+ return GetParent();
}
}
{
get
{
- bool visibility = IsVisible();
- return visibility;
+ return IsVisible();
}
}
}
get
{
- float ret = GetCurrentOpacity();
- return ret;
+ return GetCurrentOpacity();
}
}
}
get
{
- bool focusable = IsKeyboardFocusable();
- return focusable;
+ return IsKeyboardFocusable();
+ }
+ }
+
+ public bool IsOnStage
+ {
+ get
+ {
+ return OnStage();
}
}
%define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
%typemap(cscode) NameSpace::ClassName %{
- public static readonly int ParentOrigin = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get();
- public static readonly int ParentOriginX = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get();
- public static readonly int ParentOriginY = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get();
- public static readonly int ParentOriginZ = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get();
- public static readonly int AnchorPoint = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get();
- public static readonly int AnchorPointX = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get();
- public static readonly int AnchorPointY = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get();
- public static readonly int AnchorPointZ = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get();
- public static readonly int Size = NDalicPINVOKE.Actor_Property_SIZE_get();
- public static readonly int SizeWidth = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get();
- public static readonly int SizeHeight = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get();
- public static readonly int SizeDepth = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get();
- public static readonly int Position = NDalicPINVOKE.Actor_Property_POSITION_get();
- public static readonly int PositionX = NDalicPINVOKE.Actor_Property_POSITION_X_get();
- public static readonly int PositionY = NDalicPINVOKE.Actor_Property_POSITION_Y_get();
- public static readonly int PositionZ = NDalicPINVOKE.Actor_Property_POSITION_Z_get();
- public static readonly int WorldPosition = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get();
- public static readonly int WorldPositionX = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get();
- public static readonly int WorldPositionY = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get();
- public static readonly int WorldPositionZ = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get();
- public static readonly int Orientation = NDalicPINVOKE.Actor_Property_ORIENTATION_get();
- public static readonly int WorldOrientation = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get();
- public static readonly int Scale = NDalicPINVOKE.Actor_Property_SCALE_get();
- public static readonly int ScaleX = NDalicPINVOKE.Actor_Property_SCALE_X_get();
- public static readonly int ScaleY = NDalicPINVOKE.Actor_Property_SCALE_Y_get();
- public static readonly int ScaleZ = NDalicPINVOKE.Actor_Property_SCALE_Z_get();
- public static readonly int WorldScale = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get();
- public static readonly int Visibile = NDalicPINVOKE.Actor_Property_VISIBLE_get();
- public static readonly int Color = NDalicPINVOKE.Actor_Property_COLOR_get();
- public static readonly int ColorRed = NDalicPINVOKE.Actor_Property_COLOR_RED_get();
- public static readonly int ColorGreeb = NDalicPINVOKE.Actor_Property_COLOR_GREEN_get();
- public static readonly int ColorBlue = NDalicPINVOKE.Actor_Property_COLOR_BLUE_get();
- public static readonly int ColorAlpha = NDalicPINVOKE.Actor_Property_COLOR_ALPHA_get();
- public static readonly int WorldColor = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get();
- public static readonly int WorldMatrix = NDalicPINVOKE.Actor_Property_WORLD_MATRIX_get();
- public static readonly int Name = NDalicPINVOKE.Actor_Property_NAME_get();
- public static readonly int Sensitive = NDalicPINVOKE.Actor_Property_SENSITIVE_get();
- public static readonly int LeaveRequired = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get();
- public static readonly int InheritOrientation = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get();
- public static readonly int InheritScale = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get();
- public static readonly int ColorMode = NDalicPINVOKE.Actor_Property_COLOR_MODE_get();
- public static readonly int PositionInheritance = NDalicPINVOKE.Actor_Property_POSITION_INHERITANCE_get();
- public static readonly int DrawMode = NDalicPINVOKE.Actor_Property_DRAW_MODE_get();
- public static readonly int SizeModeFactor = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get();
- public static readonly int WidthResizePolicy = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get();
- public static readonly int HeightResizePolicy = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get();
- public static readonly int SizeScalePolicy = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get();
- public static readonly int WidthForHeight = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get();
- public static readonly int HeightForWidth = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get();
- public static readonly int Padding = NDalicPINVOKE.Actor_Property_PADDING_get();
- public static readonly int MinimumSize = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get();
- public static readonly int MaximumSize = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get();
- public static readonly int InheritPosition = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get();
- public static readonly int ClippingMode = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get();
- /**
- * @brief Event arguments that passed via Finished signal
- *
- */
- public class FinishedEventArgs : EventArgs
- {
- private Animation _animation;
-
- /**
- * @brief Animation - is the Animation which has finished with the animation.
- *
- */
- public Animation Animation
- {
- get
- {
- return _animation;
- }
- set
- {
- _animation = value;
- }
- }
- }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
- private DaliEventHandler<object,FinishedEventArgs> _animationFinishedEventHandler;
- private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
+ private EventCallbackDelegateType1<IntPtr> _animationFinishedEventCallbackDelegate;
+ private event EventHandler _animationFinishedEventHandler;
/**
* @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of FinishedEventHandler - DaliEventHandler<object,FinishedEventArgs>) provided by the user.
* Finished signal is emitted when an Animation's animations have finished.
*/
- public event DaliEventHandler<object,FinishedEventArgs> Finished
+ public event EventHandler Finished
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_animationFinishedEventHandler == null)
- {
- _animationFinishedEventHandler += value;
-
- _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
- this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
- }
+ _animationFinishedEventHandler += value;
+ _animationFinishedEventCallbackDelegate = OnFinished;
+ this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
}
}
-
remove
{
lock(this)
{
this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
}
-
_animationFinishedEventHandler -= value;
}
}
// Callback for Animation FinishedSignal
private void OnFinished(IntPtr data)
{
- FinishedEventArgs e = new FinishedEventArgs();
-
- // Populate all members of "e" (FinishedEventArgs) with real data
- e.Animation = Animation.GetAnimationFromPtr(data);
-
if (_animationFinishedEventHandler != null)
{
//here we send all data to user event handlers
- _animationFinishedEventHandler(this, e);
+ _animationFinishedEventHandler(this, null);
}
}
-
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;
}
+ private float MilliSecondsToSeconds( int millisec )
+ {
+ return (float)millisec / 1000.0f;
+ }
- public float Duration
+ private int SecondsToMilliSeconds( float sec )
{
- set
- {
- SetDuration(value);
- }
- get
- {
- float ret = GetDuration();
- return ret;
- }
+ return (int)( sec * 1000 );
}
- public int DurationMilliSecs
+ public int Duration
{
set
{
- SetDuration(value/1000);
+ SetDuration( MilliSecondsToSeconds( value ) );
}
get
{
- int ret = (int) GetDuration() * 1000;
- return ret;
+ return SecondsToMilliSeconds( GetDuration() );
}
}
}
}
- public Animation.State Status
+ public Dali.Constants.Animation.State Status
{
get
{
- Animation.State ret = GetState();
- return ret;
+ return (Dali.Constants.Animation.State)GetState();
}
}
}
}
- public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue)
+ public Dali.Constants.Animation.EndAction EndAction
{
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(relativeValue);
- AnimateBy(new Property(target, var), new Property.Value(obj));
+ set
+ {
+ switch(value)
+ {
+ case Dali.Constants.Animation.EndAction.Cancel :
+ SetEndAction(Dali.Animation.DaliEndAction.Bake);
+ break;
+ case Dali.Constants.Animation.EndAction.Discard :
+ SetEndAction(Dali.Animation.DaliEndAction.Discard);
+ break;
+ case Dali.Constants.Animation.EndAction.Stop :
+ SetEndAction(Dali.Animation.DaliEndAction.BakeFinal);
+ break;
+ default :
+ SetEndAction(Dali.Animation.DaliEndAction.Bake);
+ break;
+ }
+ }
+ get
+ {
+ Dali.Animation.DaliEndAction temp = GetEndAction();
+ switch(temp)
+ {
+ case Dali.Animation.DaliEndAction.Bake :
+ return Dali.Constants.Animation.EndAction.Cancel;
+ case Dali.Animation.DaliEndAction.Discard :
+ return Dali.Constants.Animation.EndAction.Discard;
+ case Dali.Animation.DaliEndAction.BakeFinal :
+ return Dali.Constants.Animation.EndAction.Stop;
+ default :
+ return Dali.Constants.Animation.EndAction.Cancel;
+ }
+ }
}
- public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha)
- {
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(relativeValue);
- AnimateBy(new Property(target, var), new Property.Value(obj), alpha);
+ public void Stop(Dali.Constants.Animation.EndAction action) {
+ switch( action )
+ {
+ case Dali.Constants.Animation.EndAction.Cancel :
+ SetEndAction(Dali.Animation.DaliEndAction.Bake);
+ break;
+ case Dali.Constants.Animation.EndAction.Discard :
+ SetEndAction(Dali.Animation.DaliEndAction.Discard);
+ break;
+ case Dali.Constants.Animation.EndAction.Stop :
+ SetEndAction(Dali.Animation.DaliEndAction.BakeFinal);
+ break;
+ default :
+ SetEndAction(Dali.Animation.DaliEndAction.Bake);
+ break;
+ }
+ NDalicPINVOKE.Animation_Stop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, TimePeriod period)
- {
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(relativeValue);
- AnimateBy(new Property(target, var), new Property.Value(obj), period);
- }
+ public int StartTime { set; get; }
+ public int EndTime { set; get; }
+ public string TargetPoperty { set; get; }
+ public object Destination { set; get; }
+ public Dali.AlphaFunction AlphaFunction { set; get; }
- public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha, TimePeriod period)
- {
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(relativeValue);
- AnimateBy(new Property(target, var), new Property.Value(obj), alpha, period);
- }
- public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue)
+ public void AnimateBy(Actor target)
{
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(destinationValue);
- AnimateTo(new Property(target, var), new Property.Value(obj));
- }
+ string _str1 = TargetPoperty.Substring(0, 1);
+ string _str2 = TargetPoperty.Substring(1);
+ string _str = _str1.ToLower() + _str2;
- public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha)
- {
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(destinationValue);
- AnimateTo(new Property(target, var), new Property.Value(obj), alpha);
- }
+ dynamic obj = (object)Destination;
- public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, TimePeriod period)
- {
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(destinationValue);
- AnimateTo(new Property(target, var), new Property.Value(obj), period);
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
- public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha, TimePeriod period)
+ public void AnimateBy(Actor target, string propertyIndex)
{
- dynamic var = (object)(propertyIndex);
- dynamic obj = (object)(destinationValue);
- AnimateTo(new Property(target, var), new Property.Value(obj), alpha, period);
- }
+ string _str1 = propertyIndex.Substring(0, 1);
+ string _str2 = propertyIndex.Substring(1);
+ string _str = _str1.ToLower() + _str2;
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames)
- {
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames);
- }
+ dynamic obj = (object)Destination;
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, Animation.Interpolation interpolation)
- {
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, interpolation);
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha)
+ public void AnimateBy(Actor target, string propertyIndex, object relativeValue)
{
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, alpha);
- }
+ string _str1 = propertyIndex.Substring(0, 1);
+ string _str2 = propertyIndex.Substring(1);
+ string _str = _str1.ToLower() + _str2;
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
- {
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, alpha, interpolation);
- }
+ dynamic obj = (object)relativeValue;
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period)
- {
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, period);
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateBy(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateBy(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
+ public void AnimateTo(Actor target)
{
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, period, interpolation);
+ string _str1 = TargetPoperty.Substring(0, 1);
+ string _str2 = TargetPoperty.Substring(1);
+ string _str = _str1.ToLower() + _str2;
+
+ dynamic obj = (object)Destination;
+
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
+ public void AnimateTo(Actor target, string propertyIndex)
{
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, alpha, period);
+ string _str1 = propertyIndex.Substring(0, 1);
+ string _str2 = propertyIndex.Substring(1);
+ string _str = _str1.ToLower() + _str2;
+
+ dynamic obj = (object)Destination;
+
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
- public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
+ public void AnimateTo(Actor target, string propertyIndex, object destinationValue)
{
- dynamic var = (object)(propertyIndex);
- AnimateBetween(new Property(target, var), keyFrames, alpha, period, interpolation);
- }
+ string _str1 = propertyIndex.Substring(0, 1);
+ string _str2 = propertyIndex.Substring(1);
+ string _str = _str1.ToLower() + _str2;
- public void Stop(Animation.EndAction action) {
- SetEndAction(action);
- NDalicPINVOKE.Animation_Stop(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ dynamic obj = (object)destinationValue;
+
+ if( this.AlphaFunction != null )
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time );
+ }
+ }
+ else
+ {
+ if( this.StartTime == 0 && this.EndTime == 0 )
+ {
+ AnimateTo(new Property(target, _str), new Property.Value(obj) );
+ }
+ else
+ {
+ Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) );
+ AnimateTo(new Property(target, _str), new Property.Value(obj), time );
+ }
+ }
}
/**
public Animation (int durationmSeconds) : this (NDalicPINVOKE.Animation_New((float)durationmSeconds/1000.0f), true) {
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+
+ public Animation () : this (NDalicPINVOKE.Animation_New( 0.0f ), true ) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
%}
%enddef
// Populate all members of "e" (OnStageEventArgs) with real data
e.View = View.GetViewFromPtr(data);
+ //Console.WriteLine("############# OnStage()! e.View.Name=" + e.View.Name);
+
if (_viewOnStageEventHandler != null)
{
//here we send all data to user event handlers
%define STAGE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
%typemap(cscode) NameSpace::ClassName %{
-/**
- * @brief Event arguments that passed via Touch signal
- *
- */
-public class TouchEventArgs : EventArgs
-{
- private TouchData _touchData;
-
- /**
- * @brief TouchData - contains the information of touch points
- *
- */
- public TouchData TouchData
- {
- get
- {
- return _touchData;
- }
- set
- {
- _touchData = value;
- }
- }
-}
-
-
-/**
- * @brief Event arguments that passed via Wheel signal
- *
- */
-public class WheelEventArgs : EventArgs
-{
- private WheelEvent _wheelEvent;
-
- /**
- * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
- *
- */
- public WheelEvent WheelEvent
- {
- get
- {
- return _wheelEvent;
- }
- set
- {
- _wheelEvent = value;
- }
- }
-}
-
-/**
- * @brief Event arguments that passed via KeyEvent signal
- *
- */
-public class KeyEventArgs : EventArgs
-{
- private KeyEvent _keyEvent;
-
- /**
- * @brief KeyEvent - is the keyevent sent to Stage.
- *
- */
- public KeyEvent KeyEvent
- {
- get
- {
- return _keyEvent;
- }
- set
- {
- _keyEvent = value;
- }
- }
-}
-
-/**
- * @brief Event arguments that passed via EventProcessingFinished signal
- *
- */
-public class EventProcessingFinishedEventArgs : EventArgs
-{
-}
-
-/**
- * @brief Event arguments that passed via ContextLost signal
- *
- */
-public class ContextLostEventArgs : EventArgs
-{
-}
-
-/**
- * @brief Event arguments that passed via ContextRegained signal
- *
- */
-public class ContextRegainedEventArgs : EventArgs
-{
-}
-
-/**
- * @brief Event arguments that passed via SceneCreated signal
- *
- */
-public class SceneCreatedEventArgs : EventArgs
-{
-}
-
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void StageTouchCallbackDelegate(IntPtr data);
- private DaliEventHandler<object,TouchEventArgs> _stageTouchEventHandler;
- private StageTouchCallbackDelegate _stageTouchCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void WheelCallbackDelegate(IntPtr data);
- private DaliEventHandler<object,WheelEventArgs> _stageWheelEventHandler;
- private WheelCallbackDelegate _stageWheelCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void KeyCallbackDelegate(IntPtr data);
- private DaliEventHandler<object,KeyEventArgs> _stageKeyEventHandler;
- private KeyCallbackDelegate _stageKeyCallbackDelegate;
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void EventProcessingFinishedEventCallbackDelegate();
- private DaliEventHandler<object,EventProcessingFinishedEventArgs> _stageEventProcessingFinishedEventHandler;
- private EventProcessingFinishedEventCallbackDelegate _stageEventProcessingFinishedEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void ContextLostEventCallbackDelegate();
- private DaliEventHandler<object,ContextLostEventArgs> _stageContextLostEventHandler;
- private ContextLostEventCallbackDelegate _stageContextLostEventCallbackDelegate;
+ /**
+ * @brief Event arguments that passed via Touch signal
+ *
+ */
+ public class TouchEventArgs : EventArgs
+ {
+ private TouchData _touchData;
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void ContextRegainedEventCallbackDelegate();
- private DaliEventHandler<object,ContextRegainedEventArgs> _stageContextRegainedEventHandler;
- private ContextRegainedEventCallbackDelegate _stageContextRegainedEventCallbackDelegate;
+ /**
+ * @brief TouchData - contains the information of touch points
+ *
+ */
+ public TouchData TouchData
+ {
+ get
+ {
+ return _touchData;
+ }
+ set
+ {
+ _touchData = value;
+ }
+ }
+ }
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void SceneCreatedEventCallbackDelegate();
- private DaliEventHandler<object,SceneCreatedEventArgs> _stageSceneCreatedEventHandler;
- private SceneCreatedEventCallbackDelegate _stageSceneCreatedEventCallbackDelegate;
+ private event EventHandler<TouchEventArgs> _stageTouchEventHandler;
+ private EventCallbackDelegateType1<IntPtr> _stageTouchCallbackDelegate;
/**
- * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of TouchEventHandler-DaliEventHandler<object,TouchEventArgs>) provided by the user.
- * Touched signal is emitted when the screen is touched and when the touch ends
+ * @brief Event for TouchEvent signal which can be used to subscribe/unsubscribe the event handler
+ * TouchEvent signal is emitted when the screen is touched and when the touch ends
* (i.e. the down & up touch events only).
*
*/
- public event DaliEventHandler<object,TouchEventArgs> Touched
+ public event EventHandler<TouchEventArgs> TouchEvent
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageTouchEventHandler == null)
- {
- _stageTouchEventHandler += value;
-
- _stageTouchCallbackDelegate = new StageTouchCallbackDelegate(OnStageTouch);
- this.TouchSignal().Connect(_stageTouchCallbackDelegate);
- }
+ _stageTouchEventHandler += value;
+ _stageTouchCallbackDelegate = OnStageTouch;
+ this.TouchSignal().Connect(_stageTouchCallbackDelegate);
}
}
-
remove
{
lock(this)
{
this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
}
-
_stageTouchEventHandler -= value;
}
}
}
- // Callback for Stage Touch signal
private void OnStageTouch(IntPtr data)
{
- TouchEventArgs e = new TouchEventArgs();
+ TouchEventArgs e = new TouchEventArgs();
+
+ if( data != null )
+ {
+ e.TouchData = TouchData.GetTouchDataFromPtr( data );
+ }
+
+ if (_stageTouchEventHandler != null)
+ {
+ _stageTouchEventHandler(this, e);
+ }
+ }
+
- // Populate all members of "e" (TouchEventArgs) with real data
- e.TouchData = TouchData.GetTouchDataFromPtr( data );
+ /**
+ * @brief WheelEvent arguments that passed via Wheel signal
+ *
+ */
+ public class WheelEventArgs : EventArgs
+ {
+ private WheelEvent _wheelEvent;
- if (_stageTouchEventHandler != null)
+ /**
+ * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
+ *
+ */
+ public WheelEvent WheelEvent
{
- //here we send all data to user event handlers
- _stageTouchEventHandler(this, e);
+ get
+ {
+ return _wheelEvent;
+ }
+ set
+ {
+ _wheelEvent = value;
+ }
}
}
+ private event EventHandler<WheelEventArgs> _stageWheelEventHandler;
+ private EventCallbackDelegateType1<IntPtr> _stageWheelCallbackDelegate;
+
/**
- * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of WheelEventHandler-DaliEventHandler<object,WheelEventArgs>) provided by the user.
- * WheelMoved signal is emitted is emitted when wheel event is received.
+ * @brief Event for WheelEvent signal which can be used to subscribe/unsubscribe the event handler
+ * WheelEvent signal is emitted is emitted when wheel event is received.
*
*/
- public event DaliEventHandler<object,WheelEventArgs> WheelMoved
+ public event EventHandler<WheelEventArgs> WheelEvent
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageWheelEventHandler == null)
- {
- _stageWheelEventHandler += value;
-
- _stageWheelCallbackDelegate = new WheelCallbackDelegate(OnStageWheel);
- this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
- }
+ _stageWheelEventHandler += value;
+ _stageWheelCallbackDelegate = OnStageWheel;
+ this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
}
}
-
remove
{
lock(this)
{
this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
}
-
_stageWheelEventHandler -= value;
}
}
}
- // Callback for Stage WheelEventsignal
private void OnStageWheel(IntPtr data)
{
- WheelEventArgs e = new WheelEventArgs();
+ WheelEventArgs e = new WheelEventArgs();
- // Populate all members of "e" (WheelEventArgs) with real data
- e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data );
+ if( data != null )
+ {
+ e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data );
+ }
+
+ if (_stageWheelEventHandler != null)
+ {
+ _stageWheelEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via KeyEvent signal
+ *
+ */
+ public class KeyEventArgs : EventArgs
+ {
+ private KeyEvent _keyEvent;
- if (_stageWheelEventHandler != null)
+ /**
+ * @brief KeyEvent - is the keyevent sent to Stage.
+ *
+ */
+ public KeyEvent KeyEvent
{
- //here we send all data to user event handlers
- _stageWheelEventHandler(this, e);
+ get
+ {
+ return _keyEvent;
+ }
+ set
+ {
+ _keyEvent = value;
+ }
}
}
+ private event EventHandler<KeyEventArgs> _stageKeyEventHandler;
+ private EventCallbackDelegateType1<IntPtr> _stageKeyCallbackDelegate;
+
/**
- * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of KeyEventHandler-DaliEventHandler<object,KeyEventArgs>) provided by the user.
- * KeyPressed signal is emitted is emitted when key event is received.
+ * @brief Event for KeyEvent signal which can be used to subscribe/unsubscribe the event handler
+ * KeyEvent signal is emitted is emitted when key event is received.
*
*/
- public event DaliEventHandler<object,KeyEventArgs> KeyPressed
+ public event EventHandler<KeyEventArgs> KeyEvent
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageKeyEventHandler == null)
- {
- _stageKeyEventHandler += value;
-
- _stageKeyCallbackDelegate = new KeyCallbackDelegate(OnStageKey);
- this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
- }
+ _stageKeyEventHandler += value;
+ _stageKeyCallbackDelegate = OnStageKey;
+ this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
}
}
-
remove
{
lock(this)
{
this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
}
-
_stageKeyEventHandler -= value;
}
}
}
// Callback for Stage KeyEventsignal
- private void OnStageKey(IntPtr keyEvent)
+ private void OnStageKey(IntPtr data)
{
- KeyEventArgs e = new KeyEventArgs();
+ KeyEventArgs e = new KeyEventArgs();
+
+ if( data != null )
+ {
+ e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( data );
+ }
+
+ if (_stageKeyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageKeyEventHandler(this, e);
+ }
+ }
- // Populate all members of "e" (KeyEventArgs) with real data
- e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( keyEvent );
- if (_stageKeyEventHandler != null)
- {
- //here we send all data to user event handlers
- _stageKeyEventHandler(this, e);
- }
- }
+ private event EventHandler _stageEventProcessingFinishedEventHandler;
+ private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
/**
* @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of EventProcessingFinishedEventHandler-DaliEventHandler<object,EventProcessingFinishedEventArgs>)
* provided by the user. EventProcessingFinished signal is emitted just after the event processing is finished.
*
*/
- public event DaliEventHandler<object,EventProcessingFinishedEventArgs> EventProcessingFinished
+ public event EventHandler EventProcessingFinished
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageEventProcessingFinishedEventHandler == null)
- {
- _stageEventProcessingFinishedEventHandler += value;
-
- _stageEventProcessingFinishedEventCallbackDelegate = new EventProcessingFinishedEventCallbackDelegate(OnEventProcessingFinished);
- this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
- }
+ _stageEventProcessingFinishedEventHandler += value;
+ _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
+ this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
}
}
-
remove
{
lock(this)
{
this.EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
}
-
_stageEventProcessingFinishedEventHandler -= value;
}
}
// Callback for Stage EventProcessingFinishedSignal
private void OnEventProcessingFinished()
{
- EventProcessingFinishedEventArgs e = new EventProcessingFinishedEventArgs();
-
if (_stageEventProcessingFinishedEventHandler != null)
{
- //here we send all data to user event handlers
- _stageEventProcessingFinishedEventHandler(this, e);
+ _stageEventProcessingFinishedEventHandler(this, null);
}
}
+
+ private EventHandler _stageContextLostEventHandler;
+ private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
+
/**
* @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of ContextLostEventHandler-DaliEventHandler<object,ContextLostEventArgs>) provided by the user.
* ContextLost signal is emitted when the GL context is lost (Platform specific behaviour).
*
*/
- public event DaliEventHandler<object,ContextLostEventArgs> ContextLost
+ public event EventHandler ContextLost
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageContextLostEventHandler == null)
- {
- _stageContextLostEventHandler += value;
-
- _stageContextLostEventCallbackDelegate = new ContextLostEventCallbackDelegate(OnContextLost);
- this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
- }
+ _stageContextLostEventHandler += value;
+ _stageContextLostEventCallbackDelegate = OnContextLost;
+ this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
}
}
-
remove
{
lock(this)
// Callback for Stage ContextLostSignal
private void OnContextLost()
{
- ContextLostEventArgs e = new ContextLostEventArgs();
-
if (_stageContextLostEventHandler != null)
{
- //here we send all data to user event handlers
- _stageContextLostEventHandler(this, e);
+ _stageContextLostEventHandler(this, null);
}
}
+
+ private EventHandler _stageContextRegainedEventHandler;
+ private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
+
/**
* @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of ContextRegainedEventHandler-DaliEventHandler<object,ContextRegainedEventArgs>)
* provided by the user. ContextRegained signal is emitted when the GL context is regained (Platform specific
* behaviour).
*
*/
- public event DaliEventHandler<object,ContextRegainedEventArgs> ContextRegained
+ public event EventHandler ContextRegained
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageContextRegainedEventHandler == null)
- {
- _stageContextRegainedEventHandler += value;
-
- _stageContextRegainedEventCallbackDelegate = new ContextRegainedEventCallbackDelegate(OnContextRegained);
- this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
- }
+ _stageContextRegainedEventHandler += value;
+ _stageContextRegainedEventCallbackDelegate = OnContextRegained;
+ this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
}
}
-
remove
{
lock(this)
// Callback for Stage ContextRegainedSignal
private void OnContextRegained()
{
- ContextRegainedEventArgs e = new ContextRegainedEventArgs();
-
if (_stageContextRegainedEventHandler != null)
{
- //here we send all data to user event handlers
- _stageContextRegainedEventHandler(this, e);
+ _stageContextRegainedEventHandler(this, null);
}
}
+
+ private EventHandler _stageSceneCreatedEventHandler;
+ private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
+
/**
* @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of SceneCreatedEventHandler-DaliEventHandler<object,SceneCreatedEventArgs>) provided by the user.
* SceneCreated signal is emitted after the initial scene is created.
*
*/
- public event DaliEventHandler<object,SceneCreatedEventArgs> SceneCreated
+ public event EventHandler SceneCreated
{
add
{
lock(this)
{
- // Restricted to only one listener
- if (_stageSceneCreatedEventHandler == null)
- {
- _stageSceneCreatedEventHandler += value;
-
- _stageSceneCreatedEventCallbackDelegate = new SceneCreatedEventCallbackDelegate(OnSceneCreated);
- this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
- }
+ _stageSceneCreatedEventHandler += value;
+ _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
+ this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
}
}
-
remove
{
lock(this)
// Callback for Stage SceneCreatedSignal
private void OnSceneCreated()
{
- SceneCreatedEventArgs e = new SceneCreatedEventArgs();
-
if (_stageSceneCreatedEventHandler != null)
{
- //here we send all data to user event handlers
- _stageSceneCreatedEventHandler(this, e);
+ _stageSceneCreatedEventHandler(this, null);
}
}
- ///< name "Size", type Dali.Size (Stage Size value)
- //@since 1.0.0
- public Dali.Size Size
+
+ public Vector2 Size
{
get
{
- Vector2 ret1 = GetSize();
- Dali.Size ret= new Size(ret1);
+ Vector2 ret = GetSize();
return ret;
}
}
- ///< name "BackgroundColor", type Dali.Color (Stage background color value)
- //@since 1.0.0
- public Dali.Color BackgroundColor
+ public Vector4 BackgroundColor
{
set
{
}
get
{
- Vector4 ret1 = GetBackgroundColor();
- Dali.Color ret = new Color(ret1);
+ Vector4 ret = GetBackgroundColor();
return ret;
}
}
--- /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.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+ class Example
+ {
+ // This is simple structure to contain Control name and implement state at once
+ // name : control name
+ // isImplemented : the state which the control is implemented in public or not
+ private struct Item
+ {
+ public String name;
+ public bool isImplemented;
+
+ public Item(String name, bool isImplemented)
+ {
+ this.name = name;
+ this.isImplemented = isImplemented;
+ }
+ }
+
+ private Dali.Application _application;
+ private TableView _contentContainer;
+ private Stage _stage;
+ private Popup _popup;
+
+ // List of items
+ private Item[] mViewList = {
+ new Item("PushButton", true), new Item("DropDown", false), new Item("Toggle", false),
+ 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("Tooltip", false), new Item("Popup", true), new Item("Toast", true),
+ new Item("ItemView", false), new Item("CheckBox", true)
+ };
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += OnInitialize;
+ }
+
+ public void OnInitialize(object source, AUIApplicationInitEventArgs e)
+ {
+ Console.WriteLine("Customized Application Initialize event handler");
+ _stage = Stage.GetCurrent();
+ _stage.BackgroundColor = Color.White;
+
+ // Top label
+ TextLabel topLabel = new TextLabel();
+ topLabel.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ topLabel.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
+ topLabel.AnchorPoint = NDalic.AnchorPointTopCenter;
+ topLabel.ParentOrigin = NDalic.ParentOriginTopCenter;
+ topLabel.SetSizeModeFactor(new Vector3( 0.0f, 0.1f, 0.0f ) );
+ topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
+ topLabel.TextColor = NDalic.WHITE;
+ topLabel.Text = " DALi Views";
+ topLabel.HorizontalAlignment = "BEGIN";
+ topLabel.VerticalAlignment = "CENTER";
+ topLabel.PointSize = 42.0f;
+ _stage.Add(topLabel);
+
+ // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right )
+ _contentContainer = new TableView(6, 5);
+ _contentContainer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ _contentContainer.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
+ _contentContainer.SetSizeModeFactor(new Vector3( 0.0f, 0.9f, 0.0f ) );
+ _contentContainer.AnchorPoint = NDalic.AnchorPointBottomCenter;
+ _contentContainer.ParentOrigin = NDalic.ParentOriginBottomCenter;
+ _contentContainer.SetRelativeHeight(0, 0.07f);
+ _contentContainer.SetRelativeHeight(1, 0.26f);
+ _contentContainer.SetRelativeHeight(2, 0.07f);
+ _contentContainer.SetRelativeHeight(3, 0.26f);
+ _contentContainer.SetRelativeHeight(4, 0.07f);
+ _contentContainer.SetRelativeHeight(5, 0.26f);
+ _contentContainer.SetKeyboardFocusable(true);
+ _stage.Add(_contentContainer);
+
+ CreateContent();
+
+ FocusManager.Instance.PreFocusChange += OnPreFocusChange;
+ }
+
+ // Callback for KeyboardFocusManager
+ private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e)
+ {
+ if (!e.Proposed && !e.Current)
+ {
+ e.Proposed = _contentContainer.GetChildAt(1);
+ }
+ return e.Proposed;
+ }
+
+ private void CreateContent()
+ {
+ for (int i = 0; i < mViewList.Length; i++)
+ {
+ CreateItem(mViewList[i], i);
+ }
+ }
+
+ private void CreateItem(Item item, int idx)
+ {
+ // Make label for item
+ TextLabel itemLabel = new TextLabel(" " + item.name);
+ itemLabel.Size = new Vector3(_stage.GetSize().width * 0.2f, _stage.GetSize().height * 0.05f, 0.0f);
+ itemLabel.HorizontalAlignment = "BEGIN";
+ itemLabel.VerticalAlignment = "BOTTOM";
+ itemLabel.PointSize = 18.0f;
+ _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5));
+
+ // If item is implemented in public, attach it on stage
+ if (item.isImplemented)
+ {
+ if (item.name.CompareTo("PushButton") == 0)
+ {
+ PushButton pushButton = new PushButton();
+ pushButton.LabelText = "Push Button";
+ pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+ pushButton.UnselectedColor = new Vector4(1.0f,0.0f,0.0f,1.0f);
+ pushButton.SelectedColor = new Vector4(0.0f,1.0f,0.0f,1.0f);
+ pushButton.Clicked += (obj, e) =>
+ {
+ e.Button.LabelText = "Click Me";
+ e.Button.UnselectedColor = new Vector4(0.0f,0.0f,1.0f,1.0f);
+ return true;
+ };
+
+ _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ if (item.name.CompareTo("DropDown") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("Toggle") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("InputField") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("AnimateGif") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("Loading") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("ProgressBar") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("ScrollBar") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("CheckBox") == 0)
+ {
+ CheckBoxButton checkBoxButton = new CheckBoxButton();
+ checkBoxButton.LabelText = "Yes";
+
+ _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ if (item.name.CompareTo("RadioButton") == 0)
+ {
+ TableView tableView = new TableView(2, 1);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+
+ RadioButton rButton = new RadioButton();
+ rButton.LabelText = "Yes";
+ rButton.Selected = true;
+ tableView.AddChild(rButton, new TableView.CellPosition(0, 0));
+
+ rButton = new RadioButton();
+ rButton.LabelText = "No";
+
+ tableView.AddChild(rButton, new TableView.CellPosition(1, 0));
+
+ _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ if (item.name.CompareTo("Tooltip") == 0)
+ {
+
+ }
+ if (item.name.CompareTo("Popup") == 0)
+ {
+ PushButton button = new PushButton();
+ button.LabelText = "Popup";
+ button.ParentOrigin = NDalic.ParentOriginCenter;
+ button.AnchorPoint = NDalic.AnchorPointCenter;
+ button.MaximumSize = new Vector2(90.0f,50.0f);
+ _popup = CreatePopup();
+ _popup.SetTitle(CreateTitle("Popup"));
+
+ TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?");
+ text.BackgroundColor = Color.White;
+ text.MultiLine = true;
+ text.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ text.SetResizePolicy(ResizePolicyType.DIMENSION_DEPENDENCY, DimensionType.HEIGHT);
+ text.SetPadding(new RectFloat(10.0f, 10.0f, 20.0f, 0.0f));
+ _popup.SetContent(text);
+ _popup.SetKeyboardFocusable(true);
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+
+ button.Clicked += (obj, ee) =>
+ {
+ _stage.Add(_popup);
+ _popup.SetDisplayState(Popup.DisplayStateType.SHOWN);
+ FocusManager.Instance.SetCurrentFocusActor((_popup.FindChildByName( "Footer" )).FindChildByName("OKButton"));
+ return true;
+ };
+ _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ if (item.name.CompareTo("Toast") == 0)
+ {
+ PushButton button = new PushButton();
+ button.LabelText = "Toast";
+ button.ParentOrigin = NDalic.ParentOriginCenter;
+ button.AnchorPoint = NDalic.AnchorPointCenter;
+ button.Clicked += (obj, ee) =>
+ {
+ TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo( "PopupToast" ));
+ if( typeInfo )
+ {
+ BaseHandle baseHandle = typeInfo.CreateInstance();
+ if( baseHandle )
+ {
+ Popup toast = Popup.DownCast( baseHandle );
+ TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself");
+ text.TextColor = Color.White;
+ text.MultiLine = true;
+ text.HorizontalAlignment = "center";
+ toast.SetTitle( text);
+ _stage.Add(toast);
+ toast.SetDisplayState( Popup.DisplayStateType.SHOWN);
+ }
+ }
+ return true;
+ };
+ _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ if (item.name.CompareTo("ItemView") == 0)
+ {
+
+ }
+ }
+ else
+ {
+ ImageView notSupportView = new ImageView("images/not_yet_sign.png");
+ notSupportView.Size = new Vector3(_stage.GetSize().width * 0.2f, _stage.GetSize().height * 0.25f, 0.0f);
+ notSupportView.SetKeyboardFocusable(true);
+ _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ }
+ Popup CreatePopup()
+ {
+ Popup confirmationPopup = new Popup();
+
+ Actor footer = new Actor();
+ footer.SetName("Footer");
+ footer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ footer.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT);
+ footer.SetSize(0.0f, 80.0f);
+ footer.ParentOrigin = NDalic.ParentOriginCenter;
+ footer.AnchorPoint = NDalic.AnchorPointCenter;
+
+ PushButton okButton = CreateOKButton();
+ okButton.ParentOrigin = NDalic.ParentOriginCenter;
+ okButton.AnchorPoint = NDalic.AnchorPointCenter;
+ okButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
+ okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
+
+ PushButton cancelButton = CreateCancelButton();
+ cancelButton.ParentOrigin = NDalic.ParentOriginCenter;
+ cancelButton.AnchorPoint = NDalic.AnchorPointCenter;
+ cancelButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
+ cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
+
+ TableView controlLayout = new TableView(1, 2);
+ controlLayout.ParentOrigin = NDalic.ParentOriginCenter;
+ controlLayout.AnchorPoint = NDalic.AnchorPointCenter;
+ controlLayout.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
+ controlLayout.SetCellPadding(new Size(10.0f, 10.0f));
+ controlLayout.SetRelativeWidth(0, 0.5f);
+ controlLayout.SetRelativeWidth(1, 0.5f);
+ controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
+ controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
+ controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0));
+ controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1));
+
+ footer.Add(controlLayout);
+
+ confirmationPopup.SetFooter(footer);
+ return confirmationPopup;
+ }
+ Actor CreateTitle(string title)
+ {
+ TextLabel titleActor = new TextLabel(title);
+ titleActor.TextColor = Color.White;
+ titleActor.MultiLine = true;
+ titleActor.HorizontalAlignment = "center";
+ return titleActor;
+ }
+
+ PushButton CreateOKButton()
+ {
+ PushButton okayButton = new PushButton();
+ okayButton.SetName("OKButton");
+ okayButton.LabelText = "OK";
+ okayButton.SetKeyboardFocusable(true);
+ okayButton.Clicked += (obj, ee) =>
+ {
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+ return true;
+ };
+ return okayButton;
+ }
+ PushButton CreateCancelButton()
+ {
+ PushButton cancelButton = new PushButton();
+ cancelButton.LabelText = "Cancel";
+ cancelButton.SetKeyboardFocusable(true);
+ cancelButton.Clicked += (obj, ee) =>
+ {
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+ return true;
+ };
+ return cancelButton;
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Hello Mono World");
+
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop();
+ }
+ }
+}
/*
- * 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.
- *
- */
+* 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.
+*
+*/
using System;
using System.Runtime.InteropServices;
using Dali;
+using Dali.Constants;
namespace MyCSharpExample
{
- class Example
- {
- private Dali.Application _application;
+ class Example
+ {
+ private Dali.Application _application;
+ private Animation _animation;
+ private TextLabel _text;
- private Animation _animation;
- private TextLabel _text;
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += Initialize;
+ }
- public Example(Dali.Application application)
- {
- _application = application;
- _application.Initialized += Initialize;
- }
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ Console.WriteLine("Customized Application Initialize event handler");
+ Stage stage = Stage.GetCurrent();
+ stage.BackgroundColor = Color.Cyan;
+ stage.TouchEvent += OnStageTouched;
+ stage.WheelEvent += OnStageWheelMoved;
+ stage.KeyEvent += OnStageKeyPressed;
+ stage.EventProcessingFinished += OnStageEventProcessingFinished;
+
+ // Add a _text label to the stage
+ _text = new TextLabel("Hello Mono World");
+ _text.ParentOrigin = ParentOrigin.Center;
+ _text.AnchorPoint = AnchorPoint.Center;
+ _text.HorizontalAlignment = "CENTER";
+ _text.PointSize = 32.0f;
+ _text.TextColor = Color.Magenta;
+ stage.Add(_text);
+ }
- public void Initialize(object source, AUIApplicationInitEventArgs e)
- {
- Console.WriteLine("Customized Application Initialize event handler");
- Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = Color.Green;
+ // Callback for _animation finished signal handling
+ public void AnimationFinished(object sender, EventArgs e)
+ {
+ Console.WriteLine("AnimationFinished()!");
+ }
- stage.Touched += OnStageTouched;
+ // Callback for _animation finished signal handling
+ public void AnimationFinished2(object sender, EventArgs e)
+ {
+ Console.WriteLine("AnimationFinished2()!");
+ if(_animation)
+ {
+ Console.WriteLine("Duration= " + _animation.Duration);
+ Console.WriteLine("EndAction= " + _animation.EndAction);
+ }
+ }
- // Add a _text label to the stage
- _text = new TextLabel("Hello Mono World");
- _text.ParentOrigin = NDalic.ParentOriginCenter;
- _text.AnchorPoint = NDalic.AnchorPointCenter;
- _text.HorizontalAlignment = "CENTER";
- _text.PointSize = 32.0f;
+ public void OnStageEventProcessingFinished(object sender, EventArgs e)
+ {
+ Console.WriteLine("OnStageEventProcessingFinished()!");
+ if( e != null)
+ {
+ Console.WriteLine("e != null !");
+ }
+ }
- stage.Add(_text);
- }
+ public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e)
+ {
+ Console.WriteLine("OnStageKeyEventOccured()!");
+ Console.WriteLine("keyPressedName=" + e.KeyEvent.keyPressedName);
+ Console.WriteLine("state=" + e.KeyEvent.state);
+ }
- // Callback for _animation finished signal handling
- public void AnimationFinished(object source, Animation.FinishedEventArgs e)
- {
- Console.WriteLine("Customized Animation Finished Event handler");
- Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
- Console.WriteLine("End Action = " + e.Animation.GetEndAction());
- }
+ public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e)
+ {
+ Console.WriteLine("OnStageWheelEventOccured()!");
+ Console.WriteLine("direction=" + e.WheelEvent.direction);
+ Console.WriteLine("type=" + e.WheelEvent.type);
+ }
- // Callback for stage touched signal handling
- public void OnStageTouched(object source, Stage.TouchEventArgs e)
+ // Callback for stage touched signal handling
+ public void OnStageTouched(object sender, Stage.TouchEventArgs e)
+ {
+ // Only animate the _text label when touch down happens
+ if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ {
+ Console.WriteLine("Customized Stage Touch event handler");
+ // Create a new _animation
+ if( _animation )
{
- //TouchData touchData = TouchData.GetTouchDataFromPtr( data );
-
- // Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
- {
- Console.WriteLine("Customized Stage Touch event handler");
- // Create a new _animation
- if( _animation )
- {
- _animation.Reset();
- }
-
- _animation = new Animation(1.0f); // 1 second of duration
-
- _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
-
- _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
-
- // Connect the signal callback for animaiton finished signal
- _animation.Finished += AnimationFinished;
-
- // Play the _animation
- _animation.Play();
-
- Console.WriteLine("Looping:" + _animation.Looping);
- }
+ //_animation.Stop(Dali.Constants.Animation.EndAction.Stop);
+ _animation.Reset();
}
- public void MainLoop()
- {
- _application.MainLoop ();
- }
+ _animation = new Animation {
+ Duration = 2000,
+ StartTime = 0,
+ EndTime = 500,
+ TargetPoperty = "Orientation",
+ Destination = new Quaternion( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis)
+ };
+ _animation.AnimateTo(_text);
+
+ _animation.StartTime = 500;
+ _animation.EndTime = 1000;
+ _animation.TargetPoperty = "Orientation";
+ _animation.Destination = new Quaternion( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis );
+ _animation.AnimateTo(_text);
+
+ _animation.StartTime = 1000;
+ _animation.EndTime = 1500;
+ _animation.TargetPoperty = "ScaleX";
+ _animation.Destination = 3.0f;
+ _animation.AnimateBy(_text);
+
+ _animation.StartTime = 1500;
+ _animation.EndTime = 2000;
+ _animation.TargetPoperty = "ScaleY";
+ _animation.Destination = 4.0f;
+ _animation.AnimateBy(_text);
+
+ _animation.EndAction = Dali.Constants.Animation.EndAction.Discard;
+
+ // Connect the signal callback for animaiton finished signal
+ _animation.Finished += AnimationFinished;
+ _animation.Finished += AnimationFinished2;
+
+ // Play the _animation
+ _animation.Play();
+
+ }
+ }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
- [STAThread]
- static void Main(string[] args)
- {
- Console.WriteLine ("Hello Mono World");
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine ("Main() called!");
- Example example = new Example(Application.NewApplication());
- example.MainLoop ();
- }
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
}
+ }
}
}
// Callback for _animation finished signal handling
- public void AnimationFinished(object source, Animation.FinishedEventArgs e)
+ public void AnimationFinished(object sender, EventArgs e)
{
Console.WriteLine("Customized Animation Finished Event handler");
- Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
}
private void OnKey(object source, View.KeyInputFocusGainedEventArgs e)
{
{
// Make sure when the current spin that takes input focus also takes the keyboard focus
// For example, when you tap the spin directly
- KeyboardFocusManager.Get().SetCurrentFocusActor(_textField);
+ FocusManager.Instance.SetCurrentFocusActor(_textField);
}
public void TextFieldKeyInputFocusLost(object source, KeyInputFocusLostEventArgs e)
_spinDay.SetKeyboardFocusable(true);
_spinDay.Name = "_spinDay";
- KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.Get();
+ FocusManager keyboardFocusManager = FocusManager.Instance;
keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChange;
keyboardFocusManager.FocusedActorEnterKeyPressed += OnFocusedActorEnterKeyPressed;
}
- private Actor OnKeyboardPreFocusChange(object source, KeyboardFocusManager.PreFocusChangeEventArgs e)
+ private Actor OnKeyboardPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e)
{
Actor nextFocusActor = e.Proposed;
return nextFocusActor;
}
- private void OnFocusedActorEnterKeyPressed(object source, KeyboardFocusManager.FocusedActorEnterKeyEventArgs e)
+ private void OnFocusedActorEnterKeyPressed(object source, FocusManager.FocusedActorEnterKeyEventArgs e)
{
// Make the text field in the current focused spin to take the key input
KeyInputFocusManager manager = KeyInputFocusManager.Get();
--- /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.
+*
+*/
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+using Dali.Constants;
+
+namespace MyCSharpExample
+{
+ class Example
+ {
+ private Dali.Application _application;
+ private Animation _animation;
+ private TextLabel _text;
+ private View _view1, _view2, _view3;
+ private UserAlphaFunctionDelegate _user_alpha_func;
+ private int myCount;
+
+ public static void Log(string str)
+ {
+ Console.WriteLine("[DALI C# SAMPLE] " + str);
+ }
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += Initialize;
+ }
+
+ // Declare user alpha function delegate
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate float UserAlphaFunctionDelegate(float progress);
+
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ Log("Initialize() is called!");
+ Stage stage = Stage.GetCurrent();
+ stage.BackgroundColor = Color.White;
+ stage.TouchEvent += OnStageTouched;
+ stage.TouchEvent += OnStageTouched2;
+ //stage.EventProcessingFinished += OnEventProcessingFinished;
+ stage.WheelEvent += OnStageWheelEvent;
+
+ // Add a _text label to the stage
+ _text = new TextLabel("Hello Mono World");
+ _text.ParentOrigin = ParentOrigin.BottomCenter;
+ _text.AnchorPoint = AnchorPoint.BottomCenter;
+ _text.HorizontalAlignment = "CENTER";
+ _text.PointSize = 32.0f;
+ stage.Add(_text);
+
+ _view1 = new View();
+ _view1.Size = new Vector3(200.0f, 200.0f, 0.0f);
+ _view1.BackgroundColor = Color.Green;
+ _view1.ParentOrigin = ParentOrigin.Center;
+ _view1.AnchorPoint = AnchorPoint.Center;
+ _view1.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS);
+ _view1.OnStageEvent += OnStage;
+ stage.Add(_view1);
+
+ _view2 = new View();
+ _view2.BackgroundColor = Color.Red;
+ _view2.Size = new Vector3(50.0f, 50.0f, 0.0f);
+ _view2.ParentOrigin = ParentOrigin.TopLeft;
+ _view2.AnchorPoint = AnchorPoint.TopLeft;
+ _view2.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS);
+ _view1.Add(_view2);
+
+ _view3 = new View();
+ _view3.BackgroundColor = Color.Blue;
+ _view3.Size = new Vector3(50.0f, 50.0f, 0.0f);
+ _view3.ParentOrigin = ParentOrigin.TopLeft;
+ _view3.AnchorPoint = AnchorPoint.TopLeft;
+ _view3.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS);
+ _view1.Add(_view3);
+
+ _user_alpha_func = new UserAlphaFunctionDelegate(body);
+
+ MyAnimating();
+ }
+
+ // User defines alpha function as custom alpha function
+ // Important Notification : when this custom alpha-function is implemented,
+ // the other function call nor other data excess is prevented.
+ // this method must be implemented to calculate the values of input and output purely.
+ // unless, this will cause application crash.
+ float body(float progress)
+ {
+ if (progress > 0.2f && progress< 0.7f)
+ {
+ return progress + 0.8f;
+ }
+ return progress;
+ }
+
+ // Callback for _animation finished signal handling
+ public void AnimationFinished(object sender, EventArgs e)
+ {
+ Log("AnimationFinished() is called!");
+ myCount = 0;
+ }
+
+ public void MyAnimating()
+ {
+ // Create a new _animation
+ if( _animation )
+ {
+ _animation.Clear();
+ _animation.Reset();
+ }
+
+ _animation = new Animation(10000); // 10000 milli-second of duration
+ _animation.StartTime = 5000;
+ _animation.EndTime = 10000;
+ _animation.TargetPoperty = "Position";
+ _animation.AlphaFunction = new AlphaFunction(_user_alpha_func);
+ _animation.Destination = new Vector3(150.0f, 150.0f, 0.0f);
+ _animation.AnimateTo(_view2);
+ // Connect the signal callback for animaiton finished signal
+ _animation.Finished += AnimationFinished;
+ _animation.EndAction = Dali.Constants.Animation.EndAction.Discard;
+ // Play the _animation
+ _animation.Play();
+ }
+
+ // Callback for stage touched signal handling
+ public void OnStageTouched(object source, Stage.TouchEventArgs e)
+ {
+ // Only animate the _text label when touch down happens
+ if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ {
+ Log("OnStageTouched() is called! PointStateType.DOWN came!");
+ myCount++;
+ if( myCount > 1 )
+ {
+ _animation.Stop();
+ Log("_animation.Stop() is called!");
+ }
+ }
+ }
+
+ // Callback for stage touched signal handling
+ public void OnStageTouched2(object source, Stage.TouchEventArgs e)
+ {
+ Log("OnStageTouched2() is called!state="+ e.TouchData.GetState(0) );
+ }
+
+ public void OnEventProcessingFinished(object source)
+ {
+ Log("OnEventProcessingFinished() is called!");
+ }
+
+ public void OnStageWheelEvent(object source, Stage.WheelEventArgs e)
+ {
+ Log("OnStageWheelEvent() is called!");
+ //Log("OnStageWheelEvent() is called!direction="+ e.WheelEvent.direction + " timeStamp=" + e.WheelEvent.timeStamp );
+ }
+
+
+ public void OnStage(object source , View.OnStageEventArgs e)
+ {
+ Log("OnStage() is called!");
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Log("Main() is called!");
+
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
+
+ Log("After MainLoop()");
+ }
+ }
+}
+
*/
using System;
-namespace Dali {
- namespace Constants{
- namespace AlphaFunction {
- public enum BuiltinFunction {
+namespace Dali
+{
+ namespace Constants
+ {
+ namespace AlphaFunction
+ {
+ public enum BuiltinFunction
+ {
Default = Dali.AlphaFunction.BuiltinFunction.DEFAULT,
Linear = Dali.AlphaFunction.BuiltinFunction.LINEAR,
Reverse = Dali.AlphaFunction.BuiltinFunction.REVERSE,
EaseOutBack = Dali.AlphaFunction.BuiltinFunction.EASE_OUT_BACK,
Count = Dali.AlphaFunction.BuiltinFunction.COUNT
}
-
-
- public enum Mode {
+ public enum Mode
+ {
BuiltinFunction = Dali.AlphaFunction.Mode.BUILTIN_FUNCTION,
CustomFunction = Dali.AlphaFunction.Mode.CUSTOM_FUNCTION,
Bezier = Dali.AlphaFunction.Mode.BEZIER
}
-
} // namespace AlphaFunction
- namespace FrameBuffer {
- namespace Attachment {
- public enum Mask {
+ namespace FrameBuffer
+ {
+ namespace Attachment
+ {
+ public enum Mask
+ {
None = Dali.FrameBuffer.Attachment.Mask.NONE, ///< No attachments are created initially @SINCE_1_1.45
Depth = Dali.FrameBuffer.Attachment.Mask.DEPTH, ///< Depth buffer bit-mask value @SINCE_1_1.45
Stencil = Dali.FrameBuffer.Attachment.Mask.STENCIL , ///< Stencil buffer bit-mask value @SINCE_1_1.45
- // Preset bit-mask combinations:
DepthStencil = Dali.FrameBuffer.Attachment.Mask.DEPTH_STENCIL ///< The Framebuffer will be created with depth and stencil buffer @SINCE_1_1.45
}
- } //namespace FrameBuffer
- } // namespace Attachment
-
+ } //namespace Attachment
+ } // namespace FrameBuffer
- public enum TextureType {
+ public enum TextureType
+ {
Texture2D = Dali.TextureType.TEXTURE_2D, ///< One 2D image @SINCE_1_1.43
TextureCube = Dali.TextureType.TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43
}
- /**
- * @brief Stereoscopic view modes
- * @SINCE_1_0.0
- */
- public enum ViewMode {
+ public enum ViewMode
+ {
Mono = Dali.ViewMode.MONO, ///< Monoscopic (single camera). This is the default @SINCE_1_0.0
StereoHorizontal = Dali.ViewMode.STEREO_HORIZONTAL, ///< Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides. @SINCE_1_0.0
StereoVertical = Dali.ViewMode.STEREO_VERTICAL, ///< Stereoscopic. Frame buffer is split vertically with the left camera view at the top and the right camera view at the bottom. @SINCE_1_0.0
StereoInterlaced = Dali.ViewMode.STEREO_INTERLACED ///< @DEPRECATED_1_1.19 @brief Stereoscopic. Left/Right camera views are rendered into the framebuffer on alternate frames. @SINCE_1_0.0
}
- public enum MeshVisualShadingModeValue {
+ public enum MeshVisualShadingModeValue
+ {
TexturelessWithDiffuseLighting = Dali.MeshVisualShadingModeValue.TEXTURELESS_WITH_DIFFUSE_LIGHTING, ///< *Simplest*. One color that is lit by ambient and diffuse lighting. @SINCE_1_1.45
TexturedWithSpecularLigting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_SPECULAR_LIGHTING, ///< Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. @SINCE_1_1.45
TexturedWithDetailedSpecularLighting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ///< Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. @SINCE_1_1.45
}
- /**
- * @brief Projection modes.
- * @SINCE_1_0.0
- */
- public enum ProjectionMode {
+ public enum ProjectionMode
+ {
PerspectiveProjection = Dali.ProjectionMode.PERSPECTIVE_PROJECTION, ///< Distance causes foreshortening; objects further from the camera appear smaller @SINCE_1_0.0
OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0
}
+ namespace Animation
+ {
+ public enum EndAction
+ {
+ Cancel = Dali.Animation.DaliEndAction.Bake,
+ Discard = Dali.Animation.DaliEndAction.Discard,
+ Stop = Dali.Animation.DaliEndAction.BakeFinal
+ }
+ public enum Interpolation
+ {
+ Linear = Dali.Animation.Interpolation.Linear,
+ Cubic = Dali.Animation.Interpolation.Cubic
+ }
+ public enum State
+ {
+ Stopped = Dali.Animation.State.STOPPED,
+ Playing = Dali.Animation.State.PLAYING,
+ Paused = Dali.Animation.State.PAUSED
+ }
+ } //namespace Animation
+
+ public struct ParentOrigin
+ {
+ public static readonly float Top = NDalic.ParentOriginTop;
+ public static readonly float Bottom = NDalic.ParentOriginBottom;
+ public static readonly float Left = NDalic.ParentOriginLeft;
+ public static readonly float Right = NDalic.ParentOriginRight;
+ public static readonly float Middle = NDalic.ParentOriginMiddle;
+ public static readonly Dali.Vector3 TopLeft = NDalic.ParentOriginTopLeft;
+ public static readonly Dali.Vector3 TopCenter = NDalic.ParentOriginTopCenter;
+ public static readonly Dali.Vector3 TopRight = NDalic.ParentOriginTopRight;
+ public static readonly Dali.Vector3 CenterLeft = NDalic.ParentOriginCenterLeft;
+ public static readonly Dali.Vector3 Center = NDalic.ParentOriginCenter;
+ public static readonly Dali.Vector3 CenterRight = NDalic.ParentOriginCenterRight;
+ public static readonly Dali.Vector3 BottomLeft = NDalic.ParentOriginBottomLeft;
+ public static readonly Dali.Vector3 BottomCenter = NDalic.ParentOriginBottomCenter;
+ public static readonly Dali.Vector3 BottomRight = NDalic.ParentOriginBottomRight;
+ }
+
+ public struct AnchorPoint
+ {
+ public static readonly float Top = NDalic.AnchorPointTop;
+ public static readonly float Bottom = NDalic.AnchorPointBottom;
+ public static readonly float Left = NDalic.AnchorPointLeft;
+ public static readonly float Right = NDalic.AnchorPointRight;
+ public static readonly float Middle = NDalic.AnchorPointMiddle;
+ public static readonly Dali.Vector3 TopLeft = NDalic.AnchorPointTopLeft;
+ public static readonly Dali.Vector3 TopCenter = NDalic.AnchorPointTopCenter;
+ public static readonly Dali.Vector3 TopRight = NDalic.AnchorPointTopRight;
+ public static readonly Dali.Vector3 CenterLeft = NDalic.AnchorPointCenterLeft;
+ public static readonly Dali.Vector3 Center = NDalic.AnchorPointCenter;
+ public static readonly Dali.Vector3 CenterRight = NDalic.AnchorPointCenterRight;
+ public static readonly Dali.Vector3 BottomLeft = NDalic.AnchorPointBottomLeft;
+ public static readonly Dali.Vector3 BottomCenter = NDalic.AnchorPointBottomCenter;
+ public static readonly Dali.Vector3 BottomRight = NDalic.AnchorPointBottomRight;
+ }
+
+ public struct Vect3
+ {
+ public static readonly Dali.Vector3 One = Dali.Vector3.ONE;
+ public static readonly Dali.Vector3 Xaxis = Dali.Vector3.XAXIS;
+ public static readonly Dali.Vector3 Yaxis = Dali.Vector3.YAXIS;
+ public static readonly Dali.Vector3 Zaxis = Dali.Vector3.ZAXIS;
+ public static readonly Dali.Vector3 NegativeXaxis = Dali.Vector3.NEGATIVE_XAXIS;
+ public static readonly Dali.Vector3 NegativeYaxis = Dali.Vector3.NEGATIVE_YAXIS;
+ public static readonly Dali.Vector3 NegativeZaxis = Dali.Vector3.NEGATIVE_ZAXIS;
+ public static readonly Dali.Vector3 Zero = Dali.Vector3.ZERO;
+ }
} // namespace Constants
} // namesapce Dali
using System.Runtime.InteropServices;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate void DaliEventHandler<T,U>(T source, U e);
+ public delegate R DaliEventHandlerWithReturnType<T,U,R>(T source, U e);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate R DaliEventHandlerWithReturnType<T,U,R>(T source, U e);
+ public delegate void EventCallbackDelegateType0();
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void EventCallbackDelegateType1<T>(T arg1);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void EventCallbackDelegateType2<T,U>(T arg1, U arg2);
+
+
+ //this should be removed with EventHandler from .NET
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void DaliEventHandler<T,U>(T source, U e);
+
}
using System;
using System.Runtime.InteropServices;
-public class KeyboardFocusManager : BaseHandle {
+public class FocusManager : BaseHandle {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- internal KeyboardFocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) {
+ internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardFocusManager obj) {
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusManager obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- ~KeyboardFocusManager() {
+ ~FocusManager() {
DisposeQueue.Instance.Add(this);
}
}
}
- public KeyboardFocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) {
+ public FocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) {
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- public static KeyboardFocusManager Get() {
- KeyboardFocusManager ret = new KeyboardFocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true);
+ public static FocusManager Get() {
+ FocusManager ret = new FocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
return ret;
}
+ private static readonly FocusManager instance = FocusManager.Get();
+
+ public static FocusManager Instance
+ {
+ get
+ {
+ return instance;
+ }
+ }
+
+
}
}
return ret;
}
- public void Connect(KeyboardFocusManager.PreFocusChangeEventCallbackDelegate func) {
+ public void Connect(FocusManager.PreFocusChangeEventCallbackDelegate func) {
NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Connect(swigCPtr, func);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public static extern uint KeyboardPreFocusChangeSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Connect")]
- public static extern void KeyboardPreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, KeyboardFocusManager.PreFocusChangeEventCallbackDelegate delegate1);
+ public static extern void KeyboardPreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, FocusManager.PreFocusChangeEventCallbackDelegate delegate1);
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Disconnect")]
public static extern void KeyboardPreFocusChangeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
# Extract the property name, type
property = $propertyStruct.new;
+ #First strip out any comments at the end of the macro, some have text like // deprecated
+ commentIndex = propertyMacro.index("//");
+
+ if( commentIndex )
+ propertyMacro = propertyMacro.slice(0..commentIndex-1)
+ end
+
+
# Split the macro definition by comma and quotes, close bracket and delete any empty segments
data = propertyMacro.split(/[\s,")]/).reject { |s| s.empty? }
property.type = data[4]
end
+ # last item should be property enum, e.g. INPUT_POINT_SIZE
property.enum = data[data.length-1]
end