1. GBS Builds
1.1. NON-SMACK Targets
1.2. SMACK enabled Targets
+ 1.3. DEBUG Builds
+ 1.4. MOBILE Profile
2. Building for Ubuntu desktop
2.1. Minimum Requirements
2.2. Building the Repository
gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
-1.3. MOBILE Profile
--------------------
+1.3. DEBUG Builds
+-----------------
- gbs build -A [TARGET_ARCH] --spec dali-toolkit-mobile.spec
+ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
2. Building for Ubuntu desktop
==============================
LIST(APPEND TC_SOURCES
dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
dali-toolkit-test-utils/toolkit-application.cpp
+ dali-toolkit-test-utils/toolkit-bitmap-loader.cpp
dali-toolkit-test-utils/toolkit-clipboard.cpp
dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
{
return TextureSet::New();
}
+
TextureSet CreateTextureSet( Image image )
{
TextureSet textureSet = TextureSet::New();
return vertexData;
}
-Geometry CreateQuadGeometry(void)
-{
- PropertyBuffer vertexData = CreatePropertyBuffer();
- return CreateQuadGeometryFromBuffer( vertexData );
-}
-
-Geometry CreateQuadGeometryFromBuffer( PropertyBuffer vertexData )
-{
- const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
- TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
- vertexData.SetData(texturedQuadVertexData, 4);
-
- unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
-
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexData );
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
-
- return geometry;
-}
-
-
-
} // namespace Dali
Shader CreateShader();
TextureSet CreateTextureSet();
TextureSet CreateTextureSet( Image image );
-Geometry CreateQuadGeometry();
-Geometry CreateQuadGeometryFromBuffer( PropertyBuffer vertexData );
PropertyBuffer CreatePropertyBuffer();
}
Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader )
{
// Create the geometry
- Geometry geometry = CreateQuadGeometry();
+ Geometry geometry = Geometry::QUAD();
// Create Shader
Shader shader = Shader::New( vertexShader, fragmentShader );
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
#include <test-button.h>
-#include <dali/devel-api/object/type-registry-helper.h>
using namespace Dali;
using namespace Dali::Toolkit;
* limitations under the License.
*/
+// CLASS HEADER
+#include "toolkit-bitmap-loader.h"
+
+// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <cstring>
+#include <semaphore.h>
using namespace Dali;
namespace Dali
{
-class Adaptor;
+namespace
+{
+Dali::BitmapLoader gBitmapLoader;
+}
+
namespace Internal
{
mPixelData(),
mUrl(url)
{
+ sem_init( &mySemaphore, 0, 0 );
}
~BitmapLoader(){}
memset(buffer, 0, bufferSize);
mPixelData = PixelData::New( buffer, mSize.GetWidth(), mSize.GetHeight(), Pixel::RGBA8888, PixelData::FREE);
+
+ sem_post( &mySemaphore );
}
PixelDataPtr GetPixelData() const
return mPixelData ? true : false;
}
+ void WaitForLoading()
+ {
+ if( mPixelData )
+ {
+ return;
+ }
+ sem_wait( &mySemaphore );
+ }
+
ImageDimensions mSize;
PixelDataPtr mPixelData;
const std::string mUrl;
+ sem_t mySemaphore;
};
} // internal
Dali::BitmapLoader Dali::BitmapLoader::New(std::string const&url, Dali::Uint16Pair size, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode, bool orientationCorrection)
{
IntrusivePtr<Internal::BitmapLoader> internal = Internal::BitmapLoader::New(url, size, fittingMode, samplingMode, orientationCorrection);
- return BitmapLoader( internal.Get() );
+ gBitmapLoader = BitmapLoader(internal.Get());
+ return gBitmapLoader;
+}
+
+BitmapLoader::BitmapLoader()
+{
}
Dali::BitmapLoader::BitmapLoader(Dali::BitmapLoader const& handle)
Dali::BitmapLoader::~BitmapLoader()
{
}
+BitmapLoader& BitmapLoader::operator=(const BitmapLoader& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
void Dali::BitmapLoader::Load()
{
GetImplementation(*this).Load();
{
return GetImplementation(*this).IsLoaded();
}
+void Dali::BitmapLoader::WaitForLoading()
+{
+ GetImplementation(*this).WaitForLoading();
+}
+
+BitmapLoader Dali::BitmapLoader::GetLatestCreated()
+{
+ return gBitmapLoader;
+}
+
+void Dali::BitmapLoader::ResetLatestCreated()
+{
+ gBitmapLoader.Reset();
+}
} // Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_BITMAP_LOADER_H__
+#define __DALI_TOOLKIT_BITMAP_LOADER_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.
+ */
+
+#define __DALI_BITMAP_LOADER_H__
+
+#include <string>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/images/pixel.h>
+#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/devel-api/images/pixel-data.h>
+
+namespace Dali
+{
+namespace Internal
+{
+class BitmapLoader;
+}
+
+class DALI_IMPORT_API BitmapLoader : public BaseHandle
+{
+public:
+
+ static BitmapLoader New( const std::string& url,
+ ImageDimensions size = ImageDimensions( 0, 0 ),
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR,
+ bool orientationCorrection = true);
+ BitmapLoader();
+ ~BitmapLoader();
+ BitmapLoader(const BitmapLoader& handle);
+ BitmapLoader& operator=(const BitmapLoader& rhs);
+
+public:
+ void Load();
+ bool IsLoaded();
+ std::string GetUrl() const;
+ PixelDataPtr GetPixelData() const;
+
+ void WaitForLoading();
+ static BitmapLoader GetLatestCreated(); // return the latest created BitmapLoader
+ static void ResetLatestCreated();
+
+public: // Not intended for application developers
+
+ explicit DALI_INTERNAL BitmapLoader(Internal::BitmapLoader*);
+};
+
+} // Dali
+
+#endif /* __DALI_TOOLKIT_BITMAP_LOADER_H__ */
*
*/
+// HEADER
#include "toolkit-style-monitor.h"
+// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/signals/dali-signal.h>
#include <dali-toolkit/devel-api/builder/builder.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/object/type-registry-helper.h>
#include <test-button.h>
#include <test-animation-data.h>
propertyMap.Insert( "desiredHeight", 30 );
propertyMap.Insert( "fittingMode", "FIT_HEIGHT" );
propertyMap.Insert( "samplingMode", "BOX_THEN_NEAREST" );
+ propertyMap.Insert( "synchronousLoading", true );
ControlRenderer imageRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( imageRenderer );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
+ value = resultMap.Find( "synchronousLoading", Property::BOOLEAN );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<bool>() == true );
+
// Get an image renderer with an image handle, and test the default property values
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageRenderer = factory.GetControlRenderer(image);
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 200 );
+ value = resultMap.Find( "synchronousLoading", Property::BOOLEAN );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<bool>() == false );
+
END_TEST;
}
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/flex-container/flex-container.h>
using namespace Dali;
using namespace Toolkit;
const char* const PROPERTY_NAME_JUSTIFY_CONTENT = "justifyContent";
const char* const PROPERTY_NAME_ALIGN_ITEMS = "alignItems";
const char* const PROPERTY_NAME_ALIGN_CONTENT = "alignContent";
+const char* const CHILD_PROPERTY_NAME_FLEX = "flex";
+const char* const CHILD_PROPERTY_NAME_ALIGN_SELF = "alignSelf";
+const char* const CHILD_PROPERTY_NAME_FLEX_MARGIN = "flexMargin";
} // namespace
FlexContainer flexContainer = FlexContainer::New();
DALI_TEST_CHECK( flexContainer );
+ // Add flex container to the stage
+ Stage::GetCurrent().Add( flexContainer );
+
+ // Create two actors and add them to the container
+ Actor actor1 = Actor::New();
+ Actor actor2 = Actor::New();
+ DALI_TEST_CHECK( actor1 );
+ DALI_TEST_CHECK( actor2 );
+
+ flexContainer.Add(actor1);
+ flexContainer.Add(actor2);
+
// Check content direction property.
flexContainer.SetProperty( FlexContainer::Property::CONTENT_DIRECTION, FlexContainer::RTL );
DALI_TEST_EQUALS( (FlexContainer::ContentDirection)flexContainer.GetProperty<int>( FlexContainer::Property::CONTENT_DIRECTION ), FlexContainer::RTL, TEST_LOCATION );
END_TEST;
}
+int UtcDaliToolkitFlexContainerSetChildPropertyP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitFlexContainerSetChildPropertyP");
+ FlexContainer flexContainer = FlexContainer::New();
+ DALI_TEST_CHECK( flexContainer );
+
+ // Add flex container to the stage
+ Stage::GetCurrent().Add( flexContainer );
+
+ // Create an actor and add it to the container
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( actor );
+
+ flexContainer.Add(actor);
+
+ // Check flex child property.
+ actor.SetProperty( FlexContainer::ChildProperty::FLEX, 2.0f );
+ DALI_TEST_EQUALS( actor.GetProperty<float>( FlexContainer::ChildProperty::FLEX ), 2.0f, TEST_LOCATION );
+ DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_FLEX ) == FlexContainer::ChildProperty::FLEX );
+
+ // Check align self child property.
+ actor.SetProperty( FlexContainer::ChildProperty::ALIGN_SELF, FlexContainer::ALIGN_FLEX_END );
+ DALI_TEST_EQUALS( (FlexContainer::Alignment)actor.GetProperty<int>( FlexContainer::ChildProperty::ALIGN_SELF ), FlexContainer::ALIGN_FLEX_END, TEST_LOCATION );
+ DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_ALIGN_SELF ) == FlexContainer::ChildProperty::ALIGN_SELF );
+
+ // Check flex margin child property.
+ actor.SetProperty( FlexContainer::ChildProperty::FLEX_MARGIN, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
+ DALI_TEST_EQUALS( actor.GetProperty<Vector4>( FlexContainer::ChildProperty::FLEX_MARGIN ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_FLEX_MARGIN ) == FlexContainer::ChildProperty::FLEX_MARGIN );
+
+ END_TEST;
+}
+
// 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-bitmap-loader.h>
+#include <toolkit-event-thread-callback.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/devel-api/scripting/scripting.h>
const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
const char* TEST_IMAGE_FILE_NAME2 = "gallery_image_02.jpg";
+// resolution: 34*34, pixel format: RGBA8888
+static const char* gImage_34_RGBA = TEST_RESOURCE_DIR "/icon-edit.png";
+// resolution: 600*600, pixel format: RGB888
+static const char* gImage_600_RGB = TEST_RESOURCE_DIR "/test-image-600.jpg";
+
void TestImage( ImageView imageView, BufferImage image )
{
Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
END_TEST;
}
+int UtcDaliImageViewAsyncLoadingWithoutAltasing(void)
+{
+ ToolkitTestApplication application;
+
+ // Async loading, no atlasing for big size image
+ ImageView imageView = ImageView::New( gImage_600_RGB );
+
+ // By default, Aysnc loading is used
+ Stage::GetCurrent().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+ application.Render(16);
+ application.SendNotification();
+
+ // BitmapLoader is not used
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( !loader );
+
+ END_TEST;
+}
+
+int UtcDaliImageViewAsyncLoadingWithAltasing(void)
+{
+ ToolkitTestApplication application;
+
+ //Async loading, automatic atlasing for small size image
+ TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+ callStack.Reset();
+ callStack.Enable(true);
+
+ ImageView imageView = ImageView::New( gImage_34_RGBA, ImageDimensions( 34, 34 ) );
+
+ // By default, Aysnc loading is used
+ // loading is not started if the actor is offStage
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( !loader );
+
+ Stage::GetCurrent().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+ application.Render(16);
+ application.SendNotification();
+
+ // loading started
+ loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+
+ // worker thread is created
+ EventThreadCallback* eventTrigger = EventThreadCallback::Get();
+ DALI_TEST_CHECK( eventTrigger );
+
+ loader.WaitForLoading();// waiting until the image to be loaded
+ DALI_TEST_CHECK( loader.IsLoaded() );
+
+ CallbackBase* callback = eventTrigger->GetCallback();
+ CallbackBase::Execute( *callback );
+
+ application.SendNotification();
+ application.Render(16);
+
+ callStack.Enable(false);
+
+ DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 34, 34" ) );
+
+
+ END_TEST;
+}
+
+int UtcDaliImageViewSyncLoading(void)
+{
+ ToolkitTestApplication application;
+
+ Property::Map syncLoadingMap;
+ syncLoadingMap[ "synchronousLoading" ] = true;
+
+ // Sync loading, no atlasing for big size image
+ {
+ ImageView imageView = ImageView::New( gImage_600_RGB );
+
+ // Sync loading is used
+ imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
+
+ // BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+ }
+
+ // Sync loading, automatic atlasing for small size image
+ {
+ BitmapLoader::ResetLatestCreated();
+ TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+ callStack.Reset();
+ callStack.Enable(true);
+
+ ImageView imageView = ImageView::New( );
+ // Sync loading is used
+ syncLoadingMap[ "url" ] = gImage_34_RGBA;
+ syncLoadingMap[ "desiredHeight" ] = 34;
+ syncLoadingMap[ "desiredWidth" ] = 34;
+ imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
+
+ // loading is started even if the actor is offStage
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+
+ loader.WaitForLoading();
+
+ DALI_TEST_CHECK( loader.IsLoaded() );
+
+ Stage::GetCurrent().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+ DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 34, 34" ) );
+ }
+
+ END_TEST;
+}
+
int UtcDaliImageViewSizeWithBackground(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliTableViewCustomProperties(void)
+int UtcDaliTableViewChildProperties(void)
{
ToolkitTestApplication application;
- tet_infoline("UtcDaliTableViewCustomProperties");
+ tet_infoline("UtcDaliTableViewChildProperties");
// Create a 10x10 table-view
TableView tableView = TableView::New(10,10);
// Create a child actor with the custom properties
Actor child1 = Actor::New();
- child1.RegisterProperty( "cellIndex", Vector2( 3, 4 ), Property::READ_WRITE );
+ child1.SetProperty( TableView::ChildProperty::CELL_INDEX, Vector2( 3, 4 ) );
tableView.Add( child1 );
// Check for actors at actual positions.
DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(3,4)) == child1);
Actor child2 = Actor::New();
float rowSpan = 3.f;
float columnSpan = 2.f;
- child2.RegisterProperty( "cellIndex", Vector2( 6, 1 ), Property::READ_WRITE );
- child2.RegisterProperty( "rowSpan", rowSpan, Property::READ_WRITE );
- child2.RegisterProperty( "columnSpan", columnSpan, Property::READ_WRITE );
+ child2.SetProperty( TableView::ChildProperty::CELL_INDEX, Vector2( 6, 1 ) );
+ child2.SetProperty( TableView::ChildProperty::ROW_SPAN, rowSpan );
+ child2.SetProperty( TableView::ChildProperty::COLUMN_SPAN, columnSpan );
tableView.Add( child2 );
// Check for actors at actual positions.
for( int i=0; i<rowSpan; i++ )
// Create a third child actor with the cell alignment properties
Actor child3 = Actor::New();
child3.SetSize( 5.f,5.f );
- child3.RegisterProperty( "cellHorizontalAlignment", "center", Property::READ_WRITE );
- child3.RegisterProperty( "cellVerticalAlignment", "bottom", Property::READ_WRITE );
+ child3.SetProperty( TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT, "center" );
+ child3.SetProperty( TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT, "bottom" );
tableView.Add( child3 );
// store the actor in the first available cell
const char* const PROPERTY_NAME_UNDERLINE_COLOR = "underlineColor";
const char* const PROPERTY_NAME_UNDERLINE_HEIGHT = "underlineHeight";
const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
+const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
+const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
+const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
+const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_COLOR ) == TextLabel::Property::UNDERLINE_COLOR );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_HEIGHT) == TextLabel::Property::UNDERLINE_HEIGHT );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
END_TEST;
}
label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
+ // Check autoscroll properties
+ const int SCROLL_SPEED = 80;
+ const int SCROLL_LOOPS = 4;
+ const float SCROLL_GAP = 50.0f;
+ label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
+ DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
+ label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
+ DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
+ DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
+ DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
END_TEST;
}
END_TEST;
}
+int UtcDaliToolkitTextlabelScrollingP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
+ TextLabel label = TextLabel::New("Some text to scroll");
+ DALI_TEST_CHECK( label );
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ Stage::GetCurrent().Add( label );
+ // Turn on all the effects
+ label.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
+
+ try
+ {
+ // Render some text with the shared atlas backend
+ label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ application.SendNotification();
+ application.Render();
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
develapibloomviewdir = $(develapicontrolsdir)/bloom-view
develapibubbleemitterdir = $(develapicontrolsdir)/bubble-effect
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
-develapiflexcontainerdir = $(develapicontrolsdir)/flex-container
develapimagnifierdir = $(develapicontrolsdir)/magnifier
develapirendererfactorydir = $(develapicontrolsdir)/renderer-factory
develapipopupdir = $(develapicontrolsdir)/popup
develapibubbleemitter_HEADERS = $(devel_api_bubble_emitter_header_files)
develapibuilder_HEADERS = $(devel_api_builder_header_files)
develapieffectsview_HEADERS = $(devel_api_effects_view_header_files)
-develapiflexcontainer_HEADERS = $(devel_api_flex_container_header_files)
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
develapiimageatlas_HEADERS = $(devel_api_image_atlas_header_files)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
publicapialignmentdir = $(publicapicontrolsdir)/alignment
publicapibuttonsdir = $(publicapicontrolsdir)/buttons
publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls
+publicapiflexcontainerdir = $(publicapicontrolsdir)/flex-container
publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view
publicapiimageviewdir = $(publicapicontrolsdir)/image-view
publicapimodel3dviewdir = $(publicapicontrolsdir)/model3d-view
publicapialignment_HEADERS = $(public_api_alignment_header_files)
publicapibuttons_HEADERS = $(public_api_buttons_header_files)
publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files)
+publicapiflexcontainer_HEADERS = $(public_api_flex_container_header_files)
publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files)
publicapiimageview_HEADERS = $(public_api_image_view_header_files)
publicapiitemview_HEADERS = $(public_api_item_view_header_files)
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
$(devel_api_src_dir)/controls/bloom-view/bloom-view.cpp \
$(devel_api_src_dir)/controls/bubble-effect/bubble-emitter.cpp \
$(devel_api_src_dir)/controls/effects-view/effects-view.cpp \
- $(devel_api_src_dir)/controls/flex-container/flex-container.cpp \
$(devel_api_src_dir)/controls/magnifier/magnifier.cpp \
$(devel_api_src_dir)/controls/popup/confirmation-popup.cpp \
$(devel_api_src_dir)/controls/popup/popup.cpp \
devel_api_effects_view_header_files = \
$(devel_api_src_dir)/controls/effects-view/effects-view.h
-devel_api_flex_container_header_files = \
- $(devel_api_src_dir)/controls/flex-container/flex-container.h
-
devel_api_magnifier_header_files = \
$(devel_api_src_dir)/controls/magnifier/magnifier.h
bool AccessibilityManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
- Dali::BaseHandle handle( object );
-
bool connected( true );
AccessibilityManager* manager = dynamic_cast<AccessibilityManager*>( object );
- if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
- {
- manager->FocusChangedSignal().Connect( tracker, functor );
- }
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_OVERSHOT ) )
- {
- manager->FocusOvershotSignal().Connect( tracker, functor );
- }
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+ if( manager )
{
- manager->FocusedActorActivatedSignal().Connect( tracker, functor );
- }
- else
- {
- // signalName does not match any signal
- connected = false;
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
+ {
+ manager->FocusChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_OVERSHOT ) )
+ {
+ manager->FocusOvershotSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+ {
+ manager->FocusedActorActivatedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
}
return connected;
#include <list>
#include <map>
#include <dali/public-api/common/stage.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-map.h>
// EXTERNAL INCLUDES
#include <dali/public-api/object/property-input.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
namespace Dali
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/devel-api/rendering/renderer.h>
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/object/property-map.h>
#include <dali/devel-api/rendering/renderer.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
// EXTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
#include <sstream>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
namespace
{
-/*
- * Custom properties for how to lay out the actor.
- *
- * When an actor is add to the flex container, the following custom properties of the actor
- * are checked to decide how to lay out the actor inside the flex container.
- *
- * These non-animatable properties should be registered to the child which would be added
- * to the flex container, and once added their values can not be changed.
- */
-const char * const FLEX_PROPERTY_NAME("flex");
-const char * const ALIGN_SELF_PROPERTY_NAME("alignSelf");
-const char * const FLEX_MARGIN_PROPERTY_NAME("flexMargin");
#if defined(DEBUG_ENABLED)
// debugging support, very useful when new features are added or bugs are hunted down
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::FlexContainer, Toolkit::Control, Create );
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "contentDirection", INTEGER, CONTENT_DIRECTION )
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexDirection", INTEGER, FLEX_DIRECTION )
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexWrap", INTEGER, FLEX_WRAP )
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "justifyContent", INTEGER, JUSTIFY_CONTENT )
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignItems", INTEGER, ALIGN_ITEMS )
-DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignContent", INTEGER, ALIGN_CONTENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "contentDirection", INTEGER, CONTENT_DIRECTION )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexDirection", INTEGER, FLEX_DIRECTION )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexWrap", INTEGER, FLEX_WRAP )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "justifyContent", INTEGER, JUSTIFY_CONTENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignItems", INTEGER, ALIGN_ITEMS )
+DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignContent", INTEGER, ALIGN_CONTENT )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flex", FLOAT, FLEX )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignSelf", INTEGER, ALIGN_SELF )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexMargin", VECTOR4, FLEX_MARGIN )
DALI_TYPE_REGISTRATION_END()
childNode->style.maxDimensions[CSS_WIDTH] = childActor.GetMaximumSize().x;
childNode->style.maxDimensions[CSS_HEIGHT] = childActor.GetMaximumSize().y;
- // Test custom properties on the child
- if( childActor.GetPropertyIndex( FLEX_PROPERTY_NAME ) != Property::INVALID_INDEX )
+ // Check child properties on the child for how to layout it.
+ // These properties should be dynamically registered to the child which
+ // would be added to FlexContainer.
+
+ if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE )
{
- childNode->style.flex = childActor.GetProperty( childActor.GetPropertyIndex(FLEX_PROPERTY_NAME) ).Get<float>();
+ childNode->style.flex = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX ).Get<float>();
}
- Property::Index alignSelfPropertyIndex = childActor.GetPropertyIndex( ALIGN_SELF_PROPERTY_NAME );
- if( alignSelfPropertyIndex != Property::INVALID_INDEX )
+ Toolkit::FlexContainer::Alignment alignSelf( Toolkit::FlexContainer::ALIGN_AUTO );
+ if( childActor.GetPropertyType( Toolkit::FlexContainer::FlexContainer::ChildProperty::ALIGN_SELF ) != Property::NONE )
{
- Property::Value alignSelfPropertyValue = childActor.GetProperty( alignSelfPropertyIndex );
-
- Toolkit::FlexContainer::Alignment alignSelf( Toolkit::FlexContainer::ALIGN_AUTO );
+ Property::Value alignSelfPropertyValue = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::ALIGN_SELF );
if( alignSelfPropertyValue.GetType() == Property::INTEGER )
{
alignSelf = static_cast<Toolkit::FlexContainer::Alignment>( alignSelfPropertyValue.Get< int >() );
ALIGN_SELF_STRING_TABLE_COUNT,
alignSelf );
}
- childNode->style.align_self = static_cast<css_align_t>(alignSelf);
}
+ childNode->style.align_self = static_cast<css_align_t>(alignSelf);
- if( childActor.GetPropertyIndex( FLEX_MARGIN_PROPERTY_NAME ) != Property::INVALID_INDEX )
+ if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ) != Property::NONE )
{
- Vector4 flexMargin = childActor.GetProperty( childActor.GetPropertyIndex(FLEX_MARGIN_PROPERTY_NAME) ).Get<Vector4>();
+ Vector4 flexMargin = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ).Get<Vector4>();
childNode->style.margin[CSS_LEFT] = flexMargin.x;
childNode->style.margin[CSS_TOP] = flexMargin.y;
childNode->style.margin[CSS_RIGHT] = flexMargin.z;
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/flex-container/flex-container.h>
+#include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
extern "C"
{
#include "layout.h"
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/integration-api/debug.h>
// EXTERNAL INCLUDES
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
using namespace Dali;
ImageView::ImageView()
-: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
- mPremultipledAlphaEnabled( false )
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) )
{
}
case Toolkit::ImageView::Property::PRE_MULTIPLIED_ALPHA:
{
- bool IsPre;
- if( value.Get( IsPre ) )
+ bool isPre;
+ if( value.Get( isPre ) )
{
- GetImpl(imageView).EnablePreMultipliedAlpha( IsPre );
+ GetImpl(imageView).EnablePreMultipliedAlpha( isPre );
}
break;
}
std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
Image mImage; ///< the Image if the image came from a Image, null otherwise
Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
-
- bool mPremultipledAlphaEnabled; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
};
} // namespace Internal
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraint-source.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
// EXTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
namespace Dali
{
// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
//INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
// EXTERNAL INCLUDES
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <cstring>
namespace Dali
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <dali/devel-api/adaptor-framework/physical-keyboard.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/public-api/animation/constraints.h>
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = RendererFactoryCache::CreateQuadGeometry();
+ geometry = Geometry::QUAD();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
{
IS_ON_STAGE = 1,
IS_FROM_CACHE = 1 << 1,
- IS_PREMULTIPLIED_ALPHA = 1 << 2
+ IS_PREMULTIPLIED_ALPHA = 1 << 2,
+ IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 3
};
struct CustomShader
void ControlRenderer::EnablePreMultipliedAlpha( bool preMultipled )
{
- mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
+ if(preMultipled)
+ {
+ mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
+ }
+ else
+ {
+ mImpl->mFlags &= ~Impl::IS_PREMULTIPLIED_ALPHA;
+ }
+
if( mImpl->mRenderer )
{
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, preMultipled);
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = RendererFactoryCache::CreateQuadGeometry();
+ geometry = Geometry::QUAD();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
#include <cstring> // for strncasecmp
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/images/native-image.h>
+#include <dali/devel-api/images/atlas.h>
+#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/integration-api/debug.h>
// INTERNAL HEADER
const char * const IMAGE_SAMPLING_MODE( "samplingMode" );
const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
+const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
// fitting modes
const char * const SHRINK_TO_FIT("SHRINK_TO_FIT");
geometry = factoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = RendererFactoryCache::CreateQuadGeometry();
+ geometry = Geometry::QUAD();
factoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
}
}
mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+
+ }
+
+ Property::Value* syncLoading = propertyMap.Find( SYNCHRONOUS_LOADING );
+ if( syncLoading )
+ {
+ bool sync;
+ syncLoading->Get( sync );
+ if( sync )
+ {
+ mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ }
+ else
+ {
+ mImpl->mFlags &= ~Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ }
+ }
+
+ // if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage
+ // ( for on-stage actor with image url unchanged, resource loading is already finished)
+ if( ( !mImpl->mRenderer || imageURLValue) && IsSynchronousResourceLoading() )
+ {
+ DoSynchronousResourceLoading();
}
// remove old renderer if exit
}
}
- TextureSet textureSet = TextureSet::New();
-
Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
return renderer;
}
else
{
geometry = CreateGeometry( mFactoryCache, mImpl->mCustomShader->mGridSize );
- if( mImpl->mCustomShader->mVertexShader.empty() && mImpl->mCustomShader->mFragmentShader.empty() )
+ shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? VERTEX_SHADER : mImpl->mCustomShader->mVertexShader,
+ mNativeFragmentShaderCode,
+ mImpl->mCustomShader->mHints );
+ if( mImpl->mCustomShader->mVertexShader.empty() )
{
- shader = Shader::New( VERTEX_SHADER, mNativeFragmentShaderCode );
- }
- else
- {
- shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? VERTEX_SHADER : mImpl->mCustomShader->mVertexShader,
- mNativeFragmentShaderCode,
- mImpl->mCustomShader->mHints );
- if( mImpl->mCustomShader->mVertexShader.empty() )
- {
- shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
- shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
- }
+ shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
+ shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
}
}
return renderer;
}
+
+bool ImageRenderer::IsSynchronousResourceLoading() const
+{
+ return mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+}
+
+void ImageRenderer::DoSynchronousResourceLoading()
+{
+ if( !mImageUrl.empty() )
+ {
+ BitmapLoader loader = BitmapLoader::New( mImageUrl, mDesiredSize, mFittingMode, mSamplingMode );
+ loader.Load();
+ mPixels = loader.GetPixelData();
+ }
+}
+
+Image ImageRenderer::LoadImage( const std::string& url, bool synchronousLoading )
+{
+ if( synchronousLoading )
+ {
+ if( !mPixels )
+ {
+ // use broken image
+ return RendererFactory::GetBrokenRendererImage();
+ }
+ Atlas image = Atlas::New( mPixels->GetWidth(), mPixels->GetHeight(), mPixels->GetPixelFormat() );
+ image.Upload( mPixels, 0, 0 );
+ return image;
+ }
+ else
+ {
+ ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
+ resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
+ return resourceImage;
+ }
+}
+
+TextureSet ImageRenderer::CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading )
+{
+ TextureSet textureSet;
+ textureRect = FULL_TEXTURE_RECT;
+ if( synchronousLoading )
+ {
+ if( !mPixels )
+ {
+ // use broken image
+ textureSet = TextureSet::New();
+ textureSet.SetImage( 0u, RendererFactory::GetBrokenRendererImage() );
+ }
+ else
+ {
+ textureSet = mAtlasManager.Add(textureRect, mPixels );
+ if( !textureSet ) // big image, no atlasing
+ {
+ Atlas image = Atlas::New( mPixels->GetWidth(), mPixels->GetHeight(), mPixels->GetPixelFormat() );
+ image.Upload( mPixels, 0, 0 );
+ textureSet = TextureSet::New();
+ textureSet.SetImage( 0u, image );
+ }
+ }
+ }
+ else
+ {
+ textureSet = mAtlasManager.Add(textureRect, url, mDesiredSize, mFittingMode, mSamplingMode );
+ if( !textureSet ) // big image, no atlasing
+ {
+ ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
+ resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
+ textureSet = TextureSet::New();
+ textureSet.SetImage( 0u, resourceImage );
+ }
+ }
+
+ return textureSet;
+}
+
void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
{
if( imageUrl.empty() )
if( !mImpl->mRenderer )
{
Vector4 atlasRect;
- TextureSet textureSet = mAtlasManager.Add(atlasRect, imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
- if( textureSet )
+ TextureSet textureSet = CreateTextureSet(atlasRect, imageUrl, IsSynchronousResourceLoading() );
+ Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
+ Shader shader( GetImageShader(mFactoryCache) );
+ mImpl->mRenderer = Renderer::New( geometry, shader );
+ mImpl->mRenderer.SetTextures( textureSet );
+ if( atlasRect != FULL_TEXTURE_RECT )
{
- Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
- Shader shader( GetImageShader(mFactoryCache) );
- mImpl->mRenderer = Renderer::New( geometry, shader );
- mImpl->mRenderer.SetTextures( textureSet );
mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
}
- else // big image, atlasing is not applied
- {
- mImpl->mRenderer = CreateRenderer();
-
- ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
- image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
- TextureSet textureSet = mImpl->mRenderer.GetTextures();
- textureSet.SetImage( 0u, image );
- }
-
mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
}
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
mImpl->mRenderer = CreateRenderer();
- ResourceImage resourceImage = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
- resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
- ApplyImageToSampler( resourceImage );
+ Image image = LoadImage( imageUrl, IsSynchronousResourceLoading() );
+ ApplyImageToSampler( image );
}
}
{
map.Clear();
map.Insert( RENDERER_TYPE, IMAGE_RENDERER );
+
+ bool sync = IsSynchronousResourceLoading();
+ map.Insert( SYNCHRONOUS_LOADING, sync );
if( !mImageUrl.empty() )
{
map.Insert( IMAGE_URL_NAME, mImageUrl );
mSamplingMode = samplingMode;
mImage.Reset();
+ if( IsSynchronousResourceLoading() )
+ {
+ DoSynchronousResourceLoading();
+ }
+
if( mImpl->mRenderer )
{
if( GetIsFromCache() ) // if renderer is from cache, remove the old one
}
else // if renderer is not from cache, reuse the same renderer and only change the texture
{
- ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
- image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
+ Image image = LoadImage( imageUrl, IsSynchronousResourceLoading() );
ApplyImageToSampler( image );
}
}
if( image )
{
TextureSet textureSet = mImpl->mRenderer.GetTextures();
- if( textureSet )
+ if( !textureSet )
{
- textureSet.SetImage( 0u, image );
+ textureSet = TextureSet::New();
+ mImpl->mRenderer.SetTextures( textureSet );
}
+ textureSet.SetImage( 0u, image );
}
}
{
mNativeFragmentShaderCode.replace( mNativeFragmentShaderCode.find( DEFAULT_SAMPLER_TYPENAME ), strlen( DEFAULT_SAMPLER_TYPENAME ), customSamplerTypename );
}
-
}
} // namespace Internal
*
* The following properties are optional
*
- * | %Property Name | Type |
- * |-------------------------|------------------|
+ * | %Property Name | Type |
+ * |--------------------|------------------|
* | url | STRING |
* | fittingMode | STRING |
* | samplingMode | STRING |
* | desiredWidth | INT |
* | desiredHeight | INT |
+ * | synchronousLoading | BOOLEAN |
*
* where imageFittingMode should be one of the following fitting modes:
* "SHRINK_TO_FIT"
* The renderer will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
*
* @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
- * @param[in] imageUrl The URL to to image resource to use
+ * @param[in] imageUrl The URL of the image resource to use
* @param[in] size The width and height to fit the loaded image to.
* @param[in] fittingMode The FittingMode of the resource to load
* @param[in] samplingMode The SamplingMode of the resource to load
Renderer CreateNativeImageRenderer() const;
/**
+ * @brief Query whether resources requires to be loaded synchronously.
+ * @return Returns true if synchronoud resource loading is required, false otherwise.
+ */
+ bool IsSynchronousResourceLoading() const;
+
+ /**
+ * @brief Do the synchronous resource loading
+ */
+ void DoSynchronousResourceLoading();
+
+ /**
+ * Load the image.
+ * @param[in] url The URL of the image resource to use.
+ * @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously.
+ */
+ Image LoadImage( const std::string& url, bool synchronousLoading );
+
+ /**
+ * Load the image and create a texture set to hold the texture, with automatic atlasing applied.
+ * @param [out] textureRect The texture area of the resource image in the atlas.
+ * @param[in] url The URL of the image resource to use.
+ * @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously.
+ */
+ TextureSet CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading );
+
+ /**
* Callback function of image resource loading succeed
* @param[in] image The Image content that we attempted to load from mImageUrl
*/
private:
Image mImage;
ImageAtlasManager& mAtlasManager;
+ PixelDataPtr mPixels;
std::string mImageUrl;
Dali::ImageDimensions mDesiredSize;
return mDebugRenderer;
}
-Geometry RendererFactoryCache::CreateQuadGeometry()
-{
- const float halfWidth = 0.5f;
- const float halfHeight = 0.5f;
- struct QuadVertex { Vector2 position;};
- QuadVertex quadVertexData[4] =
- {
- { Vector2(-halfWidth, -halfHeight) },
- { Vector2(-halfWidth, halfHeight) },
- { Vector2( halfWidth, -halfHeight) },
- { Vector2( halfWidth, halfHeight) }
- };
-
- Property::Map quadVertexFormat;
- quadVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
- quadVertices.SetData( quadVertexData, 4 );
-
- // Create the geometry object
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( quadVertices );
- geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
-
- return geometry;
-}
-
SvgRasterizeThread* RendererFactoryCache::GetSVGRasterizationThread()
{
if( !mSvgRasterizeThread )
*/
void SaveShader( ShaderType type, Shader shader );
- /*
- * Greate the quad geometry.
- * Quad geometry is shared by multiple kind of Renderer, so implement it in the factory-cache.
- */
- static Geometry CreateQuadGeometry();
-
/**
* Create the grid geometry.
* @param[in] gridSize The size of the grid.
*/
// CLASS HEADER
-#include "renderer-factory-impl.h"
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
-// Internal HEADER
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/renderers/border/border-renderer.h>
#include <dali-toolkit/internal/controls/renderers/color/color-renderer.h>
#include <dali-toolkit/internal/controls/renderers/debug/debug-renderer.h>
{
char id[64];
char ref[64];
- char type;
+
+ /**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char type' with 'signed char type' here.
+ */
+ signed char type;
union {
NSVGlinearData linear;
NSVGradialData radial;
};
char spread;
- char units;
+
+ /**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char units' with 'signed char units' here.
+ */
+ signed char units;
float xform[6];
int nstops;
NSVGgradientStop* stops;
return NULL;
}
-static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, char* paintType)
+/**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char paintType' with 'signed char paintType' here.
+ */
+static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, signed char* paintType)
{
NSVGattrib* attr = nsvg__getAttr(p);
NSVGgradientData* data = NULL;
} NSVGgradient;
typedef struct NSVGpaint {
- char type;
+ /**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char type' with 'signed char type' here.
+ */
+ signed char type;
union {
unsigned int color;
NSVGgradient* gradient;
} NSVGmemPage;
typedef struct NSVGcachedPaint {
- char type;
+ /**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char type' with 'signed char type' here.
+ */
+ signed char type;
char spread;
float xform[6];
unsigned int colors[256];
// note: this routine clips fills that extend off the edges... ideally this
// wouldn't happen, but it could happen if the truetype glyph bounding boxes
// are wrong, or if the user supplies a too-small bitmap
-static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule)
+
+ /**
+ * In the original file, using char type (without signed or unsigned) can be interpreted
+ * as 'unsigned char' in some build environments, like ARM architecture.
+ * To prevent the unexpected behavior, we replace 'char fillRule' with 'signed char fillRule' here.
+ */
+static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, signed char fillRule)
{
// non-zero winding fill
int x0 = 0, w = 0;
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = mFactoryCache.CreateQuadGeometry();
+ geometry = Geometry::QUAD();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
TextureSet textureSet = TextureSet::New();
/*
- * 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.
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/property-array.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
-
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
{
const char* DEFAULT_INDICATOR_IMAGE_PATH = DALI_IMAGE_DIR "popup_scroll.9.png";
-const float MINIMUM_INDICATOR_HEIGHT(20.0f); // The minimum indicator height for the nine patch border
const float DEFAULT_SLIDER_DEPTH(1.0f);
const float DEFAULT_INDICATOR_SHOW_DURATION(0.5f);
const float DEFAULT_INDICATOR_HIDE_DURATION(0.5f);
const float DEFAULT_PAN_GESTURE_PROCESS_TIME(16.7f); // 16.7 milliseconds, i.e. one frame
const float DEFAULT_INDICATOR_FIXED_HEIGHT(80.0f);
+const float DEFAULT_INDICATOR_MINIMUM_HEIGHT(0.0f);
+const float DEFAULT_INDICATOR_START_PADDING(0.0f);
+const float DEFAULT_INDICATOR_END_PADDING(0.0f);
/**
* Indicator size constraint
*/
struct IndicatorSizeConstraint
{
- IndicatorSizeConstraint()
+ /**
+ * @param[in] minimumHeight The minimum height for the indicator
+ * @param[in] padding The sum of the padding at the start & end of the indicator
+ */
+ IndicatorSizeConstraint( float minimumHeight, float padding )
+ : mMinimumHeight( minimumHeight ),
+ mPadding( padding )
{
}
* @param[in] parentSizeProperty The parent size of scroll indicator.
* @return The new scroll indicator size.
*/
- void operator()(Vector3& current, const PropertyInputContainer& inputs )
+ void operator()( Vector3& current, const PropertyInputContainer& inputs )
{
const Vector3& parentSize = inputs[0]->GetVector3();
const float contentSize = inputs[1]->GetFloat();
- float height = contentSize > parentSize.height ?
- parentSize.height * ( parentSize.height / contentSize ) :
- parentSize.height * ( (parentSize.height - contentSize * 0.5f) / parentSize.height);
+ // Take into account padding that may exist at the beginning and end of the indicator.
+ const float parentHeightMinusPadding = parentSize.height - mPadding;
- current.y = std::max(MINIMUM_INDICATOR_HEIGHT, height);
+ float height = contentSize > parentHeightMinusPadding ?
+ parentHeightMinusPadding * ( parentHeightMinusPadding / contentSize ) :
+ parentHeightMinusPadding * ( ( parentHeightMinusPadding - contentSize * 0.5f ) / parentHeightMinusPadding );
+
+ current.y = std::max( mMinimumHeight, height );
}
+
+ float mMinimumHeight;
+ float mPadding;
};
/**
struct IndicatorPositionConstraint
{
/**
- * @param[in] minPosition The minimum limit of scroll position
- * @param[in] maxPosition the maximum limit of scroll position
+ * @param[in] startPadding The padding at the start of the indicator
+ * @param[in] endPadding The padding at the end of the indicator
*/
- IndicatorPositionConstraint()
+ IndicatorPositionConstraint( float startPadding, float endPadding )
+ : mStartPadding( startPadding ),
+ mEndPadding( endPadding )
{
}
const Vector3& indicatorSize = inputs[0]->GetVector3();
const Vector3& parentSize = inputs[1]->GetVector3();
const float scrollPosition = -inputs[2]->GetFloat();
- const float minScrollPosition = inputs[3]->GetFloat();
- const float maxScrollPosition = inputs[4]->GetFloat();
+ const float minimumScrollPosition = inputs[3]->GetFloat();
+ const float maximumScrollPosition = inputs[4]->GetFloat();
- float relativePosition = std::max( 0.0f, std::min( 1.0f, (scrollPosition - minScrollPosition) / (maxScrollPosition - minScrollPosition) ) );
- current.y = ( parentSize.height - indicatorSize.height ) * relativePosition;
+ // Take into account padding that may exist at the beginning and end of the indicator.
+ const float parentHeightMinusPadding = parentSize.height - ( mStartPadding + mEndPadding );
+
+ float relativePosition = std::max( 0.0f, std::min( 1.0f, ( scrollPosition - minimumScrollPosition ) / ( maximumScrollPosition - minimumScrollPosition ) ) );
+ current.y = mStartPadding + ( parentHeightMinusPadding - indicatorSize.height ) * relativePosition;
current.z = DEFAULT_SLIDER_DEPTH;
}
+
+ float mStartPadding;
+ float mEndPadding;
};
} // unnamed namespace
DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorShowDuration", FLOAT, INDICATOR_SHOW_DURATION )
DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorHideDuration", FLOAT, INDICATOR_HIDE_DURATION )
DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "scrollPositionIntervals", ARRAY, SCROLL_POSITION_INTERVALS )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorMinimumHeight", FLOAT, INDICATOR_MINIMUM_HEIGHT )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorStartPadding", FLOAT, INDICATOR_START_PADDING )
+DALI_PROPERTY_REGISTRATION( Toolkit, ScrollBar, "indicatorEndPadding", FLOAT, INDICATOR_END_PADDING )
DALI_SIGNAL_REGISTRATION( Toolkit, ScrollBar, "panFinished", PAN_FINISHED_SIGNAL )
DALI_SIGNAL_REGISTRATION( Toolkit, ScrollBar, "scrollPositionIntervalReached", SCROLL_POSITION_INTERVAL_REACHED_SIGNAL )
mCurrentScrollPosition(0.0f),
mIndicatorHeightPolicy(Toolkit::ScrollBar::Variable),
mIndicatorFixedHeight(DEFAULT_INDICATOR_FIXED_HEIGHT),
+ mIndicatorMinimumHeight(DEFAULT_INDICATOR_MINIMUM_HEIGHT),
+ mIndicatorStartPadding(DEFAULT_INDICATOR_START_PADDING),
+ mIndicatorEndPadding(DEFAULT_INDICATOR_END_PADDING),
mIsPanning(false),
mIndicatorFirstShow(true)
{
}
else
{
- mIndicatorSizeConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::SIZE, IndicatorSizeConstraint() );
+ mIndicatorSizeConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::SIZE,
+ IndicatorSizeConstraint( mIndicatorMinimumHeight, mIndicatorStartPadding + mIndicatorEndPadding ) );
mIndicatorSizeConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
mIndicatorSizeConstraint.AddSource( Source( scrollableHandle, mPropertyScrollContentSize ) );
mIndicatorSizeConstraint.Apply();
mIndicatorPositionConstraint.Remove();
}
- mIndicatorPositionConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::POSITION, IndicatorPositionConstraint() );
+ mIndicatorPositionConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::POSITION,
+ IndicatorPositionConstraint( mIndicatorStartPadding, mIndicatorEndPadding ) );
mIndicatorPositionConstraint.AddSource( LocalSource( Actor::Property::SIZE ) );
mIndicatorPositionConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
mIndicatorPositionConstraint.AddSource( Source( scrollableHandle, mPropertyScrollPosition ) );
}
case Gesture::Continuing:
{
- Vector3 delta(gesture.displacement.x, gesture.displacement.y, 0.0f);
- mGestureDisplacement+=delta;
+ mGestureDisplacement.x += gesture.displacement.x;
+ mGestureDisplacement.y += gesture.displacement.y;
- Vector3 span = Self().GetCurrentSize() - mIndicator.GetCurrentSize();
- float minScrollPosition = scrollableHandle.GetProperty<float>(mPropertyMinScrollPosition);
- float maxScrollPosition = scrollableHandle.GetProperty<float>(mPropertyMaxScrollPosition);
+ float minScrollPosition = scrollableHandle.GetProperty<float>( mPropertyMinScrollPosition );
+ float maxScrollPosition = scrollableHandle.GetProperty<float>( mPropertyMaxScrollPosition );
+
+ // The domain size is the internal range
float domainSize = maxScrollPosition - minScrollPosition;
+ float logicalSize = Self().GetCurrentSize().y - ( mIndicator.GetCurrentSize().y + mIndicatorStartPadding + mIndicatorEndPadding );
- mCurrentScrollPosition = mScrollStart - mGestureDisplacement.y * domainSize / span.y;
- mCurrentScrollPosition = 0.0f - std::min(maxScrollPosition, std::max(-mCurrentScrollPosition, minScrollPosition));
+ mCurrentScrollPosition = mScrollStart - ( ( mGestureDisplacement.y * domainSize ) / logicalSize );
+ mCurrentScrollPosition = -std::min( maxScrollPosition, std::max( -mCurrentScrollPosition, minScrollPosition ) );
break;
}
void ScrollBar::SetIndicatorHeightPolicy( Toolkit::ScrollBar::IndicatorHeightPolicy policy )
{
- mIndicatorHeightPolicy = policy;
- ApplyConstraints();
+ if( policy != mIndicatorHeightPolicy )
+ {
+ mIndicatorHeightPolicy = policy;
+ ApplyConstraints();
+ }
}
Toolkit::ScrollBar::IndicatorHeightPolicy ScrollBar::GetIndicatorHeightPolicy() const
}
break;
}
+ case Toolkit::ScrollBar::Property::INDICATOR_MINIMUM_HEIGHT:
+ {
+ scrollBarImpl.mIndicatorMinimumHeight = value.Get<float>();
+ scrollBarImpl.ApplyConstraints();
+ break;
+ }
+ case Toolkit::ScrollBar::Property::INDICATOR_START_PADDING:
+ {
+ scrollBarImpl.mIndicatorStartPadding = value.Get<float>();
+ scrollBarImpl.ApplyConstraints();
+ break;
+ }
+ case Toolkit::ScrollBar::Property::INDICATOR_END_PADDING:
+ {
+ scrollBarImpl.mIndicatorEndPadding = value.Get<float>();
+ scrollBarImpl.ApplyConstraints();
+ break;
+ }
}
}
}
}
break;
}
+ case Toolkit::ScrollBar::Property::INDICATOR_MINIMUM_HEIGHT:
+ {
+ value = scrollBarImpl.mIndicatorMinimumHeight;
+ break;
+ }
+ case Toolkit::ScrollBar::Property::INDICATOR_START_PADDING:
+ {
+ value = scrollBarImpl.mIndicatorStartPadding;
+ break;
+ }
+ case Toolkit::ScrollBar::Property::INDICATOR_END_PADDING:
+ {
+ value = scrollBarImpl.mIndicatorEndPadding;
+ break;
+ }
}
}
return value;
#define __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_H__
/*
- * 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.
Toolkit::ScrollBar::Direction mDirection; ///< The direction of scroll bar (vertical or horizontal)
- WeakHandleBase mScrollableObject; ///< Object to be scrolled
+ WeakHandleBase mScrollableObject; ///< Object to be scrolled
Property::Index mPropertyScrollPosition; ///< Index of scroll position property owned by the object to be scrolled
Property::Index mPropertyMinScrollPosition; ///< Index of minimum scroll position property owned by the object to be scrolled
Property::Index mPropertyMaxScrollPosition; ///< Index of maximum scroll position property owned by the object to be scrolled
Property::Index mPropertyScrollContentSize; ///< Index of scroll content size property owned by the object to be scrolled
- float mIndicatorShowDuration; ///< The duration of scroll indicator show animation
- float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation
+ float mIndicatorShowDuration; ///< The duration of scroll indicator show animation
+ float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation
float mScrollStart; ///< Scroll Start position (start of drag)
Vector3 mGestureDisplacement; ///< Gesture Displacement.
- float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture
+ float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture
Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy; ///< The height policy of scroll indicator (variable or fixed)
- float mIndicatorFixedHeight; ///< The fixed height of scroll indicator
+ float mIndicatorFixedHeight; ///< The fixed height of scroll indicator
+ float mIndicatorMinimumHeight; ///< The minimum height for a variable size indicator
+ float mIndicatorStartPadding; ///< The padding at the start of the indicator
+ float mIndicatorEndPadding; ///< The padding at the end of the indicator
Timer mContractDelayTimer; ///< Timer guarantee contract delay time.
Timer mPanProcessTimer; ///< The timer to process the pan gesture after the gesture is started.
- Dali::Vector<float> mScrollPositionIntervals; ///< List of values to receive notification for when the current scroll position goes above or below them
+ Dali::Vector<float> mScrollPositionIntervals; ///< List of values to receive notification for when the current scroll position goes above or below them
PropertyNotification mPositionNotification; ///< Stores the property notification used for scroll position changes
PanFinishedSignalType mPanFinishedSignal;
Constraint mIndicatorSizeConstraint;
Constraint mScrollPositionInCurrentAxisConstraint;
- bool mIsPanning : 1; ///< Whether the scroll bar is being panned.
- bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
+ bool mIsPanning : 1; ///< Whether the scroll bar is being panned.
+ bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
};
} // namespace Internal
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/integration-api/debug.h>
#include <limits>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/rendering/renderer.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
#include <sstream>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
namespace
{
-/*
- * Custom properties for where to put the actor.
- *
- * When an actor is add to the tableView through Actor::Add() instead of TableView::AddChild,
- * the following custom properties of the actor are checked to decide the actor position inside the table
- *
- * These non-animatable properties should be registered to the child which would be added to the table
- */
-const char * const CELL_INDEX_PROPERTY_NAME("cellIndex");
-const char * const ROW_SPAN_PROPERTY_NAME("rowSpan");
-const char * const COLUMN_SPAN_PROPERTY_NAME("columnSpan");
-const char * const CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME("cellHorizontalAlignment");
-const char * const CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME("cellVerticalAlignment");
-
/**
* @brief Should the tableview fit around the given actor
*
DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "cellPadding", VECTOR2, CELL_PADDING )
DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layoutRows", MAP, LAYOUT_ROWS )
DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layoutColumns", MAP, LAYOUT_COLUMNS )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, TableView, "cellIndex", VECTOR2, CELL_INDEX )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, TableView, "rowSpan", FLOAT, ROW_SPAN )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, TableView, "columnSpan", FLOAT, COLUMN_SPAN )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, TableView, "cellHorizontalAlignment", STRING, CELL_HORIZONTAL_ALIGNMENT )
+DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, TableView, "cellVerticalAlignment", STRING, CELL_VERTICAL_ALIGNMENT )
DALI_TYPE_REGISTRATION_END()
return;
}
- // Test properties on actor
+ // Check child properties on actor to decide its position inside the table
HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT;
VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP;
- if( child.GetPropertyIndex( CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME ) != Property::INVALID_INDEX )
+
+ if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ) != Property::NONE )
{
- std::string value = child.GetProperty( child.GetPropertyIndex(CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME) ).Get<std::string >();
+ std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ).Get<std::string >();
Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(),
HORIZONTAL_ALIGNMENT_STRING_TABLE,
HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
horizontalAlignment );
}
- if( child.GetPropertyIndex( CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME ) != Property::INVALID_INDEX )
+
+ if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ) != Property::NONE )
{
- std::string value = child.GetProperty( child.GetPropertyIndex(CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME) ).Get<std::string >();
+ std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ).Get<std::string >();
Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(),
VERTICAL_ALIGNMENT_STRING_TABLE,
VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
verticalAlignment );
}
-
Toolkit::TableView::CellPosition cellPosition;
- if( child.GetPropertyIndex(ROW_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
+ if( child.GetPropertyType( Toolkit::TableView::ChildProperty::ROW_SPAN ) != Property::NONE )
{
- cellPosition.rowSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(ROW_SPAN_PROPERTY_NAME) ).Get<float>() );
+ cellPosition.rowSpan = static_cast<unsigned int>( child.GetProperty( Toolkit::TableView::ChildProperty::ROW_SPAN ).Get<float>() );
}
- if( child.GetPropertyIndex(COLUMN_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
+ if( child.GetPropertyType( Toolkit::TableView::ChildProperty::COLUMN_SPAN ) != Property::NONE )
{
- cellPosition.columnSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(COLUMN_SPAN_PROPERTY_NAME) ).Get<float>() );
+ cellPosition.columnSpan = static_cast<unsigned int>( child.GetProperty( Toolkit::TableView::ChildProperty::COLUMN_SPAN ).Get<float>() );
}
- if( child.GetPropertyIndex(CELL_INDEX_PROPERTY_NAME) != Property::INVALID_INDEX )
+ if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_INDEX ) != Property::NONE )
{
- Vector2 indices = child.GetProperty( child.GetPropertyIndex(CELL_INDEX_PROPERTY_NAME) ).Get<Vector2 >();
+ Vector2 indices = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_INDEX ).Get<Vector2 >();
cellPosition.rowIndex = static_cast<unsigned int>( indices.x );
cellPosition.columnIndex = static_cast<unsigned int>( indices.y );
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
// EXTERNAL INCLUDES
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
+#include <dali-toolkit/internal/text/text-definitions.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
using Dali::Toolkit::Text::LayoutEngine;
namespace
{
-#if defined(DEBUG_ENABLED)
- Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+#if defined ( DEBUG_ENABLED )
+ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextLabel, Toolkit::Control, Create );
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", STRING, FONT_STYLE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalAlignment", STRING, VERTICAL_ALIGNMENT )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textColor", VECTOR4, TEXT_COLOR )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowOffset", VECTOR2, SHADOW_OFFSET )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowColor", VECTOR4, SHADOW_COLOR )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalAlignment", STRING, VERTICAL_ALIGNMENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textColor", VECTOR4, TEXT_COLOR )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowOffset", VECTOR2, SHADOW_OFFSET )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowColor", VECTOR4, SHADOW_COLOR )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableAutoScroll", BOOLEAN, ENABLE_AUTO_SCROLL )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
DALI_TYPE_REGISTRATION_END()
+
+
} // namespace
Toolkit::TextLabel TextLabel::New()
{
const std::string fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
impl.mController->SetDefaultFontFamily( fontFamily );
}
break;
}
break;
}
+ case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
+ {
+ if( impl.mController )
+ {
+ const bool enableAutoScroll = value.Get<bool>();
+ // If request to auto scroll is the same as current state then do nothing.
+ if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() )
+ {
+ // If request is disable (false) and auto scrolling is enabled then need to stop it
+ if ( enableAutoScroll == false )
+ {
+ if( impl.mTextScroller )
+ {
+ impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0)
+ }
+ }
+ // If request is enable (true) then start autoscroll as not already running
+ else
+ {
+ impl.mController->GetLayoutEngine().SetTextEllipsisEnabled( false );
+ impl.mController->SetAutoScrollEnabled( enableAutoScroll );
+ }
+ }
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED:
+ {
+ if( !impl.mTextScroller )
+ {
+ impl.mTextScroller = Text::TextScroller::New( impl );
+ }
+ impl.mTextScroller->SetSpeed( value.Get<int>() );
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT:
+ {
+ if( !impl.mTextScroller )
+ {
+ impl.mTextScroller = Text::TextScroller::New( impl );
+ }
+ impl.mTextScroller->SetLoopCount( value.Get<int>() );
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
+ {
+ if( !impl.mTextScroller )
+ {
+ impl.mTextScroller = Text::TextScroller::New( impl );
+ }
+ impl.mTextScroller->SetGap( value.Get<float>() );
+ break;
+ }
}
}
}
}
break;
}
+ case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsAutoScrollEnabled();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED:
+ {
+ TextLabel& impl( GetImpl( label ) );
+ if ( impl.mTextScroller )
+ {
+ value = impl.mTextScroller->GetSpeed();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT:
+ {
+ if( impl.mController )
+ {
+ TextLabel& impl( GetImpl( label ) );
+ if ( impl.mTextScroller )
+ {
+ value = impl.mTextScroller->GetLoopCount();
+ }
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
+ {
+ TextLabel& impl( GetImpl( label ) );
+ if ( impl.mTextScroller )
+ {
+ value = impl.mTextScroller->GetGap();
+ }
+ break;
+ }
}
}
// Enable the text ellipsis.
LayoutEngine& engine = mController->GetLayoutEngine();
- engine.SetTextEllipsisEnabled( true );
+ engine.SetTextEllipsisEnabled( true ); // If false then text larger than control will overflow
engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
self.OnStageSignal().Connect( this, &TextLabel::OnStageConnect );
void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" );
+
if( mController->Relayout( size ) ||
!mRenderer )
{
void TextLabel::RenderText()
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::RenderText IsAutoScrollEnabled[%s] [%p]\n", ( mController->IsAutoScrollEnabled())?"true":"false", this );
+
Actor self = Self();
Actor renderableActor;
+
if( mRenderer )
{
renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
self.Add( renderableActor );
}
mRenderableActor = renderableActor;
+
+ if ( mController->IsAutoScrollEnabled() )
+ {
+ SetUpAutoScrolling();
+ }
}
}
+void TextLabel::SetUpAutoScrolling()
+{
+ const Size& controlSize = mController->GetView().GetControlSize();
+ const Size offScreenSize = GetNaturalSize().GetVectorXY(); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only.
+ const Vector2& alignmentOffset = mController->GetAlignmentOffset();
+ const Text::CharacterDirection direction = mController->GetAutoScrollDirection();
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling alignmentOffset[%f,%f] offScreenSize[%f,%f] controlSize[%f,%f]\n",
+ alignmentOffset.x, alignmentOffset.y, offScreenSize.x,offScreenSize.y , controlSize.x,controlSize.y);
+
+ if ( !mTextScroller )
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling Creating default TextScoller\n");
+
+ // If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults
+ mTextScroller = Text::TextScroller::New( *this );
+ }
+ mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset );
+
+ Actor self = Self();
+ self.Add( mTextScroller->GetScrollingText() );
+ self.Add( mTextScroller->GetSourceCamera() );
+}
+
void TextLabel::OnStageConnect( Dali::Actor actor )
{
if ( mHasBeenStaged )
// Pure Virtual from TextController Interface, only needed when inputting text
}
+void TextLabel::ScrollingFinished()
+{
+ // Pure Virtual from TextScroller Interface
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::ScrollingFinished\n");
+ mController->SetAutoScrollEnabled( false );
+ mController->GetLayoutEngine().SetTextEllipsisEnabled( true );
+ RequestTextRelayout();
+}
+
TextLabel::TextLabel()
: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-scroller-interface.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali-toolkit/internal/text/text-scroller.h>
namespace Dali
{
/**
* @brief A control which renders a short text string.
*/
-class TextLabel : public Control, public Text::ControlInterface
+class TextLabel : public Control, public Text::ControlInterface, public Text::ScrollerInterface
{
public:
*/
virtual void MaxLengthReached();
+private: // from TextScroller
+
+ /**
+ * @copydoc Text::ScrollerInterface::ScrollingFinished()
+ */
+ virtual void ScrollingFinished();
+
private: // Implementation
/**
*/
void RenderText();
+ /**
+ * @brief Set up Autoscrolling
+ */
+ void SetUpAutoScrolling();
+
private: // Data
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
+ Text::TextScrollerPtr mTextScroller;
Actor mRenderableActor;
int mRenderingBackend;
bool mHasBeenStaged:1;
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
// EXTERNAL INCLUDES
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
#include <dali-toolkit/internal/feedback/feedback-style.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/object-registry.h>
$(toolkit_src_dir)/text/text-controller-impl.cpp \
$(toolkit_src_dir)/text/text-font-style.cpp \
$(toolkit_src_dir)/text/text-io.cpp \
+ $(toolkit_src_dir)/text/text-scroller.cpp \
+ $(toolkit_src_dir)/text/text-scroller-interface.cpp \
$(toolkit_src_dir)/text/text-view.cpp \
$(toolkit_src_dir)/text/text-view-interface.cpp \
$(toolkit_src_dir)/text/visual-model-impl.cpp \
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/integration-api/debug.h>
bool KeyInputFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
- Dali::BaseHandle handle( object );
-
bool connected( true );
KeyInputFocusManager* manager = dynamic_cast<KeyInputFocusManager*>( object );
- if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_CHANGED ) )
- {
- manager->KeyInputFocusChangedSignal().Connect( tracker, functor );
- }
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_UNHANDLED_KEY_EVENT ) )
- {
- manager->UnhandledKeyEventSignal().Connect( tracker, functor );
- }
- else
+ if( manager )
{
- // signalName does not match any signal
- connected = false;
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_CHANGED ) )
+ {
+ manager->KeyInputFocusChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_UNHANDLED_KEY_EVENT ) )
+ {
+ manager->UnhandledKeyEventSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
}
return connected;
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/singleton-service.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
LayoutEngine::Layout LayoutEngine::GetLayout() const
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "GetLayout[%d]\n", mImpl->mLayout);
return mImpl->mLayout;
}
void LayoutEngine::SetTextEllipsisEnabled( bool enabled )
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "-->LayoutEngine::SetTextEllipsisEnabled[%s]\n", (enabled)?"true":"false" );
mImpl->mEllipsisEnabled = enabled;
}
namespace
{
#if defined(DEBUG_ENABLED)
- Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
+ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_RENDERING");
#endif
const float ZERO( 0.0f );
renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1 );
containerActor.Add( shadowActor );
containerActor.Add( actor );
+#if defined(DEBUG_ENABLED)
+ containerActor.SetName("TextContainer");
+#endif
actor = containerActor;
}
}
// Keep all of the origins aligned
actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-
actor.SetSize( actorSize );
actor.RegisterProperty("uOffset", Vector2::ZERO );
return actor;
Actor AtlasRenderer::Render( Text::ViewInterface& view, int depth )
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Text::AtlasRenderer::Render()\n" );
+
UnparentAndReset( mImpl->mActor );
Length numberOfGlyphs = view.GetNumberOfGlyphs();
mMaximumNumberOfCharacters( 50u ),
mRecalculateNaturalSize( true ),
mMarkupProcessorEnabled( false ),
- mClipboardHideEnabled( true )
+ mClipboardHideEnabled( true ),
+ mAutoScrollEnabled( false ),
+ mAutoScrollDirectionRTL( false )
{
mLogicalModel = LogicalModel::New();
mVisualModel = VisualModel::New();
bool mRecalculateNaturalSize:1; ///< Whether the natural size needs to be recalculated.
bool mMarkupProcessorEnabled:1; ///< Whether the mark-up procesor is enabled.
- bool mClipboardHideEnabled:1; ///< Whether the ClipboardHide function work or not
+ bool mClipboardHideEnabled:1; ///< Whether the ClipboardHide function work or not
+ bool mAutoScrollEnabled:1; ///< Whether auto text scrolling is enabled.
+ CharacterDirection mAutoScrollDirectionRTL:1; ///< Direction of auto scrolling, true if rtl
+
};
} // namespace Text
return mImpl->mMarkupProcessorEnabled;
}
+void Controller::SetAutoScrollEnabled( bool enable )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable)?"true":"false", ( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX)?"true":"false", this );
+
+ if ( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX )
+ {
+ if ( enable )
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled for SINGLE_LINE_BOX\n" );
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
+ LAYOUT |
+ ALIGN |
+ UPDATE_ACTUAL_SIZE |
+ UPDATE_DIRECTION |
+ REORDER );
+
+ }
+ else
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled Disabling autoscroll\n");
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
+ LAYOUT |
+ ALIGN |
+ UPDATE_ACTUAL_SIZE |
+ REORDER );
+ }
+
+ mImpl->mAutoScrollEnabled = enable;
+ mImpl->RequestRelayout();
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Attempted AutoScrolling on a non SINGLE_LINE_BOX, request ignored" );
+ mImpl->mAutoScrollEnabled = false;
+ }
+}
+
+bool Controller::IsAutoScrollEnabled() const
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::IsAutoScrollEnabled[%s]\n", (mImpl->mAutoScrollEnabled)?"true":"false" );
+
+ return mImpl->mAutoScrollEnabled;
+}
+
+CharacterDirection Controller::GetAutoScrollDirection() const
+{
+ return mImpl->mAutoScrollDirectionRTL;
+}
+
void Controller::SetText( const std::string& text )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
void Controller::UpdateAfterFontChange( const std::string& newDefaultFont )
{
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange");
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::UpdateAfterFontChange");
if( !mImpl->mFontDefaults->familyDefined ) // If user defined font then should not update when system font changes
{
mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count();
- // Store the actual control's width.
- const float actualControlWidth = mImpl->mVisualModel->mControlSize.width;
+ // Store the actual control's size to restore later.
+ const Size actualControlSize = mImpl->mVisualModel->mControlSize;
DoRelayout( Size( MAX_FLOAT, MAX_FLOAT ),
static_cast<OperationsMask>( onlyOnceOperations |
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
- // Restore the actual control's width.
- mImpl->mVisualModel->mControlSize.width = actualControlWidth;
+ // Restore the actual control's size.
+ mImpl->mVisualModel->mControlSize = actualControlSize;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
}
bool Controller::Relayout( const Size& size )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f\n", this, size.width, size.height );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, (mImpl->mAutoScrollEnabled)?"true":"false" );
if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
{
if( NO_OPERATION != ( LAYOUT & operations ) )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
+
// Some vectors with data needed to layout and reorder may be void
// after the first time the text has been laid out.
// Fill the vectors again.
mImpl->mVisualModel->mLines,
layoutSize );
+
if( viewUpdated )
{
+ if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
+ {
+ mImpl->mAutoScrollDirectionRTL = false;
+ }
+
// Reorder the lines
if( NO_OPERATION != ( REORDER & operations ) )
{
requestedNumberOfCharacters,
glyphPositions );
+ if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
+ {
+ const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
+ if ( firstline )
+ {
+ mImpl->mAutoScrollDirectionRTL = firstline->direction;
+ }
+ }
}
} // REORDER
viewUpdated = true;
}
-
+#if defined(DEBUG_ENABLED)
+ std::string currentText;
+ GetText( currentText );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::DoRelayout [%p] mImpl->mAutoScrollDirectionRTL[%s] [%s]\n", this, (mImpl->mAutoScrollDirectionRTL)?"true":"false", currentText.c_str() );
+#endif
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
return viewUpdated;
}
REORDER = 0x0400,
ALIGN = 0x0800,
COLOR = 0x1000,
+ UPDATE_DIRECTION = 0x2000,
ALL_OPERATIONS = 0xFFFF
};
bool IsMarkupProcessorEnabled() const;
/**
+ * @brief Enables/disables the auto text scrolling
+ *
+ * By default is disabled.
+ *
+ * @param[in] enable Whether to enable the auto scrolling
+ */
+ void SetAutoScrollEnabled( bool enable );
+
+ /**
+ * @brief Retrieves whether auto text scrolling is enabled.
+ *
+ * By default is disabled.
+ *
+ * @return @e true if auto scrolling is enabled, otherwise returns @e false.
+ */
+ bool IsAutoScrollEnabled() const;
+
+ /**
+ * @brief Get direction of the text from the first line of text,
+ * @return bool rtl (right to left) is true
+ */
+ CharacterDirection GetAutoScrollDirection() const;
+
+ /**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
--- /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/text/text-scroller-interface.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+ScrollerInterface::ScrollerInterface()
+{
+}
+
+ScrollerInterface::~ScrollerInterface()
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_SCROLLER_INTERFACE_H__
+#define __DALI_TOOLKIT_TEXT_SCROLLER_INTERFACE_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
+{
+
+class Actor;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief An interface used by the text-controls which implement auto-scrolling
+ */
+class ScrollerInterface
+{
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ ScrollerInterface();
+
+ /**
+ * @brief Virtual destructor.
+ */
+ virtual ~ScrollerInterface();
+
+ /**
+ * @brief Called when the scrolling finishes
+ */
+ virtual void ScrollingFinished() = 0;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SCROLLER_INTERFACE_H__
--- /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/text/text-scroller.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/sampler.h>
+#include <dali/devel-api/rendering/shader.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-scroller-interface.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace
+{
+
+#if defined ( DEBUG_ENABLED )
+ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_SCROLLING");
+#endif
+
+const int MINIMUM_SCROLL_SPEED = 1; // Speed should be set by Property system.
+
+const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ varying highp vec2 vTexCoord;\n
+ varying highp float vRatio;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ uniform mediump float uDelta;\n
+ uniform mediump vec2 uTextureSize;
+ uniform mediump float uGap;\n
+ uniform mediump float uRtl;\n
+ \n
+ void main()\n
+ {\n
+ {\n
+ mediump vec4 vertexPosition = vec4(aPosition*uSize.xy, 0.0, 1.0);\n
+ float smallTextPadding = max(uSize.x - uTextureSize.x, 0. );\n
+ float gap = max( uGap, smallTextPadding );\n
+ vTexCoord.x = ( uDelta + ( uRtl * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x+gap );\n
+ vTexCoord.y = aPosition.y;\n
+ vRatio = uTextureSize.x / ( uTextureSize.x + gap );\n
+ gl_Position = uMvpMatrix * vertexPosition;\n
+ }\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ varying highp float vRatio;\n
+ uniform sampler2D sTexture;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 texCoord;\n
+ texCoord.y = vTexCoord.y;\n
+ texCoord.x = fract( vTexCoord.x ) / vRatio;\n
+ if ( texCoord.x > 1.0 )\n
+ discard;\n
+ \n
+ gl_FragColor = texture2D( sTexture, texCoord );\n
+ }\n
+);
+
+/**
+ * @brief Create and set up a camera for the render task to use
+ *
+ * @param[in] sizeOfTarget size of the source camera to look at
+ * @param[out] offscreenCamera custom camera
+ */
+void CreateCameraActor( const Size& sizeOfTarget, CameraActor& offscreenCamera )
+{
+ offscreenCamera = CameraActor::New();
+ offscreenCamera.SetOrthographicProjection( sizeOfTarget );
+ offscreenCamera.SetInvertYAxis( true );
+}
+
+/**
+ * @brief Create a render task
+ *
+ * @param[in] sourceActor actor to be used as source
+ * @param[in] cameraActor camera looking at source
+ * @param[in] offscreenTarget resulting image from render task
+ * @param[out] renderTask render task that has been setup
+ */
+void CreateRenderTask( Actor sourceActor, CameraActor cameraActor , FrameBufferImage offscreenTarget, RenderTask& renderTask )
+{
+ Stage stage = Stage::GetCurrent();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ renderTask = taskList.CreateTask();
+ renderTask.SetSourceActor( sourceActor );
+ renderTask.SetExclusive( true );
+ renderTask.SetInputEnabled( false );
+ renderTask.SetClearEnabled( true );
+ renderTask.SetCameraActor( cameraActor );
+ renderTask.SetTargetFrameBuffer( offscreenTarget );
+ renderTask.SetClearColor( Color::TRANSPARENT );
+ renderTask.SetCullMode( false );
+}
+
+/**
+ * @brief Create quad geometry for the mesh
+ *
+ * @param[out] geometry quad geometry that can be used for a mesh
+ */
+void CreateGeometry( Geometry& geometry )
+{
+ struct QuadVertex { Vector2 position; };
+
+ QuadVertex quadVertexData[4] =
+ {
+ { Vector2( 0.0f, 0.0f) },
+ { Vector2( 1.0f, 0.0f) },
+ { Vector2( 0.0f, 1.0f) },
+ { Vector2( 1.0f, 1.0f) },
+ };
+
+ const unsigned short indices[6] =
+ {
+ 3,1,0,0,2,3
+ };
+
+ Property::Map quadVertexFormat;
+ quadVertexFormat["aPosition"] = Property::VECTOR2;
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData(quadVertexData, 4 );
+
+ geometry = Geometry::New();
+ geometry.AddVertexBuffer( quadVertices );
+ geometry.SetIndexBuffer( indices, sizeof(indices)/sizeof(indices[0]) );
+}
+
+
+/**
+ * @brief Create a renderer
+ *
+ * @param[in] frameBufferImage texture to be used
+ * @param[out] renderer mesh renderer using the supplied texture
+ */
+void CreateRenderer( FrameBufferImage frameBufferImage, Dali::Renderer& renderer )
+{
+ Shader shader = Shader::New( VERTEX_SHADER_SCROLL , FRAGMENT_SHADER, Shader::HINT_NONE );
+
+ Sampler sampler = Sampler::New();
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST );
+
+ TextureSet textureSet = TextureSet::New();
+ textureSet.SetImage( 0u, frameBufferImage );
+ textureSet.SetSampler( 0u, sampler );
+
+ Geometry meshGeometry;
+ CreateGeometry( meshGeometry );
+
+ renderer = Renderer::New( meshGeometry, shader );
+ renderer.SetTextures( textureSet );
+}
+
+} // namespace
+
+namespace Text
+{
+
+TextScrollerPtr TextScroller::New( ScrollerInterface& scrollerInterface )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::New\n" );
+
+ TextScrollerPtr textScroller( new TextScroller( scrollerInterface) );
+ return textScroller;
+}
+
+void TextScroller::SetGap( int gap )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetGap gap[%d]\n", gap );
+ mWrapGap = gap;
+}
+
+int TextScroller::GetGap() const
+{
+ return mWrapGap;
+}
+
+void TextScroller::SetSpeed( int scrollSpeed )
+{
+ mScrollSpeed = std::max( MINIMUM_SCROLL_SPEED, scrollSpeed );
+}
+
+int TextScroller::GetSpeed() const
+{
+ return mScrollSpeed;
+}
+
+void TextScroller::SetLoopCount( int loopCount )
+{
+ if ( loopCount > 0 )
+ {
+ mLoopCount = loopCount;
+ }
+
+ if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING )
+ {
+ if ( loopCount == 0 ) // Request to stop looping
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" );
+ mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
+ }
+ }
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount [%d] Status[%s]\n", mLoopCount, (loopCount)?"looping":"stop" );
+}
+
+int TextScroller::GetLoopCount() const
+{
+ return mLoopCount;
+}
+
+Actor TextScroller::GetSourceCamera() const
+{
+ return mOffscreenCameraActor;
+}
+
+Actor TextScroller::GetScrollingText() const
+{
+ return mScrollingTextActor;
+}
+
+TextScroller::TextScroller( ScrollerInterface& scrollerInterface ) : mScrollerInterface( scrollerInterface ),
+ mScrollDeltaIndex( Property::INVALID_INDEX ),
+ mScrollSpeed( MINIMUM_SCROLL_SPEED ),
+ mLoopCount( 1 ),
+ mWrapGap( 0 )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller Default Constructor\n" );
+}
+
+TextScroller::~TextScroller()
+{
+ CleanUp();
+}
+
+void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, const Vector2 alignmentOffset )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d] alignmentOffset[%f,%f]\n",
+ controlSize.x, controlSize.y, offScreenSize.x, offScreenSize.y, direction, alignmentOffset.x, alignmentOffset.y );
+
+ FrameBufferImage offscreenRenderTargetForText = FrameBufferImage::New( offScreenSize.width, offScreenSize.height, Pixel::RGBA8888, Dali::Image::UNUSED );
+ Renderer renderer;
+
+ CreateCameraActor( offScreenSize, mOffscreenCameraActor );
+ CreateRenderer( offscreenRenderTargetForText, renderer );
+ CreateRenderTask( sourceActor, mOffscreenCameraActor, offscreenRenderTargetForText, mRenderTask );
+
+ // Reposition camera to match alignment of target, RTL text has direction=true
+ if ( direction )
+ {
+ mOffscreenCameraActor.SetX( alignmentOffset.x + offScreenSize.width*0.5f );
+ }
+ else
+ {
+ mOffscreenCameraActor.SetX( offScreenSize.width * 0.5f );
+ }
+
+ mOffscreenCameraActor.SetY( offScreenSize.height * 0.5f );
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters mWrapGap[%d]\n", mWrapGap )
+
+ mScrollingTextActor = Actor::New();
+ mScrollingTextActor.AddRenderer( renderer );
+ mScrollingTextActor.RegisterProperty( "uTextureSize", offScreenSize );
+ mScrollingTextActor.RegisterProperty( "uRtl", ((direction)?1.0f:0.0f) );
+ mScrollingTextActor.RegisterProperty( "uGap", mWrapGap );
+ mScrollingTextActor.SetSize( controlSize.width, std::min( offScreenSize.height, controlSize.height ) );
+ mScrollDeltaIndex = mScrollingTextActor.RegisterProperty( "uDelta", 0.0f );
+
+ float scrollAmount = std::max( offScreenSize.width + mWrapGap, controlSize.width );
+ float scrollDuration = scrollAmount / mScrollSpeed;
+
+ if ( direction )
+ {
+ scrollAmount = -scrollAmount; // reverse direction of scrollung
+ }
+
+ StartScrolling( scrollAmount, scrollDuration, mLoopCount );
+}
+
+void TextScroller::AutoScrollAnimationFinished( Dali::Animation& animation )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::AutoScrollAnimationFinished\n" );
+ CleanUp();
+ mScrollerInterface.ScrollingFinished();
+}
+
+void TextScroller::StartScrolling( float scrollAmount, float scrollDuration, int loopCount )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed );
+
+ mScrollAnimation = Animation::New( scrollDuration );
+ mScrollAnimation.AnimateTo( Property( mScrollingTextActor, mScrollDeltaIndex ), scrollAmount );
+ mScrollAnimation.SetEndAction( Animation::Discard );
+ mScrollAnimation.SetLoopCount( loopCount );
+ mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );
+ mScrollAnimation.Play();
+}
+
+void TextScroller::CleanUp()
+{
+ if ( Stage::IsInstalled() )
+ {
+ Stage stage = Stage::GetCurrent();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ UnparentAndReset( mScrollingTextActor );
+ UnparentAndReset( mOffscreenCameraActor );
+ taskList.RemoveTask( mRenderTask );
+ }
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_SCROLLER_H__
+#define __DALI_TOOLKIT_TEXT_SCROLLER_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/actors/camera-actor.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/render-tasks/render-task.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class TextScroller;
+class ScrollerInterface;
+
+typedef IntrusivePtr<TextScroller> TextScrollerPtr;
+
+/**
+ * @brief A helper class for scrolling text
+ */
+class TextScroller : public RefObject, public ConnectionTracker
+{
+public:
+
+ /**
+ * @brief Text Scrolling helper, used to automatically scroll text, SetParameters should be called before scrolling is needed.
+ * CleanUp removes the Scrolling actors from stage whilst keeping the Scroller object alive and preserving Speed, Gap and Loop count.
+ *
+ * @param[in] scrollerInterface scroller interface
+ */
+ static TextScrollerPtr New( ScrollerInterface& scrollerInterface );
+
+ /**
+ * @brief Set parameters relating to source required for scrolling
+ *
+ * @param[in] sourceActor source actor to be scrolled
+ * @param[in] controlSize size of the control to scroll within
+ * @param[in] offScreenSize size of the sourceActor
+ * @param[in] direction text direction true for right to left text
+ * @param[in] alignmentOffset alignment of source text
+ *
+ */
+ void SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, const Vector2 alignmentOffset );
+
+ /**
+ * @brief Set the gap distance to elapse before the text wraps around
+ * @param[in] gap distance to elapse
+ */
+ void SetGap( int gap );
+
+ /**
+ * @brief Get the distance before scrolling wraps
+ * @return gap distance to elapse
+ */
+ int GetGap() const;
+
+ /**
+ * @brief Set speed the text should scroll
+ * @param[in] scrollSpeed pixels per second
+ */
+ void SetSpeed( int scrollSpeed );
+
+ /**
+ * @brief Get the speed of text scrolling
+ * @return speed in pixels per second
+ */
+ int GetSpeed() const;
+
+ /**
+ * @brief Set the number of times the text scrolling should loop, can stop current scrolling by passing in 0;
+ * @param[in] loopCount number of times the scrolled text should loop, 0 to stop scrolling
+ */
+ void SetLoopCount( int loopCount );
+
+ /**
+ * @brief Get the number of loops
+ * @return int number of loops
+ */
+ int GetLoopCount() const;
+
+ /**
+ * @brief Get the camera used to look at source, should be added to the parent of target actor.
+ * @return camera Actor
+ */
+ Actor GetSourceCamera() const;
+
+ /**
+ * @brief Get the resulting scrolling text actor, add to target actor which will show scrolling text
+ * @return mesh Actor
+ */
+ Actor GetScrollingText() const;
+
+private: // Implementation
+
+ /**
+ * Constructor
+ */
+ TextScroller( ScrollerInterface& scrollerInterface );
+
+ /**
+ * Destructor
+ */
+ ~TextScroller();
+
+ // Undefined
+ TextScroller( const TextScroller& handle );
+
+ // Undefined
+ TextScroller& operator=( const TextScroller& handle );
+
+ /**
+ * @brief Callback for end of animation
+ * @param[in] animation Animation handle
+ */
+ void AutoScrollAnimationFinished( Dali::Animation& animation );
+
+ /**
+ * @brief variables required to set up scrolling animation
+ * @param[in] scrollAmount distance to animate text for the given duration
+ * @param[in] scrollDuration duration of aninmation
+ * @param[in] loopCount number of times to loop the scrolling text
+ */
+ void StartScrolling( float scrollAmount, float scrollDuration, int loopCount );
+
+ /**
+ * @brief When scrolling ended, the actors are cleaned up so no longer staged.
+ */
+ void CleanUp();
+
+private:
+
+ RenderTask mRenderTask; // Renders full text to a FrameBuffer which is then scrolled.
+ CameraActor mOffscreenCameraActor; // Camera used by render task
+ Actor mScrollingTextActor; // Actor used to show scrolling text
+ ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling
+ Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll
+ Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex
+
+ int mScrollSpeed; ///< Speed which text should automatically scroll at
+ int mLoopCount; ///< Number of time the text should scroll
+ int mWrapGap; ///< Gap before text wraps around when scrolling
+
+}; // TextScroller class
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SCROLLER_H__
+
struct GlyphRun;
/**
- * @brief Abstract interface to provide the information necessary displaying text.
+ * @brief Abstract interface to provide the information necessary to display text.
*
* This includes:
* - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
/**
* @brief Retrieves the target size of the UI control.
*
- * @return The text's size.
+ * @return The control's size.
*/
virtual const Vector2& GetControlSize() const = 0;
bool mUnderlineEnabled:1; ///< Underline enabled flag
bool mUnderlineColorSet:1; ///< Has the underline color been explicitly set?
-
};
} // namespace Text
}
}
- const Vector2& size = Self().GetCurrentSize().GetVectorXY();
- Vector2 halfSize = size * 0.5f;
+ const Vector2 halfSize = Self().GetCurrentSize().GetVectorXY() * 0.5f;
//the centre to "explode" the tiles outwards from
Vector3 centre( halfSize.x, halfSize.y, -1.0f / mDisplacementSpreadFactor );
void CubeTransitionCrossEffect::SetupAnimation( unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre )
{
- const Vector2& size = Self().GetCurrentSize().GetVectorXY();
+ const Vector2 size = Self().GetCurrentSize().GetVectorXY();
Vector2 halfSize = size * 0.5f;
//the position of the centre of the front face tile
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
#include <dali/integration-api/debug.h>
return tile;
}
-
-Geometry CreateQuadGeometry()
-{
- const float halfWidth = 0.5f;
- const float halfHeight = 0.5f;
- struct QuadVertex { Vector2 position;};
- QuadVertex quadVertexData[4] =
- {
- { Vector2(-halfWidth, -halfHeight) },
- { Vector2( halfWidth, -halfHeight) },
- { Vector2(-halfWidth, halfHeight) },
- { Vector2( halfWidth, halfHeight) }
- };
-
- Property::Map quadVertexFormat;
- quadVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
- quadVertices.SetData( quadVertexData, 4 );
-
- // Create the geometry object
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( quadVertices );
- geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
-
- return geometry;
-}
-
}
const Vector4 CubeTransitionEffect::FULL_BRIGHTNESS( 1.0f, 1.0f, 1.0f, 1.0f );
{
Control::OnStageConnection( depth );
- Geometry geometry = CreateQuadGeometry();
+ Geometry geometry = Geometry::QUAD();
Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
TextureSet textureSet = TextureSet::New();
void CubeTransitionWaveEffect::CalculateSaddleSurfaceParameters( Vector2 position, Vector2 displacement )
{
- const Vector2& size = Self().GetCurrentSize().GetVectorXY();
+ const Vector2 size = Self().GetCurrentSize().GetVectorXY();
// the line passes through 'position' and has the direction of 'displacement'
float coefA, coefB, coefC; //line equation: Ax+By+C=0;
coefA = displacement.y;
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
-#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/rendering/renderer.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
*/
// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/flex-container/flex-container.h>
+#include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/flex-container/flex-container-impl.h>
* "name":"icon",
* "type":"ImageView",
* "image":"image.png",
- * "customProperties": {
- * "flex":1, // property to make the item to receive the specified proportion of the free space in the container. If all items in the container use this pattern, their sizes will be proportional to the specified flex factor.
- * "alignSelf":"flexStart", // property to specify how the item will align along the cross axis, if set, this overides the default alignment for all items in the container
- * "flexMargin":[10, 10, 10, 10] // property to specify the space around the item, if not set, default value is [0, 0, 0, 0]
+ * "properties": {
+ * "flex":1, // property to make the item to receive the specified proportion of the free space in the container.
+ * "alignSelf":"flexStart", // property to specify how the item will align along the cross axis.
+ * "flexMargin":[10, 10, 10, 10] // property to specify the space around the item.
* }
* @endcode
+ * @SINCE_1_1.35
*/
class DALI_IMPORT_API FlexContainer : public Control
/**
* @brief The direction of the main axis in the flex container. This determines
* the direction that flex items are laid out in the flex container.
+ * @SINCE_1_1.35
*/
enum FlexDirection
{
- COLUMN, ///< The flexible items are displayed vertically as a column
- COLUMN_REVERSE, ///< The flexible items are displayed vertically as a column, but in reverse order
- ROW, ///< The flexible items are displayed horizontally as a row
- ROW_REVERSE ///< The flexible items are displayed horizontally as a row, but in reverse order
+ COLUMN, ///< The flexible items are displayed vertically as a column @SINCE_1_1.35
+ COLUMN_REVERSE, ///< The flexible items are displayed vertically as a column, but in reverse order @SINCE_1_1.35
+ ROW, ///< The flexible items are displayed horizontally as a row @SINCE_1_1.35
+ ROW_REVERSE ///< The flexible items are displayed horizontally as a row, but in reverse order @SINCE_1_1.35
};
/**
* @brief The primary direction in which content is ordered in the flex container
* and on which sides the “start” and “end” are.
+ * @SINCE_1_1.35
*/
enum ContentDirection
{
- INHERIT, ///< Inherits the same direction from the parent
- LTR, ///< From left to right
- RTL ///< From right to left
+ INHERIT, ///< Inherits the same direction from the parent @SINCE_1_1.35
+ LTR, ///< From left to right @SINCE_1_1.35
+ RTL ///< From right to left @SINCE_1_1.35
};
/**
* @brief Alignment of the flex items when the items do not use all available
* space on the main-axis.
+ * @SINCE_1_1.35
*/
enum Justification
{
- JUSTIFY_FLEX_START, ///< Items are positioned at the beginning of the container
- JUSTIFY_CENTER, ///< Items are positioned at the center of the container
- JUSTIFY_FLEX_END, ///< Items are positioned at the end of the container
- JUSTIFY_SPACE_BETWEEN, ///< Items are positioned with equal space between the lines
- JUSTIFY_SPACE_AROUND ///< Items are positioned with equal space before, between, and after the lines
+ JUSTIFY_FLEX_START, ///< Items are positioned at the beginning of the container @SINCE_1_1.35
+ JUSTIFY_CENTER, ///< Items are positioned at the center of the container @SINCE_1_1.35
+ JUSTIFY_FLEX_END, ///< Items are positioned at the end of the container @SINCE_1_1.35
+ JUSTIFY_SPACE_BETWEEN, ///< Items are positioned with equal space between the lines @SINCE_1_1.35
+ JUSTIFY_SPACE_AROUND ///< Items are positioned with equal space before, between, and after the lines @SINCE_1_1.35
};
/**
* @brief Alignment of the flex items or lines when the items or lines do not
* use all available space on the cross-axis.
+ * @SINCE_1_1.35
*/
enum Alignment
{
- ALIGN_AUTO, ///< Inherits the same alignment from the parent (only valid for "alignSelf" property)
- ALIGN_FLEX_START, ///< At the beginning of the container
- ALIGN_CENTER, ///< At the center of the container
- ALIGN_FLEX_END, ///< At the end of the container
- ALIGN_STRETCH ///< Stretch to fit the container
+ ALIGN_AUTO, ///< Inherits the same alignment from the parent (only valid for "alignSelf" property) @SINCE_1_1.35
+ ALIGN_FLEX_START, ///< At the beginning of the container @SINCE_1_1.35
+ ALIGN_CENTER, ///< At the center of the container @SINCE_1_1.35
+ ALIGN_FLEX_END, ///< At the end of the container @SINCE_1_1.35
+ ALIGN_STRETCH ///< Stretch to fit the container @SINCE_1_1.35
};
/**
* @brief The wrap type of the flex container when there is no enough room for
* all the items on one flex line.
+ * @SINCE_1_1.35
*/
enum WrapType
{
- NO_WRAP, ///< Flex items laid out in single line (shrunk to fit the flex container along the main axis)
- WRAP ///< Flex items laid out in multiple lines if needed
+ NO_WRAP, ///< Flex items laid out in single line (shrunk to fit the flex container along the main axis) @SINCE_1_1.35
+ WRAP ///< Flex items laid out in multiple lines if needed @SINCE_1_1.35
};
public:
/**
* @brief The start and end property ranges for this control.
+ * @SINCE_1_1.35
*/
enum PropertyRange
{
- PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_1.35
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices @SINCE_1_1.35
+
+ CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, ///< @SINCE_1_1.35
+ CHILD_PROPERTY_END_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve child property indices @SINCE_1_1.35
};
/**
* @brief An enumeration of properties belonging to the FlexContainer class.
+ * @SINCE_1_1.35
*/
struct Property
{
enum
{
- CONTENT_DIRECTION = PROPERTY_START_INDEX, ///< name "contentDirection", The primary direction in which content is ordered, @see FlexContainer::ContentDirection, type INTEGER
- FLEX_DIRECTION, ///< name "flexDirection", The direction of the main-axis which determines the direction that flex items are laid out, @see FlexContainer::FlexDirection, type INTEGER
- FLEX_WRAP, ///< name "flexWrap", Whether the flex items should wrap or not if there is no enough room for them on one flex line, @see FlexContainer::WrapType, type INTEGER
- JUSTIFY_CONTENT, ///< name "justifyContent", The alignment of flex items when the items do not use all available space on the main-axis, @see FlexContainer::Justification, type INTEGER
- ALIGN_ITEMS, ///< name "alignItems", The alignment of flex items when the items do not use all available space on the cross-axis, @see FlexContainer::Alignment, type INTEGER
- ALIGN_CONTENT ///< name "alignContent", Similar to "alignItems", but it aligns flex lines, so only works when there are multiple lines, @see FlexContainer::Alignment, type INTEGER
+ // Event side properties
+ CONTENT_DIRECTION = PROPERTY_START_INDEX, ///< name "contentDirection", The primary direction in which content is ordered, @see FlexContainer::ContentDirection, type INTEGER @SINCE_1_1.35
+ FLEX_DIRECTION, ///< name "flexDirection", The direction of the main-axis which determines the direction that flex items are laid out, @see FlexContainer::FlexDirection, type INTEGER @SINCE_1_1.35
+ FLEX_WRAP, ///< name "flexWrap", Whether the flex items should wrap or not if there is no enough room for them on one flex line, @see FlexContainer::WrapType, type INTEGER @SINCE_1_1.35
+ JUSTIFY_CONTENT, ///< name "justifyContent", The alignment of flex items when the items do not use all available space on the main-axis, @see FlexContainer::Justification, type INTEGER @SINCE_1_1.35
+ ALIGN_ITEMS, ///< name "alignItems", The alignment of flex items when the items do not use all available space on the cross-axis, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35
+ ALIGN_CONTENT ///< name "alignContent", Similar to "alignItems", but it aligns flex lines, so only works when there are multiple lines, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35
};
};
/**
- * Create a FlexContainer handle; this can be initialised with FlexContainer::New()
+ * @brief An enumeration of child properties belonging to the FlexContainer class.
+ * @SINCE_1_1.35
+ */
+ struct ChildProperty
+ {
+ enum
+ {
+ // Event side child properties
+ FLEX = CHILD_PROPERTY_START_INDEX, ///< name "flex", The proportion of the free space in the container the flex item will receive. If all items in the container set this property, their sizes will be proportional to the specified flex factor, type FLOAT @SINCE_1_1.35
+ ALIGN_SELF, ///< name "alignSelf", The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35
+ FLEX_MARGIN ///< name "flexMargin", The space around the flex item, type VECTOR4 @SINCE_1_1.35
+ };
+ };
+
+ /**
+ * @brief Create a FlexContainer handle; this can be initialised with FlexContainer::New()
* Calling member functions with an uninitialised handle is not allowed.
+ * @SINCE_1_1.35
*/
FlexContainer();
/**
- * Copy constructor. Creates another handle that points to the same real object
- * @param handle to copy from
+ * @brief Copy constructor. Creates another handle that points to the same real object
+ * @SINCE_1_1.35
+ *
+ * @param[in] handle The handle to copy from
*/
FlexContainer( const FlexContainer& handle );
/**
- * Assignment operator. Changes this handle to point to another real object
+ * @brief Assignment operator. Changes this handle to point to another real object
+ * @SINCE_1_1.35
*/
FlexContainer& operator=( const FlexContainer& handle );
/**
* @brief Destructor
*
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @details This is non-virtual since derived Handle types must not contain data or virtual methods.
+ *
+ * @SINCE_1_1.35
*/
~FlexContainer();
/**
- * Create the FlexContainer control.
+ * @brief Create the FlexContainer control.
+ * @SINCE_1_1.35
+ *
* @return A handle to the FlexContainer control.
*/
static FlexContainer New();
/**
- * Downcast an Object handle to FlexContainer. If handle points to a FlexContainer the
- * downcast produces valid handle. If not the returned handle is left uninitialized.
+ * @brief Downcast an Object handle to FlexContainer.
+ *
+ * @details If handle points to a FlexContainer the downcast produces
+ * valid handle. If not the returned handle is left uninitialized.
+ *
+ * @SINCE_1_1.35
+ *
* @param[in] handle Handle to an object
* @return handle to a FlexContainer or an uninitialized handle
*/
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
+ * @SINCE_1_1.35
*
* @param[in] implementation The Control implementation.
*/
/**
* @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @SINCE_1_1.35
*
* @param[in] internal A pointer to the internal CustomActor.
*/
*/
PRE_MULTIPLIED_ALPHA,
+
// Animatable properties
/**
* @brief name "pixelArea", type Vector4
* @details Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
- * @SINCE_1_0.18
+ * @SINCE_1_1.18
*/
PIXEL_AREA = ANIMATABLE_PROPERTY_START_INDEX,
};
#define __DALI_TOOLKIT_SCROLL_BAR_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.
{
enum
{
- SCROLL_DIRECTION = PROPERTY_START_INDEX, ///< name "scrollDirection", @see SetScrollDirection(), type std::string @SINCE_1_0.0
- INDICATOR_HEIGHT_POLICY, ///< name "indicatorHeightPolicy", @see SetIndicatorHeightPolicy(), type std::string @SINCE_1_0.0
- INDICATOR_FIXED_HEIGHT, ///< name "indicatorFixedHeight", @see SetIndicatorFixedHeight(), type float @SINCE_1_0.0
- INDICATOR_SHOW_DURATION, ///< name "indicatorShowDuration", @see SetIndicatorShowDuration(), type float @SINCE_1_0.0
- INDICATOR_HIDE_DURATION, ///< name "indicatorHideDuration", @see SetIndicatorHideDuration(), type float @SINCE_1_0.0
- SCROLL_POSITION_INTERVALS ///< name "scrollPositionIntervals", @see SetScrollPositionIntervals() type Property::Array @SINCE_1_0.0
+ /**
+ * @brief name "scrollDirection", type std::string
+ * @see SetScrollDirection()
+ * @SINCE_1_0.0
+ */
+ SCROLL_DIRECTION = PROPERTY_START_INDEX,
+ /**
+ * @brief name "indicatorHeightPolicy", type std::string
+ * @see SetIndicatorHeightPolicy()
+ * @SINCE_1_0.0
+ */
+ INDICATOR_HEIGHT_POLICY,
+ /**
+ * @brief name "indicatorFixedHeight", type float
+ * @see SetIndicatorFixedHeight()
+ * @SINCE_1_0.0
+ */
+ INDICATOR_FIXED_HEIGHT,
+ /**
+ * @brief name "indicatorShowDuration", type float
+ * @see SetIndicatorShowDuration()
+ * @SINCE_1_0.0
+ */
+ INDICATOR_SHOW_DURATION,
+ /**
+ * @brief name "indicatorHideDuration", type float
+ * @see SetIndicatorHideDuration()
+ * @SINCE_1_0.0
+ */
+ INDICATOR_HIDE_DURATION,
+ /**
+ * @brief name "scrollPositionIntervals", type Property::Array
+ * @see SetScrollPositionIntervals()
+ * @SINCE_1_0.0
+ */
+ SCROLL_POSITION_INTERVALS,
+ /**
+ * @brief name "indicatorMinimumHeight", type float
+ * The minimum height for a variable size indicator.
+ * @SINCE_1_1.36
+ */
+ INDICATOR_MINIMUM_HEIGHT,
+ /**
+ * @brief name "indicatorStartPadding", type float
+ * The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
+ * @SINCE_1_1.36
+ */
+ INDICATOR_START_PADDING,
+ /**
+ * @brief name "indicatorEndPadding", type float
+ * The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
+ * @SINCE_1_1.36
+ */
+ INDICATOR_END_PADDING
};
};
enum PropertyRange
{
PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices @SINCE_1_0.0
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices @SINCE_1_0.0
+
+ CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, ///< @SINCE_1_1.36
+ CHILD_PROPERTY_END_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve child property indices @SINCE_1_1.36
};
/**
};
/**
+ * @brief An enumeration of child properties belonging to the TableView class.
+ * @SINCE_1_1.36
+ */
+ struct ChildProperty
+ {
+ enum
+ {
+ CELL_INDEX = CHILD_PROPERTY_START_INDEX, ///< name "cellIndex", The top-left cell this child occupies, if not set, the first available cell is used, type VECTOR2 @SINCE_1_1.36
+ ROW_SPAN, ///< name "rowSpan", The number of rows this child occupies, if not set, default value is 1, type FLOAT @SINCE_1_1.36
+ COLUMN_SPAN, ///< name "columnSpan", The number of columns this child occupies, if not set, default value is 1, type FLOAT @SINCE_1_1.36
+ CELL_HORIZONTAL_ALIGNMENT, ///< name "cellHorizontalAlignment", The horizontal alignment of this child inside the cells, if not set, default value is 'left', type STRING @SINCE_1_1.36
+ CELL_VERTICAL_ALIGNMENT ///< name "cellVerticalAlignment", The vertical alignment of this child inside the cells, if not set, default value is 'top', type STRING @SINCE_1_1.36
+ };
+ };
+
+ /**
* @brief Describes how the size of a row / column been set
* @SINCE_1_0.0
*/
* @brief A control which renders a short text string.
*
* Text labels are lightweight, non-editable and do not respond to user input.
+ *
+ * @section TextLabelProperties Properties
+ * |%Property enum |String name |Type |Writable|Animatable|
+ * |----------------------------------|---------------------|--------------|--------|----------|
+ * | Property::RENDERING_BACKEND | renderingBackend | INTEGER | O | X |
+ * | Property::TEXT | text | STRING | O | X |
+ * | Property::FONT_FAMILY | fontFamily | STRING | O | X |
+ * | Property::FONT_STYLE | fontStyle | STRING | O | X |
+ * | Property::POINT_SIZE | pointSize | FLOAT | O | X |
+ * | Property::MULTI_LINE | multiLine | BOOLEAN | O | X |
+ * | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
+ * | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
+ * | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
+ * | Property::SHADOW_OFFSET | shadowOffset | VECTOR2 | O | X |
+ * | Property::SHADOW_COLOR | shadowColor | VECTOR4 | O | X |
+ * | Property::UNDERLINE_ENABLED | underlineEnabled | BOOLEAN | O | X |
+ * | Property::UNDERLINE_COLOR | underlineColor | VECTOR4 | O | X |
+ * | Property::UNDERLINE_HEIGHT | underlineHeight | FLOAT | O | X |
+ * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
+ * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
+ * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
+ *
* @SINCE_1_0.0
*/
class DALI_IMPORT_API TextLabel : public Control
{
enum
{
- RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "renderingBackend", The type or rendering e.g. bitmap-based, type INT @SINCE_1_0.0
- TEXT, ///< name "text", The text to display in UTF-8 format, type STRING @SINCE_1_0.0
- FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_0.0
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_0.0
- POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_0.0
- MULTI_LINE, ///< name "multiLine", The single-line or multi-line layout option, type BOOLEAN @SINCE_1_0.0
- HORIZONTAL_ALIGNMENT, ///< name "horizontalAlignment", The line horizontal alignment, type STRING, values "BEGIN", "CENTER", "END" @SINCE_1_0.0
- VERTICAL_ALIGNMENT, ///< name "verticalAlignment", The line vertical alignment, type STRING, values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0
- TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4 @SINCE_1_0.0
- SHADOW_OFFSET, ///< name "shadowOffset", The drop shadow offset 0 indicates no shadow, type VECTOR2 @SINCE_1_0.0
- SHADOW_COLOR, ///< name "shadowColor", The color of a drop shadow, type VECTOR4 @SINCE_1_0.0
- UNDERLINE_ENABLED, ///< name "underlineEnabled", The underline enabled flag, type BOOLEAN @SINCE_1_0.0
- UNDERLINE_COLOR, ///< name "underlineColor", The color of the underline, type VECTOR4 @SINCE_1_0.0
- UNDERLINE_HEIGHT, ///< name "underlineHeight", Overrides the underline height from font metrics, type FLOAT @SINCE_1_0.0
- ENABLE_MARKUP ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_0.0
+ /**
+ * @brief The type of rendering e.g. bitmap-based
+ * @details name "renderingBackend", type INT, default RENDERING_SHARED_ATLAS
+ * @SINCE_1_0.0
+ */
+ RENDERING_BACKEND = PROPERTY_START_INDEX,
+
+ /**
+ * @brief The text to display in UTF-8 format,
+ * @details name "text", type STRING
+ * @SINCE_1_0.0
+ */
+ TEXT,
+
+ /**
+ * @brief The requested font family to use,
+ * @details name "fontFamily", type STRING
+ * @SINCE_1_0.0
+ */
+ FONT_FAMILY,
+
+ /**
+ * @brief The requested font style to use,
+ * @details name "fontStyle", type STRING
+ * @SINCE_1_0.0
+ */
+ FONT_STYLE,
+
+ /**
+ * @brief The size of font in points
+ * @details name "pointSize", type FLOAT
+ * @SINCE_1_0.0
+ */
+ POINT_SIZE,
+
+ /**
+ * @brief The single-line or multi-line layout option
+ * @details name "multiLine", type FLOAT, default SINGLE_LINE_BOX
+ * @SINCE_1_0.0
+ */
+ MULTI_LINE,
+
+ /**
+ * @brief The line horizontal alignment
+ * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN
+ * @SINCE_1_0.0
+ */
+ HORIZONTAL_ALIGNMENT,
+
+ /**
+ * @brief The line vertical alignment
+ * @details name "verticalAlignment", type STRING, values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP
+ * @SINCE_1_0.0
+ */
+ VERTICAL_ALIGNMENT,
+
+ /**
+ * @brief The color of the text
+ * @details name "textColor", type VECTOR4
+ * @SINCE_1_0.0
+ */
+ TEXT_COLOR,
+
+ /**
+ * @brief The drop shadow offset 0 indicates no shadow
+ * @details name "shadowOffset", type VECTOR4
+ * @SINCE_1_0.0
+ */
+ SHADOW_OFFSET,
+
+ /**
+ * @brief The color of a drop shadow
+ * @details name "shadowColor", type VECTOR4
+ * @SINCE_1_0.0
+ */
+ SHADOW_COLOR,
+
+ /**
+ * @brief The underline enabled flag
+ * @details name "underlineEnabled", type BOOLEAN
+ * @SINCE_1_0.0
+ */
+ UNDERLINE_ENABLED,
+
+ /**
+ * @brief The color of the underline
+ * @details name "underlineColor", type VECTOR4
+ * @SINCE_1_0.0
+ */
+ UNDERLINE_COLOR,
+
+ /**
+ * @brief Overrides the underline height from font metrics
+ * @details name "underlineHeight", type FLOAT
+ * @SINCE_1_0.0
+ */
+ UNDERLINE_HEIGHT,
+
+ /**
+ * @brief Whether the mark-up processing is enabled
+ * @details name "enableMarkup", type BOOLEAN
+ * @SINCE_1_0.0
+ */
+ ENABLE_MARKUP,
+
+ /**
+ * @brief Start or stop auto scrolling,
+ * @details name "enableMarkup", type BOOLEAN, default is false
+ * @SINCE_1_1.35
+ */
+ ENABLE_AUTO_SCROLL,
+
+ /**
+ * @brief Start or stop auto scrolling,
+ * @details name "autoScrollSpeed", type INT, default in style sheet
+ * @SINCE_1_1.35
+ */
+ AUTO_SCROLL_SPEED,
+
+ /**
+ * @brief Number of complete loops when scrolling enabled
+ * @details name "autoScrollLoopCount", type INT, default in style sheet
+ * @SINCE_1_1.35
+ */
+ AUTO_SCROLL_LOOP_COUNT,
+
+ /**
+ * @brief Gap before before scrolling wraps
+ * @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being show at start and end.
+ * @SINCE_1_1.35
+ */
+ AUTO_SCROLL_GAP
};
};
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 34;
+const unsigned int TOOLKIT_MICRO_VERSION = 36;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
$(public_api_src_dir)/controls/buttons/push-button.cpp \
$(public_api_src_dir)/controls/buttons/radio-button.cpp \
$(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \
+ $(public_api_src_dir)/controls/flex-container/flex-container.cpp \
$(public_api_src_dir)/controls/image-view/image-view.cpp \
$(public_api_src_dir)/controls/model3d-view/model3d-view.cpp \
$(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \
public_api_model3d_view_header_files = \
$(public_api_src_dir)/controls/model3d-view/model3d-view.h
+public_api_flex_container_header_files = \
+ $(public_api_src_dir)/controls/flex-container/flex-container.h
+
public_api_gaussian_blur_view_header_files = \
$(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
{
"textlabel":
{
- "pointSize":18
+ "pointSize":18,
+ "enableAutoScroll":false,
+ "autoScrollLoopCount":2,
+ "autoScrollGap":50,
+ "autoScrollSpeed":80
},
"textlabelFontSize0":
{
"textlabel":
{
- "pointSize":18
+ "pointSize":18,
+ "enableAutoScroll":false,
+ "autoScrollLoopCount":2,
+ "autoScrollGap":50,
+ "autoScrollSpeed":80
},
"textlabelFontSize0":
+ [Relative To Constraint](@ref constraints-relative-to)
+ [Multi-threading Notes](@ref animation-multi-threading-notes)
+ [Shader Animation](@ref animation-shader)
- + [Styling](@ref styling)
+ + [Styling](@ref styling)
### Resources
+ [Resource Image](@ref resource-image)
- The parameter to DALI_PROPERTY_TABLE_END should match the start index of the property enumeration.
<br>
-<h2 class="pg">How to implement a property within Dali-toolkit:</h2>
+<h2 class="pg">How to implement a property within Dali-toolkit controls and application-side custom controls:</h2>
Macros are used to define properties for the following reasons:
Source file: <b>image-view-impl.cpp</b>, within an unnamed namespace:
+@code
+#include <dali/public-api/object/type-registry-helper.h>
+@endcode
+
@clip{"image-view-impl.cpp",DALI_TYPE_REGISTRATION_BEGIN,DALI_TYPE_REGISTRATION_END}
<b>Notes:</b>
- Properties should be in the same order as in the enum.
- Signals and actions are registered likewise in that order.
- Properties type-registered using these macros will have their order checked at compile time. If you get an indexing compile error, check the order matches the enum order.
+ The error will look like this: " error: invalid application of 'sizeof' to incomplete type 'Dali::CompileTimeAssertBool<false>' "
+- If using the Pimpl design pattern when creating a custom control from within an application, the Handle (public) and Object (internal) classes should have the same name. They can be separated by different namespaces.
+ This requirement is actually due to how the type-registry in DALi looks up properties.
<br>
<hr>
|:----------------------|:--------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------:|
| Default | Properties defined within DALi Core, e.g. Dali::Actor, Dali::ShaderEffect default properties etc. | \link Dali::DEFAULT_OBJECT_PROPERTY_START_INDEX DEFAULT_OBJECT_PROPERTY_START_INDEX\endlink | \link Dali::DEFAULT_PROPERTY_MAX_COUNT DEFAULT_PROPERTY_MAX_COUNT\endlink (9999999) |
| Registered | Properties registered using Dali::PropertyRegistration | \link Dali::PROPERTY_REGISTRATION_START_INDEX PROPERTY_REGISTRATION_START_INDEX\endlink (10000000) | \link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999) |
-| Registered Animatable | Animatable properties registered using Dali::PropertyRegistration | \link Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX\endlink (20000000) | \link Dali::ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX\endlink (29999999) |
+| Registered Animatable | Animatable properties registered using Dali::AnimatablePropertyRegistration | \link Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX\endlink (20000000) | \link Dali::ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX\endlink (29999999) |
+| Registered Child | Child properties (which parent supports in its children) registered using Dali::ChildPropertyRegistration | \link Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX\endlink (20000000) | \link Dali::CHILD_PROPERTY_REGISTRATION_MAX_INDEX CHILD_PROPERTY_REGISTRATION_MAX_INDEX\endlink (49999999) |
| Control | Property range reserved by Dali::Toolkit::Control | \link Dali::Toolkit::Control::CONTROL_PROPERTY_START_INDEX CONTROL_PROPERTY_START_INDEX\endlink (10000000) | \link Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX CONTROL_PROPERTY_END_INDEX\endlink (10001000) |
| Derived Control | Property range for control deriving directly from Dali::Toolkit::Control | 10001001 | \link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999) |
| Custom | Custom properties added to instance using Dali::Handle::RegisterProperty | \link Dali::PROPERTY_CUSTOM_START_INDEX PROPERTY_CUSTOM_START_INDEX\endlink (50000000) | Onwards... |
// Create flex items and set the proportion
Dali::Toolkit::Control item1 = Dali::Toolkit::Control::New();
-item1.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE );
+item1.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f );
flexContainer.Add( item1 );
Dali::Toolkit::Control item2 = Dali::Toolkit::Control::New();
-item2.RegisterProperty( "flex", 3.0f, Dali::Property::READ_WRITE );
+item2.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 3.0f );
flexContainer.Add( item2 );
Dali::Toolkit::Control item3 = Dali::Toolkit::Control::New();
-item3.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE );
+item3.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f );
flexContainer.Add( item3 );
Dali::Toolkit::Control item4 = Dali::Toolkit::Control::New();
-item4.RegisterProperty( "flex", 2.0f, Dali::Property::READ_WRITE );
+item4.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 2.0f );
flexContainer.Add( item4 );
Dali::Toolkit::Control item5 = Dali::Toolkit::Control::New();
-item5.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE );
+item5.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f );
flexContainer.Add( item5 );
~~~
// Create flex items and set the proportion
var item1 = new dali.Control();
-item1.registerCustomProperty("flex", 1.0, dali.PROPERTY_READ_WRITE);
+item1.flex = 1.0;
flexContainer.add(item1);
var item2 = new dali.Control();
-item2.registerCustomProperty("flex", 3.0, dali.PROPERTY_READ_WRITE);
+item2.flex = 3.0;
flexContainer.add(item2);
var item3 = new dali.Control();
-item3.registerCustomProperty("flex", 1.0, dali.PROPERTY_READ_WRITE);
+item3.flex = 1.0;
flexContainer.add(item3);
var item4 = new dali.Control();
-item4.registerCustomProperty("flex", 2.0, dali.PROPERTY_READ_WRITE);
+item4.flex = 2.0;
flexContainer.add(item4);
var item5 = new dali.Control();
-item5.registerCustomProperty("flex", 1.0, dali.PROPERTY_READ_WRITE);
+item5.flex = 1.0;
flexContainer.add(item5);
~~~
// Create flex items and add them to the flex container
Dali::Toolkit::Control item1 = Dali::Toolkit::Control::New();
-item1.RegisterProperty( "alignSelf", Dali::Toolkit::FlexContainer::ALIGN_CENTER, Dali::Property::READ_WRITE ); // Align item1 at the center of the container
+item1.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // Align item1 at the center of the container
flexContainer.Add( item1 );
Dali::Toolkit::Control item2 = Dali::Toolkit::Control::New();
flexContainer.Add( item2 ); // item2 is aligned at the beginning of ther container
Dali::Toolkit::Control item3 = Dali::Toolkit::Control::New();
-item3.RegisterProperty( "alignSelf", Dali::Toolkit::FlexContainer::ALIGN_FLEX_END, Dali::Property::READ_WRITE ); // Align item3 at the bottom of the container
+item3.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexContainer::ALIGN_FLEX_END ); // Align item3 at the bottom of the container
flexContainer.Add( item3 );
Dali::Toolkit::Control item4 = Dali::Toolkit::Control::New();
// Create flex items and add them to the flex container
var item1 = new dali.Control();
-item1.registerCustomProperty("alignSelf", "center", dali.PROPERTY_READ_WRITE); // Align item1 at the center of the container
+item1.alignSelf = "center"; // Align item1 at the center of the container
flexContainer.add(item1);
var item2 = new dali.Control();
flexContainer.add(item2); // item2 is aligned at the beginning of ther container
var item3 = new dali.Control();
-item1.registerCustomProperty("alignSelf", "flexEnd", dali.PROPERTY_READ_WRITE); // Align item3 at the bottom of the container
+item1.alignSelf = "flexEnd"; // Align item3 at the bottom of the container
flexContainer.add(item3);
var item4 = new dali.Control();
Dali::Toolkit::Control item = Dali::Toolkit::Control::New();
// Add the margin around the item
-item.RegisterProperty( "flexMargin", Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE );
+item.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Vector4(10.0f, 10.0f, 10.0f, 10.0f) );
// Add the item to the container
flexContainer.Add( item );
var item = new dali.Control();
// Add the margin around the item
-item.registerCustomProperty("flexMargin", [10.0, 10.0, 10.0, 10.0], dali.PROPERTY_READ_WRITE);
+item.flexMargin = [10.0, 10.0, 10.0, 10.0];
// Add the item to the container
flexContainer.add(item);
toolBar.SetProperty( Dali::Toolkit::FlexContainer::Property::FLEX_DIRECTION, Dali::Toolkit::FlexContainer::ROW ); // display toolbar items horizontally
toolBar.SetProperty( Dali::Toolkit::FlexContainer::Property::ALIGN_ITEMS, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // align toolbar items vertically center
-toolBar.RegisterProperty( "flex", 0.1f, Dali::Property::READ_WRITE ); // 10 percent of available space in the cross axis
+toolBar.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 0.1f ); // 10 percent of available space in the cross axis
~~~
~~~{.js}
toolBar.flexDirection = "row"; // display toolbar items horizontally
toolBar.alignItems = "center"; // align toolbar items vertically center
-toolBar.registerCustomProperty("flex", 0.1, dali.PROPERTY_READ_WRITE); // 10 percent of available space in the cross axis
+toolBar.flex = 0.1; // 10 percent of available space in the cross axis
~~~
Then we create another flex container as the content area to display the image, and it will be displayed in the bottom of the main container.
content.SetProperty( Dali::Toolkit::FlexContainer::Property::FLEX_DIRECTION, Dali::Toolkit::FlexContainer::ROW ); // display items horizontally
content.SetProperty( Dali::Toolkit::FlexContainer::Property::JUSTIFY_CONTENT, Dali::Toolkit::FlexContainer::JUSTIFY_CENTER ); // align items horizontally center
content.SetProperty( Dali::Toolkit::FlexContainer::Property::ALIGN_ITEMS, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // align items vertically center
-content.RegisterProperty( "flex", 0.9f, Dali::Property::READ_WRITE ); // 90 percent of available space in the cross axis
+content.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 0.9f ); // 90 percent of available space in the cross axis
// Add it to the main container
flexContainer.Add( content );
content.flexDirection = "row";
content.alignItems = "center"; // align items vertically center
content.justifyContent = "center"; // align items horizontally center
-content.registerCustomProperty("flex", 0.9, dali.PROPERTY_READ_WRITE); // 90 percent of available space in the cross axis
+content.flex = 0.9; // 90 percent of available space in the cross axis
// Add it to the main container
flexContainer.add(content);
prevButton.SetParentOrigin( Dali::ParentOrigin::TOP_LEFT );
prevButton.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
prevButton.SetMinimumSize( Dali::Vector2( 100.0f, 60.0f ) ); // this is the minimum size the button should keep
-prevButton.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the button
+prevButton.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the button
toolBar.Add( prevButton );
// Set the button text
title.SetResizePolicy( Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::ALL_DIMENSIONS );
title.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
title.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
-title.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE ); // take all the available space left apart from the two buttons
-title.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the title
+title.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f ); // take all the available space left apart from the two buttons
+title.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the title
toolBar.Add( title );
// Add a button to the right of the toolbar
nextButton.SetParentOrigin( Dali::ParentOrigin::TOP_LEFT );
nextButton.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
nextButton.SetMinimumSize( Dali::Vector2( 100.0f, 60.0f ) ); // this is the minimum size the button should keep
-nextButton.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the button
+nextButton.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the button
toolBar.Add( nextButton );
// Set the button text
prevButton.anchorPoint = dali.TOP_LEFT;
prevButton.minimumSize = [100.0, 60.0]; // this is the minimum size the button should keep
prevButton.labelText = "Prev";
-prevButton.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the button
+prevButton.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the button
toolBar.add( prevButton );
title.horizontalAlignment = "CENTER";
title.verticalAlignment = "CENTER";
title.text = "Gallery";
-title.registerCustomProperty("flex", 1.0, dali.PROPERTY_READ_WRITE); // take all the available space left apart from the two buttons
-title.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the title
+title.flex = 1.0; // take all the available space left apart from the two buttons
+title.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the title
toolBar.add( title );
nextButton.anchorPoint = dali.TOP_LEFT;
nextButton.minimumSize = [100.0, 60.0]; // this is the minimum size the button should keep
nextButton.labelText = "Next";
-nextButton.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the button
+nextButton.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the button
toolBar.add( nextButton );
~~~
--- /dev/null
+<!--
+/**-->
+
+# Text auto scrolling {#text-auto-scrolling}
+
+## Overview
+
+Auto TextLabel scrolling enables the text to scroll within the control, it can be used if text exceeds the boundary of the control hence showing the full content.
+It will also scroll text that is smaller than the control and ensure the same bit of text is not visible at the same time, this gap can be configured to be larger.
+
+If the number of loops (repetitions) is not set then once triggered to start it will scroll until requested to stop.
+If loop count is set to 3 for example it will scroll the text 3 times.
+
+![ ](../assets/img/text-controls/AutoScroll.gif)
+![ ](AutoScroll.gif)
+
+### Usage
+
+At version 1.1.35 auto scrolling is only supported in single line, mutliline text will not scroll and Text should be BEGIN aligned.
+
+The ENABLE_AUTO_SCROLL property should be set to TRUE to enable scrolling.
+
+The scroll speed, gap and loop count can be set in the stylesheet or provided by Dali::Handle::SetProperty. See the description of each below.
+
+Once enabled it will start scrolling until the loop count is completed or the ENABLE_AUTO_SCROLL set to false, setting ENABLE_AUTO_SCROLL to false will let the
+text complete it's current scrolling loop then stop.
+
+## The additional properties below can be set to customise the scrolling behaviour
+
+#### AUTO_SCROLL_SPEED
+
+This controls the speed of the scrolling, the speed should be provided as pixels/second.
+
+#### AUTO_SCROLL_LOOP_COUNT
+
+This specifies how many times the text will complete a full scroll cycle.
+If not set then it will keep scrolling until ENABLE_AUTO_SCROLL is set to false.
+
+Setting ENABLE_AUTO_SCROLL to false will stop scrolling whilst still maintaining the original loop count value for when it is next started.
+
+#### AUTO_SCROLL_GAP
+
+This specifies the amount of whitespace to display before the scrolling text is shown again.
+
+This will be increased if the given value is not large enough to prevent the same bit of text being visible at two locations in the control.
+
+Provide the distance in pixels.
+
+### Scroll Direction
+
+The scroll direction is choosen automatically with the following rules:
+
+If the text is single-lined it will scroll left when the text is Left to Right (LTR) or scroll right if text is Right to Left (RTL).
+
+If the text is multi-lined it will scroll upwards. ( Not supported at 1.1.35 )
+
+### Text Label Scrolling Properties
+
+The properties used by TextLabel for Auto Scrolling are listed [here](@ref TextLabelProperties)
+
+@class TextLabel_Scrolling
+
+*/
![ ](../assets/img/text-controls/TextWith1pxUnderline.png)
![ ](TextWith1pxUnderline.png)
-### Text Label Properties
+### Auto Scrolling
+
+![ ](../assets/img/text-controls/AutoScroll.gif)
+![ ](AutoScroll.gif)
- Name (JavaScript) | Name (C++) | Type | Writable | Animatable
----------------------|----------------------|--------------|--------------|-----------
- renderingBackend | RENDERING_BACKEND | INTEGER | O | X
- text | TEXT | STRING | O | X
- fontFamily | FONT_FAMILY | STRING | O | X
- fontStyle | FONT_STYLE | STRING | O | X
- pointSize | POINT_SIZE | FLOAT | O | X
- multiLine | MULTI_LINE | BOOLEAN | O | X
- horizontalAlignment | HORIZONTAL_ALIGNMENT | STRING | O | X
- verticalAlignment | VERTICAL_ALIGNMENT | STRING | O | X
- textColor | TEXT_COLOR | VECTOR4 | O | X
- shadowOffset | SHADOW_OFFSET | VECTOR2 | O | X
- shadowColor | SHADOW_COLOR | VECTOR4 | O | X
- underlineEnabled | UNDERLINE_ENABLED | BOOLEAN | O | X
- underlineColor | UNDERLINE_COLOR | VECTOR4 | O | X
- underlineHeight | UNDERLINE_HEIGHT | FLOAT | O | X
- enableMarkup | ENABLE_MARKUP | BOOLEAN | O | X
+The \link text-auto-scrolling Auto text scrolling \endlink section details how to scroll text automatically.
+### Text Label Properties
+The properties used by TextLabel are listed [here](@ref TextLabelProperties)
@class TextLabel
toolBar.backgroundColor = dali.COLOR_CYAN;
toolBar.flexDirection = "row"; // display toolbar items horizontally
toolBar.alignItems = "center"; // align toolbar items vertically center
- toolBar.registerCustomProperty("flex", 0.1, dali.PROPERTY_READ_WRITE); // 10 percent of available space in the cross axis
+ toolBar.flex = 0.1; // 10 percent of available space in the cross axis
flexContainer.add(toolBar);
content.flexDirection = "row";
content.alignItems = "center"; // align items vertically center
content.justifyContent = "center"; // align items horizontally center
- content.registerCustomProperty("flex", 0.9, dali.PROPERTY_READ_WRITE); // 90 percent of available space in the cross axis
+ content.flex = 0.9; // 90 percent of available space in the cross axis
flexContainer.add(content);
prevButton.anchorPoint = dali.TOP_LEFT;
prevButton.minimumSize = [100.0, 60.0]; // this is the minimum size the button should keep
prevButton.labelText = "Prev";
- prevButton.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the button
+ prevButton.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the button
toolBar.add( prevButton );
title.verticalAlignment = "CENTER";
title.text = "Gallery";
title.pointSize = 28;
- title.registerCustomProperty("flex", 1.0, dali.PROPERTY_READ_WRITE); // take all the available space left apart from the two buttons
- title.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the title
+ title.flex = 1.0; // take all the available space left apart from the two buttons
+ title.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the title
toolBar.add( title );
nextButton.anchorPoint = dali.TOP_LEFT;
nextButton.minimumSize = [100.0, 60.0]; // this is the minimum size the button should keep
nextButton.labelText = "Next";
- nextButton.registerCustomProperty("flexMargin", [10, 10, 10, 10], dali.PROPERTY_READ_WRITE); // set 10 pixel margin around the button
+ nextButton.flexMargin = [10, 10, 10, 10]; // set 10 pixel margin around the button
toolBar.add( nextButton );
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.1.34
+Version: 1.1.36
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
autoreconf --install
DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
-%configure --enable-profile=%{dali_toolkit_profile} --with-style=%{dali_style_folder} --enable-i18n=yes
+
+%configure --enable-profile=%{dali_toolkit_profile} \
+ --with-style=%{dali_style_folder} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ --enable-i18n=yes
+
make %{?jobs:-j%jobs}
##############################
// CLASS HEADER
#include "module-loader.h"
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+
// INTERNAL INCLUDES
#include <v8-utils.h>
}
else
{
- std::string error="Invalid property Set for "+name + "\n";
- DALI_SCRIPT_EXCEPTION( isolate, error );
+ // Trying to set the value for a property that is not registered yet.
+ std::stringstream msg;
+ msg << "Trying to set the value of an unregistered property: ";
+ msg << name;
+ DALI_SCRIPT_WARNING( msg.str().c_str() );
+
+ // Register the custom property automatically.
+ handle.RegisterProperty( name, PropertyValueWrapper::ExtractPropertyValue( isolate, javaScriptValue), Property::READ_WRITE );
}
}
return daliPropertyValue;
}
+Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* isolate, v8::Local< v8::Value> v8Value)
+{
+ v8::HandleScope handleScope( isolate);
+
+ Dali::Property::Value daliPropertyValue;
+
+ // Check if it's a javascript Array
+ Dali::Property::Value array = VectorOrMatrixFromV8Array( isolate, v8Value );
+
+ if( V8Utils::IsBooleanPrimitiveOrObject( v8Value ) )
+ {
+ daliPropertyValue = Dali::Property::Value( V8Utils::GetBooleanValue( isolate, v8Value));
+ }
+ else if( V8Utils::IsNumberPrimitiveOrObject( v8Value ) )
+ {
+ daliPropertyValue = Dali::Property::Value( V8Utils::GetNumberValue( isolate, v8Value) );
+ }
+ else if( v8Value->IsInt32() )
+ {
+ daliPropertyValue = Dali::Property::Value( v8Value->Int32Value() ) ;
+ }
+ else if( V8Utils::IsStringPrimitiveOrObject( v8Value) )
+ {
+ daliPropertyValue = Dali::Property::Value( V8Utils::GetStringValue( isolate, v8Value) );
+ }
+ else if( array.GetType() == Dali::Property::VECTOR2
+ || array.GetType() == Dali::Property::VECTOR3
+ || array.GetType() == Dali::Property::VECTOR4 )
+ {
+ daliPropertyValue = array;
+ }
+ else if( array.GetType() == Dali::Property::MATRIX )
+ {
+ Dali::Matrix mat = array.Get<Dali::Matrix>();
+ daliPropertyValue = mat;
+ }
+ else if( array.GetType() == Dali::Property::MATRIX3 )
+ {
+ Dali::Matrix3 mat = array.Get<Dali::Matrix3>();
+ daliPropertyValue = mat;
+ }
+ else if( array.GetType() == Dali::Property::ARRAY )
+ {
+ daliPropertyValue = ArrayFromV8Array( isolate, v8Value );
+ }
+ else if( v8Value->IsObject() )
+ {
+ // Assume this is a property map
+ v8::Local<v8::Object> object = v8::Handle<v8::Object>::Cast(v8Value);
+ Dali::Property::Map propertyMap = V8Utils::GetPropertyMapFromObject(isolate, object);
+ daliPropertyValue = Dali::Property::Value( propertyMap );
+ }
+
+ return daliPropertyValue;
+}
+
void PropertyValueWrapper::NewRotation( const v8::FunctionCallbackInfo< v8::Value >& args)
{
v8::Isolate* isolate = args.GetIsolate();
static Dali::Property::Value ExtractPropertyValue( v8::Isolate* isolate, v8::Local< v8::Value> v8Value, Dali::Property::Type type);
/**
+ * Extract a property value from a javascript object
+ * @return property value
+ */
+ static Dali::Property::Value ExtractPropertyValue( v8::Isolate* isolate, v8::Local< v8::Value> v8Value);
+
+ /**
* @brief Extract a vector or a matrix from a JavaScript array
* @return property value ( vector or matrix)
*/
return ret;
}
-
-
void ScriptError( const char* function, v8::Isolate* isolate, std::string errorString )
{
v8::EscapableHandleScope scope( isolate);
isolate->ThrowException( v8::String::NewFromUtf8( isolate, errorMsg.c_str()) );
}
+void ScriptWarning( const char* function, std::string warningString )
+{
+ std::string warningMsg = std::string(function) + std::string("(), ") + warningString;
+ DALI_LOG_WARNING("%s \n", warningMsg.c_str() );
+}
+
bool IsBooleanPrimitiveOrObject( const v8::Local<v8::Value>& value )
{
return ( value->IsBoolean() || value->IsBooleanObject());
v8::Local<v8::Int32> v = value->ToInt32();
return Dali::Property::Value(static_cast<int>(v->Value()));
}
+ else if( value->IsString() )
+ {
+ found = true;
+ std::string valueString = V8Utils::v8StringToStdString( value );
+ return Dali::Property::Value(valueString);
+ }
+
return daliPropertyValue;
}
};
#define DALI_SCRIPT_EXCEPTION( isolate, message ) V8Utils::ScriptError( __FUNCTION__ , isolate, message );
+#define DALI_SCRIPT_WARNING( message ) V8Utils::ScriptWarning( __FUNCTION__ , message );
namespace V8Utils
{
void ScriptError( const char* function, v8::Isolate* isolate, std::string errorString );
/**
+ * Script warning
+ */
+void ScriptWarning( const char* function, std::string warningString );
+
+/**
* @return in the value is a boolean primitive or a boolean object
*/
bool IsBooleanPrimitiveOrObject( const v8::Local<v8::Value>& value );