From: David Steele Date: Tue, 2 Aug 2016 10:21:53 +0000 (+0100) Subject: VR: Merge devel/master into devel/new_vr branch X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2d851df4b0fd7cff04d90f6a12576471a8cf18b;p=platform%2Fcore%2Fuifw%2Fdali-demo.git VR: Merge devel/master into devel/new_vr branch Change-Id: I453b40b129d97029bd3b95eac8c18024e48f2f08 --- diff --git a/.gitignore b/.gitignore index 4f0ee13..156dc31 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ dali-builder *.mo demo-theme.json simple-image-wall.js +/shared/resources-location.cpp diff --git a/build/tizen/.gitignore b/build/tizen/.gitignore index bc56788..9425618 100644 --- a/build/tizen/.gitignore +++ b/build/tizen/.gitignore @@ -10,3 +10,4 @@ install_manifest.txt /docs/dali.doxy /builder/dali-builder /examples/*.demo +/mo diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 11b2fec..575f2b6 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -5,17 +5,22 @@ SET(dali-demo_VERSION_MAJOR 1) SET(dali-demo_VERSION_MINOR 0) SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..) +SET(DEMO_SHARED ${CMAKE_SOURCE_DIR}/../../shared) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) IF(DEFINED DALI_APP_DIR) - SET(APP_DATA_DIR ${DALI_APP_DIR}) - SET(BINDIR ${APP_DATA_DIR}/bin) + SET(BINDIR ${DALI_APP_DIR}/bin) ELSE() - SET(APP_DATA_DIR ${PREFIX}/share/com.samsung.dali-demo) SET(BINDIR ${PREFIX}/bin) ENDIF() +IF(DEFINED DALI_APP_RES_DIR) + SET(APP_DATA_RES_DIR ${DALI_APP_RES_DIR}) +ELSE() + SET(APP_DATA_RES_DIR ${PREFIX}/share/com.samsung.dali-demo/res) +ENDIF() + MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} ) if(CMAKE_BUILD_TYPE MATCHES Debug) MESSAGE("Setting variable: DEBUG_ENABLED") @@ -31,11 +36,11 @@ IF(NOT DEFINED LOCAL_STYLE_DIR) SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style) ENDIF() -SET(IMAGES_DIR ${APP_DATA_DIR}/images/) -SET(VIDEOS_DIR ${APP_DATA_DIR}/videos/) -SET(MODELS_DIR ${APP_DATA_DIR}/models/) -SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) -SET(STYLE_DIR ${APP_DATA_DIR}/style/) +SET(IMAGES_DIR ${APP_DATA_RES_DIR}/images/) +SET(VIDEOS_DIR ${APP_DATA_RES_DIR}/videos/) +SET(MODELS_DIR ${APP_DATA_RES_DIR}/models/) +SET(SCRIPTS_DIR ${APP_DATA_RES_DIR}/scripts/) +SET(STYLE_DIR ${APP_DATA_RES_DIR}/style/) IF(NOT DEFINED LOCALE_DIR) SET(LOCALE_DIR ${PREFIX}/share/locale) @@ -46,11 +51,13 @@ SET(DEMO_VIDEO_DIR \\"${VIDEOS_DIR}\\") SET(DEMO_MODEL_DIR \\"${MODELS_DIR}\\") SET(DEMO_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") SET(DEMO_STYLE_DIR \\"${STYLE_DIR}\\") -SET(DEMO_THEME_PATH \\"${STYLE_DIR}/demo-theme.json\\") +SET(DEMO_THEME_PATH \\"${STYLE_DIR}demo-theme.json\\") SET(DEMO_EXAMPLE_BIN \\"${BINDIR}/\\") SET(DEMO_LOCALE_DIR \\"${LOCALE_DIR}\\") SET(DEMO_LANG \\"${LANG}\\") +SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}/images) + FILE(GLOB LOCAL_IMAGES_PNG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.png") FILE(GLOB LOCAL_IMAGES_JPG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.jpg") FILE(GLOB LOCAL_IMAGES_GIF RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.gif") @@ -81,12 +88,27 @@ FOREACH(flag ${LOCAL_SCRIPTS_LIST}) INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR}) ENDFOREACH(flag) +#Create resources location file +CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) + #Replace @DEMO_STYLE_IMAGE_DIR@ in following files -SET(DEMO_STYLE_IMAGE_DIR ${IMAGES_DIR}) CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) -INSTALL(FILES ${LOCAL_STYLE_DIR}/demo-theme.json DESTINATION ${STYLE_DIR}) -CONFIGURE_FILE( ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js.in ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js ) -INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js DESTINATION ${SCRIPTS_DIR}) +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json ) +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) +MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files") + +FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json") +FOREACH(flag ${LOCAL_STYLES_LIST}) + INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}) +ENDFOREACH(flag) +MESSAGE("Installed ${LOCAL_STYLES_LIST} to ${STYLE_DIR}") + +FILE(GLOB LOCAL_STYLE_IMAGES_LIST "${LOCAL_STYLE_DIR}/images/*.png") +FOREACH(flag ${LOCAL_STYLE_IMAGES_LIST}) + INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}/images) +ENDFOREACH(flag) +MESSAGE("Installed style resources ${LOCAL_STYLE_IMAGES_LIST} to ${STYLE_DIR}/images") SET(PKG_LIST dali-core dali-adaptor @@ -99,13 +121,47 @@ FOREACH(flag ${REQUIRED_PKGS_CFLAGS}) SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") +SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_STYLE_DIR=${DEMO_STYLE_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") + +########################################################################### +# Internationalization + +SET(PO_DIR ${RESOURCE_DIR}/po) + +FILE(GLOB PO_FILES RELATIVE "${PO_DIR}" "${PO_DIR}/*.po") + +SET(MSGFMT "/usr/bin/msgfmt") +SET(MO_FILES_DIR ${CMAKE_BINARY_DIR}/mo) +FILE(MAKE_DIRECTORY ${MO_FILES_DIR}) + +FOREACH(PO_FILE ${PO_FILES}) + SET(PO_FILE ${PO_DIR}/${PO_FILE}) + MESSAGE("PO: ${PO_FILE}") + GET_FILENAME_COMPONENT(ABS_PO_FILE ${PO_FILE} ABSOLUTE) + GET_FILENAME_COMPONENT(lang ${ABS_PO_FILE} NAME_WE) + SET(MO_FILE ${MO_FILES_DIR}/${lang}.mo) + ADD_CUSTOM_COMMAND(OUTPUT ${MO_FILE} + COMMAND ${MSGFMT} -o ${MO_FILE} ${ABS_PO_FILE} + DEPENDS ${ABS_PO_FILE}) + INSTALL(FILES ${MO_FILE} DESTINATION ${LOCALE_DIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo) + SET(MO_FILES ${MO_FILES} ${MO_FILE}) +ENDFOREACH(PO_FILE) + +MESSAGE(".mo files: ${MO_FILES}") +ADD_CUSTOM_TARGET(po ALL DEPENDS ${MO_FILES}) + +OPTION(INTERNATIONALIZATION "Internationalization demo string names" ON) +IF (INTERNATIONALIZATION) + SET(DALI_DEMO_CFLAGS "${DALI_DEMO_CFLAGS} -DINTERNATIONALIZATION_ENABLED") +ENDIF(INTERNATIONALIZATION) + +########################################################################### SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) -INCLUDE_DIRECTORIES(${DEMO_SRC_DIR}) +#INCLUDE_DIRECTORIES(${DEMO_SRC_DIR}) ADD_SUBDIRECTORY(demo) ADD_SUBDIRECTORY(examples) diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt index 227bc50..6aaf032 100644 --- a/build/tizen/demo/CMakeLists.txt +++ b/build/tizen/demo/CMakeLists.txt @@ -2,31 +2,14 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) + +IF(NOT DEFINED DALI_APP_RES_DIR) + message([STATUS] "Setting application resource path from resource-location file") + SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") +ENDIF() + ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) -# Internationalization - -SET(PO_DIR ${DEMO_SRC_DIR}/po) - -FILE(GLOB PO_FILES RELATIVE "${PO_DIR}" "${PO_DIR}/*.po") - -SET(MSGFMT "/usr/bin/msgfmt") - -FOREACH(PO_FILE ${PO_FILES}) - SET(PO_FILE ${PO_DIR}/${PO_FILE}) - MESSAGE("PO: ${PO_FILE}") - GET_FILENAME_COMPONENT(ABS_PO_FILE ${PO_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(lang ${ABS_PO_FILE} NAME_WE) - SET(MO_FILE ${PO_DIR}/${lang}.mo) - ADD_CUSTOM_COMMAND(OUTPUT ${MO_FILE} - COMMAND ${MSGFMT} -o ${MO_FILE} ${ABS_PO_FILE} - DEPENDS ${ABS_PO_FILE}) - INSTALL(FILES ${MO_FILE} DESTINATION ${LOCALE_DIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo) - SET(MO_FILES ${MO_FILES} ${MO_FILE}) -ENDFOREACH(PO_FILE) - -MESSAGE(".mo files: ${MO_FILES}") -ADD_CUSTOM_TARGET(po ALL DEPENDS ${MO_FILES}) diff --git a/build/tizen/examples/CMakeLists.txt b/build/tizen/examples/CMakeLists.txt index 7fa03fe..d83f427 100644 --- a/build/tizen/examples/CMakeLists.txt +++ b/build/tizen/examples/CMakeLists.txt @@ -15,6 +15,10 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) FOREACH(EXAMPLE ${SUBDIRS}) FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") + IF(NOT DEFINED DALI_APP_RES_DIR) + SET( SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") + + ENDIF() ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) diff --git a/build/tizen/resources-location.in b/build/tizen/resources-location.in new file mode 100644 index 0000000..89b0b87 --- /dev/null +++ b/build/tizen/resources-location.in @@ -0,0 +1,8 @@ +/** + * This file defines the location dali-demo resources + It is used exclusively for Ubuntu builds where an application resource directory is explicity defined. + */ + +#include + +int dali_demo_RESOURCE_DIR = setenv("DALI_APPLICATION_PACKAGE", "@APP_DATA_RES_DIR@" , 1); diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 6c856c3..4a58819 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -55,9 +55,6 @@ - - - @@ -169,4 +166,10 @@ + + + + + + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 25f2ddc..adf8b2b 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -1,7 +1,7 @@ #include "../examples/hello-world/hello-world-example.cpp" #if 0 /* - * 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. @@ -48,7 +48,6 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR)); demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH)); demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); - demo.AddExample(Example("radial-menu.example", DALI_DEMO_STR_TITLE_RADIAL_MENU)); demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); @@ -82,6 +81,9 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL)); demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); + demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); + demo.AddExample(Example("sparkle.example", DALI_DEMO_STR_TITLE_SPARKLE)); + demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR)); demo.SortAlphabetically( true ); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 312c87e..b336641 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -25,9 +25,12 @@ #include #include #include +#include +#include // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" using namespace Dali; using namespace Dali::Toolkit; @@ -38,13 +41,11 @@ namespace { const std::string LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" ); -const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DEMO_IMAGE_DIR "top-bar.png" ); const std::string TILE_BACKGROUND(DEMO_IMAGE_DIR "item-background.9.png"); -const std::string TILE_BACKGROUND_ALPHA(DEMO_IMAGE_DIR "item-background-alpha.9.png"); +const std::string TILE_BACKGROUND_ALPHA( DEMO_IMAGE_DIR "demo-tile-texture.9.png" ); -const char * const DEFAULT_TOOLBAR_TEXT( "TOUCH TO LAUNCH EXAMPLE" ); - -const float BUTTON_PRESS_ANIMATION_TIME = 0.25f; ///< Time to perform button scale effect. +const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text +const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect. const float ROTATE_ANIMATION_TIME = 0.5f; ///< Time to perform rotate effect. const int MAX_PAGES = 256; ///< Maximum pages (arbitrary safety limit) const int EXAMPLES_PER_ROW = 3; @@ -52,20 +53,21 @@ const int ROWS_PER_PAGE = 3; const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE; const float LOGO_MARGIN_RATIO = 0.1f / 0.3f; const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f; -const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent +const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights. const float STENCIL_RELATIVE_SIZE = 1.0f; const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); +const Vector4 TILE_COLOR( 0.4f, 0.6f, 0.9f, 0.6f ); const Vector4 BUBBLE_COLOR[] = { - Vector4( 0.3255f, 0.3412f, 0.6353f, 0.38f ), - Vector4( 0.3647f, 0.7569f, 0.8157f, 0.38f ), - Vector4( 0.3804f, 0.7412f, 0.6510f, 0.38f ), - Vector4( 1.f, 1.f, 1.f, 0.2f ) + Vector4( 0.3255f, 0.3412f, 0.6353f, 0.32f ), + Vector4( 0.3647f, 0.7569f, 0.8157f, 0.32f ), + Vector4( 0.3804f, 0.7412f, 0.6510f, 0.32f ), + Vector4( 1.f, 1.f, 1.f, 0.13f ) }; const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); @@ -83,6 +85,31 @@ const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f ); const float BUBBLE_MIN_Z = -1.0; const float BUBBLE_MAX_Z = 0.0f; +// This shader takes a texture. +// An alpha discard is performed. +// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect. +const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER( + varying mediump vec2 vTexCoord; + varying mediump vec3 vIllumination; + uniform lowp vec4 uColor; + uniform sampler2D sTexture; + uniform mediump vec3 uCustomPosition; + + void main() + { + if( texture2D( sTexture, vTexCoord ).a <= 0.0001 ) + { + discard; + } + + mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 ); + mediump vec4 color = texture2D( sTexture, wrapTexCoord ); + mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0; + + gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 ); + } +); + /** * Creates the background image */ @@ -90,12 +117,11 @@ Control CreateBackground( std::string stylename ) { Control background = Control::New(); Stage::GetCurrent().Add( background ); - background.SetProperty( Control::Property::STYLE_NAME,stylename); + background.SetStyleName( stylename ); background.SetName( "BACKGROUND" ); background.SetAnchorPoint( AnchorPoint::CENTER ); background.SetParentOrigin( ParentOrigin::CENTER ); background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - return background; } @@ -131,6 +157,41 @@ private: float mScale; }; +/** + * Constraint to precalculate values from the scroll-view + * and tile positions to pass to the tile shader. + */ +struct TileShaderPositionConstraint +{ + TileShaderPositionConstraint( float pageWidth, float tileXOffset ) + : mPageWidth( pageWidth ), + mTileXOffset( tileXOffset ) + { + } + + void operator()( Vector3& position, const PropertyInputContainer& inputs ) + { + // Set up position.x as the tiles X offset (0.0 -> 1.0). + position.x = mTileXOffset; + // Set up position.z as the linear scroll-view X offset (0.0 -> 1.0). + position.z = 1.0f * ( -fmod( inputs[0]->GetVector2().x, mPageWidth ) / mPageWidth ); + // Set up position.y as a rectified version of the scroll-views X offset. + // IE. instead of 0.0 -> 1.0, it moves between 0.0 -> 0.5 -> 0.0 within the same span. + if( position.z > 0.5f ) + { + position.y = 1.0f - position.z; + } + else + { + position.y = position.z; + } + } + +private: + float mPageWidth; + float mTileXOffset; +}; + bool CompareByTitle( const Example& lhs, const Example& rhs ) { return lhs.title < rhs.title; @@ -140,11 +201,9 @@ bool CompareByTitle( const Example& lhs, const Example& rhs ) DaliTableView::DaliTableView( Application& application ) : mApplication( application ), - mBackgroundLayer(), mRootActor(), mRotateAnimation(), mPressedAnimation(), - mScrollViewLayer(), mScrollView(), mScrollViewEffect(), mScrollRulerX(), @@ -184,60 +243,32 @@ void DaliTableView::Initialize( Application& application ) application.SetViewMode( STEREO_HORIZONTAL ); Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent ); - const Vector2 stageSize = Stage::GetCurrent().GetSize(); // Background - Control background = CreateBackground( "launcherbackground" ); - Stage::GetCurrent().Add( background ); - - // Add root actor - mRootActor = TableView::New( 4, 1 ); - mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); - mRootActor.SetParentOrigin( ParentOrigin::CENTER ); - mRootActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mRootActor = CreateBackground( "LauncherBackground" ); Stage::GetCurrent().Add( mRootActor ); - // Toolbar at top - Dali::Toolkit::ToolBar toolbar; - Dali::Layer toolBarLayer = DemoHelper::CreateToolbar(toolbar, - DEFAULT_TOOLBAR_IMAGE_PATH, - DEFAULT_TOOLBAR_TEXT, - DemoHelper::DEFAULT_VIEW_STYLE); - - mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) ); - mRootActor.SetFitHeight( 0 ); - // Add logo ImageView logo = CreateLogo( LOGO_PATH ); logo.SetName( "LOGO_IMAGE" ); + logo.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + logo.SetParentOrigin( Vector3( 0.5f, 0.1f, 0.5f ) ); logo.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); - const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; // Show version in a popup when log is tapped mLogoTapDetector = TapGestureDetector::New(); mLogoTapDetector.Attach( logo ); mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped ); - const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO; - - Alignment alignment = Alignment::New(); - alignment.SetName( "LOGO_ALIGNMENT" ); - alignment.Add( logo ); - alignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); - alignment.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); - Actor alignmentActor = alignment; - alignmentActor.SetPadding( Padding( 0.0f, 0.0f, logoMargin, logoMargin )); - mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); - mRootActor.SetFitHeight( 1 ); - - // scrollview occupying the majority of the screen + // Scrollview occupying the majority of the screen mScrollView = ScrollView::New(); + mScrollView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + mScrollView.SetParentOrigin( Vector3( 0.5f, 1.0f - 0.05f, 0.5f ) ); + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mScrollView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); + mScrollView.SetSizeModeFactor( Vector3( 0.0f, 0.6f, 0.0f ) ); - mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); - mScrollView.SetParentOrigin( ParentOrigin::CENTER ); - mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width; mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) ); @@ -246,42 +277,20 @@ void DaliTableView::Initialize( Application& application ) mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); mScrollView.TouchSignal().Connect( this, &DaliTableView::OnScrollTouched ); - mScrollViewLayer = Layer::New(); - - // Disable the depth test for performance - mScrollViewLayer.SetDepthTestDisabled( true ); - mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); - mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); - mScrollViewLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - - // Create solid background colour. - Control backgroundColourActor = Control::New(); - backgroundColourActor.SetBackgroundColor( BACKGROUND_COLOR ); - backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); - backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); - backgroundColourActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); - backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) ); - - mScrollViewLayer.Add( backgroundColourActor ); + mPageWidth = stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f; // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show Actor bubbleContainer = Actor::New(); bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); - backgroundColourActor.Add( bubbleContainer ); - SetupBackground( bubbleContainer ); - Alignment buttonsAlignment = Alignment::New(); - buttonsAlignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - buttonsAlignment.Add( mScrollViewLayer ); - - mScrollViewLayer.Add( mScrollView ); - - mRootActor.AddChild( buttonsAlignment, TableView::CellPosition( 2, 0 ) ); - - mRootActor.SetFixedHeight( 3, bottomMargin ); + mRootActor.Add( logo ); + // We use depth index to bring the logo above the bubbles (as an alternative to creating actors). + logo.GetRendererAt( 0 ).SetProperty( Renderer::Property::DEPTH_INDEX, 30000 ); + mRootActor.Add( bubbleContainer ); + mRootActor.Add( mScrollView ); // Add scroll view effect and setup constraints on pages ApplyScrollViewEffect(); @@ -328,7 +337,6 @@ void DaliTableView::ApplyCubeEffectToPages() void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor ) { - } void DaliTableView::Populate() @@ -367,7 +375,9 @@ void DaliTableView::Populate() { const Example& example = ( *iter ); - Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true ); + // Calculate the tiles relative position on the page (between 0 & 1 in each dimension). + Vector2 position( static_cast( column ) / ( EXAMPLES_PER_ROW - 1.0f ), static_cast( row ) / ( EXAMPLES_PER_ROW - 1.0f ) ); + Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), position ); AccessibilityManager accessibilityManager = AccessibilityManager::Get(); accessibilityManager.SetFocusOrder( tile, ++exampleCount ); accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL, @@ -377,7 +387,6 @@ void DaliTableView::Populate() "You can run this example" ); tile.SetPadding( Padding( margin, margin, margin, margin ) ); - page.AddChild( tile, TableView::CellPosition( row, column ) ); iter++; @@ -408,7 +417,7 @@ void DaliTableView::Populate() } // Update Ruler info. - mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f ); + mScrollRulerX = new FixedRuler( mPageWidth ); mScrollRulerY = new DefaultRuler(); mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) ); mScrollRulerY->Disable(); @@ -439,7 +448,7 @@ void DaliTableView::Rotate( unsigned int degrees ) mRotateAnimation.Play(); } -Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ) +Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Vector2& position ) { Actor content = Actor::New(); content.SetName( name ); @@ -448,31 +457,53 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); content.SetSizeModeFactor( sizeMultiplier ); - // create background image - if( addBackground ) - { - ImageView image = ImageView::New( TILE_BACKGROUND ); - image.SetAnchorPoint( AnchorPoint::CENTER ); - image.SetParentOrigin( ParentOrigin::CENTER ); - // make the image 100% of tile - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - - content.Add( image ); - - // Add stencil - Toolkit::ImageView stencil = NewStencilImage(); - stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - image.Add( stencil ); - } + Toolkit::ImageView tileContent = ImageView::New(); + tileContent.SetParentOrigin( ParentOrigin::CENTER ); + tileContent.SetAnchorPoint( AnchorPoint::CENTER ); + tileContent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + + // Add the image via the property first. + tileContent.SetProperty( Toolkit::ImageView::Property::IMAGE, TILE_BACKGROUND_ALPHA ); + // Register a property with the ImageView. This allows us to inject the scroll-view position into the shader. + Property::Value value = Vector3( 0.0f, 0.0f, 0.0f ); + Property::Index propertyIndex = tileContent.RegisterProperty( "uCustomPosition", value ); + + // Add a shader to the image (details in shader source). + Property::Map map; + Property::Map customShader; + customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = FRAGMENT_SHADER_TEXTURED; + map[ Visual::Property::SHADER ] = customShader; + tileContent.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); + tileContent.SetColor( TILE_COLOR ); + + // We create a constraint to perform a precalculation on the scroll-view X offset + // and pass it to the shader uniform, along with the tile's position. + Constraint shaderPosition = Constraint::New < Vector3 > ( tileContent, propertyIndex, TileShaderPositionConstraint( mPageWidth, position.x ) ); + shaderPosition.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); + shaderPosition.SetRemoveAction( Constraint::Discard ); + shaderPosition.Apply(); + content.Add( tileContent ); + + // Create an ImageView for the 9-patch border around the tile. + ImageView image = ImageView::New( TILE_BACKGROUND ); + image.SetAnchorPoint( AnchorPoint::CENTER ); + image.SetParentOrigin( ParentOrigin::CENTER ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + image.SetOpacity( 0.8f ); + tileContent.Add( image ); TextLabel label = TextLabel::New(); - label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" ); + label.SetAnchorPoint( AnchorPoint::CENTER ); + label.SetParentOrigin( ParentOrigin::CENTER ); + label.SetStyleName( "LauncherLabel" ); label.SetProperty( TextLabel::Property::MULTI_LINE, true ); label.SetProperty( TextLabel::Property::TEXT, title ); label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + + // Pad around the label as its size is the same as the 9-patch border. It will overlap it without padding. + label.SetPadding( Padding( TILE_LABEL_PADDING, TILE_LABEL_PADDING, TILE_LABEL_PADDING, TILE_LABEL_PADDING ) ); content.Add( label ); // Set the tile to be keyboard focusable @@ -485,19 +516,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit return content; } -Toolkit::ImageView DaliTableView::NewStencilImage() -{ - Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA ); - stencil.SetParentOrigin( ParentOrigin::CENTER ); - stencil.SetAnchorPoint( AnchorPoint::CENTER ); - stencil.SetDrawMode( DrawMode::STENCIL ); - - Property::Map shaderEffect = CreateAlphaDiscardEffect(); - stencil.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect ); - - return stencil; -} - bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event ) { return DoTilePress( actor, event.GetState( 0 ) ); @@ -541,10 +559,14 @@ bool DaliTableView::DoTilePress( Actor actor, PointState::Type pointState ) // scale the content actor within the Tile, as to not affect the placement within the Table. Actor content = actor.GetChildAt(0); - mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunction::EASE_IN_OUT, + mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.7f, 0.7f, 1.0f ), AlphaFunction::EASE_IN_OUT, TimePeriod( 0.0f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) ); mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::EASE_IN_OUT, TimePeriod( BUTTON_PRESS_ANIMATION_TIME * 0.5f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) ); + + // Rotate button on the Y axis when pressed. + mPressedAnimation.AnimateBy( Property( content, Actor::Property::ORIENTATION ), Quaternion( Degree( 0.0f ), Degree( 180.0f ), Degree( 0.0f ) ) ); + mPressedAnimation.Play(); mPressedAnimation.FinishedSignal().Connect( this, &DaliTableView::OnPressedAnimationFinished ); } @@ -661,14 +683,16 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) void DaliTableView::SetupBackground( Actor bubbleContainer ) { - // Create distance field shape. - BufferImage distanceField; + // Create distance field shapes. + BufferImage distanceFields[2]; Size imageSize( 512, 512 ); - CreateShapeImage( CIRCLE, imageSize, distanceField ); + + CreateShapeImage( CIRCLE, imageSize, distanceFields[0] ); + CreateShapeImage( BUBBLE, imageSize, distanceFields[1] ); // Add bubbles to the bubbleContainer. // Note: The bubbleContainer is parented externally to this function. - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField ); + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceFields ); } void DaliTableView::InitialiseBackgroundActors( Actor actor ) @@ -684,7 +708,7 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) Actor child = actor.GetChildAt( i ); // Calculate a random position - Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), + Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.85f * BACKGROUND_SPREAD_SCALE ), Random::Range( -size.y, size.y ), Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); @@ -707,12 +731,13 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) } } -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField ) +void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* distanceField ) { for( int i = 0; i < count; ++i ) { float randSize = Random::Range( 10.0f, 400.0f ); - ImageView dfActor = ImageView::New( distanceField ); + int distanceFieldType = static_cast( Random::Range( 0.0f, 1.0f ) + 0.5f ); + ImageView dfActor = ImageView::New( distanceField[ distanceFieldType ] ); dfActor.SetSize( Vector2( randSize, randSize ) ); dfActor.SetParentOrigin( ParentOrigin::CENTER ); @@ -741,8 +766,8 @@ void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, Buf case CIRCLE: GenerateCircle( size, imageDataA8 ); break; - case SQUARE: - GenerateSquare( size, imageDataA8 ); + case BUBBLE: + GenerateCircle( size, imageDataA8, true ); break; default: break; @@ -756,18 +781,7 @@ void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, Buf } } -void DaliTableView::GenerateSquare( const Size& size, std::vector< unsigned char >& distanceFieldOut ) -{ - for( int h = 0; h < size.height; ++h ) - { - for( int w = 0; w < size.width; ++w ) - { - distanceFieldOut.push_back( 0xFF ); - } - } -} - -void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut ) +void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut, bool hollow ) { const float radius = size.width * 0.5f * size.width * 0.5f; Vector2 center( size.width / 2, size.height / 2 ); @@ -779,14 +793,12 @@ void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char Vector2 pos( w, h ); Vector2 dist = pos - center; - if( dist.x * dist.x + dist.y * dist.y > radius ) - { - distanceFieldOut.push_back( 0x00 ); - } - else - { - distanceFieldOut.push_back( 0xFF ); - } + float distance = ( dist.x * dist.x ) + ( dist.y * dist.y ); + + // If hollow, check the distance against a min & max value, otherwise just use the max value. + unsigned char fillByte = ( hollow ? ( ( distance <= radius ) && ( distance > ( radius * 0.7f ) ) ) : ( distance <= radius ) ) ? 0xFF : 0x00; + + distanceFieldOut.push_back( fillByte ); } } } @@ -844,12 +856,12 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali:: { Actor nextFocusActor = proposed; - if ( !current && !proposed ) + if( !current && !proposed ) { // Set the initial focus to the first tile in the current page should be focused. nextFocusActor = mPages[mScrollView.GetCurrentPage()].GetChildAt(0); } - else if( !proposed || (proposed && proposed == mScrollViewLayer) ) + else if( !proposed ) { // ScrollView is being focused but nothing in the current page can be focused further // in the given direction. We should work out which page to scroll to next. diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 749000b..f7785d5 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -103,7 +103,7 @@ private: // Application callbacks & implementation enum ShapeType { CIRCLE, - SQUARE + BUBBLE }; /** @@ -135,23 +135,16 @@ private: // Application callbacks & implementation void Rotate( unsigned int degrees ); /** - * Creates a tile for the main menu and toolbar. + * Creates a tile for the main menu. * * @param[in] name The unique name for this Tile * @param[in] title The text caption that appears on the Tile * @param[in] parentSize Tile's parent size. - * @param[in] addBackground Whether to add a background graphic to the tile or not + * @param[in] position The tiles relative position within a page * * @return The Actor for the created tile. */ - Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ); - - /** - * Create a stencil image - * - * @return The stencil image - */ - Dali::Toolkit::ImageView NewStencilImage(); + Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Dali::Vector2& position ); // Signal handlers @@ -268,9 +261,9 @@ private: // Application callbacks & implementation * * @param[in] layer The layer to add the actors to * @param[in] count The number of actors to generate - * @param[in] distanceField The distance field bitmap to use + * @param[in] distanceField A array (pointer) to 2 distance field types to use */ - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField ); + void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField ); /** * Create a bitmap with the specified shape and also output a distance field @@ -296,8 +289,9 @@ private: // Application callbacks & implementation * @param[in] size The size of the bitmap to create * @param[out] imageOut The return bitmap * @param[out] distanceFieldOut The return depth field alpha map + * @param[in] hollow Optional - Set to true for a thick circle outline without fill */ - void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut ); + void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut, bool hollow = false ); /** * Creates the logo. @@ -372,11 +366,9 @@ private: // Application callbacks & implementation private: Dali::Application& mApplication; ///< Application instance. - Dali::Layer mBackgroundLayer; ///< Background resides on a separate layer. - Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor) + Dali::Toolkit::Control mRootActor; ///< All content (excluding background is anchored to this Actor) Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. Dali::Animation mPressedAnimation; ///< Button press scaling animation. - Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer. Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler @@ -390,6 +382,7 @@ private: AnimationList mBackgroundAnimations; ///< List of background bubble animations ExampleList mExampleList; ///< List of examples. + float mPageWidth; ///< The width of a page within the scroll-view, used to calculate the domain int mTotalPages; ///< Total pages within scrollview. bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled diff --git a/demo/file.list b/demo/file.list deleted file mode 100644 index c64143a..0000000 --- a/demo/file.list +++ /dev/null @@ -1,25 +0,0 @@ -# Add files to build with demo here - -common_src_files = \ - $(demo_src_dir)/dali-table-view.cpp - -demo_src_files = \ - $(common_src_files) \ - $(demo_src_dir)/dali-demo.cpp - -# Add files to install here - -demo_image_files = \ - $(demo_src_dir)/images/*.png \ - $(demo_src_dir)/images/*.jpg \ - $(demo_src_dir)/images/*.gif \ - $(demo_src_dir)/images/*.bmp \ - $(demo_src_dir)/images/*.ico \ - $(demo_src_dir)/images/*.wbmp \ - $(demo_src_dir)/images/*.svg - -demo_model_files = \ - $(demo_src_dir)/models/* - -demo_script_files = \ - $(demo_src_dir)/scripts/* diff --git a/demo/po/as.po b/demo/po/as.po deleted file mode 100755 index 8dfe3d0..0000000 --- a/demo/po/as.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "বেলুন" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "অৱৰুদ্ধ কৰক" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "থুপ" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "ঘনক পৰিৱৰ্তনীয় প্ৰভাৱ" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "পৰিৱৰ্তনীয় প্ৰভাৱ" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "আইটেম দর্শন" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "পৰিবৰ্দ্ধক" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "অস্পষ্ট" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "বিস্তাৰ" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "পৃষ্ঠা লেআউট" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "ৰেডিয়েল নক্সা" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "প্ৰতিফলিত কৰক" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "স্ক্ৰ'ল কৰক" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "ছাঁয়া" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "লিপি" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "প্ৰতিচ্ছবি স্কেল কৰক" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "লেৱেল কৰক" diff --git a/demo/po/de.po b/demo/po/de.po deleted file mode 100755 index e75f9de..0000000 --- a/demo/po/de.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "Schaumbildung" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "Blöcke" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "Cluster" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "Würfel Übergangseffekt" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "Auflösen Übergangseffekt" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "Item-Ansicht" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "Bildschirmlupe" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "Bewegungsunschärfe" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "Bewegung Strecke" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Seite wechseln" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "Radialmenü" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "Brechung" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "Scroll-Ansicht" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "Licht und Schatten" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "Scripting" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "Bildskalierung" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "Beschriftung" diff --git a/demo/po/en.po b/demo/po/en.po deleted file mode 100755 index a2ec3fa..0000000 --- a/demo/po/en.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "Bubbles" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "Blocks" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "Cluster" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "Cube Transition" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "Dissolve Transition" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "Item View" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "Magnifier" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "Motion Blur" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "Motion Stretch" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Page Turn View" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "Radial Menu" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "Refraction" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "Scroll View" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "Lights and shadows" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "Script Based UI" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "Image Scaling Modes" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "Text Label" diff --git a/demo/po/en_GB.po b/demo/po/en_GB.po deleted file mode 100755 index a2ec3fa..0000000 --- a/demo/po/en_GB.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "Bubbles" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "Blocks" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "Cluster" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "Cube Transition" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "Dissolve Transition" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "Item View" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "Magnifier" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "Motion Blur" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "Motion Stretch" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Page Turn View" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "Radial Menu" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "Refraction" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "Scroll View" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "Lights and shadows" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "Script Based UI" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "Image Scaling Modes" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "Text Label" diff --git a/demo/po/en_US.po b/demo/po/en_US.po deleted file mode 100755 index a2ec3fa..0000000 --- a/demo/po/en_US.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "Bubbles" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "Blocks" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "Cluster" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "Cube Transition" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "Dissolve Transition" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "Item View" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "Magnifier" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "Motion Blur" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "Motion Stretch" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Page Turn View" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "Radial Menu" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "Refraction" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "Scroll View" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "Lights and shadows" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "Script Based UI" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "Image Scaling Modes" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "Text Label" diff --git a/demo/po/es.po b/demo/po/es.po deleted file mode 100644 index 179a69e..0000000 --- a/demo/po/es.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "Burbujas" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "Bloques" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "Agrupación" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "Transición cubos" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "Transición disolver" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "Vista de elementos" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "Lupa" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "Desenfoque de movimiento" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "Movimiento con deformación" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Vista de páginas" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "Menú radial" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "Refracción" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "Vista de desplazamiento" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "Luces y sombras" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "Interfaz definida por Script" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "Modos de escalado de imagen" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "Etiqueta de texto" diff --git a/demo/po/ko.po b/demo/po/ko.po deleted file mode 100755 index 78f5987..0000000 --- a/demo/po/ko.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "방울" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "블록" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "클러스터" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "입방체 전환" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "디졸브 전환" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "아이템 뷰" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "돋보기" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "모션 블러" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "늘이기" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "책장 넘기기" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "레이디 얼 메뉴" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "굴절 효과" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "스크롤 뷰" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "빛과 그림자" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "스크립팅" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "이미지 확대" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "텍스트 라벨" diff --git a/demo/po/ml.po b/demo/po/ml.po deleted file mode 100755 index 90049da..0000000 --- a/demo/po/ml.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "കുമിള" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "തടയപ്പെട്ട" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "ക്ലസ്റ്റര്" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "സമചതുരക്കട്ട സംക്രമണ ഇഫക്ട്" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "സ്ഥാനാന്തരം സംക്രമണ ഇഫക്ട്" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "ഇനം കാഴ്ച" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "ഭൂതക്കണ്ണാടി" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "അവ്യക്തമാക്കല്" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "സ്ട്രെച്ച്" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "പേജ് ലേഔട്ട്" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "റേഡിയല് രേഖാചിത്രം" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "പ്രതിഫലിക്കുക" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "സ്ക്രോള്ചെയ്യുക കാഴ്ച" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "നിഴല്" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "സ്ക്രിപ്റ്റ്" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "ഇമേജിംഗ്" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "ലേബലുചെയ്യുക" diff --git a/demo/po/ur.po b/demo/po/ur.po deleted file mode 100644 index b2c3302..0000000 --- a/demo/po/ur.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "بلبلے" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "اینٹیں" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "کلسٹر" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "کیوب منتقلی" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "حل منتقلی" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "چیزوں کی فہرست" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "مکبر" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "دھندلانے کی حرکت" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "کھینچھنے کی حرکت" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "کتاب" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "ریڈیل مینو" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "رفراکشن" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "سکرول ویو" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "روشنی اور سائے" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "سکرپٹ" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "تصویر پیمائی" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "لیبل" diff --git a/demo/po/zn_CH.po b/demo/po/zn_CH.po deleted file mode 100755 index f136c4b..0000000 --- a/demo/po/zn_CH.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "DALI_DEMO_STR_TITLE_BUBBLES" -msgstr "气泡" - -msgid "DALI_DEMO_STR_TITLE_BLOCKS" -msgstr "块体" - -msgid "DALI_DEMO_STR_TITLE_CLUSTER" -msgstr "叢集" - -msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" -msgstr "方块 切换效果" - -msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" -msgstr "冰消瓦解 切换效果" - -msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" -msgstr "項目 檢視" - -msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" -msgstr "放大鏡" - -msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" -msgstr "动作 模糊" - -msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" -msgstr "动作 拉伸" - -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "页面" - -msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" -msgstr "射线图" - -msgid "DALI_DEMO_STR_TITLE_REFRACTION" -msgstr "折光" - -msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" -msgstr "捲動" - -msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" -msgstr "阴影" - -msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" -msgstr "指令檔" - -msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" -msgstr "图像 制定級數" - -msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" -msgstr "标签" diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 36b94a9..7180fef 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -238,6 +238,9 @@ public: mSensor.TiltedSignal().Connect( this, &ExampleController::OnTilted ); } + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + // Creates a default view with a default tool bar. // The view is added to the stage. Toolkit::ToolBar toolBar; diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index e80c88b..81aacaf 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -387,7 +387,7 @@ public: Actor MenuItem(const std::string& text) { TextLabel label = TextLabel::New( ShortName( text ) ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" ); + label.SetStyleName( "BuilderLabel" ); label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); // Hook up tap detector diff --git a/examples/homescreen-benchmark/homescreen-benchmark.cpp b/examples/homescreen-benchmark/homescreen-benchmark.cpp index 17ff08e..8e04e44 100644 --- a/examples/homescreen-benchmark/homescreen-benchmark.cpp +++ b/examples/homescreen-benchmark/homescreen-benchmark.cpp @@ -248,10 +248,10 @@ public: Property::Map map; std::stringstream imagePath; imagePath << IMAGE_PATH_PREFIX << currentIconIndex << IMAGE_PATH_POSTFIX; - map[ Dali::Toolkit::BatchImageVisual::Property::URL ] = imagePath.str(); + map[ Dali::Toolkit::ImageVisual::Property::URL ] = imagePath.str(); // Enable/disable batching - map[ Toolkit::Visual::Property::BATCHING_ENABLED ] = mConfig.mBatchingEnabled; + map[ Toolkit::ImageVisual::Property::BATCHING_ENABLED ] = mConfig.mBatchingEnabled; imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); imageView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index 3af560d..f13617a 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -45,9 +45,8 @@ const char* const SAMPLING_BUTTON_ID = "SAMPLING_BUTTON"; const char* const FITTING_BUTTON_TEXT = "Fitting"; const char* const SAMPLING_BUTTON_TEXT = "Sampling"; -const char* const STYLE_LABEL_TEXT = "grouplabel"; -const char* const STYLE_BUTTON_TEXT = "buttonlabel"; - +const char* const STYLE_LABEL_TEXT = "ImageScalingGroupLabel"; +const char* const STYLE_BUTTON_TEXT = "ImageScalingButton"; const char* IMAGE_PATHS[] = { @@ -175,6 +174,9 @@ public: // Get a handle to the stage Stage stage = Stage::GetCurrent(); + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + // Background image: Dali::Property::Map backgroundImage; backgroundImage.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE ); @@ -333,7 +335,7 @@ public: fittingModeGroup.SetFitHeight( 1 ); TextLabel label = TextLabel::New( "Image fitting mode:" ); - label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT ); + label.SetStyleName( STYLE_LABEL_TEXT ); fittingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( FITTING_BUTTON_ID, StringFromScalingMode( mFittingMode ) ); @@ -354,7 +356,7 @@ public: samplingModeGroup.SetFitHeight( 1 ); TextLabel label = TextLabel::New( "Image sampling mode:" ); - label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT ); + label.SetStyleName( STYLE_LABEL_TEXT ); samplingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( SAMPLING_BUTTON_ID, StringFromFilterMode( mSamplingMode ) ); @@ -368,7 +370,7 @@ public: Toolkit::PushButton CreateButton( const char * id, const char * label ) { Toolkit::PushButton button = Toolkit::PushButton::New(); - button.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + button.SetStyleName( STYLE_BUTTON_TEXT ); button.SetName( id ); button.SetLabelText( label ); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); diff --git a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp index 55ac6b6..b00ccf5 100644 --- a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp +++ b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp @@ -16,16 +16,21 @@ */ #include +#include "shared/view.h" using namespace Dali; namespace { -const char* IMAGE_PATH[] = { DEMO_IMAGE_DIR "gallery-large-7.jpg", - DEMO_IMAGE_DIR "gallery-large-12.jpg", - DEMO_IMAGE_DIR "gallery-large-18.jpg" }; +const char* BIG_TEST_IMAGE( DEMO_IMAGE_DIR "book-landscape-cover.jpg" ); +const char* SMALL_TEST_IMAGE( DEMO_IMAGE_DIR "gallery-large-1.jpg" ); -const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*); +const char * const APPLICATION_TITLE( "Pixel Area & Wrap Mode" ); +const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); +const char * const BUTTON_ICON( DEMO_IMAGE_DIR "icon-change.png" ); +const char * const BUTTON_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" ); + +const Vector4 ORIGINAL_PIXEL_AREA( -0.5f, -0.5f, 2.f, 2.f ); } class ImageViewPixelAreaApp : public ConnectionTracker @@ -52,44 +57,158 @@ private: Stage stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &ImageViewPixelAreaApp::OnKeyEvent); - ImageDimensions size( 510, 510 ); - float subSize = 170.f; - float relativeSubSize = 0.33; - Animation animation = Animation::New( 10.f ); + Toolkit::ToolBar toolBar; + Toolkit::Control background; + // Creates a default view with a default tool bar. + mContent = DemoHelper::CreateView( application, + background, + toolBar, + "", + TOOLBAR_IMAGE, + APPLICATION_TITLE ); + + // Add a button to switch the scene. (right of toolbar) + Toolkit::PushButton switchButton = Toolkit::PushButton::New(); + switchButton.SetUnselectedImage( BUTTON_ICON ); + switchButton.SetSelectedImage( BUTTON_ICON_SELECTED ); + switchButton.ClickedSignal().Connect( this, &ImageViewPixelAreaApp::OnButtonClicked ); + toolBar.AddControl( switchButton, + DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, + Toolkit::Alignment::HorizontalRight, + DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); + + + // for testing image WITH automatic atlasing + visualPropertyMap[0][ Toolkit::ImageVisual::Property::URL ] = SMALL_TEST_IMAGE; + visualPropertyMap[0][ Toolkit::ImageVisual::Property::DESIRED_WIDTH ] = 500; + visualPropertyMap[0][ Toolkit::ImageVisual::Property::DESIRED_HEIGHT ] = 500; + visualPropertyMap[0][ Toolkit::ImageVisual::Property::WRAP_MODE_U ] = WrapMode::CLAMP_TO_EDGE; + visualPropertyMap[0][ Toolkit::ImageVisual::Property::WRAP_MODE_V ] = WrapMode::MIRRORED_REPEAT; + visualPropertyMap[0][ Toolkit::ImageVisual::Property::PIXEL_AREA ] = ORIGINAL_PIXEL_AREA; + + // for testing image WITHOUT automatic atlasing + visualPropertyMap[1][ Toolkit::ImageVisual::Property::URL ] = BIG_TEST_IMAGE; + visualPropertyMap[1][ Toolkit::ImageVisual::Property::DESIRED_WIDTH ] = 640; + visualPropertyMap[1][ Toolkit::ImageVisual::Property::DESIRED_HEIGHT ] = 720; + visualPropertyMap[1][ Toolkit::ImageVisual::Property::WRAP_MODE_U ] = WrapMode::MIRRORED_REPEAT; + visualPropertyMap[1][ Toolkit::ImageVisual::Property::WRAP_MODE_V ] = WrapMode::REPEAT; + visualPropertyMap[1][ Toolkit::ImageVisual::Property::PIXEL_AREA ] = ORIGINAL_PIXEL_AREA; + + CreateScene( visualPropertyMap[0] ); + + mWrapLabel = Toolkit::TextLabel::New(" Automatic atlasing\n WrapMode: CLAMP_TO_EDGE, MIRRORED_REPEAT"); + mWrapLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + mWrapLabel.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER ); + mWrapLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mWrapLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + mWrapLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); + mContent.Add( mWrapLabel ); + + mPixelAreaLabel = Toolkit::TextLabel::New( " Use ImageVisual::Property::PIXEL_AREA\n " ); + mPixelAreaLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); + mPixelAreaLabel.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER ); + mPixelAreaLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); + mWrapLabel.Add( mPixelAreaLabel ); + } + + void CreateScene( const Property::Value& propertyMap ) + { for( int i=0; i<3;i++ ) for( int j=0; j<3; j++ ) { - mImageView[i][j] = Toolkit::ImageView::New( IMAGE_PATH[mIndex], size ); - mImageView[i][j].SetParentOrigin( ParentOrigin::CENTER ); - mImageView[i][j].SetAnchorPoint(AnchorPoint::CENTER ); - mImageView[i][j].SetPosition( subSize*(i-1)*1.1f, subSize*(j-1)*1.1f ); - mImageView[i][j].SetSize( subSize, subSize ); - stage.Add(mImageView[i][j]); - - animation.AnimateTo( Property(mImageView[i][j], Toolkit::ImageView::Property::PIXEL_AREA), - Vector4( relativeSubSize*i, relativeSubSize*j, relativeSubSize, relativeSubSize ), - AlphaFunction::BOUNCE ); + mImageView[i][j] = Toolkit::ImageView::New(); + mImageView[i][j].SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap ); + mImageView[i][j].SetPosition( 50.f*(i-1), 50.f*(j-1) ); } - animation.SetLooping( true ); - animation.Play(); - // Respond to a click anywhere on the stage - stage.GetRootLayer().TouchSignal().Connect( this, &ImageViewPixelAreaApp::OnTouch ); + mImageView[1][1].SetParentOrigin( ParentOrigin::CENTER ); + mImageView[1][1].SetAnchorPoint(AnchorPoint::CENTER ); + mImageView[1][1].SetScale( 1.f/3.f ); + mContent.Add( mImageView[1][1] ); + + mImageView[0][0].SetParentOrigin( ParentOrigin::TOP_LEFT ); + mImageView[0][0].SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT ); + mImageView[0][0].SetPosition( -50.f, -50.f ); + mImageView[1][1].Add( mImageView[0][0] ); + + mImageView[1][0].SetParentOrigin( ParentOrigin::TOP_CENTER ); + mImageView[1][0].SetAnchorPoint(AnchorPoint::BOTTOM_CENTER ); + mImageView[1][1].Add( mImageView[1][0] ); + + mImageView[2][0].SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mImageView[2][0].SetAnchorPoint(AnchorPoint::BOTTOM_LEFT ); + mImageView[1][1].Add( mImageView[2][0] ); + + mImageView[0][1].SetParentOrigin( ParentOrigin::CENTER_LEFT ); + mImageView[0][1].SetAnchorPoint(AnchorPoint::CENTER_RIGHT ); + mImageView[1][1].Add( mImageView[0][1] ); + + mImageView[2][1].SetParentOrigin( ParentOrigin::CENTER_RIGHT ); + mImageView[2][1].SetAnchorPoint(AnchorPoint::CENTER_LEFT ); + mImageView[1][1].Add( mImageView[2][1] ); + + mImageView[0][2].SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); + mImageView[0][2].SetAnchorPoint(AnchorPoint::TOP_RIGHT ); + mImageView[1][1].Add( mImageView[0][2] ); + + mImageView[1][2].SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + mImageView[1][2].SetAnchorPoint(AnchorPoint::TOP_CENTER ); + mImageView[1][1].Add( mImageView[1][2] ); + + mImageView[2][2].SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); + mImageView[2][2].SetAnchorPoint(AnchorPoint::TOP_LEFT ); + mImageView[1][1].Add( mImageView[2][2] ); + } - bool OnTouch( Actor actor, const TouchData& touch ) - { - if( touch.GetState( 0 ) == PointState::DOWN ) + bool OnButtonClicked( Toolkit::Button button ) { - mIndex++; - for( int i=0; i<3;i++ ) - for( int j=0; j<3; j++ ) + if( mAnimation ) + { + mAnimation.Stop(); + mAnimation.Clear(); + } + + mIndex = ( mIndex+1 ) % 4; + if( mIndex%2 == 0 ) + { + // switch to the other image + // set the pixel area to image visual, the pixel area property is registered on the renderer + mContent.Remove( mImageView[1][1] ); + CreateScene( visualPropertyMap[mIndex/2] ); + if( mIndex == 0 ) { - mImageView[i][j].SetImage( IMAGE_PATH[mIndex%NUM_IMAGES] ); + mWrapLabel.SetProperty( Toolkit::TextLabel::Property::TEXT," Automatic atlasing\n WrapMode: CLAMP_TO_EDGE, MIRRORED_REPEAT"); } + else + { + mWrapLabel.SetProperty( Toolkit::TextLabel::Property::TEXT," No atlasing\n WrapMode: MIRRORED_REPEAT, REPEAT"); + } + mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, " Use ImageVisual::Property::PIXEL_AREA\n " ); + } + else + { + // animate the pixel area property on image view, + // the animatable pixel area property is registered on the actor, which overwrites the property on the renderer + mAnimation = Animation::New( 10.f ); + float relativeSubSize = 0.33; + for( int i=0; i<3;i++ ) + for( int j=0; j<3; j++ ) + { + mImageView[i][j].SetProperty( Toolkit::ImageView::Property::PIXEL_AREA, ORIGINAL_PIXEL_AREA ); + mAnimation.AnimateTo( Property(mImageView[i][j], Toolkit::ImageView::Property::PIXEL_AREA), + Vector4( relativeSubSize*i, relativeSubSize*j, relativeSubSize, relativeSubSize ), + AlphaFunction::BOUNCE ); + } + mAnimation.SetLooping( true ); + mAnimation.Play(); + + mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, " Animate ImageView::Property::PIXEL_AREA \n (Overwrite the ImageVisual property) " ); + } + return true; } - return true; - } void OnKeyEvent(const KeyEvent& event) { @@ -104,7 +223,12 @@ private: private: Application& mApplication; + Layer mContent; Toolkit::ImageView mImageView[3][3]; + Property::Map visualPropertyMap[2]; + Toolkit::TextLabel mWrapLabel; + Toolkit::TextLabel mPixelAreaLabel; + Animation mAnimation; unsigned int mIndex; }; diff --git a/examples/image-view-svg/image-view-svg-example.cpp b/examples/image-view-svg/image-view-svg-example.cpp index 7c08b44..12180f2 100644 --- a/examples/image-view-svg/image-view-svg-example.cpp +++ b/examples/image-view-svg/image-view-svg-example.cpp @@ -66,6 +66,9 @@ public: Vector2 stageSize = stage.GetSize(); mActorSize = stageSize/2.f; + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + stage.KeyEventSignal().Connect(this, &ImageSvgController::OnKeyEvent); // Background, for receiving gestures diff --git a/examples/line-mesh/line-mesh-example.cpp b/examples/line-mesh/line-mesh-example.cpp index 53f0fe8..a56f1b5 100644 --- a/examples/line-mesh/line-mesh-example.cpp +++ b/examples/line-mesh/line-mesh-example.cpp @@ -234,7 +234,7 @@ public: Dali::Toolkit::RadioButton radio = Dali::Toolkit::RadioButton::New(); - radio.SetProperty( Dali::Toolkit::RadioButton::Property::LABEL, labelMap ); + radio.SetProperty( Dali::Toolkit::Button::Property::LABEL, labelMap ); radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); radio.SetSelected( i == 0 ); diff --git a/examples/mesh-visual/mesh-visual-example.cpp b/examples/mesh-visual/mesh-visual-example.cpp index 566a289..9a12c0e 100644 --- a/examples/mesh-visual/mesh-visual-example.cpp +++ b/examples/mesh-visual/mesh-visual-example.cpp @@ -41,11 +41,24 @@ namespace MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING }; + //Button labels. + const char * const PAUSE = " || "; + const char * const PLAY = " > "; + const char * const FIXED = "FIXED"; + const char * const MANUAL = "MANUAL"; + const char * const FRONT = "FRONT"; + const char * const BACK = "BACK"; + + //Image urls for the light. + const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; + const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; + const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; const float MODEL_SCALE = 0.75f; const float LIGHT_SCALE = 0.15f; const float BUTTONS_OFFSET_BOTTOM = 0.9f; + const float BUTTONS_OFFSET_SIDE = 0.2f; const int NUM_MESHES = 1;//TODOVR //Used to identify actors. @@ -66,7 +79,8 @@ public: mTag( -1 ), //Non-valid default, which will get set to a correct value when used. mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used. mPaused( false ), //Animations play by default. - mLightFixed( true ) //The light is fixed by default. + mLightFixed( true ), //The light is fixed by default. + mLightFront( true ) //The light is in front by default. { // Connect to the Application's Init signal mApplication.InitSignal().Connect( this, &MeshVisualController::Create ); @@ -79,26 +93,18 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - //todor - application.SetViewMode( VR ); - // Get a handle to the stage Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor( Vector4( 0.0, 0.5, 1.0, 1.0 ) ); + + //TODOVR application.SetViewMode( Dali::VR ); //application.SetStereoBase( 105.0f ); - //Set up layer to place objects on. - Layer baseLayer = Layer::New(); - baseLayer.SetParentOrigin( ParentOrigin::CENTER ); - baseLayer.SetAnchorPoint( AnchorPoint::CENTER ); - baseLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - baseLayer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation. - baseLayer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so. - baseLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor. - baseLayer.TouchedSignal().Connect( this, &MeshVisualController::OnTouch ); - stage.Add( baseLayer ); - + //Set up root layer to receive touch gestures. + Layer rootLayer = stage.GetRootLayer(); + rootLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor. + rootLayer.TouchSignal().Connect( this, &MeshVisualController::OnTouch ); const float CUBE_WIDTH_SCALE( 2.0f ); ///< The width (and height + depth) of the main and reflection cubes. const char * const CUBE_TEXTURE( DEMO_IMAGE_DIR "people-medium-1.jpg" ); @@ -125,10 +131,9 @@ public: renderer.SetTextures( cubeTextureSet ); // Setup the renderer properties: // We are writing to the color buffer & culling back faces. - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true ); renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT ); // No stencil is used for the main cube. - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF ); + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::NONE ); // We do need to write to the depth buffer as other objects need to appear underneath this cube. renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF ); // We do not need to test the depth buffer as we are culling the back faces. @@ -136,18 +141,16 @@ public: // This object must be rendered 1st. //renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 * DEPTH_INDEX_GRANULARITY ); container.AddRenderer( renderer ); - baseLayer.Add( container ); - - + rootLayer.Add( container ); //Place models on the scene. - SetupModels( baseLayer ); + SetupModels( rootLayer ); //Place buttons on the scene. - SetupButtons( baseLayer ); + SetupButtons( rootLayer ); //Add a light to the scene. - SetupLight( baseLayer ); + SetupLight( rootLayer ); //Allow for exiting of the application via key presses. stage.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent ); @@ -163,7 +166,7 @@ public: mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mContainers[i].RegisterProperty( "Tag", MODEL_TAG ); //Used to differentiate between different kinds of actor. mContainers[i].RegisterProperty( "Model", Property::Value( i ) ); //Used to index into the model. - mContainers[i].TouchedSignal().Connect( this, &MeshVisualController::OnTouch ); + mContainers[i].TouchSignal().Connect( this, &MeshVisualController::OnTouch ); layer.Add( mContainers[i] ); } @@ -214,62 +217,78 @@ public: //Place the various buttons on the bottom of the screen, with title labels where necessary. void SetupButtons( Layer layer ) { -#if 1 - //Text label title for changing model or shader. - TextLabel changeTitleLabel = TextLabel::New( "Switch" ); - changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); - changeTitleLabel.SetParentOrigin( Vector3( 0.2, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); - changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - layer.Add( changeTitleLabel ); -#endif - //Create button for model changing + //Actor for positioning model and shading mode buttons. + Actor positionActorModel = Actor::New(); + positionActorModel.SetParentOrigin( Vector3( BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + positionActorModel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + layer.Add( positionActorModel ); + + //Create button for model changing. PushButton modelButton = Toolkit::PushButton::New(); modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked ); - modelButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - modelButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); + modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); + modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); modelButton.SetLabelText( "Model" ); - changeTitleLabel.Add( modelButton ); + positionActorModel.Add( modelButton ); + + //Create button for shading mode changing. + PushButton shadingModeButton = Toolkit::PushButton::New(); + shadingModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked ); + shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + shadingModeButton.SetLabelText( "Shading Mode" ); + positionActorModel.Add( shadingModeButton ); + + //Text label title for changing model or shading mode. + TextLabel changeTitleLabel = TextLabel::New( "Change" ); + changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); + changeTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); + changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + modelButton.Add( changeTitleLabel ); -#if 0 - //Create button for shader changing - PushButton shaderButton = Toolkit::PushButton::New(); - shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - shaderButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShaderClicked ); - shaderButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - shaderButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - shaderButton.SetLabelText( "Shader" ); - changeTitleLabel.Add( shaderButton ); - - //Create button for pausing animations + //Create button for pausing animations. PushButton pauseButton = Toolkit::PushButton::New(); pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked ); - pauseButton.SetParentOrigin( Vector3( 0.5, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); - pauseButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - pauseButton.SetLabelText( " || " ); + pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + pauseButton.SetAnchorPoint( AnchorPoint::CENTER ); + pauseButton.SetLabelText( PAUSE ); layer.Add( pauseButton ); -#endif + + //Actor for positioning light position buttons. + Actor positionActorLight = Actor::New(); + positionActorLight.SetParentOrigin( Vector3( 1.0 - BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + positionActorLight.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + layer.Add( positionActorLight ); + + //Create button for switching between manual and fixed light position. + PushButton lightModeButton = Toolkit::PushButton::New(); + lightModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); + lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); + lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + lightModeButton.SetLabelText( FIXED ); + positionActorLight.Add( lightModeButton ); + + //Create button for switching between front and back light position. + PushButton lightSideButton = Toolkit::PushButton::New(); + lightSideButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked ); + lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + lightSideButton.SetLabelText( FRONT ); + positionActorLight.Add( lightSideButton ); //Text label title for light position mode. TextLabel lightTitleLabel = TextLabel::New( "Light Position" ); lightTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); lightTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); - lightTitleLabel.SetParentOrigin( Vector3( 0.8, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + lightTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); lightTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - layer.Add( lightTitleLabel ); - -#if 0 - //Create button for switching between manual and fixed light position. - PushButton lightButton = Toolkit::PushButton::New(); - lightButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - lightButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); - lightButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - lightButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - lightButton.SetLabelText( "FIXED" ); - lightTitleLabel.Add( lightButton ); -#endif + lightModeButton.Add( lightTitleLabel ); } //Add a point light source the the scene, on a layer above the first. @@ -302,13 +321,10 @@ public: mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.85f, Stage::GetCurrent().GetSize().y * 0.125 ); //Supply an image to represent the light. - Property::Map lightMap; - lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); - lightMap.Insert( ImageVisual::Property::URL, DEMO_IMAGE_DIR "light-icon.png" ); - mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) ); + SetLightImage(); //Connect to touch signal for dragging. - mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch ); + mLightSource.TouchSignal().Connect( this, &MeshVisualController::OnTouch ); //Place the light source on a layer above the base, so that it is rendered above everything else. Layer upperLayer = Layer::New(); @@ -320,14 +336,27 @@ public: upperLayer.Add( mLightSource ); //Decide which light to use to begin with. - if( mLightFixed ) + SetLightMode(); + } + + //Sets the image to use for the light source depending on whether the light is in front or behind. + void SetLightImage() + { + std::string imageUrl; + + if( mLightFront ) { - UseFixedLight(); + imageUrl = LIGHT_URL_FRONT; } else { - UseManualLight(); + imageUrl = LIGHT_URL_BACK; } + + Property::Map lightMap; + lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + lightMap.Insert( ImageVisual::Property::URL, imageUrl ); + mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) ); } //Updates the displayed models to account for parameter changes. @@ -348,16 +377,31 @@ public: } } + //Set the mode used to light the models. + void SetLightMode() + { + if( mLightFixed ) + { + UseFixedLight(); + } + else + { + UseManualLight(); + } + } + + //Make the models use a fixed, invisible light above the center of the stage. void UseFixedLight() { //Hide draggable source mLightSource.SetVisible( false ); - //Use stage dimensions to place light at center, offset outwards in z axis. + //Use stage dimensions to place light at center, offset in z axis. Stage stage = Stage::GetCurrent(); float width = stage.GetSize().width; float height = stage.GetSize().height; - Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f, std::max( width, height ) * 5.0f ); + Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f, + ( mLightFront ? 1 : -1 ) * std::max( width, height ) * 5.0f ); //Set global light position for( int i = 0; i < NUM_MESHES; ++i ) @@ -366,21 +410,23 @@ public: } } + //Make the models use a light source that the user can drag around. void UseManualLight() { //Show draggable source mLightSource.SetVisible( true ); - //Update to switch light position to that off the source. + //Update to switch light position of models to that of the source. UpdateLight(); } //Updates the light position for each model to account for changes in the source on screen. void UpdateLight() { - //Set light position to the x and y of the light control, offset out of the screen. + //Set light position to the x and y of the light control, offset into/out of the screen. Vector3 controlPosition = mLightSource.GetCurrentPosition(); - Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x / 2.0f ); + Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, + ( mLightFront ? 1 : -1 ) * Stage::GetCurrent().GetSize().x / 2.0f ); for( int i = 0; i < NUM_MESHES; ++i ) { @@ -390,14 +436,11 @@ public: //If the light source is touched, move it by dragging it. //If a model is touched, rotate it by panning around. - bool OnTouch( Actor actor, const TouchEvent& event ) + bool OnTouch( Actor actor, const TouchData& touch ) { - //Get primary touch point. - const Dali::TouchPoint& point = event.GetPoint( 0 ); - - switch( point.state ) + switch( touch.GetState( 0 ) ) { - case TouchPoint::Down: + case PointState::DOWN: { //Determine what was touched. actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mTag ); @@ -411,13 +454,13 @@ public: mModels[mSelectedModelIndex].rotationAnimation.Pause(); //Store start points. - mPanStart = point.screen; + mPanStart = touch.GetScreenPosition( 0 ); mRotationStart = mModels[mSelectedModelIndex].rotation; } break; } - case TouchPoint::Motion: + case PointState::MOTION: { //Switch on the kind of actor we're interacting with. switch( mTag ) @@ -425,7 +468,7 @@ public: case MODEL_TAG: //Rotate model { //Calculate displacement and corresponding rotation. - Vector2 displacement = point.screen - mPanStart; + Vector2 displacement = touch.GetScreenPosition( 0 ) - mPanStart; mModels[mSelectedModelIndex].rotation = Vector2( mRotationStart.x - displacement.y / Y_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis mRotationStart.y + displacement.x / X_ROTATION_DISPLACEMENT_FACTOR ); // X displacement rotates around Y axis Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) * @@ -439,7 +482,7 @@ public: case LIGHT_TAG: //Drag light { //Set light source to new position and update the models accordingly. - mLightSource.SetPosition( Vector3( point.screen ) ); + mLightSource.SetPosition( Vector3( touch.GetScreenPosition( 0 ) ) ); UpdateLight(); break; @@ -448,8 +491,8 @@ public: break; } - case TouchPoint::Interrupted: //Same as finished. - case TouchPoint::Finished: + case PointState::INTERRUPTED: //Same as finished. + case PointState::FINISHED: { if( mTag == MODEL_TAG ) { @@ -482,8 +525,8 @@ public: return true; } - //Cycle through the list of shaders. - bool OnChangeShaderClicked( Toolkit::Button button ) + //Cycle through the list of shading modes. + bool OnChangeShadingModeClicked( Toolkit::Button button ) { ++mShadingModeIndex %= 3; @@ -507,7 +550,7 @@ public: mModels[i].rotationAnimation.Pause(); } - button.SetLabelText( " > " ); + button.SetLabelText( PLAY ); } else //Unpause all animations again. { @@ -516,13 +559,13 @@ public: mModels[i].rotationAnimation.Play(); } - button.SetLabelText( " || " ); + button.SetLabelText( PAUSE ); } return true; } - //Switch between a fixed light source in front of the screen, and a light source the user can drag around. + //Switch between a fixed light source above/behind the screen, and a light source the user can drag around. bool OnChangeLightModeClicked( Toolkit::Button button ) { //Toggle state. @@ -530,17 +573,39 @@ public: if( mLightFixed ) { - UseFixedLight(); - - button.SetLabelText( "FIXED" ); + button.SetLabelText( FIXED ); } else { - UseManualLight(); + button.SetLabelText( MANUAL ); + } + + SetLightMode(); + + return true; + } + + //Switch between the light being in front of and behind the models. + bool OnChangeLightSideClicked( Toolkit::Button button ) + { + //Toggle state. + mLightFront = !mLightFront; - button.SetLabelText( "MANUAL" ); + if( mLightFront ) + { + button.SetLabelText( FRONT ); + } + else + { + button.SetLabelText( BACK ); } + //Change light image. + SetLightImage(); + + //Update light to account for the change. + SetLightMode(); + return true; } @@ -803,11 +868,12 @@ private: Vector2 mRotationStart; int mModelIndex; //Index of model to load. - int mShadingModeIndex; //Index of shader type to use. + int mShadingModeIndex; //Index of shading mode to use. int mTag; //Identifies what kind of actor has been selected in OnTouch. int mSelectedModelIndex; //Index of model selected on screen. bool mPaused; //If true, all animations are paused and should stay so. bool mLightFixed; //If false, the light is in manual. + bool mLightFront; //Bool for light being in front or behind the models. }; // Entry point for Linux & Tizen applications diff --git a/examples/model3d-view/model3d-view-example.cpp b/examples/model3d-view/model3d-view-example.cpp index 5adb945..40cf6eb 100644 --- a/examples/model3d-view/model3d-view-example.cpp +++ b/examples/model3d-view/model3d-view-example.cpp @@ -76,18 +76,10 @@ public: Vector2 screenSize = stage.GetSize(); //Add background - Toolkit::ImageView backView = Toolkit::ImageView::New(BACKGROUND_IMAGE); - backView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - stage.Add(backView); - - //Add 3D model control - m3DLayer = Layer::New(); - stage.GetRootLayer().Add(m3DLayer); - - //3D models require 3D based rendering method, so it can use depth buffer, etc. - m3DLayer.SetBehavior(Layer::LAYER_3D); - m3DLayer.SetParentOrigin( ParentOrigin::CENTER ); - m3DLayer.SetAnchorPoint( AnchorPoint::CENTER ); + Toolkit::ImageView backView = Toolkit::ImageView::New( BACKGROUND_IMAGE ); + backView.SetParentOrigin( ParentOrigin::CENTER ); + backView.SetAnchorPoint( AnchorPoint::CENTER ); + stage.Add( backView ); mModelCounter = 0; @@ -100,7 +92,7 @@ public: mModel3dView.SetProperty(Model3dView::Property::LIGHT_POSITION, Vector3(5,10.,0)); - m3DLayer.Add( mModel3dView ); + backView.Add( mModel3dView ); mIlluminationShader = Model3dView::IlluminationType(mModel3dView.GetProperty(Model3dView::Property::ILLUMINATION_TYPE)); @@ -108,7 +100,7 @@ public: mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mButtonLayer.SetParentOrigin( ParentOrigin::CENTER ); mButtonLayer.SetAnchorPoint( AnchorPoint::CENTER ); - stage.GetRootLayer().Add(mButtonLayer); + stage.Add(mButtonLayer); // Create button for model changing Toolkit::PushButton editButton = Toolkit::PushButton::New(); @@ -281,7 +273,6 @@ private: int mModelCounter; Model3dView mModel3dView; - Layer m3DLayer; Layer mButtonLayer; TapGestureDetector mTapDetector; diff --git a/examples/native-image-source/native-image-source-example.cpp b/examples/native-image-source/native-image-source-example.cpp index fe676dc..cf9304b 100644 --- a/examples/native-image-source/native-image-source-example.cpp +++ b/examples/native-image-source/native-image-source-example.cpp @@ -146,6 +146,10 @@ public: // Get a handle to the stage Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor( Color::WHITE ); + + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); mButtonRefreshAlways = PushButton::New(); diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index b1b71ab..3d037eb 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -242,6 +242,9 @@ void PageTurnController::OnInit( Application& app ) Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent); + // Hide the indicator bar + app.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); diff --git a/examples/primitive-shapes/primitive-shapes-example.cpp b/examples/primitive-shapes/primitive-shapes-example.cpp index bf8478d..89ff58c 100644 --- a/examples/primitive-shapes/primitive-shapes-example.cpp +++ b/examples/primitive-shapes/primitive-shapes-example.cpp @@ -68,6 +68,9 @@ public: Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor( Color::WHITE ); + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + //Set up layer to place UI on. Layer layer = Layer::New(); layer.SetParentOrigin( ParentOrigin::CENTER ); @@ -315,7 +318,7 @@ public: //Visual map for model mVisualMap.Clear(); mVisualMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE; - mVisualMap[ PrimitiveVisual::Property::COLOR ] = mColor; + mVisualMap[ PrimitiveVisual::Property::MIX_COLOR ] = mColor; } //Sets the 3D model to a sphere and modifies the sliders appropriately. diff --git a/examples/progress-bar/progress-bar-example.cpp b/examples/progress-bar/progress-bar-example.cpp new file mode 100644 index 0000000..593e297 --- /dev/null +++ b/examples/progress-bar/progress-bar-example.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "shared/view.h" +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using Dali::Toolkit::ProgressBar; + +namespace +{ + +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg"; +const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; +const char* const TOOLBAR_TITLE = "Progress Bar"; + +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); + +// Layout sizes +const int MARGIN_SIZE = 10; +const int TOP_MARGIN = 85; + +} // namespace + +/** This example shows how to create and use PROGRESS BAR. + */ + +class ProgressBarExample: public ConnectionTracker +{ +public: + + ProgressBarExample( Application& application ) + : mApplication( application ) + { + // Connect to the Application's Init signal + mProgressValue = 0.0f; + mApplication.InitSignal().Connect( this, &ProgressBarExample::Create ); + } + + ~ProgressBarExample() + { + // Nothing to do here + } + + void Create( Application& application ) + { + // The Init signal is received once (only) during the Application lifetime + + // Respond to key events + Stage::GetCurrent().KeyEventSignal().Connect( this, &ProgressBarExample::OnKeyEvent ); + + // Creates a default view with a default tool bar. + // The view is added to the stage. + + mContentLayer = DemoHelper::CreateView( application, + mView, + mToolBar, + BACKGROUND_IMAGE, + TOOLBAR_IMAGE, + TOOLBAR_TITLE ); + + mProgressBar = ProgressBar::New(); + mProgressBar.SetParentOrigin(ParentOrigin::TOP_CENTER); + mProgressBar.SetAnchorPoint(AnchorPoint::TOP_CENTER); + mProgressBar.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); + mProgressBar.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); + + Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1); + contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); + contentTable.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); + contentTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); + contentTable.SetParentOrigin(ParentOrigin::TOP_LEFT); + contentTable.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE * 0.5f)); + + for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) + { + contentTable.SetFitHeight( i ); + } + + contentTable.SetPosition( 0.0f, TOP_MARGIN ); + mContentLayer.Add( contentTable ); + + // Image selector for progress bar + Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 ); + progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + progressBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + progressBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + progressBackground.SetRelativeWidth( 0, 1.0f ); + progressBackground.SetFitHeight( 0 ); + contentTable.Add( progressBackground ); + progressBackground.Add( mProgressBar ); + + // Create buttons + Toolkit::TableView buttonBackground = Toolkit::TableView::New( 2, 1 ); + buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + buttonBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + + for( unsigned int i = 0; i < buttonBackground.GetRows(); ++i ) + { + buttonBackground.SetFitHeight( i ); + } + + contentTable.Add( buttonBackground ); + + mSetProgressButton = Toolkit::PushButton::New(); + mSetProgressButton.SetLabelText( "Set Progress" ); + mSetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mSetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mSetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnSetProgressButtonSelected ); + + buttonBackground.Add( mSetProgressButton ); + + mResetProgressButton = Toolkit::PushButton::New(); + mResetProgressButton.SetLabelText( "Reset Progress" ); + mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected ); + + buttonBackground.Add( mResetProgressButton ); + } + + bool OnResetProgressButtonSelected( Toolkit::Button button ) + { + mProgressValue = 0.0f; + mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f); + return true; + } + + bool OnSetProgressButtonSelected( Toolkit::Button button ) + { + mProgressValue += 0.1f; + mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue); + return true; + } + + void OnKeyEvent( const KeyEvent& event ) + { + if( event.state == KeyEvent::Down ) + { + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) + { + // Exit application when click back or escape. + mApplication.Quit(); + } + } + } + +private: + + Application& mApplication; + Toolkit::Control mView; ///< The View instance. + Toolkit::ToolBar mToolBar; ///< The View's Toolbar. + Layer mContentLayer; ///< Content layer. + ProgressBar mProgressBar; + Toolkit::PushButton mSetProgressButton; + Toolkit::PushButton mResetProgressButton; + float mProgressValue; +}; + +void RunTest( Application& application ) +{ + ProgressBarExample test( application ); + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +int DALI_EXPORT_API main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); + + RunTest( application ); + + return 0; +} diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp deleted file mode 100644 index 13be24a..0000000 --- a/examples/radial-menu/radial-menu-example.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include "shared/view.h" -#include "radial-sweep-view.h" -#include "radial-sweep-view-impl.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char* TEST_OUTER_RING_FILENAME = DEMO_IMAGE_DIR "layer2.png"; // Image to be masked -const char* TEST_INNER_RING_FILENAME = DEMO_IMAGE_DIR "layer1.png"; // Image to be masked -const char* TEST_MENU_FILENAME = DEMO_IMAGE_DIR "layer3.png"; // Image to be masked -const char* TEST_DIAL_FILENAME = DEMO_IMAGE_DIR "layer4.png"; // Image to be masked -const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); // Background for toolbar -const char* APPLICATION_TITLE( "Radial Menu" ); -const char * const PLAY_ICON( DEMO_IMAGE_DIR "icon-play.png" ); -const char * const PLAY_ICON_SELECTED( DEMO_IMAGE_DIR "icon-play-selected.png" ); -const char * const STOP_ICON( DEMO_IMAGE_DIR "icon-stop.png" ); -const char * const STOP_ICON_SELECTED( DEMO_IMAGE_DIR "icon-stop-selected.png" ); -} - - -/******************************************************************************** - * Application controller class - */ - -// This example shows how to create a mesh actor for use as a stencil buffer -class RadialMenuExample : public ConnectionTracker -{ -public: - /** - * Constructor - * @param[in] app The application handle - */ - RadialMenuExample(Application app); - - /** - * Destructor - */ - ~RadialMenuExample(); - -private: - - /** - * Initialization signal handler - all actor initialization should happen here - * @param[in] app The application handle - */ - void OnInit(Application& app); - - /** - * Create a sweep view with the given image and parameters - */ - RadialSweepView CreateSweepView( std::string imageName, Degree initial, Degree final ); - - /** - * Start the sweep animation on the menu - */ - void StartAnimation(); - - /** - * Play or pause the animation when the button is clicked - */ - bool OnButtonClicked( Toolkit::Button button ); - - /** - * Update the state flag and change the button icon when the animation is finished - */ - void OnAnimationFinished( Animation& source ); - - /** - * Main key event handler - * - * @param[in] event The key event to respond to - */ - void OnKeyEvent(const KeyEvent& event); - -private: // Member variables - enum AnimState - { - STOPPED, - PAUSED, - PLAYING - }; - - Application mApplication; ///< The application handle - Toolkit::Control mView; ///< The toolbar view - Layer mContents; ///< The toolbar contents pane - ImageView mImageView; ///< Image view shown by stencil mask - Animation mAnimation; - AnimState mAnimationState; - - Toolkit::PushButton mPlayStopButton; - ImageView mDialView; - RadialSweepView mRadialSweepView1; - RadialSweepView mRadialSweepView2; - RadialSweepView mRadialSweepView3; -}; - -RadialMenuExample::RadialMenuExample(Application app) -: mApplication( app ), - mAnimationState(STOPPED) -{ - // Connect to the Application's Init signal - app.InitSignal().Connect(this, &RadialMenuExample::OnInit); -} - -RadialMenuExample::~RadialMenuExample() -{ - // Nothing to do here; actor handles will clean up themselves. -} - -void RadialMenuExample::OnInit(Application& app) -{ - Stage stage = Dali::Stage::GetCurrent(); - - // The Init signal is received once (only) during the Application lifetime - stage.KeyEventSignal().Connect(this, &RadialMenuExample::OnKeyEvent); - - // Create toolbar & view - Toolkit::ToolBar toolBar; - mContents = DemoHelper::CreateView( mApplication, - mView, - toolBar, - "", - TOOLBAR_IMAGE, - APPLICATION_TITLE ); - - mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - - mPlayStopButton.ClickedSignal().Connect( this, &RadialMenuExample::OnButtonClicked ); - - toolBar.AddControl( mPlayStopButton, - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, - Toolkit::Alignment::HorizontalRight, - DemoHelper::DEFAULT_PLAY_PADDING ); - - - const ImageDimensions intImgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME); - Vector2 imgSize = Vector2( intImgSize.GetWidth(), intImgSize.GetHeight() ); - Vector2 stageSize = stage.GetSize(); - float scale = stageSize.width / imgSize.width; - float availableHeight = stageSize.height - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight * 2.0f; - if(availableHeight <= stageSize.width) - { - scale = availableHeight / imgSize.width; - } - - mRadialSweepView1 = CreateSweepView( TEST_OUTER_RING_FILENAME, Degree(-90.0f), Degree(-90.0f)); - mRadialSweepView2 = CreateSweepView( TEST_INNER_RING_FILENAME, Degree(90.0f), Degree(0.0f)); - mRadialSweepView3 = CreateSweepView( TEST_MENU_FILENAME, Degree(100.0f), Degree(0.0f)); - mRadialSweepView3.SetInitialActorAngle(Degree(-110)); - mRadialSweepView3.SetFinalActorAngle(Degree(0)); - - mDialView = ImageView::New( TEST_DIAL_FILENAME ); - mDialView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - mDialView.SetParentOrigin( ParentOrigin::CENTER ); - mDialView.SetScale(scale); - Layer dialLayer = Layer::New(); - - dialLayer.Add( mDialView ); - dialLayer.SetParentOrigin( ParentOrigin::CENTER ); - dialLayer.SetSize(stage.GetSize()); - mContents.Add(dialLayer); - - mRadialSweepView1.SetScale(scale); - mRadialSweepView2.SetScale(scale); - mRadialSweepView3.SetScale(scale); - - StartAnimation(); -} - -void RadialMenuExample::StartAnimation() -{ - mDialView.SetOpacity(0.0f); - mRadialSweepView1.SetOpacity(0.0f); - mAnimation = Animation::New(6.0f); - mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f); - mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f); - mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f); - mAnimation.AnimateTo( Property( mDialView, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.8f ) ); - mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.5f ) ); - mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished ); - - mAnimationState = PLAYING; - mAnimation.Play(); -} - -bool RadialMenuExample::OnButtonClicked( Toolkit::Button button ) -{ - switch( mAnimationState ) - { - case PLAYING: - { - mAnimation.Pause(); - mAnimationState = PAUSED; - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); - } - break; - - case PAUSED: - { - mAnimation.Play(); - mAnimationState = PLAYING; - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - } - break; - - case STOPPED: - { - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - mRadialSweepView1.Deactivate(); - mRadialSweepView2.Deactivate(); - mRadialSweepView3.Deactivate(); - StartAnimation(); - } - } - return false; -} - -void RadialMenuExample::OnAnimationFinished( Animation& source ) -{ - mAnimationState = STOPPED; - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); -} - -RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, - Degree initialAngle, - Degree finalAngle) -{ - // Create the image - mImageView = ImageView::New(imageName); - mImageView.SetParentOrigin(ParentOrigin::CENTER); - mImageView.SetAnchorPoint(AnchorPoint::CENTER); - mImageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - - // Create the stencil - const ImageDimensions imageSize = ResourceImage::GetImageSize(imageName); - float diameter = std::max(imageSize.GetWidth(), imageSize.GetHeight()); - RadialSweepView radialSweepView = RadialSweepView::New(); - radialSweepView.SetDiameter( diameter ); - radialSweepView.SetInitialAngle( initialAngle ); - radialSweepView.SetFinalAngle( finalAngle ); - radialSweepView.SetInitialSector( Degree(0.0f) ); - radialSweepView.SetFinalSector( Degree(359.999f) ); - radialSweepView.SetSize( Stage::GetCurrent().GetSize()); - radialSweepView.SetEasingFunction( Dali::AlphaFunction::EASE_IN_OUT ); - radialSweepView.SetParentOrigin( ParentOrigin::CENTER ); - mContents.Add(radialSweepView); - radialSweepView.Add( mImageView ); - mImageView.SetParentOrigin( ParentOrigin::CENTER ); - - return radialSweepView; -} - - -void RadialMenuExample::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - -void RunTest(Application app) -{ - RadialMenuExample test(app); - - app.MainLoop(); -} - -// Entry point for Linux & Tizen applications -int DALI_EXPORT_API main(int argc, char **argv) -{ - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); - - RunTest(app); - - return 0; -} diff --git a/examples/radial-menu/radial-sweep-view-impl.cpp b/examples/radial-menu/radial-sweep-view-impl.cpp deleted file mode 100644 index 34bbe7c..0000000 --- a/examples/radial-menu/radial-sweep-view-impl.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "radial-sweep-view-impl.h" - -#include -#include - -using namespace Dali; - -namespace -{ - -const char* VERTEX_SHADER_PREFIX( "#define MATH_PI_2 1.570796\n#define MATH_PI_4 0.785398\n" ); - -const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( -attribute mediump float aAngleIndex;\n -attribute mediump vec2 aPosition1;\n -attribute mediump vec2 aPosition2;\n -uniform mediump mat4 uMvpMatrix;\n -uniform mediump float uStartAngle;\n -uniform mediump float uRotationAngle;\n -\n -void main()\n -{\n - float currentAngle = uStartAngle + uRotationAngle;\n - float angleInterval1 = MATH_PI_4 * aAngleIndex;\n - vec4 vertexPosition = vec4(0.0, 0.0, 0.0, 1.0);\n - if( currentAngle >= angleInterval1)\n - {\n - float angleInterval2 = angleInterval1 + MATH_PI_2;\n - float angle = currentAngle < angleInterval2 ? currentAngle : angleInterval2;\n - float delta;\n - if( mod( aAngleIndex+4.0, 4.0) < 2.0 )\n - {\n - delta = 0.5 - 0.5*cos(angle) / sin(angle);\n - }\n - else\n - {\n - delta = 0.5 + 0.5*sin(angle) / cos(angle);\n - }\n - vertexPosition.xy = mix( aPosition1, aPosition2, delta );\n - }\n - gl_Position = uMvpMatrix * vertexPosition;\n -} -); - -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( -uniform lowp vec4 uColor;\n -\n -void main()\n -{\n - gl_FragColor = uColor;\n -}\n -); - -float HoldZeroFastEaseInOutHoldOne(float progress) -{ - if( progress < 0.2f) - { - return 0.0f; - } - else if(progress < 0.5f) - { - progress = (progress-0.2) / 0.3f; - return progress*progress*progress*0.5f; - } - else if(progress < 0.8f) - { - progress = ((progress - 0.5f) / 0.3f) - 1.0f; - return (progress*progress*progress+1.0f) * 0.5f + 0.5f; - } - else - { - return 1.0f; - } -} - -} // anonymous namespace - - -RadialSweepView RadialSweepViewImpl::New( ) -{ - return New( 2.0f, 100.0f, ANGLE_0, ANGLE_0, ANGLE_0, ANGLE_360 ); -} - - -RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector ) -{ - RadialSweepViewImpl* impl= new RadialSweepViewImpl(duration, diameter, initialAngle, finalAngle, initialSector, finalSector); - RadialSweepView handle = RadialSweepView(*impl); - return handle; -} - -RadialSweepViewImpl::RadialSweepViewImpl( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector ) -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), - mDuration(duration), - mDiameter(diameter), - mInitialAngle(initialAngle), - mFinalAngle(finalAngle), - mInitialSector(initialSector), - mFinalSector(finalSector), - mInitialActorAngle(0), - mFinalActorAngle(0), - mEasingFunction(HoldZeroFastEaseInOutHoldOne), - mStartAngleIndex(Property::INVALID_INDEX), - mRotationAngleIndex(Property::INVALID_INDEX), - mRotateActorsWithStencil(false), - mRotateActors(false) -{ -} - -void RadialSweepViewImpl::SetDuration(float duration) -{ - mDuration = duration; -} - -void RadialSweepViewImpl::SetEasingFunction( Dali::AlphaFunction easingFunction ) -{ - mEasingFunction = easingFunction; -} - -void RadialSweepViewImpl::SetDiameter(float diameter) -{ - mDiameter = diameter; -} - -void RadialSweepViewImpl::SetInitialAngle( Dali::Radian initialAngle) -{ - mInitialAngle = initialAngle; -} - -void RadialSweepViewImpl::SetFinalAngle( Dali::Radian finalAngle) -{ - mFinalAngle = finalAngle; -} - -void RadialSweepViewImpl::SetInitialSector( Dali::Radian initialSector) -{ - mInitialSector = initialSector; -} - -void RadialSweepViewImpl::SetFinalSector( Dali::Radian finalSector) -{ - mFinalSector = finalSector; -} - -void RadialSweepViewImpl::SetInitialActorAngle( Dali::Radian initialAngle ) -{ - mInitialActorAngle = initialAngle; - mRotateActors = true; -} - -void RadialSweepViewImpl::SetFinalActorAngle( Dali::Radian finalAngle ) -{ - mFinalActorAngle = finalAngle; - mRotateActors = true; -} - -float RadialSweepViewImpl::GetDuration( ) -{ - return mDuration; -} - -float RadialSweepViewImpl::GetDiameter( ) -{ - return mDiameter; -} - -Dali::Radian RadialSweepViewImpl::GetInitialAngle( ) -{ - return mInitialAngle; -} - -Dali::Radian RadialSweepViewImpl::GetFinalAngle( ) -{ - return mFinalAngle; -} - -Dali::Radian RadialSweepViewImpl::GetInitialSector( ) -{ - return mInitialSector; -} - -Dali::Radian RadialSweepViewImpl::GetFinalSector( ) -{ - return mFinalSector; -} - -Dali::Radian RadialSweepViewImpl::GetInitialActorAngle( ) -{ - return mInitialActorAngle; -} - -Dali::Radian RadialSweepViewImpl::GetFinalActorAngle( ) -{ - return mFinalActorAngle; -} - -void RadialSweepViewImpl::RotateActorsWithStencil(bool rotate) -{ - mRotateActorsWithStencil = rotate; -} - -void RadialSweepViewImpl::Add(Actor actor) -{ - if( ! mLayer ) - { - mLayer = Layer::New(); - Self().Add(mLayer); - mLayer.SetSize( Stage::GetCurrent().GetSize() ); - mLayer.SetParentOrigin( ParentOrigin::CENTER ); - } - - mLayer.Add(actor); -} - -void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float duration ) -{ - bool startAnimation=false; - if( ! anim ) - { - mAnim = Animation::New( mDuration ); - anim = mAnim; - startAnimation = true; - } - - if( ! mStencilActor ) - { - CreateStencil( mInitialSector ); - mLayer.Add( mStencilActor ); - mStencilActor.SetScale(mDiameter); - } - - mStencilActor.SetOrientation( mInitialAngle, Vector3::ZAXIS ); - mStencilActor.SetProperty( mRotationAngleIndex, mInitialSector.radian ); - - if( mRotateActors ) - { - for(unsigned int i=0, count=mLayer.GetChildCount(); i -#include "radial-sweep-view.h" - - -/******************************************************************************** - * Class to implement a layer with a radial sweep stencil mask and an actor tree - */ -class RadialSweepViewImpl : public Dali::Toolkit::Internal::Control -{ -public: - static RadialSweepView New(); - - static RadialSweepView New( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - RadialSweepViewImpl( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - void SetDuration(float duration); - void SetEasingFunction( Dali::AlphaFunction easingFunction ); - - void SetDiameter(float diameter); - void SetInitialAngle( Dali::Radian initialAngle); - void SetFinalAngle( Dali::Radian finalAngle); - void SetInitialSector( Dali::Radian initialSector); - void SetFinalSector( Dali::Radian finalSector); - void SetInitialActorAngle( Dali::Radian initialAngle ); - void SetFinalActorAngle( Dali::Radian finalAngle ); - - float GetDuration( ); - float GetDiameter( ); - Dali::Radian GetInitialAngle( ); - Dali::Radian GetFinalAngle( ); - Dali::Radian GetInitialSector( ); - Dali::Radian GetFinalSector( ); - Dali::Radian GetInitialActorAngle( ); - Dali::Radian GetFinalActorAngle( ); - - void RotateActorsWithStencil(bool rotate); - - void Add( Dali::Actor actor ); - - void Activate( Dali::Animation anim = Dali::Animation(), float offsetTime=0, float duration=2.0f ); - - void Deactivate(); - -private: - - /** - * Create the stencil mask - */ - void CreateStencil(Dali::Radian initialSector ); - -private: - Dali::Layer mLayer; - Dali::Animation mAnim; - float mDuration; - float mDiameter; - Dali::Radian mInitialAngle; - Dali::Radian mFinalAngle; - Dali::Radian mInitialSector; - Dali::Radian mFinalSector; - Dali::Radian mInitialActorAngle; - Dali::Radian mFinalActorAngle; - Dali::AlphaFunction mEasingFunction; - Dali::Actor mStencilActor; ///< Stencil actor which generates mask - Dali::Property::Index mStartAngleIndex; ///< Index of start-angle property - Dali::Property::Index mRotationAngleIndex; ///< Index of rotation-angle property - bool mRotateActorsWithStencil:1; - bool mRotateActors; -}; - - -inline RadialSweepViewImpl& GetImpl( RadialSweepView& obj ) -{ - DALI_ASSERT_ALWAYS(obj); - Dali::RefObject& handle = obj.GetImplementation(); - return static_cast(handle); -} - -inline const RadialSweepViewImpl& GetImpl( const RadialSweepView& obj ) -{ - DALI_ASSERT_ALWAYS(obj); - const Dali::RefObject& handle = obj.GetImplementation(); - return static_cast(handle); -} - - - -#endif // DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H diff --git a/examples/radial-menu/radial-sweep-view.cpp b/examples/radial-menu/radial-sweep-view.cpp deleted file mode 100644 index 46e2609..0000000 --- a/examples/radial-menu/radial-sweep-view.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "radial-sweep-view.h" -#include "radial-sweep-view-impl.h" - -using namespace Dali; - -RadialSweepView::RadialSweepView() -{ -} - -RadialSweepView::RadialSweepView(const RadialSweepView& handle) -: Control(handle) -{ -} - -RadialSweepView& RadialSweepView::operator=(const RadialSweepView& rhs) -{ - if( &rhs != this ) - { - Control::operator=(rhs); - } - return *this; -} - -RadialSweepView::~RadialSweepView() -{ -} - -RadialSweepView RadialSweepView::DownCast( BaseHandle handle ) -{ - return Control::DownCast(handle); -} - -RadialSweepView RadialSweepView::New( ) -{ - return RadialSweepViewImpl::New(); -} - -RadialSweepView RadialSweepView::New( float duration, - float diameter, - Radian initialAngle, - Radian finalAngle, - Radian initialSector, - Radian finalSector ) -{ - return RadialSweepViewImpl::New(duration, diameter, initialAngle, finalAngle, initialSector, finalSector ); -} - -RadialSweepView::RadialSweepView( RadialSweepViewImpl& impl ) -: Control( impl ) -{ -} - -RadialSweepView::RadialSweepView( Dali::Internal::CustomActor* impl ) -: Control( impl ) -{ - VerifyCustomActorPointer(impl); -} - -void RadialSweepView::SetDuration(float duration) -{ - GetImpl(*this).SetDuration(duration); -} - -void RadialSweepView::SetEasingFunction( Dali::AlphaFunction easingFunction ) -{ - GetImpl(*this).SetEasingFunction( easingFunction ); -} - -void RadialSweepView::SetDiameter(float diameter) -{ - GetImpl(*this).SetDiameter(diameter); -} - -void RadialSweepView::SetInitialAngle( Dali::Radian initialAngle) -{ - GetImpl(*this).SetInitialAngle(initialAngle); -} - -void RadialSweepView::SetFinalAngle( Dali::Radian finalAngle) -{ - GetImpl(*this).SetFinalAngle(finalAngle); -} - -void RadialSweepView::SetInitialSector( Dali::Radian initialSector) -{ - GetImpl(*this).SetInitialSector(initialSector); -} - -void RadialSweepView::SetFinalSector( Dali::Radian finalSector) -{ - GetImpl(*this).SetFinalSector(finalSector); -} - -void RadialSweepView::SetInitialActorAngle( Dali::Radian initialAngle ) -{ - GetImpl(*this).SetInitialActorAngle(initialAngle); -} - -void RadialSweepView::SetFinalActorAngle( Dali::Radian finalAngle ) -{ - GetImpl(*this).SetFinalActorAngle(finalAngle); -} - -float RadialSweepView::GetDuration( ) -{ - return GetImpl(*this).GetDuration(); -} - -float RadialSweepView::GetDiameter( ) -{ - return GetImpl(*this).GetDiameter(); -} - -Dali::Radian RadialSweepView::GetInitialAngle( ) -{ - return GetImpl(*this).GetInitialAngle(); -} - -Dali::Radian RadialSweepView::GetFinalAngle( ) -{ - return GetImpl(*this).GetFinalAngle(); -} - -Dali::Radian RadialSweepView::GetInitialSector( ) -{ - return GetImpl(*this).GetInitialSector(); -} - -Dali::Radian RadialSweepView::GetFinalSector( ) -{ - return GetImpl(*this).GetFinalSector(); -} - -Dali::Radian RadialSweepView::GetInitialActorAngle( ) -{ - return GetImpl(*this).GetInitialActorAngle(); -} - -Dali::Radian RadialSweepView::GetFinalActorAngle( ) -{ - return GetImpl(*this).GetFinalActorAngle(); -} - -void RadialSweepView::RotateActorsWithStencil(bool rotate) -{ - GetImpl(*this).RotateActorsWithStencil(rotate); -} - -void RadialSweepView::Add(Actor actor) -{ - GetImpl(*this).Add(actor); -} - -void RadialSweepView::Activate() -{ - GetImpl(*this).Activate(); -} - -void RadialSweepView::Activate( Dali::Animation anim, float offsetTime, float duration ) -{ - GetImpl(*this).Activate(anim, offsetTime, duration); -} - -void RadialSweepView::Deactivate() -{ - GetImpl(*this).Deactivate(); -} diff --git a/examples/radial-menu/radial-sweep-view.h b/examples/radial-menu/radial-sweep-view.h deleted file mode 100644 index 3abdcb0..0000000 --- a/examples/radial-menu/radial-sweep-view.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_H -#define DALI_DEMO_RADIAL_SWEEP_VIEW_H - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -class RadialSweepViewImpl; - - -/******************************************************************************** - * Handle to RadialSweepView implementation - */ -class RadialSweepView : public Dali::Toolkit::Control -{ -public: - /** - * Create a new RadialSweepView with default parameters (2 second animation, - * no rotation, sweeping out a full circle). - */ - static RadialSweepView New( ); - - /** - * Create a new RadialSweepView. - * @param[in] duration The duration of the sweep animation - * @param[in] diameter The diameter of the stencil mask - * @param[in] initialAngle The initial angle of the anticlockwise line of the sweep sector - * @param[in] finalAngle The final angle of the anticlockwise line of the sweep sector - * @param[in] initialSector The angle of the starting sector - * @param[in] finalSector The angle of the sector at the end of the animation. - * Note, to cover the entire circle, use a value of 359.9999 degrees, not zero or 360 degrees. - * - * initial sector - * \ | . - * \ | . - * initialAngle \ | . final sector - * \| _| - * .________ - */ - static RadialSweepView New( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - void SetDuration(float duration); - - void SetEasingFunction( Dali::AlphaFunction easingFunction ); - - void SetDiameter(float diameter); - - void SetInitialAngle( Dali::Radian initialAngle); - - void SetFinalAngle( Dali::Radian finalAngle); - - void SetInitialSector( Dali::Radian initialSector); - - void SetFinalSector( Dali::Radian finalSector); - - void SetInitialActorAngle( Dali::Radian initialAngle ); - - void SetFinalActorAngle( Dali::Radian finalAngle ); - - float GetDuration( ); - - float GetDiameter( ); - - Dali::Radian GetInitialAngle( ); - - Dali::Radian GetFinalAngle( ); - - Dali::Radian GetInitialSector( ); - - Dali::Radian GetFinalSector( ); - - Dali::Radian GetInitialActorAngle( ); - - Dali::Radian GetFinalActorAngle( ); - - /** - * @param[in] rotate True if the actors should rotate with the stencil - */ - void RotateActorsWithStencil(bool rotate); - - /** - * Add actors to the view - */ - void Add(Actor actor); - - /** - * Activate the sweep animation - */ - void Activate( ); - - void Activate( Dali::Animation anim, float offsetTime, float duration ); - - /** - * Deactivate the sweep animation - */ - void Deactivate(); - - /** - * Default constructor. Create an uninitialized handle. - */ - RadialSweepView(); - - /** - * Copy constructor - */ - RadialSweepView(const RadialSweepView& handle); - - /** - * Assignment operator - */ - RadialSweepView& operator=(const RadialSweepView& rhs); - - /** - * Destructor - */ - ~RadialSweepView(); - - /** - * Downcast method - */ - static RadialSweepView DownCast( BaseHandle handle ); - -public: // Not for use by application developers - - RadialSweepView( RadialSweepViewImpl& impl ); - - RadialSweepView( Dali::Internal::CustomActor* impl ); -}; - -#endif diff --git a/examples/renderer-stencil/renderer-stencil-example.cpp b/examples/renderer-stencil/renderer-stencil-example.cpp index 5a92cd6..37d6fe7 100644 --- a/examples/renderer-stencil/renderer-stencil-example.cpp +++ b/examples/renderer-stencil/renderer-stencil-example.cpp @@ -116,6 +116,9 @@ private: { Stage stage = Stage::GetCurrent(); + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + // Creates the background image. Toolkit::Control background = Dali::Toolkit::Control::New(); background.SetAnchorPoint( Dali::AnchorPoint::CENTER ); @@ -272,13 +275,10 @@ private: renderer.SetTextures( textureSet ); // Setup the renderer properties: - // We are writing to the color buffer & culling back faces. - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true ); + // We are writing to the color buffer & culling back faces (no stencil is used for the main cube). + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR ); renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); - // No stencil is used for the main cube. - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF ); - // We do need to write to the depth buffer as other objects need to appear underneath this cube. renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON ); // We do not need to test the depth buffer as we are culling the back faces. @@ -313,13 +313,10 @@ private: renderer.SetTextures( planeTextureSet ); // Setup the renderer properties: - // We are writing to the color buffer & culling back faces (as we are NOT doing depth write). - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true ); + // We are writing to the color buffer & culling back faces as we are NOT doing depth write (no stencil is used for the floor). + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR ); renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); - // No stencil is used for the floor. - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF ); - // We do not write to the depth buffer as its not needed. renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF ); // We do need to test the depth buffer as we need the floor to be underneath the cube. @@ -357,11 +354,9 @@ private: Renderer renderer = CreateRenderer( planeGeometry, size, false, Vector4::ONE ); // Setup the renderer properties: - // The stencil plane is only for stencilling, so disable writing to color buffer. - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, false ); + // The stencil plane is only for stencilling. + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); - // Enable stencil. Draw to the stencil buffer (only). - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xFF ); @@ -407,8 +402,9 @@ private: renderer.SetTextures( textureSet ); // Setup the renderer properties: - // Write to color buffer so reflection is visible - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true ); + // Write to color buffer so reflection is visible. + // Also enable the stencil buffer, as we will be testing against it to only draw to areas within the stencil. + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL ); // We cull to skip drawing the back faces. renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); @@ -419,7 +415,6 @@ private: renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE ); // Enable stencil. Here we only draw to areas within the stencil. - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::EQUAL ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 ); renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xff ); diff --git a/examples/renderer-stencil/renderer-stencil-shaders.h b/examples/renderer-stencil/renderer-stencil-shaders.h index fe9c461..fcf758f 100644 --- a/examples/renderer-stencil/renderer-stencil-shaders.h +++ b/examples/renderer-stencil/renderer-stencil-shaders.h @@ -29,7 +29,7 @@ const char * const POSITION( "aPosition"); const char * const NORMAL( "aNormal" ); const char * const TEXTURE( "aTexCoord" ); -// Shader for todor (vertex): +// Shader for basic, per-vertex lighting (vertex): const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( attribute mediump vec3 aPosition; attribute highp vec3 aNormal; @@ -62,6 +62,7 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( } ); +// Fragment shader. const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( varying mediump vec2 vTexCoord; varying mediump vec3 vIllumination; @@ -74,6 +75,7 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } ); +// Shader for basic, per-vertex lighting with texture (vertex): const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER( attribute mediump vec3 aPosition; attribute highp vec3 aNormal; @@ -107,6 +109,7 @@ const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER( } ); +// Fragment shader. const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER( varying mediump vec2 vTexCoord; varying mediump vec3 vIllumination; diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 3c05fbd..5fe5daa 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -798,7 +798,7 @@ private: Layer mContentLayer; ///< Content layer. Toolkit::TextLabel mTitleActor; ///< Title text. - Toolkit::Popup mMenu; ///< The navigation menu todor. + Toolkit::Popup mMenu; ///< The navigation menu. Toolkit::Popup mPopup; ///< The current example popup. Toolkit::ItemView mItemView; ///< ItemView to hold test images. diff --git a/examples/sparkle/sparkle-effect-example.cpp b/examples/sparkle/sparkle-effect-example.cpp new file mode 100644 index 0000000..1cc465a --- /dev/null +++ b/examples/sparkle/sparkle-effect-example.cpp @@ -0,0 +1,568 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include +#include + +#include "shared/utility.h" +#include "sparkle-effect.h" + +using namespace Dali; +using Dali::Toolkit::ImageView; + +using namespace SparkleEffect; + +namespace // unnamed namespace +{ + +//background image for normal status +const char * const CIRCLE_BACKGROUND_IMAGE( DEMO_IMAGE_DIR "sparkle_normal_background.png" ); +//particle shape image +const char * const PARTICLE_IMAGE( DEMO_IMAGE_DIR "sparkle_particle.png" ); + +float EaseOutSquare( float progress ) +{ + return 1.0f - (1.0f-progress) * (1.0f-progress); +} + +float CustomBounce( float progress ) +{ + float p = 1.f-progress; + p *=p; + return 17.68f*p*p*p*progress; +} + +float Mix( const Vector2& range, float a ) +{ + return range.x * a + range.y*(1.f-a)-0.001f; +} + +const Vector4 BACKGROUND_COLOR( 0.f, 0.f, 0.05f, 1.f ); + +} // unnamed namespace + +// This example shows a sparkle particle effect +// +class SparkleEffectExample : public ConnectionTracker +{ +public: + + /** + * Create the SparkleEffectExample + * @param[in] application The DALi application instance + */ + SparkleEffectExample( Application& application ) + : mApplication( application ), + mAnimationIndex( 0u ), + mShaking( false ) + { + mApplication.InitSignal().Connect( this, &SparkleEffectExample::OnInit ); + } + +private: + + /** + * Initialize the SparkleEffectExample + * @param[in] application The DALi application instance + */ + void OnInit( Application& application ) + { + Stage stage = Stage::GetCurrent(); + stage.KeyEventSignal().Connect(this, &SparkleEffectExample::OnKeyEvent); + stage.SetBackgroundColor( BACKGROUND_COLOR ); + + mCircleBackground = ImageView::New( CIRCLE_BACKGROUND_IMAGE ); + mCircleBackground.SetParentOrigin( ParentOrigin::CENTER ); + mCircleBackground.SetAnchorPoint( AnchorPoint::CENTER ); + + stage.Add( mCircleBackground ); + + mEffect = SparkleEffect::New(); + + mMeshActor = CreateMeshActor(); + + stage.Add( mMeshActor ); + + mMeshActor.SetPosition( ACTOR_POSITION ); + mMeshActor.SetScale( ACTOR_SCALE ); + + mTapDetector = TapGestureDetector::New(); + mTapDetector.Attach(mCircleBackground); + mTapDetector.DetectedSignal().Connect( this, &SparkleEffectExample::OnTap ); + + mPanGestureDetector = PanGestureDetector::New(); + mPanGestureDetector.DetectedSignal().Connect( this, &SparkleEffectExample::OnPan ); + mPanGestureDetector.Attach( mCircleBackground ); + + PlayWanderAnimation( 35.f ); + } + + /** + * Create the mesh representing all the particles + */ + Actor CreateMeshActor() + { + // shuffling to assign the color in random order + unsigned int* shuffleArray = new unsigned int[NUM_PARTICLE]; + for( unsigned int i = 0; i vertices; + std::vector< unsigned short > faces; + + for( unsigned int i = 0; i(thereshold-particleIndex)/PARTICLE_COLORS[i].numParticle ); + } + } + return NUM_COLOR-1; + } + + /** + * All a particle to the mesh by giving the moving path and color index + * + * Two triangles per particle + * 0---------3 + * |\ | + * | \ | + * | \ | + * | \| + * 1---------2 + * + * The information we need to pass in through attribute include: + * + * path which contains 12 integer + * ---- passed in 6 Vector2 attributes + * + * color index, particle index and textureCoor( (0,0) or (1,0) or (0,1) or (1,1) ) + * ---- package these info into texCood attribute as: (+-colorIndex, +-particleIndex) + */ + void AddParticletoMesh( std::vector< Vertex >& vertices, + std::vector< unsigned short >& faces, + MovingPath& movingPath, + float colorIndex ) + { + unsigned int idx = vertices.size(); + + // store the path into position and normal, which would be decoded inside the shader + Vector2 particlePath0( movingPath[0], movingPath[1] ); + Vector2 particlePath1( movingPath[2], movingPath[3] ); + Vector2 particlePath2( movingPath[4], movingPath[5] ); + Vector2 particlePath3( movingPath[6], movingPath[7] ); + Vector2 particlePath4( movingPath[8], movingPath[9] ); + Vector2 particlePath5( movingPath[10], movingPath[11] ); + + float particleIdx = static_cast(idx/4 + 1); // count from 1 + float colorIdx = colorIndex+1.f; // count from 1 + vertices.push_back( Vertex( Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) ); + vertices.push_back( Vertex( Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) ); + vertices.push_back( Vertex( Vector2( colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) ); + vertices.push_back( Vertex( Vector2( colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) ); + + faces.push_back(idx); + faces.push_back(idx+1); + faces.push_back(idx+2); + + faces.push_back(idx); + faces.push_back(idx+2); + faces.push_back(idx+3); + } + + /* + * Main key event handler + */ + void OnKeyEvent(const KeyEvent& event) + { + if(event.state == KeyEvent::Down) + { + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) + { + mApplication.Quit(); + } + } + } + + /** + * Callback of the TapGesture + */ + void OnTap( Actor actor, const TapGesture& tap ) + { + { + PlayTapAnimation(5.f, tap.localPoint); + } + } + + /** + * Callback of the PanGesture + */ + void OnPan( Actor actor, const PanGesture& gesture ) + { + if( gesture.state == Gesture::Finished ) + { + switch(mAnimationIndex) + { + case 0: + { + PlayParticleFadeAnimation(0, NUM_PARTICLE, 0.f, 3.f ); + break; + } + case 1: + { + PlayBreakAnimation(2.0f); + break; + } + case 2: + { + PlayShakeAnimation(0.5f, 2.5f); + break; + } + default: + { + break; + } + } + + mAnimationIndex = (mAnimationIndex+1)%3; + } + } + + /** + * Animate the particle position to make them wandering on the screen with 'seemingly' random fade in/out + * @param[in] duration The duration for the particle to move a cycle on the path. the bigger this value the slower the floating movement. + * @param[in] looping Infinite playing or not + */ + void PlayWanderAnimation( float duration, bool looping = true ) + { + Animation wanderAnimation= Animation::New(duration); + wanderAnimation.AnimateTo( Property( mEffect, PERCENTAGE_UNIFORM_NAME ), 1.f ); + wanderAnimation.SetLooping(looping); // infinite playing + + wanderAnimation.Play(); + } + + /** + * Accelerate the particle moving speed + * @param[in] cycle How many extra cycles to move during the animation + * @param[in] duration The duration for the animation + */ + void PlayShakeAnimation( float cycle, float duration ) + { + if( mShaking ) + { + return; + } + DestroyAnimation( mTapAnimationAux ); + + float accelaration = GetFloatUniformValue( ACCELARATION_UNIFORM_NAME ); + mEffect.SetProperty( mEffect.GetPropertyIndex(ACCELARATION_UNIFORM_NAME), accelaration - int( accelaration) ); // Set the value as its fractional part + Animation shakeAnimation = Animation::New(duration); + shakeAnimation.AnimateBy( Property( mEffect, ACCELARATION_UNIFORM_NAME ), cycle, AlphaFunction::EASE_OUT ); + shakeAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnShakeAnimationFinished ); + + shakeAnimation.Play(); + mShaking = true; + } + + /** + * Animate the particles to appear from center and spread all over around + * @param[in] duration The duration for the animation + */ + void PlayBreakAnimation( float duration ) + { + if( GetFloatUniformValue(BREAK_UNIFORM_NAME) > 0.f ) + { + return; + } + + // Stop the fading / tap animation before the breaking + DestroyAnimation( mFadeAnimation); + mTapIndices.x = mTapIndices.y; + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices ); + mEffect.SetProperty( mEffect.GetPropertyIndex( ACCELARATION_UNIFORM_NAME ), 0.f ); + + // prepare the animation by setting the uniform to the required value + mEffect.SetProperty( mEffect.GetPropertyIndex( BREAK_UNIFORM_NAME ), 1.f ); + mMeshActor.SetScale(0.01f); + mEffect.SetProperty( mEffect.GetPropertyIndex( "uScale" ), 0.01f ); + mMeshActor.SetPosition( 0.f, 0.f, 1.f ); + + Animation breakAnimation = Animation::New(duration*1.5f); + breakAnimation.AnimateTo( Property(mMeshActor, Actor::Property::SCALE), Vector3(ACTOR_SCALE,ACTOR_SCALE,ACTOR_SCALE), EaseOutSquare); + breakAnimation.AnimateTo( Property( mEffect, "uScale" ), ACTOR_SCALE, EaseOutSquare); + breakAnimation.AnimateTo( Property(mMeshActor, Actor::Property::POSITION), ACTOR_POSITION, EaseOutSquare); + breakAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnBreakAnimationFinished ); + + float timeUnit = duration/ (NUM_PARTICLE+1) /(NUM_PARTICLE+1) ; + std::ostringstream oss; + for(unsigned int i = 0; i 0.f ) + { + return; + } + + // start the opacity animation one particle after another gradually + float timeSlice = duration / (numParticle+1); + float fadeDuration = timeSlice>0.5f ? timeSlice : 0.5f; + + Animation fadeAnimation= Animation::New(duration+fadeDuration*2.f); + std::ostringstream oss; + for(unsigned int i = startIndex; i=NUM_PARTICLE ) break; // out of bound + + oss.str(""); + oss<< OPACITY_UNIFORM_NAME<< i << "]"; + fadeAnimation.AnimateTo(Property( mEffect, oss.str()), targetValue, TimePeriod( timeSlice*i, fadeDuration*2.f )); + } + + fadeAnimation.Play(); + mFadeAnimation = fadeAnimation; + mFadeAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnFadeAnimationFinished ); + } + + /** + * Push the particles to the edge all around the circle then bounce back + * @param[in] duration The duration for the animation + * @param[in] tapPoint The position of the tap point + */ + void PlayTapAnimation(float duration, const Vector2& tapPoint ) + { + if( mTapIndices.y > mTapIndices.x && mTapAnimation.GetCurrentProgress() < 0.2f) + { + return; + } + + Animation animation= Animation::New(duration); + int idx = int(mTapIndices.y)%MAXIMUM_ANIMATION_COUNT; + mTapIndices.y += 1.f; + + std::ostringstream oss; + oss<< TAP_OFFSET_UNIFORM_NAME<< idx << "]"; + mEffect.SetProperty( mEffect.GetPropertyIndex( oss.str() ), 0.f); + animation.AnimateTo( Property( mEffect, oss.str() ), 0.75f, CustomBounce); + + oss.str(""); + oss<< TAP_POINT_UNIFORM_NAME<< idx << "]"; + mEffect.SetProperty( mEffect.GetPropertyIndex( oss.str() ), tapPoint/ACTOR_SCALE); + + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices); + + if(!mShaking) + { + mTapAnimationAux = Animation::New(duration*0.2f); + mTapAnimationAux.AnimateBy( Property( mEffect, ACCELARATION_UNIFORM_NAME ), 0.15f, AlphaFunction::EASE_IN_OUT ); + mTapAnimationAux.Play(); + } + animation.Play(); + mTapAnimationIndexPair[animation] = static_cast(mTapIndices.y -1.f); + animation.FinishedSignal().Connect( this, &SparkleEffectExample::OnTapAnimationFinished ); + mTapAnimation = animation; + } + + /** + * Callback of the animation finished signal + */ + void OnShakeAnimationFinished( Animation& animation) + { + mShaking = false; + } + + /** + * Callback of the animation finished signal + */ + void OnFadeAnimationFinished( Animation& animation) + { + mFadeAnimation.Clear(); + mFadeAnimation.Reset(); + } + + /** + * Callback of the animation finished signal + */ + void OnBreakAnimationFinished( Animation& animation) + { + mEffect.SetProperty( mEffect.GetPropertyIndex( BREAK_UNIFORM_NAME ), 0.f ); + } + + /** + * Callback of the animation finished signal + */ + void OnTapAnimationFinished( Animation& animation ) + { + if( mTapAnimationIndexPair[animation] == static_cast(mTapIndices.x) ) + { + mTapIndices.x += 1.f; + if( mTapIndices.x >= mTapIndices.y ) + { + mTapIndices = Vector2::ZERO; + } + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices); + } + + mTapAnimationIndexPair.erase( animation ); + if( mTapAnimationIndexPair.size() < 1 && mTapIndices != Vector2::ZERO) + { + mTapIndices = Vector2::ZERO; + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices); + } + + animation.Clear(); + animation.Reset(); + } + + /** + * Helper retrieve a uniform value from the Sparkle effect shader + * @param[in] uniformName The uniform + * @return The float value + */ + float GetFloatUniformValue( const std::string& uniformName ) + { + float value; + mEffect.GetProperty(mEffect.GetPropertyIndex(uniformName)).Get(value); + return value; + } + + /** + * Terminate the given animation + */ + void DestroyAnimation( Animation& animation ) + { + if( animation ) + { + animation.Clear(); + animation.Reset(); + } + } + +private: + + Application& mApplication; + Shader mEffect; + ImageView mCircleBackground; + Actor mMeshActor; + + PanGestureDetector mPanGestureDetector; + TapGestureDetector mTapDetector; + + Animation mFadeAnimation; + Animation mTapAnimation; + Animation mTapAnimationAux; + + Vector2 mTapIndices; + unsigned int mAnimationIndex; + bool mShaking; + + std::map< Animation, int > mTapAnimationIndexPair; +}; + +void RunTest( Application& application ) +{ + SparkleEffectExample theApp( application ); + + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +// +int DALI_EXPORT_API main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + RunTest( application ); + + return 0; +} + diff --git a/examples/sparkle/sparkle-effect.h b/examples/sparkle/sparkle-effect.h new file mode 100644 index 0000000..f37e1e6 --- /dev/null +++ b/examples/sparkle/sparkle-effect.h @@ -0,0 +1,393 @@ +#ifndef DALI_SPARKLE_EFFECT_H +#define DALI_SPARKLE_EFFECT_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. + * + */ + +#include +#include + +using namespace Dali; +using Dali::Toolkit::ImageView; + +/************************************************************/ +/* Custom sparkle effect shader******************************/ +/************************************************************/ + +namespace SparkleEffect +{ + // uniform which controls the position of particle on the path + const std::string PERCENTAGE_UNIFORM_NAME( "uPercentage" ); + // uniform array of particle color, set their value as the PARTICLE_COLORS given below + const std::string PARTICLE_COLOR_UNIFORM_NAME("uParticleColors["); + // uniform array of particle opacity + const std::string OPACITY_UNIFORM_NAME("uOpacity["); + // uniform which offsets the path control point, with this values >=0, the paths are squeezed towards the GatheringPoint + const std::string ACCELARATION_UNIFORM_NAME("uAcceleration"); + // uniform which indicates the ongoing tap animations + const std::string TAP_INDICES_UNIFORM_NAME("uTapIndices"); + // uniform which controls how much the offset of the midpoints relative to the start/end points of the cubic bezier curve when the path is squeezed for tap animation + const std::string TAP_OFFSET_UNIFORM_NAME("uTapOffset["); + // uniform which gives the position of the tapping, in this way the particles will be pushed away from this point + const std::string TAP_POINT_UNIFORM_NAME("uTapPoint["); + // uniform which trigger the break animation, set to 1.0 when break animation is playing, otherwise set to 0.0 + const std::string BREAK_UNIFORM_NAME("uBreak"); + + /****************particle colors******************/ + + struct ParticleColor + { + Vector3 RGB; + Vector2 AlphaRange; + unsigned int numParticle; + }; + + ParticleColor PARTICLE_COLORS[]= + { + { Vector3( 0.f, 240.f, 255.f )/255.f, Vector2( 0.2f, 1.f ), 22 }, // 00f0ff, opacity 20%~100% + { Vector3( 89.f, 151.f, 239.f )/255.f, Vector2( 0.2f, 0.5f ), 12 }, // 5997ef, opacity 20%~50% + { Vector3( 181.f, 181.f, 207.f )/255.f, Vector2( 0.5f, 1.f ), 22 }, // b5b5cf, opacity 50%~100% + { Vector3( 147.f, 147.f, 170.f )/255.f, Vector2( 0.5f, 0.5f ), 22 }, // 9393aa, opacity 50%~50% + { Vector3( 145.f, 145.f, 201.f )/255.f, Vector2( 1.f, 1.f ), 12 }, // 91bdc9, opacity 100%~100% + { Vector3( 145.f, 145.f, 201.f )/255.f, Vector2( 0.2f, 0.2f ), 21 } // 91bdc9, opacity 20%~20% + }; + const unsigned int NUM_COLOR( sizeof( PARTICLE_COLORS ) / sizeof( PARTICLE_COLORS[0] ) ); + + /***************particle moving paths********************/ + + typedef int MovingPath[12]; + + // these paths are defined inside the circle which has the center at (250, 250) and the radius as 250 + MovingPath PATHS[]= + { // each path is composed of two cubic b-curves: (p0, p1, p2, p3) & (p3, p4, p5, p0) + // p0 p1 p2 p3 p4 p5 + { 280,273, 386,41, 489,141, 491,199, 494,256, 230,394 }, + { 129,226, 357,120, 150,491, 291,406, 433,320, 47,283 }, + { 96,264, 356,133, 446,196, 370,297, 294,399, -169,384 }, + { 345,110, 359,186, 14,393, 4,247, -6,101, 321,-28 }, + { 166,161, 128,353, 566,200, 487,304, 413,403, 203,-32 }, + { 193,286, 106,331, 206,569, 334,477, 462,385, 279,240 }, + { 336,247, 293,232, 301,465, 346,479, 390,493, 374,261 }, + { 250,72, 314,72, 332,495, 250,497, 168,499, 161,72 }, + { 48,387, 32,241, 452,558, 433,358, 411,121, 62,523 }, + { 300,32, 159,27, 442,568, 186,492, -70,415, 551,41 }, + { 479,150, 503,203, 216,403, 163,298, 110,193, 448,78 }, + { 346,75, 311,97, 336,196, 389,160, 442,123, 383,51 }, + { 90,61, 54,96, 218,373, 294,300, 370,227, 141,11 }, + { 126,225, 240,280, 378,29, 221,16, 64,4, 11,170 }, + { 308,101, 243,22, -10,271, 22,352, 49,422, 396,208 }, + { 193,188, 174,302, 502,389, 500,250, 498,111, 212,72 }, + { 227,3, 16,35, 577,309, 428,423, 279,537, 438,-28 }, + { 410,58, 387,18, 22,179, 154,277, 286,374, 459,142 }, + { 178,272, 109,299, 144,429, 218,396, 293,362, 221,254 }, + { 247,46, 98,5, -91,357, 160,431, 412,505, 397,88 }, + { 41,112, 22,144, 123,273, 158,187, 192,101, 75,56 }, + { 8,300, 23,340, 267,294, 238,218, 209,142, -20,226 }, + { 112,256, 24,270, -1,470, 154,433, 308,396, 201,242 }, + { 212,277, 267,346, 509,202, 452,103, 398,8, 150,199 }, + { 154,205, 146,287, 496,282, 492,194, 488,107, 160,140 }, + { 281,350, 365,318, 415,476, 332,482, 248,489, 204,379 }, + { 327,23, 346,81, 154,319, 123,207, 92,95, 313,-21 }, + { 323,233, 283,307, 454,420, 478,354, 501,288, 374,136 }, + { 318,186, 311,252, 488,248, 481,168, 474,87, 328,76 }, + { 7,192, -10,270, 249,398, 269,307, 290,216, 25,111 }, + { 148,22, 98,22, 25,458, 125,458, 225,458, 198,22 }, + { 349,32, 307,39, 492,416, 399,446, 305,477, 460,16 }, + { 147,474, 222,554, 392,154, 486,240, 581,325, 73,394 }, + { 57,186, 13,200, 51,398, 114,374, 178,349, 97,174 }, + { 257,192, 198,188, 162,345, 240,349, 319,354, 316,197 }, + { 242,4, 283,21, 30,172, 81,215, 133,257, 209,-10 }, + { 149,408, 165,442, 472,340, 444,275, 416,210, 120,348 }, + { 106,271, 136,359, 483,370, 422,186, 360,2, 76,186 }, + { 120,146, 29,224, 469,262, 346,390, 222,518, 393,-87 }, + { 318,265, 415,280, 398,537, 247,491, 96,446, 222,249 }, + { 171,275, 207,246, 274,469, 237,497, 199,525, 139,300 }, + { 196,84, 135,105, 256,510, 334,486, 412,462, 280,55 }, + { 485,314, 452,170, 158,606, 111,411, 55,179, 515,446 }, + { 134,54, 266,4, 175,607, 392,451, 609,296, -100,144 }, + { 3,229, -1,287, 334,383, 350,267, 366,150, 10,151 }, + { 105,115, 146,125, 154,227, 92,209, 30,192, 62,105 }, + { 343,20, 388,42, 323,357, 228,313, 132,269, 278,-10 }, + { 362,186, 271,274, 60,82, 204,19, 349,-44, 453,97 }, + { 145,128, 181,32, 501,185, 498,272, 495,347, 97,257 }, + { 286,172, 342,274, 59,463, 16,331, -27,198, 231,69 }, + { 194,7, 404,-32, -38,410, 140,469, 317,528, -16,45 }, + { 39,120, 48,74, 445,109, 352,244, 259,379, 20,215 }, + { 328,247, 402,250, 411,384, 330,377, 248,370, 281,244 }, + { 189,56, 317,-31, 610,240, 396,392, 183,543, 61,144 }, + { 402,53, 430,77, 376,231, 315,161, 255,91, 351,10 }, + { 496,218, 494,260, 249,296, 251,214, 254,133, 498,139 }, + { 381,210, 469,195, 557,376, 399,391, 241,407, 292,226 }, + { 297,263, 267,346, -8,289, 14,176, 35,69, 331,168 }, + { 329,187, 363,263, 30,371, 5,287, -19,203, 302,128 }, + { 257,354, 168,351, 171,516, 252,496, 333,475, 340,356 }, + { 106,60, 107,121, 366,284, 359,168, 352,52, 105,14 }, + { 178,257, 240,314, 115,476, 71,421, 28,367, 98,182 }, + { 163,213, 191,273, 22,327, 3,248, -17,170, 118,113 }, + { 459,117, 500,185, 297,390, 248,311, 199,232, 416,46 }, + { 270,3, 317,-14, 528,375, 434,407, 339,440, 223,19 }, + { 88,76, 130,68, 78,485, 176,483, 274,482, -22,96 }, + { 422,428, 378,528, 88,205, 26,317, -36,428, 467,328 }, + { 414,127, 460,125, 489,325, 421,322, 353,320, 372,128 }, + { 227,197, 281,174, 367,311, 294,340, 221,370, 173,220 }, + { 180,14, 147,44, 436,104, 401,161, 366,219, 207,-10 }, + { 400,367, 395,404, 71,406, 77,336, 82,265, 407,300 }, + { 396,222, 396,316, 71,439, 70,245, 68,51, 396,132 }, + { 342,109, 454,153, 49,332, 208,413, 367,494, 8,-23 }, + { 147,167, 222,137, 266,169, 231,199, 197,229, 129,178 }, + { 227,272, 310,243, 277,313, 322,266, 367,219, 207,313 }, + { 279,192, 339,233, 396,211, 367,182, 338,152, 228,194 }, + { 236,20, 283,75, 346,26, 338,71, 330,116, 207,17 }, + { 129,83, 164,23, 158,14, 179,11, 200,8, 91,78 }, + { 86,231, 129,293, 164,421, 104,348, 44,275, 66,200 }, + { 193,328, 197,278, 240,348, 276,305, 311,263, 199,354 }, + { 231,364, 241,209, 309,104, 326,236, 342,367, 225,424 }, + { 414,230, 398,328, 446,445, 467,363, 489,281, 373,254 }, + { 289,122, 332,123, 348,161, 322,158, 297,156, 275,125 }, + { 142,235, 199,308, 402,229, 283,218, 164,206, 130,206 }, + { 174,396, 210,387, 328,501, 246,455, 165,409, 138,394 }, + { 288,388, 366,357, 372,458, 393,400, 414,343, 249,431 }, + { 351,278, 409,369, 497,316, 437,288, 376,260, 351,243 }, + { 87,134, 181,77, 311,121, 206,140, 101,160, 61,159 }, + { 95,195, 126,208, 133,258, 110,236, 88,215, 95,195 }, + { 140,293, 158,330, 169,275, 184,299, 198,323, 126,313 }, + { 336,319, 383,357, 388,278, 393,333, 397,388, 311,325 }, + { 338,107, 434,209, -37,469, 151,287, 338,104, 285,50 }, + { 403,134, 446,182, 378,318, 386,233, 393,149, 360,98 }, + { 366,82, 413,93, 416,158, 390,118, 364,78, 336,75 }, + { 448,188, 448,230, 465,269, 470,225, 474,181, 448,177 }, + { 121,398, 142,418, 126,475, 111,436, 96,396, 100,382 }, + { 40,296, 90,352, 170,310, 143,350, 116,391, 7,300 }, + { 25,203, 45,241, 70,204, 45,248, 19,293, 4,204 }, + { 243,222, 225,275, 345,256, 296,237, 247,218, 249,199 }, + { 159,149, 282,133, 284,199, 226,191, 169,184, 147,160 }, + { 149,257, 290,322, 151,374, 166,338, 182,302, 116,263 }, + { 255,285, 354,327, 234,287, 279,327, 323,367, 193,290 }, + { 188,220, 353,190, 290,354, 348,293, 407,231, 152,248 }, + { 305,122, 382,174, 402,229, 366,198, 329,167, 297,127 }, + { 378,260, 406,267, 390,330, 384,293, 377,257, 366,263 }, + { 178,396, 357,365, 273,461, 248,431, 223,401, 157,412 }, + { 180,89, 258,88, 302,94, 255,115, 207,136, 166,96 }, + { 81,197, 139,232, 39,257, 94,259, 150,261, 58,200 }, + { 314,89, 378,40, 383,38, 389,42, 395,45, 267,90 }, + { 371,141, 482,233, 508,244, 498,272, 488,299, 307,157 }, + { 339,348, 361,465, 382,477, 406,442, 430,406, 269,369 } + }; + const unsigned int NUM_PARTICLE( sizeof( PATHS ) / sizeof( PATHS[0] ) ); + + const float PARTICLE_SIZE = 13.f; + + const float ACTOR_SCALE = 0.704f; // resize 500*500 to 352*352, a bit smaller than 360*360 + const Vector3 ACTOR_POSITION( -176.f, -176.f, 1.f); + + const int MAXIMUM_ANIMATION_COUNT = 30; + + // Geometry format used by the SparkeEffect + struct Vertex + { + Vertex( const Vector2& texCoord, + const Vector2& aParticlePath0, + const Vector2& aParticlePath1, + const Vector2& aParticlePath2, + const Vector2& aParticlePath3, + const Vector2& aParticlePath4, + const Vector2& aParticlePath5 ) + : aTexCoord( texCoord ), + aParticlePath0( aParticlePath0 ), + aParticlePath1( aParticlePath1 ), + aParticlePath2( aParticlePath2 ), + aParticlePath3( aParticlePath3 ), + aParticlePath4( aParticlePath4 ), + aParticlePath5( aParticlePath5 ) + { + } + + Vector2 aTexCoord; + Vector2 aParticlePath0; + Vector2 aParticlePath1; + Vector2 aParticlePath2; + Vector2 aParticlePath3; + Vector2 aParticlePath4; + Vector2 aParticlePath5; + }; + + /** + * Create a SparkleEffect object. + * @return A handle to a newly allocated SparkleEffect + */ + Shader New() + { + std::string vertexShader = DALI_COMPOSE_SHADER( + precision highp float;\n + \n + attribute vec2 aTexCoord;\n + uniform mat4 uMvpMatrix;\n + varying vec2 vTexCoord;\n + \n + attribute vec2 aParticlePath0;\n + attribute vec2 aParticlePath1;\n + attribute vec2 aParticlePath2;\n + attribute vec2 aParticlePath3;\n + attribute vec2 aParticlePath4;\n + attribute vec2 aParticlePath5;\n + \n + uniform float uPercentage;\n + uniform float uPercentageMarked;\n + uniform vec3 uParticleColors[NUM_COLOR];\n + uniform float uOpacity[NUM_PARTICLE];\n + uniform vec2 uTapIndices; + uniform float uTapOffset[MAXIMUM_ANIMATION_COUNT];\n + uniform vec2 uTapPoint[MAXIMUM_ANIMATION_COUNT];\n + uniform float uAcceleration;\n + uniform float uRadius;\n + uniform float uScale;\n + uniform float uBreak;\n + \n + varying lowp vec4 vColor;\n + \n + void main()\n + {\n + // we store the particle index inside texCoord attribute + float idx = abs(aTexCoord.y)-1.0;\n + \n + // early out if the particle is invisible + if(uOpacity[int(idx)]<1e-5)\n + {\n + gl_Position = vec4(0.0);\n + vColor = vec4(0.0);\n + return;\n + }\n + \n + // As the movement along the b-curve has nonuniform speed with a uniform increasing parameter 'uPercentage' + // we give different particles the different 'percentage' to make them looks more random + float increment = idx / float(NUM_PARTICLE)*5.0; + float percentage = mod(uPercentage +uAcceleration+increment, 1.0); + \n + vec2 p0; vec2 p1; vec2 p2; vec2 p3; + // calculate the particle position by using the cubic b-curve equation + if(percentage<0.5)\n // particle on the first b-curve + {\n + p0 = aParticlePath0;\n + p1 = aParticlePath1;\n + p2 = aParticlePath2;\n + p3 = aParticlePath3;\n + }\n + else\n + {\n + p0 = aParticlePath3;\n + p1 = aParticlePath4;\n + p2 = aParticlePath5;\n + p3 = aParticlePath0;\n + }\n + float t = mod( percentage*2.0, 1.0);\n + vec2 position = (1.0-t)*(1.0-t)*(1.0-t)*p0 + 3.0*(1.0-t)*(1.0-t)*t*p1+3.0*(1.0-t)*t*t*p2 + t*t*t*p3;\n + \n + vec2 referencePoint = mix(p0,p3,0.5);\n + float maxAnimationCount = float(MAXIMUM_ANIMATION_COUNT);\n + \n + for( float i=uTapIndices.x; i +#include +#include + +using namespace Dali; // Needed for macros + +namespace Demo +{ +namespace Internal +{ + +namespace +{ + +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( + varying mediump vec2 vTexCoord;\n + uniform sampler2D sTexture;\n + uniform mediump vec4 uColor;\n + uniform mediump vec3 uChannels;\n + \n + void main()\n + {\n + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ;\n + }\n +); + +Dali::BaseHandle Create() +{ + return Demo::ImageChannelControl::New(); +} + +DALI_TYPE_REGISTRATION_BEGIN( ImageChannelControl, Dali::Toolkit::Control, Create ); + +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "url", STRING, RESOURCE_URL ); +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "redChannel", FLOAT, RED_CHANNEL ); +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "greenChannel", FLOAT, GREEN_CHANNEL ); +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "blueChannel", FLOAT, BLUE_CHANNEL ); + +DALI_TYPE_REGISTRATION_END(); + +} // anonymous namespace + + +Internal::ImageChannelControl::ImageChannelControl() +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), + mChannels( 1.0f, 1.0f, 1.0f ) +{ +} + +Internal::ImageChannelControl::~ImageChannelControl() +{ +} + +Demo::ImageChannelControl Internal::ImageChannelControl::New() +{ + IntrusivePtr impl = new Internal::ImageChannelControl(); + Demo::ImageChannelControl handle = Demo::ImageChannelControl( *impl ); + impl->Initialize(); + return handle; +} + +void ImageChannelControl::SetImage( const std::string& url ) +{ + mUrl = url; + + Actor self = Self(); + + Property::Map properties; + Property::Map shader; + shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = FRAGMENT_SHADER; + properties[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE; + properties[Dali::Toolkit::Visual::Property::SHADER]=shader; + properties[Dali::Toolkit::ImageVisual::Property::URL] = url; + + Dali::Toolkit::InitializeVisual( self, mVisual, properties ); + + RelayoutRequest(); +} + +void ImageChannelControl::OnInitialize() +{ + Actor self = Self(); + mChannelIndex = self.RegisterProperty( "uChannels", Vector3(1.0f, 1.0f, 1.0f) ); +} + +void ImageChannelControl::OnStageConnection( int depth ) +{ + Control::OnStageConnection( depth ); + + if( mVisual ) + { + CustomActor self = Self(); + mVisual.SetOnStage( self ); + } +} + +void ImageChannelControl::OnStageDisconnection() +{ + if( mVisual ) + { + CustomActor self = Self(); + mVisual.SetOffStage( self ); + } + + Control::OnStageDisconnection(); +} + +void ImageChannelControl::OnSizeSet( const Vector3& targetSize ) +{ + Control::OnSizeSet( targetSize ); + + if( mVisual ) + { + Vector2 size( targetSize ); + mVisual.SetSize( size ); + } +} + +Vector3 ImageChannelControl::GetNaturalSize() +{ + if( mVisual ) + { + Vector2 naturalSize; + mVisual.GetNaturalSize(naturalSize); + return Vector3(naturalSize); + } + return Vector3::ZERO; +} + + +/////////////////////////////////////////////////////////// +// +// Properties +// + +void ImageChannelControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) +{ + Demo::ImageChannelControl imageChannelControl = Demo::ImageChannelControl::DownCast( Dali::BaseHandle( object ) ); + + if ( imageChannelControl ) + { + ImageChannelControl& impl = GetImpl( imageChannelControl ); + Actor self = impl.Self(); + switch ( index ) + { + case Demo::ImageChannelControl::Property::RED_CHANNEL: + { + impl.mChannels[0] = value.Get(); + self.SetProperty( impl.mChannelIndex, impl.mChannels ); + break; + } + case Demo::ImageChannelControl::Property::GREEN_CHANNEL: + { + impl.mChannels[1] = value.Get(); + self.SetProperty( impl.mChannelIndex, impl.mChannels ); + break; + } + case Demo::ImageChannelControl::Property::BLUE_CHANNEL: + { + impl.mChannels[2] = value.Get(); + self.SetProperty( impl.mChannelIndex, impl.mChannels ); + break; + } + } + } +} + +Property::Value ImageChannelControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) +{ + Property::Value value; + + Demo::ImageChannelControl imageChannelControl = Demo::ImageChannelControl::DownCast( Dali::BaseHandle( object ) ); + + if ( imageChannelControl ) + { + ImageChannelControl& impl = GetImpl( imageChannelControl ); + switch ( propertyIndex ) + { + case Demo::ImageChannelControl::Property::RED_CHANNEL: + { + value = impl.mChannels[0]; + break; + } + case Demo::ImageChannelControl::Property::GREEN_CHANNEL: + { + value = impl.mChannels[1]; + break; + } + case Demo::ImageChannelControl::Property::BLUE_CHANNEL: + { + value = impl.mChannels[2]; + break; + } + } + } + + return value; +} + +} // Internal +} // Demo diff --git a/examples/styling/image-channel-control-impl.h b/examples/styling/image-channel-control-impl.h new file mode 100644 index 0000000..a733dfd --- /dev/null +++ b/examples/styling/image-channel-control-impl.h @@ -0,0 +1,120 @@ +#ifndef DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H +#define DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_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. + */ + +#include "image-channel-control.h" +#include +#include + +namespace Demo +{ + +namespace Internal // To use TypeRegistry, handle and body classes need the same name +{ + +class ImageChannelControl : public Dali::Toolkit::Internal::Control +{ +public: + /** + * Instantiate a new ImageChannelControl object + */ + static Demo::ImageChannelControl New(); + ImageChannelControl(); + ~ImageChannelControl(); + +public: // API + /** + * @copydoc ImageChannelControl::SetImage + */ + void SetImage( const std::string& url ); + +public: // Properties + /** + * Called when a property of an object of this type is set. + * @param[in] object The object whose property is set. + * @param[in] index The property index. + * @param[in] value The new property value. + */ + static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); + + /** + * Called to retrieve a property of an object of this type. + * @param[in] object The object whose property is to be retrieved. + * @param[in] index The property index. + * @return The current value of the property. + */ + static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); + +private: // From Control + /** + * @copydoc Toolkit::Control::OnInitialize() + */ + virtual void OnInitialize(); + + /** + * @copydoc Toolkit::Control::OnStageConnect() + */ + virtual void OnStageConnection( int depth ); + + /** + * @copydoc Toolkit::Control::OnStageDisconnection() + */ + virtual void OnStageDisconnection(); + + /** + * @copydoc Toolkit::Control::OnSizeSet() + */ + virtual void OnSizeSet( const Dali::Vector3& targetSize ); + + /** + * @copydoc Toolkit::Control::GetNaturalSize + */ + virtual Dali::Vector3 GetNaturalSize(); + +private: + //undefined + ImageChannelControl( const ImageChannelControl& ); + ImageChannelControl& operator=( const ImageChannelControl& ); + +private: + // Implementation details + std::string mUrl; + Dali::Toolkit::Visual::Base mVisual; + Dali::Vector3 mChannels; + Dali::Property::Index mChannelIndex; +}; + +} // Internal + +inline Internal::ImageChannelControl& GetImpl( Demo::ImageChannelControl& handle ) +{ + DALI_ASSERT_ALWAYS( handle ); + Dali::RefObject& object = handle.GetImplementation(); + return static_cast(object); +} + +inline const Internal::ImageChannelControl& GetImpl( const Demo::ImageChannelControl& handle ) +{ + DALI_ASSERT_ALWAYS( handle ); + const Dali::RefObject& object = handle.GetImplementation(); + return static_cast(object); +} + +} // Demo + +#endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_IMPL_H diff --git a/examples/styling/image-channel-control.cpp b/examples/styling/image-channel-control.cpp new file mode 100644 index 0000000..afe870d --- /dev/null +++ b/examples/styling/image-channel-control.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "image-channel-control.h" +#include "image-channel-control-impl.h" + +namespace Demo +{ + +ImageChannelControl::ImageChannelControl() +{ +} + +ImageChannelControl::ImageChannelControl( const ImageChannelControl& imageChannelControl ) +: Control( imageChannelControl ) +{ +} + +ImageChannelControl& ImageChannelControl::operator= ( const ImageChannelControl& rhs ) +{ + if( &rhs != this ) + { + Control::operator=( rhs ); + } + return *this; +} + +ImageChannelControl::~ImageChannelControl() +{ +} + +ImageChannelControl ImageChannelControl::New() +{ + ImageChannelControl imageChannelControl = Internal::ImageChannelControl::New(); + return imageChannelControl; +} + +ImageChannelControl ImageChannelControl::New( const std::string& url ) +{ + ImageChannelControl imageChannelControl = Internal::ImageChannelControl::New(); + imageChannelControl.SetImage( url ); + return imageChannelControl; +} + +ImageChannelControl ImageChannelControl::DownCast( BaseHandle handle ) +{ + return Control::DownCast< ImageChannelControl, Internal::ImageChannelControl > ( handle ); +} + +void ImageChannelControl::SetImage( const std::string& url ) +{ + GetImpl( *this ).SetImage( url ); +} + +ImageChannelControl::ImageChannelControl( Internal::ImageChannelControl& implementation ) +: Control( implementation ) +{ +} + +ImageChannelControl::ImageChannelControl( Dali::Internal::CustomActor* internal ) +: Control( internal ) +{ + VerifyCustomActorPointer< Internal::ImageChannelControl >( internal ) ; +} + + +} //namespace Demo diff --git a/examples/styling/image-channel-control.h b/examples/styling/image-channel-control.h new file mode 100644 index 0000000..12eb5de --- /dev/null +++ b/examples/styling/image-channel-control.h @@ -0,0 +1,123 @@ +#ifndef DALI_DEMO_IMAGE_CHANNEL_CONTROL_H +#define DALI_DEMO_IMAGE_CHANNEL_CONTROL_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. + */ + +#include +#include + +namespace Demo +{ + +namespace Internal +{ +// All type registered types need to have the same name for the body and the handle +class ImageChannelControl; +} + +/** + * Control that allows the RGB channels of an image to be altered. + */ +class ImageChannelControl : public Dali::Toolkit::Control +{ +public: + /** + * The start and end property ranges for this control + */ + enum PropertyRange + { + PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1, + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, + + ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000 + }; + + struct Property + { + enum + { + + RESOURCE_URL = PROPERTY_START_INDEX, + RED_CHANNEL, + GREEN_CHANNEL, + BLUE_CHANNEL + }; + }; + +public: // Construction / destruction + + /** + * Create an uninitialized handle + */ + ImageChannelControl(); + + /** + * Create a new image channel control without an image. Use + * SetImage to give this control an image + */ + static ImageChannelControl New(); + + /** + * Create a new image channel control from a given URL + */ + static ImageChannelControl New( const std::string& url ); + + /** + * Destructor. This is non-virtual since derived Handle types must not + * contain data or virtual methods + */ + ~ImageChannelControl(); + + /** + * Copy Constructor + */ + ImageChannelControl( const ImageChannelControl& imageChannelControl ); + + /** + * Assignment Operator + */ + ImageChannelControl& operator=( const ImageChannelControl& imageChannelControl ); + + /** + * Downcast + */ + static ImageChannelControl DownCast( BaseHandle handle ); + +public: // API + + /** + * Set the image for this ImageChannelControl + * @param[in] url The url of the image resource + */ + void SetImage( const std::string& url ); + +public: // Not for public use + /** + * Create a handle from an implementation + */ + ImageChannelControl( Internal::ImageChannelControl& implementation ); + + /** + * Allow the creation of an ImageChannelControl handle from an internal CustomActor pointer + */ + ImageChannelControl( Dali::Internal::CustomActor* internal ); +}; + +} // namespace Demo + +#endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_H diff --git a/examples/styling/style-example.cpp b/examples/styling/style-example.cpp new file mode 100644 index 0000000..cbdecf6 --- /dev/null +++ b/examples/styling/style-example.cpp @@ -0,0 +1,53 @@ +/* + * 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. + */ + +/** + * @file style-example.cpp + * @brief Example of styling Toolkit controls. + */ + +// External includes +#include + +// Internal includes +#include "styling-application.h" + + +/// Entry point for applications +int DALI_EXPORT_API main( int argc, char** argv ) +{ + const char* themeName = Demo::StylingApplication::DEMO_THEME_ONE_PATH; + + if( argc > 1 ) + { + int theme = atoi(argv[1]); + if( theme == 2 ) + { + themeName = Demo::StylingApplication::DEMO_THEME_TWO_PATH; + } + else if( theme == 3 ) + { + themeName = Demo::StylingApplication::DEMO_THEME_THREE_PATH; + } + } + + Application application = Application::New( &argc, &argv, themeName ); + { + Demo::StylingApplication stylingApplication( application ); + application.MainLoop(); + } + return 0; +} diff --git a/examples/styling/styling-application.cpp b/examples/styling/styling-application.cpp new file mode 100644 index 0000000..c885987 --- /dev/null +++ b/examples/styling/styling-application.cpp @@ -0,0 +1,641 @@ +/* + * 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. + */ + +/** + * @file style-example.cpp + * @brief Example of styling Toolkit controls. + */ + +// Class include +#include "styling-application.h" + +// External includes +#include +//#include +#include +#include "image-channel-control.h" +#include +#include + +// Internal includes + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace Demo +{ + +const char* StylingApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" ); +const char* StylingApplication::DEMO_THEME_TWO_PATH( DEMO_STYLE_DIR "style-example-theme-two.json" ); +const char* StylingApplication::DEMO_THEME_THREE_PATH( DEMO_STYLE_DIR "style-example-theme-three.json" ); + +namespace +{ +#define DP(x) x + +const char* DEFAULT_CONTROL_AREA_IMAGE_PATH( DEMO_IMAGE_DIR "popup_button_background.9.png" ); + +const char* POPUP_CONTROL_OK_NAME( "PopupControlOk" ); +const char* POPUP_CONTROL_CANCEL_NAME( "PopupControlCancel" ); +const char* BORDER_IMAGE( DEMO_IMAGE_DIR "border-4px.9.png" ); +const char* RESIZE_HANDLE_IMAGE( DEMO_IMAGE_DIR "resize-handle.png" ); + +const int NUMBER_OF_THEMES(3); // The default theme is considered. + +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); +const int BORDER_WIDTH( 4 ); + +const char* const SMALL_IMAGE_1 = DEMO_IMAGE_DIR "gallery-small-14.jpg"; +const char* const BIG_IMAGE_1 = DEMO_IMAGE_DIR "gallery-large-4.jpg"; + +const char* const SMALL_IMAGE_2 = DEMO_IMAGE_DIR "gallery-small-39.jpg"; +const char* const BIG_IMAGE_2 = DEMO_IMAGE_DIR "gallery-large-7.jpg"; + +const char* const SMALL_IMAGE_3 = DEMO_IMAGE_DIR "gallery-small-20.jpg"; +const char* const BIG_IMAGE_3 = DEMO_IMAGE_DIR "gallery-large-11.jpg"; + +// Layout +const int MARGIN_SIZE = 10; + +const int RADIO_LABEL_THUMBNAIL_SIZE = 60; +const int RADIO_LABEL_THUMBNAIL_SIZE_SMALL = 40; +const int RADIO_IMAGE_SPACING = 8; +const int BUTTON_HEIGHT = 48; + +Property::Index GetChannelProperty( int index ) +{ + Property::Index channelIndex = Property::INVALID_INDEX; + switch(index) + { + case 0: { channelIndex = ImageChannelControl::Property::RED_CHANNEL; break; } + case 1: { channelIndex = ImageChannelControl::Property::GREEN_CHANNEL; break; } + case 2: { channelIndex = ImageChannelControl::Property::BLUE_CHANNEL; break; } + } + return channelIndex; +} + +} // anonymous namespace + + + +StylingApplication::StylingApplication( Application& application ) +: mApplication( application ) +{ + application.InitSignal().Connect( this, &StylingApplication::Create ); +} + +StylingApplication::~StylingApplication() +{ +} + +void StylingApplication::Create( Application& application ) +{ + Stage stage = Stage::GetCurrent(); + stage.KeyEventSignal().Connect(this, &StylingApplication::OnKeyEvent); + stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) ); + + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + + mContentPane = CreateContentPane(); + stage.Add( mContentPane ); + mContentPane.SetSize( stage.GetSize() ); + + // Content panes: + TableView contentLayout = TableView::New( 5, 1 ); + contentLayout.SetName("ContentLayout"); + contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); + contentLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + + // Assign all rows the size negotiation property of fitting to children + for( unsigned int i = 0; i < contentLayout.GetRows(); ++i ) + { + if( i != 1 ) + { + contentLayout.SetFitHeight(i); // Row 1 should fill + } + } + + mContentPane.Add( contentLayout ); + + mTitle = TextLabel::New( "Styling Example" ); + mTitle.SetName( "Title" ); + mTitle.SetStyleName("Title"); + mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER ); + mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + contentLayout.Add( mTitle ); + + // Buttons: + + TableView imageSelectLayout = TableView::New( 1, 2 ); + imageSelectLayout.SetName("ImageSelectLayout"); + + imageSelectLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + imageSelectLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + imageSelectLayout.SetAnchorPoint( AnchorPoint::CENTER ); + imageSelectLayout.SetParentOrigin( ParentOrigin::CENTER ); + imageSelectLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + + // Fit radio button column to child width, leave image to fill remainder + imageSelectLayout.SetFitWidth( 0 ); + + contentLayout.Add( imageSelectLayout ); + + TableView radioButtonsLayout = TableView::New( 3, 2 ); + radioButtonsLayout.SetName("RadioButtonsLayout"); + radioButtonsLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + // Leave each row to fill to parent height + // Set each column to fit to child width + radioButtonsLayout.SetFitWidth(0); + radioButtonsLayout.SetFitWidth(1); + radioButtonsLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); + + imageSelectLayout.AddChild( radioButtonsLayout, TableView::CellPosition(0, 0) ); + imageSelectLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + + const char* images[] = { SMALL_IMAGE_1, SMALL_IMAGE_2, SMALL_IMAGE_3 }; + + for( int i=0; i<3; ++i ) + { + std::ostringstream thumbnailName; thumbnailName << "thumbnail" << i+1; + ImageView image = ImageView::New( ResourceImage::New( images[i] ) ); + image.SetName( thumbnailName.str() ); + image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + + std::ostringstream label; label << (i+1); + std::ostringstream radioButtonStyleName; + radioButtonStyleName << "imageSelectButton" << i+1; + mRadioButtons[i] = RadioButton::New( label.str() ); + mRadioButtons[i].SetName( radioButtonStyleName.str() ); + mRadioButtons[i].SetParentOrigin( ParentOrigin::TOP_LEFT ); + mRadioButtons[i].SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mRadioButtons[i].SetSelected( false ); + mRadioButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnButtonStateChange ); + + radioButtonsLayout.AddChild( mRadioButtons[i], TableView::CellPosition( i, 0 ) ); + radioButtonsLayout.AddChild( image, TableView::CellPosition( i, 1 ) ); + radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + } + + mRadioButtons[0].SetSelected( true ); + + mImageChannelControl = ImageChannelControl::New( BIG_IMAGE_1 ); + mImageChannelControl.SetName("ImageChannelControl"); + mImageChannelControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT , Dimension::ALL_DIMENSIONS ); + mImageChannelControl.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); + imageSelectLayout.AddChild( mImageChannelControl, TableView::CellPosition( 0, 1 ) ); + + imageSelectLayout.SetCellAlignment( TableView::CellPosition( 0, 1 ), HorizontalAlignment::RIGHT, VerticalAlignment::CENTER ); + + + TableView channelSliderLayout = TableView::New( 3, 3 ); + channelSliderLayout.SetName("ChannelSliderLayout"); + + // Contains a column of check buttons and a column of sliders for R/G/B + channelSliderLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + channelSliderLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + channelSliderLayout.SetAnchorPoint( AnchorPoint::CENTER ); + channelSliderLayout.SetParentOrigin( ParentOrigin::CENTER ); + channelSliderLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + + // Set each row to fit to child height + channelSliderLayout.SetFitHeight( 0 ); + channelSliderLayout.SetFitHeight( 1 ); + channelSliderLayout.SetFitHeight( 2 ); + + // Set each column to fit to child width + channelSliderLayout.SetFitWidth( 0 ); + channelSliderLayout.SetFitWidth( 1 ); + + contentLayout.Add( channelSliderLayout ); + const char *checkboxLabels[3] = {"R", "G", "B"}; + + for( int i=0; i<3; ++i ) + { + std::ostringstream checkBoxStyleName; + checkBoxStyleName << "channelActiveCheckBox" << i+1; + mCheckButtons[i] = CheckBoxButton::New(); + mCheckButtons[i].SetName( checkBoxStyleName.str() ); + mCheckButtons[i].SetParentOrigin( ParentOrigin::CENTER ); + mCheckButtons[i].SetAnchorPoint( AnchorPoint::CENTER ); + mCheckButtons[i].SetSelected( true ); + + mCheckButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnCheckButtonChange ); + mCheckButtons[i].RegisterProperty( "channel", i, Property::READ_WRITE ); + + channelSliderLayout.AddChild( mCheckButtons[i], TableView::CellPosition( i, 0 ) ); + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + + TextLabel label = TextLabel::New( checkboxLabels[i] ); + std::ostringstream labelStyleName; labelStyleName << "ColorLabel" << i+1; + label.SetName( labelStyleName.str() ); + label.SetStyleName( labelStyleName.str() ); + label.SetParentOrigin( ParentOrigin::CENTER ); + label.SetAnchorPoint ( AnchorPoint::CENTER ); + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + + channelSliderLayout.AddChild( label, TableView::CellPosition( i, 1 ) ); + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + + mChannelSliders[i] = Slider::New(); + std::ostringstream sliderStyleName; sliderStyleName << "ColorSlider" << i+1; + mChannelSliders[i].SetName( sliderStyleName.str() ); + mChannelSliders[i].SetStyleName( sliderStyleName.str() ); + mChannelSliders[i].SetParentOrigin( ParentOrigin::CENTER ); + mChannelSliders[i].SetAnchorPoint ( AnchorPoint::CENTER ); + mChannelSliders[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mChannelSliders[i].SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN , Dimension::HEIGHT ); + mChannelSliders[i].SetProperty( Slider::Property::LOWER_BOUND, 0.0f ); + mChannelSliders[i].SetProperty( Slider::Property::UPPER_BOUND, 100.0f ); + mChannelSliders[i].SetProperty( Slider::Property::VALUE_PRECISION, 0 ); + mChannelSliders[i].SetProperty( Slider::Property::VALUE, 100.0f ); + mChannelSliders[i].SetProperty( Slider::Property::SHOW_POPUP, true ); + mChannelSliders[i].SetProperty( Slider::Property::SHOW_VALUE, true ); + + mChannelSliders[i].RegisterProperty( "channel", i, Property::READ_WRITE ); + + channelSliderLayout.AddChild( mChannelSliders[i], TableView::CellPosition( i, 2 ) ); + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 2 ), HorizontalAlignment::RIGHT, VerticalAlignment::CENTER ); + + mChannelSliders[i].ValueChangedSignal().Connect( this, &StylingApplication::OnSliderChanged ); + } + + mResetButton = PushButton::New(); + mResetButton.SetLabelText( "Reset" ); + mResetButton.SetName("ResetButton"); + mResetButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + mResetButton.ClickedSignal().Connect( this, &StylingApplication::OnResetClicked ); + + contentLayout.Add( mResetButton ); + contentLayout.SetCellAlignment( TableView::CellPosition( 3, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + + TableView themeButtonLayout = TableView::New( 1, 4 ); + themeButtonLayout.SetName("ThemeButtonsLayout"); + themeButtonLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); + + themeButtonLayout.SetAnchorPoint( AnchorPoint::CENTER ); + themeButtonLayout.SetParentOrigin( ParentOrigin::CENTER ); + themeButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + themeButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); + themeButtonLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + themeButtonLayout.SetFitHeight( 0 ); + + TextLabel label = TextLabel::New( "Theme: "); + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + label.SetStyleName("ThemeLabel"); + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); + themeButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); + themeButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + + for( int i=0; i<3; ++i ) + { + mThemeButtons[i] = PushButton::New(); + mThemeButtons[i].SetName("ThemeButton"); + mThemeButtons[i].SetStyleName("ThemeButton"); + mThemeButtons[i].SetParentOrigin( ParentOrigin::CENTER ); + mThemeButtons[i].SetAnchorPoint( ParentOrigin::CENTER ); + mThemeButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mThemeButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mThemeButtons[i].RegisterProperty( "theme", i, Property::READ_WRITE ); + mThemeButtons[i].ClickedSignal().Connect( this, &StylingApplication::OnThemeButtonClicked ); + themeButtonLayout.AddChild( mThemeButtons[i], TableView::CellPosition( 0, 1+i ) ); + } + mThemeButtons[0].SetLabelText( "Lite" ); // Lightweight changes on top of Dali + mThemeButtons[1].SetLabelText( "App1" ); // Different application style + mThemeButtons[2].SetLabelText( "App2" ); + + contentLayout.Add( themeButtonLayout ); +} + +Actor StylingApplication::CreateContentPane() +{ + Toolkit::ImageView contentPane = Toolkit::ImageView::New( BORDER_IMAGE ); + contentPane.SetName("ContentPane"); + contentPane.SetParentOrigin( ParentOrigin::CENTER ); + contentPane.SetAnchorPoint( AnchorPoint::CENTER ); + contentPane.SetPadding( Padding( BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH ) ); + return contentPane; +} + +Actor StylingApplication::CreateResizableContentPane() +{ + Toolkit::ImageView contentPane = Toolkit::ImageView::New( BORDER_IMAGE ); + contentPane.SetName("ContentPane"); + contentPane.SetParentOrigin( ParentOrigin::CENTER ); + contentPane.SetAnchorPoint( AnchorPoint::CENTER ); + contentPane.SetPadding( Padding( BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH ) ); + + Toolkit::ImageView grabHandle = Toolkit::ImageView::New( RESIZE_HANDLE_IMAGE ); + grabHandle.SetName("GrabHandle"); + grabHandle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + grabHandle.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); + grabHandle.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); + grabHandle.SetPosition( -BORDER_WIDTH, -BORDER_WIDTH ); + grabHandle.SetOpacity( 0.6f ); + + Layer grabCornerLayer = Layer::New(); + grabCornerLayer.SetName("GrabCornerLayer"); + grabCornerLayer.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); + grabCornerLayer.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); + grabCornerLayer.Add( grabHandle ); + contentPane.Add( grabCornerLayer ); + + mPanGestureDetector = PanGestureDetector::New(); + mPanGestureDetector.Attach( grabHandle ); + mPanGestureDetector.DetectedSignal().Connect( this, &StylingApplication::OnPan ); + + return contentPane; +} + +Popup StylingApplication::CreateResetPopup() +{ + Stage stage = Stage::GetCurrent(); + + Popup popup= Popup::New(); + popup.SetName("ResetPopup"); + popup.SetStyleName("ResetPopup"); + popup.SetParentOrigin( ParentOrigin::CENTER ); + popup.SetAnchorPoint( AnchorPoint::CENTER ); + popup.SetSize( stage.GetSize().width * 0.75f, 0.0f ); + popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false ); + popup.OutsideTouchedSignal().Connect( this, &StylingApplication::HidePopup ); + popup.HiddenSignal().Connect( this, &StylingApplication::PopupHidden ); + + popup.SetTitle( CreateTitle( "Reset channels" ) ); + + TextLabel text = TextLabel::New( "This will reset the channel data to full value. Are you sure?" ); + text.SetName( "PopupContentText" ); + text.SetStyleName( "PopupBody" ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); + text.SetProperty( TextLabel::Property::MULTI_LINE, true ); + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) ); + popup.SetContent( text ); + + ImageView footer = ImageView::New( DEFAULT_CONTROL_AREA_IMAGE_PATH ); + footer.SetName( "PopupFooter" ); + footer.SetStyleName( "PopupFooter" ); + footer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + footer.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); + footer.SetSize( 0.0f, 80.0f ); + footer.SetAnchorPoint( AnchorPoint::CENTER ); + footer.SetParentOrigin( ParentOrigin::CENTER ); + + TableView footerLayout = TableView::New( 1, 2 ); + footerLayout.SetParentOrigin( ParentOrigin::CENTER ); + footerLayout.SetAnchorPoint ( AnchorPoint::CENTER ); + footerLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + + PushButton okayButton = PushButton::New(); + okayButton.SetName( POPUP_CONTROL_OK_NAME ); + okayButton.SetStyleName( POPUP_CONTROL_OK_NAME ); + okayButton.SetLabelText( "Ok!" ); + okayButton.ClickedSignal().Connect( this, &StylingApplication::OnReset ); + okayButton.SetParentOrigin( ParentOrigin::CENTER ); + okayButton.SetAnchorPoint( AnchorPoint::CENTER ); + okayButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); + okayButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0f ) ); + + PushButton cancelButton = PushButton::New(); + cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); + cancelButton.SetStyleName( POPUP_CONTROL_CANCEL_NAME ); + cancelButton.SetLabelText( "Cancel" ); + cancelButton.ClickedSignal().Connect( this, &StylingApplication::OnResetCancelled ); + cancelButton.SetParentOrigin( ParentOrigin::CENTER ); + cancelButton.SetAnchorPoint( AnchorPoint::CENTER ); + cancelButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); + cancelButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0f ) ); + + footerLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + footerLayout.SetCellAlignment( TableView::CellPosition( 0, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); + footerLayout.AddChild( okayButton, TableView::CellPosition( 0, 0 ) ); + footerLayout.AddChild( cancelButton, TableView::CellPosition( 0, 1 ) ); + footerLayout.SetCellPadding( Size( 10.f, 10.f ) ); + footer.Add( footerLayout ); + + popup.SetFooter( footer ); + return popup; +} + +TextLabel StylingApplication::CreateTitle( std::string title ) +{ + TextLabel titleActor = TextLabel::New( title ); + titleActor.SetName( "titleActor" ); + titleActor.SetStyleName( "PopupTitle" ); + titleActor.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + titleActor.SetProperty( TextLabel::Property::MULTI_LINE, false ); + + return titleActor; +} + +bool StylingApplication::OnButtonStateChange( Button button ) +{ + // Todo: save / restore slider states per image + + if( mImageChannelControl ) + { + if( mRadioButtons[0].IsSelected() ) + { + mImageChannelControl.SetImage( BIG_IMAGE_1 ); + } + else if( mRadioButtons[1].IsSelected() ) + { + mImageChannelControl.SetImage( BIG_IMAGE_2 ); + } + else if( mRadioButtons[2].IsSelected() ) + { + mImageChannelControl.SetImage( BIG_IMAGE_3 ); + } + } + return true; +} + +bool StylingApplication::OnCheckButtonChange( Button button ) +{ + Property::Index index = button.GetPropertyIndex("channel"); + if( index != Property::INVALID_INDEX ) + { + int channel = button.GetProperty( index ); + float value = mChannelSliders[channel].GetProperty( Slider::Property::VALUE ); + if( !button.IsSelected() ) + { + // "Turn off" the channel's contribution + value = 0.0f; + } + Property::Index channelIndex = GetChannelProperty( channel ); + mImageChannelControl.SetProperty(channelIndex, value/100.0f); + } + return true; +} + +bool StylingApplication::OnThemeButtonClicked( Button button ) +{ + int theme = button.GetProperty(button.GetPropertyIndex("theme")); + const char* themePath=NULL; + + switch( theme ) + { + case 0: + { + themePath = DEMO_THEME_ONE_PATH; + break; + } + case 1: + { + themePath = DEMO_THEME_TWO_PATH; + break; + } + case 2: + { + themePath = DEMO_THEME_THREE_PATH; + break; + } + } + StyleManager::Get().ApplyTheme( themePath ); + + return true; +} + +bool StylingApplication::OnResetClicked( Button button ) +{ + if( ! mResetPopup ) + { + mResetPopup = CreateResetPopup (); + } + + Stage::GetCurrent().Add( mResetPopup ); + + mResetPopup.SetDisplayState( Popup::SHOWN ); + return true; +} + +bool StylingApplication::OnReset( Button button ) +{ + // todo: Reset the sliders for this image + for( int i=0; i<3; ++i ) + { + mChannelSliders[i].SetProperty( Slider::Property::VALUE, 100.0f ); + } + HidePopup(); + return true; +} + +bool StylingApplication::OnResetCancelled( Button button ) +{ + HidePopup(); + return true; +} + +bool StylingApplication::OnSliderChanged( Slider slider, float value ) +{ + // todo - change color channel's saturation + Property::Index index = slider.GetPropertyIndex("channel"); + if( index != Property::INVALID_INDEX ) + { + int channel = slider.GetProperty( index ); + if( mCheckButtons[channel].IsSelected() ) + { + Property::Index channelIndex = GetChannelProperty( channel ); + mImageChannelControl.SetProperty(channelIndex, value/100.0f); + } + } + return true; +} + +void StylingApplication::HidePopup() +{ + if( mResetPopup ) + { + mResetPopup.SetDisplayState( Popup::HIDDEN ); + } +} + +void StylingApplication::PopupHidden() +{ + if( mResetPopup ) + { + // Clear down resources + mResetPopup.Unparent(); + mResetPopup.Reset(); + } +} + +void StylingApplication::OnPan( Actor actor, const PanGesture& gesture ) +{ + Vector3 size = mContentPane.GetTargetSize(); + mContentPane.SetSize( size.GetVectorXY() + gesture.displacement * 2.0f ); +} + +void StylingApplication::OnKeyEvent( const KeyEvent& keyEvent ) +{ + static int keyPressed = 0; + + if( keyEvent.state == KeyEvent::Down) + { + if( keyPressed == 0 ) // Is this the first down event? + { + printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode ); + + if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + else if( keyEvent.keyPressedName.compare("Return") == 0 ) + { + mCurrentTheme++; + mCurrentTheme %= NUMBER_OF_THEMES; + + StyleManager styleManager = StyleManager::Get(); + switch( mCurrentTheme ) + { + case 0: + { + styleManager.ApplyTheme( DEMO_THEME_ONE_PATH ); + printf("Changing to theme One\n"); + break; + } + case 1: + { + styleManager.ApplyTheme( DEMO_THEME_TWO_PATH ); + printf("Changing to theme Two\n"); + break; + } + case 2: + { + styleManager.ApplyDefaultTheme(); + printf("Changing to Toolkit theme\n"); + break; + } + } + } + } + keyPressed = 1; + } + else if( keyEvent.state == KeyEvent::Up ) + { + keyPressed = 0; + } +} + +} // namespace Demo diff --git a/examples/styling/styling-application.h b/examples/styling/styling-application.h new file mode 100644 index 0000000..8dbb395 --- /dev/null +++ b/examples/styling/styling-application.h @@ -0,0 +1,97 @@ +#ifndef DALI_DEMO_STYLING_APPLICATION_H +#define DALI_DEMO_STYLING_APPLICATION_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 +//#include +#include +#include "image-channel-control.h" +#include +#include + +// Internal includes + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace Demo +{ + +class StylingApplication : public ConnectionTracker +{ +public: + // Constructor + StylingApplication( Application& application ); + + // Destructor + ~StylingApplication(); + + // Init signal handler + void Create( Application& application ); + + // Create the GUI components + Actor CreateContentPane(); + Actor CreateResizableContentPane(); + Toolkit::Popup CreateResetPopup(); + Toolkit::TextLabel CreateTitle( std::string title ); + + // Key event handler + void OnKeyEvent( const KeyEvent& event ); + + // Button event handlers + bool OnButtonStateChange( Toolkit::Button button ); + bool OnCheckButtonChange( Toolkit::Button button ); + bool OnResetClicked( Toolkit::Button button ); + bool OnThemeButtonClicked( Toolkit::Button button ); + + // Slider event handler + bool OnSliderChanged( Toolkit::Slider slider, float value ); + + // Popup event handlers + void HidePopup(); + void PopupHidden(); + bool OnReset(Button button); + bool OnResetCancelled(Button button); + + // Grab handle handler + void OnPan( Actor actor, const PanGesture& gesture ); + + static const char* DEMO_THEME_ONE_PATH; + static const char* DEMO_THEME_TWO_PATH; + static const char* DEMO_THEME_THREE_PATH; + +private: + Application& mApplication; + int mCurrentTheme; + Actor mContentPane; + TextLabel mTitle; + RadioButton mRadioButtons[3]; // 3 demo images + CheckBoxButton mCheckButtons[3]; // rgb buttons + Slider mChannelSliders[3]; // rgb sliders + PushButton mThemeButtons[3]; + PushButton mResetButton; + ImageChannelControl mImageChannelControl; + Popup mResetPopup; + PanGestureDetector mPanGestureDetector; +}; + +} // Namespace Demo + + +#endif // DALI_DEMO_STYLING_APPLICATION_H diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index eb83eec..d2a05d7 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -62,7 +62,6 @@ const unsigned int NUMBER_OF_COLORS = sizeof( COLORS ) / sizeof( Vector4 ); class TextEditorExample : public ConnectionTracker { public: - TextEditorExample( Application& application ) : mApplication( application ) { @@ -152,6 +151,8 @@ public: "Asšúm sapěret usu ůť.\n" "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n" ); + mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged ); + contents.Add( mEditor ); } @@ -222,18 +223,36 @@ public: { const std::string& name = button.GetName(); + Vector4 color; if( "color" == name.substr( 0u, 5u ) ) { const unsigned int index = strtoul( name.substr( 5u, 1u ).c_str(), NULL, 10u ); - mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, COLORS[index] ); + color = COLORS[index]; + mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color ); } + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + mButtonContainer.SetVisible( false ); mButtonContainer.SetSensitive( false ); return true; } + void OnTextInputStyleChanged( TextEditor editor, TextEditor::InputStyle::Mask mask ) + { + if( TextEditor::InputStyle::NONE != static_cast( mask & TextEditor::InputStyle::COLOR ) ) + { + const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get(); + + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + } + + editor.Reset(); + } + private: Application& mApplication; diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 6d357eb..1b21b48 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -75,6 +75,9 @@ public: stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) ); stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent); + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + mButton = CreateFolderButton(); mButton.ClickedSignal().Connect( this, &TextFieldExample::OnButtonClicked ); stage.Add( mButton ); diff --git a/examples/text-fonts/text-fonts-example.cpp b/examples/text-fonts/text-fonts-example.cpp index 9cc4d8e..be78963 100644 --- a/examples/text-fonts/text-fonts-example.cpp +++ b/examples/text-fonts/text-fonts-example.cpp @@ -185,7 +185,7 @@ public: CreateTextLabel ( mLabel, LABEL_TEXT, Color::WHITE ); CreateTextLabel ( mLabel2, LABEL_TEXT, Color::WHITE ); - mLabel2.SetStyleName("textlabel-Rosemary"); + mLabel2.SetStyleName("TextLabelRosemary"); CreateTextLabel ( mLabel3, LABEL_TEXT, Color::WHITE ); mLabel3.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" ); diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index b2ad9a5..c035ed6 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -34,42 +34,69 @@ using namespace MultiLanguageStrings; namespace { - const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png"; - - const unsigned int KEY_ZERO = 10; - const unsigned int KEY_ONE = 11; - const unsigned int KEY_F = 41; - const unsigned int KEY_H = 43; - const unsigned int KEY_V = 55; - const unsigned int KEY_M = 58; - const unsigned int KEY_L = 46; - const unsigned int KEY_S = 39; - const unsigned int KEY_PLUS = 21; - const unsigned int KEY_MINUS = 20; - - const char* H_ALIGNMENT_STRING_TABLE[] = - { - "BEGIN", - "CENTER", - "END" - }; +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png"; + +const unsigned int KEY_ZERO = 10; +const unsigned int KEY_ONE = 11; +const unsigned int KEY_F = 41; +const unsigned int KEY_H = 43; +const unsigned int KEY_V = 55; +const unsigned int KEY_M = 58; +const unsigned int KEY_L = 46; +const unsigned int KEY_S = 39; +const unsigned int KEY_PLUS = 21; +const unsigned int KEY_MINUS = 20; + +const char* H_ALIGNMENT_STRING_TABLE[] = +{ + "BEGIN", + "CENTER", + "END" +}; + +const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] ); + +const char* V_ALIGNMENT_STRING_TABLE[] = +{ + "TOP", + "CENTER", + "BOTTOM" +}; + +const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); - const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] ); +int ConvertToEven(int value) +{ + return (value % 2 == 0) ? value : (value + 1); +} - const char* V_ALIGNMENT_STRING_TABLE[] = +struct HSVColorConstraint +{ + HSVColorConstraint(float hue, float saturation, float value) + : hue(hue), + saturation(saturation), + value(value) { - "TOP", - "CENTER", - "BOTTOM" - }; + } - const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); + void operator()(Vector4& current, const PropertyInputContainer& inputs ) + { + current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a)); + } - int ConvertToEven(int value) + Vector4 hsv2rgb(Vector4 colorHSV) { - return (value % 2 == 0) ? value : (value + 1); + float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1)); + float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1)); + float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1)); + return Vector4(r, g, b, colorHSV.a); } -} + float hue; + float saturation; + float value; +}; + +} // anonymous namespace /** * @brief The main class of the demo. @@ -134,6 +161,20 @@ public: mLabel.SetBackgroundColor( Color::WHITE ); mContainer.Add( mLabel ); + mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f ); + Renderer bgRenderer = mLabel.GetRendererAt(0); + mOverrideMixColorIndex = bgRenderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR ); + + Constraint constraint = Constraint::New( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f)); + constraint.AddSource( Source( mLabel, mHueAngleIndex ) ); + constraint.SetRemoveAction( Constraint::Discard ); + constraint.Apply(); + + Animation anim = Animation::New(50.0f); + anim.AnimateTo(Property(mLabel, mHueAngleIndex), 6.28318f); + anim.SetLooping(true); + anim.Play(); + Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl; } @@ -284,6 +325,8 @@ private: unsigned int mLanguageId; unsigned int mAlignment; + Property::Index mHueAngleIndex; + Property::Index mOverrideMixColorIndex; }; void RunTest( Application& application ) diff --git a/examples/tilt/tilt-example.cpp b/examples/tilt/tilt-example.cpp index 6d0179b..02e4f68 100644 --- a/examples/tilt/tilt-example.cpp +++ b/examples/tilt/tilt-example.cpp @@ -59,6 +59,9 @@ public: stage.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch ); CreateSensor(); + + // Connect signals to allow Back and Escape to exit. + stage.KeyEventSignal().Connect( this, &TiltController::OnKeyEvent ); } void CreateSensor() @@ -88,6 +91,21 @@ public: mTextLabel.RotateBy(pitchRot); } + /** + * @brief OnKeyEvent signal handler. + * @param[in] event The key event information + */ + void OnKeyEvent( const KeyEvent& event ) + { + if( event.state == KeyEvent::Down ) + { + if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + private: Application& mApplication; TiltSensor mTiltSensor; diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 4f312c2..4961cb3 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.1.45 +Version: 1.2.5 Release: 1 Group: System/Libraries License: Apache-2.0 @@ -53,8 +53,9 @@ of the capability of the toolkit. %define smack_rule_dir %TZ_SYS_SMACK/accesses2.d/ %endif +%define dali_app_res_dir %{dali_app_ro_dir}/res/ %define dali_app_exe_dir %{dali_app_ro_dir}/bin/ -%define locale_dir %{dali_app_ro_dir}/res/locale +%define locale_dir %{dali_app_res_dir}/locale %define local_style_dir ../../resources/style/mobile ############################## @@ -73,10 +74,13 @@ cd %{_builddir}/%{name}-%{version}/build/tizen cmake -DDALI_APP_DIR=%{dali_app_ro_dir} \ -DLOCALE_DIR=%{locale_dir} \ + -DDALI_APP_RES_DIR=%{dali_app_res_dir} \ %if 0%{?enable_debug} -DCMAKE_BUILD_TYPE=Debug \ %endif - -DLOCAL_STYLE_DIR=%{local_style_dir} . + -DLOCAL_STYLE_DIR=%{local_style_dir} \ + -DINTERNATIONALIZATION:BOOL=OFF \ + . make %{?jobs:-j%jobs} @@ -87,12 +91,13 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} cd build/tizen %make_install DALI_APP_DIR=%{dali_app_ro_dir} +%make_install DDALI_APP_RES_DIR=%{dali_app_res_dir} mkdir -p %{buildroot}%{dali_xml_file_dir} cp -f %{_builddir}/%{name}-%{version}/%{name}.xml %{buildroot}%{dali_xml_file_dir} mkdir -p %{buildroot}%{dali_icon_dir} -mv %{buildroot}/%{dali_app_ro_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir} +mv %{buildroot}/%{dali_app_res_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir} %if 0%{?enable_dali_smack_rules} && !%{with wayland} mkdir -p %{buildroot}%{smack_rule_dir} @@ -131,11 +136,12 @@ exit 0 %{dali_app_exe_dir}/dali-demo %{dali_app_exe_dir}/*.example %{dali_app_exe_dir}/dali-builder -%{dali_app_ro_dir}/images/* -%{dali_app_ro_dir}/videos/* -%{dali_app_ro_dir}/models/* -%{dali_app_ro_dir}/scripts/* -%{dali_app_ro_dir}/style/* +%{dali_app_res_dir}/images/* +%{dali_app_res_dir}/videos/* +%{dali_app_res_dir}/models/* +%{dali_app_res_dir}/scripts/* +%{dali_app_res_dir}/style/* +%{dali_app_res_dir}/style/images/* %{dali_xml_file_dir}/%{name}.xml %{dali_icon_dir}/* %{locale_dir}/* diff --git a/resources/images/demo-tile-texture.9.png b/resources/images/demo-tile-texture.9.png new file mode 100644 index 0000000..e7a6a4d Binary files /dev/null and b/resources/images/demo-tile-texture.9.png differ diff --git a/resources/images/item-background-alpha.9.png b/resources/images/item-background-alpha.9.png deleted file mode 100644 index 64579dd..0000000 Binary files a/resources/images/item-background-alpha.9.png and /dev/null differ diff --git a/resources/images/item-background.9.png b/resources/images/item-background.9.png index c5ec393..93664ca 100644 Binary files a/resources/images/item-background.9.png and b/resources/images/item-background.9.png differ diff --git a/resources/images/light-icon-back.png b/resources/images/light-icon-back.png new file mode 100644 index 0000000..96b53f1 Binary files /dev/null and b/resources/images/light-icon-back.png differ diff --git a/resources/images/light-icon.png b/resources/images/light-icon-front.png similarity index 100% rename from resources/images/light-icon.png rename to resources/images/light-icon-front.png diff --git a/resources/images/sparkle_normal_background.png b/resources/images/sparkle_normal_background.png new file mode 100755 index 0000000..a416be0 Binary files /dev/null and b/resources/images/sparkle_normal_background.png differ diff --git a/resources/images/sparkle_particle.png b/resources/images/sparkle_particle.png new file mode 100755 index 0000000..836153e Binary files /dev/null and b/resources/images/sparkle_particle.png differ diff --git a/resources/po/as.po b/resources/po/as.po new file mode 100755 index 0000000..3ac32ab --- /dev/null +++ b/resources/po/as.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "অৱৰুদ্ধ কৰক" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "বেলুন" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "ক্লিক্" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "ঝুৰ্" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "ঘনক পৰিৱৰ্তনীয় প্ৰভাৱ" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "পৰিৱৰ্তনীয় প্ৰভাৱ" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "অকৃতকাৰ্য্য হ" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "Emoji" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "অনুবিম্ব ইজাৰ" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "প্ৰতিচ্ছবি স্কেল কৰক" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "অনুবিম্ব" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "অনুবিম্ব অনুৰেখ পত্ৰ" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "অনুবিম্ব Pixel Area" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "অনুবিম্ব SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "আইটেম দর্শন" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "ছাঁয়া" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "অঁকোৱা-পকোৱা" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "Logging" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "পৰিবৰ্দ্ধক" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "মেশ অঙ্কুৰিত" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "মেশ অসংযোগ" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "3D অনুগামী" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "মেটাবল মহা-বিস্ফোৰণবাদ" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "মেটাবল প্ৰতিসৰিত" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "অস্পষ্ট" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "বিস্তাৰ" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "অইন অনুবিম্ব" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "অকণমান আপোচ কৰ্" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "পৃষ্ঠা লেআউট" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "পোপা মেনু" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "অগ্রগতি বার" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "অংশ্যমান অৰ্কিড" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "ৰেডিয়েল নক্সা" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "প্ৰতিফলিত কৰক" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "চক্ৰলেখন" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "লিপি" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "স্ক্ৰ'ল কৰক" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "তাৰকা" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "শৈলী" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "অস্পষ্টকৈ অপুষ্পক" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "টেক্সটারেদ মেশ" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "অকনিষ্ঠ আনুবংশিক" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "অকনিষ্ঠ অগ্ৰণী" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "লেৱেল কৰক" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "অক্ষশক্তি অঁকা অকনিষ্ঠ" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "অকনিষ্ঠ অৰ্জুন বঁটা" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "টিল্ট অনুভূতি" diff --git a/resources/po/de.po b/resources/po/de.po new file mode 100755 index 0000000..c1a57a0 --- /dev/null +++ b/resources/po/de.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "Blöcke" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "Schaumbildung" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "Tasten" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "Farbverlauf " + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "Würfel Übergangseffekt" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "Auflösen Übergangseffekt" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "Auswirkungen" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "Emoji" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "Bild Montage und Sampling" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "Bildskalierung" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "Bildansicht " + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "Bildansicht mit Transparenz" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "Bildansicht Pixelbereich" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "Bildansicht SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "Item-Ansicht" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "Licht und Schatten" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "Linien" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "Logging" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "Bildschirmlupe" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "Mesh Veränderung" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "Mesh Sortierung" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "3D-Modelle" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "Metaball Explosion" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "Metaball Brechung" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "Bewegungsunschärfe" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "Bewegung Strecke" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "Nativen Bild" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "Größe Verhandlung" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "Seite wechseln" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "Popup-Menü" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "Fortschrittsanzeige" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "Grundformen" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "Radialmenü" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "Brechung" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "Schablone" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "Scripting" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "Scroll-Ansicht" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "Funkeln" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "Styling" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "Unschärfe und blühen" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "Strukturiertem Mesh" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "Texteditor" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "Textfeld" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "Beschriftung" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "Mehrere Sprachen Beschriftung" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "Text Scrollen" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "Neigungssensor" diff --git a/resources/po/en.po b/resources/po/en.po new file mode 120000 index 0000000..2ed6a9a --- /dev/null +++ b/resources/po/en.po @@ -0,0 +1 @@ +en_US.po \ No newline at end of file diff --git a/resources/po/en_GB.po b/resources/po/en_GB.po new file mode 100755 index 0000000..abf951f --- /dev/null +++ b/resources/po/en_GB.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "Blocks" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "Bubbles" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "Buttons" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "Colour Gradient" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "Cube Effect" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "Dissolve Effect" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "Effects View" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "Emoji Text" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "Image Fitting and Sampling" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "Image Scaling Grid" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "Image View" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "Image View Alpha Blending" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "Image View Pixel Area" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "Image View SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "Item View" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "Lights and Shadows" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "Mesh Line" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "Logging" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "Magnifier" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "Mesh Morph" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "Mesh Sorting" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "Mesh Visual" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "Metaball Explosion" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "Metaball Refraction" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "Motion Blur" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "Motion Stretch" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "Native Image Source" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "Negotiate Size" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "Page Turn View" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "Popup" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "Progress Bar" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "Primitive Shapes" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "Radial Menu" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "Refraction" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "Renderer Stencil" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "Script-based UI" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "Scroll View" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "Sparkle" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "Styling" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "Super Blur and Bloom" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "Mesh Texture" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "Text Editor" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "Text Field" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "Text Label" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "Text Scripts" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "Text Scrolling" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "Tilt Sensor" diff --git a/resources/po/en_US.po b/resources/po/en_US.po new file mode 100755 index 0000000..0d89012 --- /dev/null +++ b/resources/po/en_US.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "Blocks" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "Bubbles" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "Buttons" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "Color Gradient" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "Cube Effect" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "Dissolve Effect" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "Effects View" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "Emoji Text" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "Image Fitting and Sampling" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "Image Scaling Grid" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "Image View" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "Image View Alpha Blending" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "Image View Pixel Area" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "Image View SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "Item View" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "Lights and Shadows" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "Mesh Line" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "Logging" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "Magnifier" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "Mesh Morph" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "Mesh Sorting" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "Mesh Visual" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "Metaball Explosion" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "Metaball Refraction" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "Motion Blur" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "Motion Stretch" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "Native Image Source" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "Negotiate Size" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "Page Turn View" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "Popup" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "Progress Bar" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "Primitive Shapes" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "Radial Menu" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "Refraction" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "Renderer Stencil" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "Script-based UI" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "Scroll View" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "Sparkle" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "Styling" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "Super Blur and Bloom" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "Mesh Texture" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "Text Editor" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "Text Field" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "Text Label" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "Text Scripts" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "Text Scrolling" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "Tilt Sensor" diff --git a/resources/po/es.po b/resources/po/es.po new file mode 100755 index 0000000..e5f82f2 --- /dev/null +++ b/resources/po/es.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "Bloques" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "Burbujas" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "Botones" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "Gradiente de color" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "Transición cubos" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "Transición disolver" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "Vista de efectos" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "Texto con emojis" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "Modo de encaje y muestreo" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "Modo de escalado de imagen" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "Control con imagenes" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "Control con imagenes con transparencias" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "Control con imagenes con area de pixeles" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "Control con imagenes SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "Vista de elementos" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "Luces y sombras" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "Lineas" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "Control de entrada" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "Lupa" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "Transformacion de geometrias" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "Ordenacion de geometrias" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "Gemeotria 3D" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "Explosion de metabolas" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "Refraccion de metabolas" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "Desenfoque de movimiento" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "Movimiento con deformación" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "Fuente de imagenes nativas" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "Negociacion de tamaño" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "Vista de páginas" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "Popup" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "Barra de progreso" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "Primitvas 3D" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "Menú radial" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "Refracción" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "Dibujado con stencil" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "Interfaz definida por Script" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "Vista de desplazamiento" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "Brillar" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "Estilo" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "Efecto blur y bloom" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "Geometria con texturas" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "Editor de texto" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "Campo de texto" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "Etiqueta de texto" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "Textos internacionales" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "Texto con desplazamiento" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "Sensor de inclinacion" diff --git a/resources/po/ko.po b/resources/po/ko.po new file mode 100755 index 0000000..5e3fbb4 --- /dev/null +++ b/resources/po/ko.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "블록" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "방울" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "버튼" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "색상 그라디언트" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "입방체 전환" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "디졸브 전환" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "이펙트 뷰" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "이모티콘 텍스트" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "이미지 조정 샘플링" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "이미지 확대" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "이미지 뷰" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "이미지 뷰 알파 블렌딩" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "이미지 뷰 픽셀 영역" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "이미지 뷰 SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "아이템 뷰" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "빛과 그림자" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "라인 메쉬" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "로깅" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "돋보기" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "메쉬 형태" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "메쉬 분류" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "메쉬 비주얼" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "메타볼 폭발" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "메타볼 굴절" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "모션 블러" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "늘이기" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "네이티브 이미지 소스" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "사이즈 조절" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "책장 넘기기" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "팝업" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "진행률 표시 줄" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "기본 모양" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "레이디 얼 메뉴" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "굴절 효과" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "렌더러 스텐실" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "스크립팅" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "스크롤 뷰" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "불꽃" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "스타일링" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "블러링 이펙트" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "텍스쳐 메쉬" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "텍스트 편집기" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "텍스트 필드" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "텍스트 라벨" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "다국어" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "텍스트 스크롤" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "기울기 센서" diff --git a/resources/po/ml.po b/resources/po/ml.po new file mode 100755 index 0000000..ec5c34d --- /dev/null +++ b/resources/po/ml.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "തടയപ്പെട്ട" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "കുമിള" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "ബട്ടണുകൾ" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "വർണ്ണ ഗ്രേഡിയന്റ്" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "സമചതുരക്കട്ട സംക്രമണ ഇഫക്ട്" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "സ്ഥാനാന്തരം സംക്രമണ ഇഫക്ട്" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "എഫക്റ്റുകൾ" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "ഇമോട്ടികോണുകൾ" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "ചിത്രം ഉചിതമാണ് ആൻഡ് ഒരുപറ്റം" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "ഇമേജിംഗ്" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "ചിത്രം കാഴ്ച" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "ചിത്രം കാഴ്ച" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "സുതാര്യത ഉപയോഗിച്ച് ഇമേജ് കാഴ്ച" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "ചിത്രം കാഴ്ച SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "ഇനം കാഴ്ച" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "നിഴല്" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "വര" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "ലോഗിംഗ്" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "ഭൂതക്കണ്ണാടി" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "മോർഫ് mesh" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "തരംതിരിക്കലിനായി mesh" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "3D മോഡലിങ്" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "മെറ്റാ പന്ത് സ്ഫോടനം" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "മെറ്റാ പന്ത് അപവർത്തനം" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "അവ്യക്തമാക്കല്" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "സ്ട്രെച്ച്" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "നേറ്റീവ് ചിത്രം" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "വലുപ്പം കൂടിയാലോചന" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "പേജ് ലേഔട്ട്" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "പോപപ്പ് മെനുവിൽ" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "പ്രോഗ്രസ് ബാർ" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "അടിസ്ഥാന രൂപങ്ങൾ" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "റേഡിയല് രേഖാചിത്രം" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "പ്രതിഫലിക്കുക" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "സീരിയോലിത്തോഗ്രാഫ്" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "സ്ക്രിപ്റ്റ്" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "സ്ക്രോള്ചെയ്യുക കാഴ്ച" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "നക്ഷത്ര" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "ശൈലി" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "മങ്ങൽ പൂക്കൽ" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "ടെക്സ്ചർ mesh" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "ടെക്സ്റ്റ് എഡിറ്റർ" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "ടെക്സ്റ്റ് ഫീൽഡ്" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "ലേബലുചെയ്യുക" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "ഒന്നിലധികം ഭാഷ വാചകം" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "ടെക്സ്റ്റ് സ്ക്രോളിംഗ്" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "ചെരിവ് സെൻസർ" diff --git a/resources/po/ur.po b/resources/po/ur.po new file mode 100755 index 0000000..822fc80 --- /dev/null +++ b/resources/po/ur.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "اینٹیں" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "بلبلے" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "بٹنوں" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "رنگ میلان" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "کیوب منتقلی" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "حل منتقلی" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "اثرات" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "اموٹکان" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "تصویر فٹنگ" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "تصویر پیمائی" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "تصویر کنٹرول" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "تصویر کنٹرول" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "تصویر کنٹرول شفافیت کے ساتھ" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "تصویر کنٹرول SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "چیزوں کی فہرست" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "روشنی اور سائے" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "لکیریں" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "لاگنگ" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "مکبر" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "میش کی تبدیلی" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "میش کی چھنٹائی" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "3D میش" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "میٹابال دھماکہ" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "میٹابال اپورتن" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "دھندلانے کی حرکت" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "کھینچھنے کی حرکت" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "نیٹو تصویر" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "سائز مذاکرات" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "کتاب" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "پاپ اپ" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "ترقی بار" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "سادہ ماڈلیے" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "ریڈیل مینو" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "رفراکشن" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "سٹینسل" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "سکرپٹ" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "سکرول ویو" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "سٹار" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "سٹائل" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "دھندلاپن اور بلوم" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "ٹیکسچرد میش" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "حروف ایڈیٹر" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "حروف لائن ایڈیٹر" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "حروف کا لیبل" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "کئی زبانوں" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "حروف کاسکرال " + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "ٹلٹ سینسر" diff --git a/resources/po/zn_CH.po b/resources/po/zn_CH.po new file mode 100755 index 0000000..d3654cd --- /dev/null +++ b/resources/po/zn_CH.po @@ -0,0 +1,140 @@ +msgid "DALI_DEMO_STR_TITLE_BLOCKS" +msgstr "块体" + +msgid "DALI_DEMO_STR_TITLE_BUBBLES" +msgstr "气泡" + +msgid "DALI_DEMO_STR_TITLE_BUTTONS" +msgstr "按钮" + +msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" +msgstr "颜色梯度" + +msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" +msgstr "方块切换效果" + +msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" +msgstr "冰消瓦解切换效果" + +msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" +msgstr "效果视图" + +msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" +msgstr "表情符号" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" +msgstr "图像填充及采样" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" +msgstr "图像缩放" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" +msgstr "图像视图" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" +msgstr "图像视图透明度" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" +msgstr "图像视图像素区域" + +msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" +msgstr "图像视图 SVG" + +msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" +msgstr "项目视图" + +msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" +msgstr "阴影" + +msgid "DALI_DEMO_STR_TITLE_LINE_MESH" +msgstr "线条" + +msgid "DALI_DEMO_STR_TITLE_LOGGING" +msgstr "记录" + +msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" +msgstr "放大鏡" + +msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" +msgstr "网格变形" + +msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" +msgstr "网格排序" + +msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" +msgstr "3D模型" + +msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" +msgstr "元球爆炸" + +msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" +msgstr "元球折射" + +msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" +msgstr "动作模糊" + +msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" +msgstr "动作拉伸" + +msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" +msgstr "本地图像" + +msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" +msgstr "尺寸协商" + +msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" +msgstr "翻页" + +msgid "DALI_DEMO_STR_TITLE_POPUP" +msgstr "弹窗" + +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR" +msgstr "进度条" + +msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" +msgstr "基本形状" + +msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" +msgstr "径向菜单" + +msgid "DALI_DEMO_STR_TITLE_REFRACTION" +msgstr "折射" + +msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" +msgstr "模板缓冲" + +msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" +msgstr "脚本用户界面" + +msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" +msgstr "滚动视图" + +msgid "DALI_DEMO_STR_TITLE_SPARKLE" +msgstr "火花" + +msgid "DALI_DEMO_STR_TITLE_STYLING" +msgstr "样式" + +msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" +msgstr "模糊及泛光" + +msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" +msgstr "纹理网格" + +msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" +msgstr "文字编辑器" + +msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" +msgstr "文字栏" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" +msgstr "标签" + +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" +msgstr "多语言标签" + +msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" +msgstr "滚动文字" + +msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" +msgstr "倾斜传感器" diff --git a/resources/style/.gitignore b/resources/style/.gitignore new file mode 100644 index 0000000..59620cc --- /dev/null +++ b/resources/style/.gitignore @@ -0,0 +1,4 @@ +demo-theme.json +style-example-theme-three.json +style-example-theme-two.json +style-example-theme-one.json diff --git a/resources/style/demo-theme.json.in b/resources/style/demo-theme.json.in index 3e680ba..8cf572d 100644 --- a/resources/style/demo-theme.json.in +++ b/resources/style/demo-theme.json.in @@ -15,57 +15,54 @@ */ { - "constants": - { - "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" - }, - "styles": { - "confirmationpopup":{ - "popupBackgroundImage":"{DEMO_IMAGE_DIR}00_popup_bg.9.png" + "ConfirmationPopup":{ + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" }, - "textlabel-Rosemary": + "TextLabelRosemary": { "fontFamily":"Rosemary" }, - "textlabel": + "TextLabel": { "fontStyle":"Regular", "pointSize":18 }, - "launcherlabel": + "LauncherLabel": { "pointSize":18 }, - "toolbarlabel": + "ToolbarLabel": { "pointSize":18 }, - "builderlabel": + "BuilderLabel": { "pointSize":13 }, - "scrollview": + "ScrollView": { "overshootEffectColor":"B018" }, - "grouplabel": + "ImageScalingGroupLabel": { "pointSize":9 }, - "buttonlabel": + "ImageScalingButton": { - "pointSize":11 + "label":{ + "pointSize":11 + } }, - "launcherbackground": + "LauncherBackground": { "background": { diff --git a/resources/style/images/.gitignore b/resources/style/images/.gitignore new file mode 100644 index 0000000..01b9fd9 --- /dev/null +++ b/resources/style/images/.gitignore @@ -0,0 +1 @@ +*.xcf diff --git a/resources/style/images/00_popup_bg.9.png b/resources/style/images/00_popup_bg.9.png new file mode 100644 index 0000000..f0e84ff Binary files /dev/null and b/resources/style/images/00_popup_bg.9.png differ diff --git a/resources/style/images/radio-button-selected.png b/resources/style/images/radio-button-selected.png new file mode 100644 index 0000000..96411bc Binary files /dev/null and b/resources/style/images/radio-button-selected.png differ diff --git a/resources/style/images/radio-button-unselected-disabled.png b/resources/style/images/radio-button-unselected-disabled.png new file mode 100644 index 0000000..d2d8d24 Binary files /dev/null and b/resources/style/images/radio-button-unselected-disabled.png differ diff --git a/resources/style/images/radio-button-unselected.png b/resources/style/images/radio-button-unselected.png new file mode 100644 index 0000000..bdf4abd Binary files /dev/null and b/resources/style/images/radio-button-unselected.png differ diff --git a/resources/style/images/slider-skin-progress-blue.9.png b/resources/style/images/slider-skin-progress-blue.9.png new file mode 100644 index 0000000..9477280 Binary files /dev/null and b/resources/style/images/slider-skin-progress-blue.9.png differ diff --git a/resources/style/images/slider-skin-progress-green.9.png b/resources/style/images/slider-skin-progress-green.9.png new file mode 100644 index 0000000..6738075 Binary files /dev/null and b/resources/style/images/slider-skin-progress-green.9.png differ diff --git a/resources/style/images/slider-skin-progress-red.9.png b/resources/style/images/slider-skin-progress-red.9.png new file mode 100644 index 0000000..6c8cdbb Binary files /dev/null and b/resources/style/images/slider-skin-progress-red.9.png differ diff --git a/resources/style/mobile/demo-theme.json.in b/resources/style/mobile/demo-theme.json.in index 86a6b57..f8b5099 100644 --- a/resources/style/mobile/demo-theme.json.in +++ b/resources/style/mobile/demo-theme.json.in @@ -18,67 +18,67 @@ { "styles": { - "textlabel-Rosemary": + "TextLabelRosemary": { "fontFamily":"Rosemary" }, - "textlabel": + "TextLabel": { "fontStyle":"Regular", "pointSize":18 }, - "textlabelFontSize0": + "TextLabelFontSize0": { "pointSize":8 }, - "textlabelFontSize1": + "TextLabelFontSize1": { "pointSize":10 }, - "textlabelFontSize2": + "TextLabelFontSize2": { "pointSize":15 }, - "textlabelFontSize3": + "TextLabelFontSize3": { "pointSize":19 }, - "textlabelFontSize4": + "TextLabelFontSize4": { "pointSize":25 }, - "launcherlabel": + "Launcherlabel": { "pointSize":8 }, - "toolbarlabel": + "ToolbarLabel": { "pointSize":10 }, - "builderlabel": + "BuilderLabel": { "pointSize":10 }, - "scrollview": + "ScrollView": { "overshootEffectColor":"B018" }, - "grouplabel": + "GroupLabel": { "pointSize":6 }, - "buttonlabel": + "ButtonLabel": { "pointSize":8 }, - "launcherbackground": + "LauncherBackground": { "background": { diff --git a/resources/style/mobile/images/radio-button-selected.png b/resources/style/mobile/images/radio-button-selected.png new file mode 100644 index 0000000..96411bc Binary files /dev/null and b/resources/style/mobile/images/radio-button-selected.png differ diff --git a/resources/style/mobile/images/radio-button-unselected-disabled.png b/resources/style/mobile/images/radio-button-unselected-disabled.png new file mode 100644 index 0000000..d2d8d24 Binary files /dev/null and b/resources/style/mobile/images/radio-button-unselected-disabled.png differ diff --git a/resources/style/mobile/images/radio-button-unselected.png b/resources/style/mobile/images/radio-button-unselected.png new file mode 100644 index 0000000..bdf4abd Binary files /dev/null and b/resources/style/mobile/images/radio-button-unselected.png differ diff --git a/resources/style/mobile/images/slider-skin-progress-blue.9.png b/resources/style/mobile/images/slider-skin-progress-blue.9.png new file mode 100644 index 0000000..9477280 Binary files /dev/null and b/resources/style/mobile/images/slider-skin-progress-blue.9.png differ diff --git a/resources/style/mobile/images/slider-skin-progress-green.9.png b/resources/style/mobile/images/slider-skin-progress-green.9.png new file mode 100644 index 0000000..6738075 Binary files /dev/null and b/resources/style/mobile/images/slider-skin-progress-green.9.png differ diff --git a/resources/style/mobile/images/slider-skin-progress-red.9.png b/resources/style/mobile/images/slider-skin-progress-red.9.png new file mode 100644 index 0000000..6c8cdbb Binary files /dev/null and b/resources/style/mobile/images/slider-skin-progress-red.9.png differ diff --git a/resources/style/mobile/style-example-theme-one.json.in b/resources/style/mobile/style-example-theme-one.json.in new file mode 100644 index 0000000..e84d423 --- /dev/null +++ b/resources/style/mobile/style-example-theme-one.json.in @@ -0,0 +1,67 @@ +{ + "styles": + { + "title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "tableview":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "flexcontainer":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] + } + }, + "radiobutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "checkboxbutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "colorLabel1":{ + "textColor": [1,0,0,1] + }, + "colorLabel2":{ + "textColor": [0,1,0,1] + }, + "colorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "themelabel":{ + "textColor":[0,1,1,1] + }, + "popupTitle":{ + "textColor":[1,1,1,1] + }, + "popupBody":{ + "textColor":[1,1,0,1] + }, + "textlabel":{ + "textColor":[0,0,0,1] + }, + "colorSlider1":{ + "styles":["slider"] + }, + "colorSlider2":{ + "styles":["slider"] + }, + "colorSlider3":{ + "styles":["slider"] + } + } +} diff --git a/resources/style/mobile/style-example-theme-three.json.in b/resources/style/mobile/style-example-theme-three.json.in new file mode 100644 index 0000000..0326e3d --- /dev/null +++ b/resources/style/mobile/style-example-theme-three.json.in @@ -0,0 +1,51 @@ +{ + "styles": + { + "title":{ + "textColor":"#0000ff", + "background": + { + "rendererType":"color", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "tableview":{ + "background": + { + "rendererType":"color", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "radiobutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "checkboxbutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "colorLabel1":{ + "textColor": [1,0,0,1] + }, + "colorLabel2":{ + "textColor": [0,1,0,1] + }, + "colorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "themelabel":{ + "textColor":[0,1,1,1] + }, + "popupTitle":{ + "textColor":[1,1,1,1] + }, + "popupBody":{ + "textColor":[1,1,0,1] + }, + "textlabel":{ + "textColor":[0,0,0,1] + } + } +} diff --git a/resources/style/mobile/style-example-theme-two.json.in b/resources/style/mobile/style-example-theme-two.json.in new file mode 100644 index 0000000..884d1ca --- /dev/null +++ b/resources/style/mobile/style-example-theme-two.json.in @@ -0,0 +1,97 @@ +{ + "constants": + { + "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" + }, + "styles": + { + "title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "tableview":{ + "background": + { + "visualType":"GRADIENT", + "startPosition": [0,-1], + "endPosition": [0,1], + "stopColor": [ [ 1.0, 0.0, 1.0, 0.03 ], [1.0,0.0,1.0,0.15] ] + } + }, + + // Change an icon size, see if it gets properly re-sized + "radiobutton":{ + "unselectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected.png", + "selectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-selected.png", + "disabledStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected-disabled.png", + "imageLabelGap":10, + "label":{ + "textColor": [0.1,1,1,1] + } + }, + "checkboxbutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "colorLabel1":{ + "textColor": [1,0,0,1] + }, + "colorLabel2":{ + "textColor": [0,1,0,1] + }, + "colorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "themelabel":{ + "textColor":[0,1,1,1] + }, + "popupTitle":{ + "textColor":[1,1,1,1] + }, + "popupBody":{ + "textColor":[1,1,0,1] + }, + + // Note, this overrides any non-renamed label styles, e.g. those in a button. + "textlabel":{ + //"textColor":[0,0,0,1] + }, + + "thinslider":{ + "styles": ["slider"], + "showPopup":true, + "showValue":false, + "valuePrecision":0, + "handleVisual":{ + "size":[48,48] + }, + "trackVisual":{ + "size":[10, 10] + }, + "enabled":true + }, + "colorSlider1":{ + "styles":["thinslider"], + "progressVisual":{ + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-red.9.png" + } + }, + "colorSlider2":{ + "styles":["thinslider"], + "progressVisual":{ + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-green.9.png" + } + }, + "colorSlider3":{ + "styles":["thinslider"], + "progressVisual":{ + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-blue.9.png" + } + } + } +} diff --git a/resources/style/style-example-theme-one.json.in b/resources/style/style-example-theme-one.json.in new file mode 100644 index 0000000..29b628c --- /dev/null +++ b/resources/style/style-example-theme-one.json.in @@ -0,0 +1,67 @@ +{ + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "FlexContainer":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] + } + }, + "RadioButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "CheckBoxButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "ColorLabel1":{ + "textColor": [1,0,0,1] + }, + "ColorLabel2":{ + "textColor": [0,1,0,1] + }, + "ColorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "ThemeLabel":{ + "textColor":[0,1,1,1] + }, + "PopupTitle":{ + "textColor":[1,1,1,1] + }, + "PopupBody":{ + "textColor":[1,1,0,1] + }, + "TextLabel":{ + "textColor":[0,0,0,1] + }, + "ColorSlider1":{ + "styles":["Slider"] + }, + "ColorSlider2":{ + "styles":["slider"] + }, + "ColorSlider3":{ + "styles":["slider"] + } + } +} diff --git a/resources/style/style-example-theme-three.json.in b/resources/style/style-example-theme-three.json.in new file mode 100644 index 0000000..f6feabb --- /dev/null +++ b/resources/style/style-example-theme-three.json.in @@ -0,0 +1,51 @@ +{ + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "RadioButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "CheckboxButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "ColorLabel1":{ + "textColor": [1,0,0,1] + }, + "ColorLabel2":{ + "textColor": [0,1,0,1] + }, + "ColorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "ThemeLabel":{ + "textColor":[0,1,1,1] + }, + "PopupTitle":{ + "textColor":[1,1,1,1] + }, + "PopupBody":{ + "textColor":[1,1,0,1] + }, + "TextLabel":{ + "textColor":[0,0,0,1] + } + } +} diff --git a/resources/style/style-example-theme-two.json.in b/resources/style/style-example-theme-two.json.in new file mode 100644 index 0000000..77a8586 --- /dev/null +++ b/resources/style/style-example-theme-two.json.in @@ -0,0 +1,97 @@ +{ + "constants": + { + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" + }, + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"GRADIENT", + "startPosition": [0,-1], + "endPosition": [0,1], + "stopColor": [ [ 1.0, 0.0, 1.0, 0.03 ], [1.0,0.0,1.0,0.15] ] + } + }, + + // Change an icon size, see if it gets properly re-sized + "RadioButton":{ + "unselectedStateImage":"{STYLE_DIR}/images/radio-button-unselected.png", + "selectedStateImage":"{STYLE_DIR}/images/radio-button-selected.png", + "disabledStateImage":"{STYLE_DIR}/images/radio-button-unselected-disabled.png", + "imageLabelGap":10, + "label":{ + "textColor": [0.1,1,1,1] + } + }, + "checkboxbutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "colorLabel1":{ + "textColor": [1,0,0,1] + }, + "colorLabel2":{ + "textColor": [0,1,0,1] + }, + "colorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "themelabel":{ + "textColor":[0,1,1,1] + }, + "popupTitle":{ + "textColor":[1,1,1,1] + }, + "popupBody":{ + "textColor":[1,1,0,1] + }, + + // Note, this overrides any non-renamed label styles, e.g. those in a button. + "TextLabel":{ + //"textColor":[0,0,0,1] + }, + + "ThinSlider":{ + "styles": ["slider"], + "showPopup":true, + "showValue":false, + "valuePrecision":0, + "handleVisual":{ + "size":[48,48] + }, + "trackVisual":{ + "size":[10, 10] + }, + "enabled":true + }, + "ColorSlider1":{ + "styles":["ThinSlider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-red.9.png" + } + }, + "ColorSlider2":{ + "styles":["ThinSlider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-green.9.png" + } + }, + "ColorSlider3":{ + "styles":["thinslider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-blue.9.png" + } + } + } +} diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 092a237..4a17bf1 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -16,8 +16,8 @@ */ /* This header file includes all multi language strings which need display */ -#ifndef __DALI_DEMO_STRINGS_H__ -#define __DALI_DEMO_STRINGS_H__ +#ifndef DALI_DEMO_STRINGS_H +#define DALI_DEMO_STRINGS_H #include @@ -32,93 +32,106 @@ extern "C" #ifdef INTERNATIONALIZATION_ENABLED -#define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") -#define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") -#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") -#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION") -#define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW") -#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") -#define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER") -#define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR") -#define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH") -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW") -#define DALI_DEMO_STR_TITLE_RADIAL_MENU dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RADIAL_MENU") -#define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") -#define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") -#define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS") -#define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") -#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING") -#define DALI_DEMO_STR_TITLE_IMAGE_SCALING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_SCALING") -#define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD") -#define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL") -#define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE") -#define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT") -#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE") -#define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") -#define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") -#define DALI_DEMO_STR_TITLE_LOGGING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LOGGING") -#define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_MESH_MORPH") -#define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_MESH_SORTING") -#define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TEXTURED_MESH") -#define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") -#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_SUPER_BLUR_BLOOM") -#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_EFFECTS_VIEW") +#define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") +#define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") +#define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") +#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") +#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION") +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EFFECTS_VIEW") +#define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT") +#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING") +#define DALI_DEMO_STR_TITLE_IMAGE_SCALING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_SCALING") +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_VIEW") +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING") +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA") +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG") +#define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW") +#define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS") +#define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LINE_MESH") +#define DALI_DEMO_STR_TITLE_LOGGING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LOGGING") +#define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER") +#define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_MORPH") +#define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_SORTING") +#define DALI_DEMO_STR_TITLE_MESH_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_VISUAL") +#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION") +#define DALI_DEMO_STR_TITLE_METABALL_REFRAC dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_REFRAC") +#define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR") +#define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH") +#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE") +#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE") +#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW") +#define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") +#define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR") +#define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") +#define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") +#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") +#define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") +#define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") +#define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE") +#define DALI_DEMO_STR_TITLE_STYLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_STYLING") +#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM") +#define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXTURED_MESH") +#define DALI_DEMO_STR_TITLE_TEXT_EDITOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_EDITOR") +#define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD") +#define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL") +#define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE") +#define DALI_DEMO_STR_TITLE_TEXT_SCROLLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_SCROLLING") +#define DALI_DEMO_STR_TITLE_TILT_SENSOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TILT_SENSOR") #else // !INTERNATIONALIZATION_ENABLED -#define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" -#define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" -#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect" -#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect" -#define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View" -#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" -#define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier" -#define DALI_DEMO_STR_TITLE_MODEL_3D_VIEWER "Model 3D Viewer" -#define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur" -#define DALI_DEMO_STR_TITLE_MOTION_STRETCH "Motion Stretch" -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View" -#define DALI_DEMO_STR_TITLE_RADIAL_MENU "Radial Menu" -#define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" -#define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" -#define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS "Lights and shadows" -#define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" -#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING "Image Fitting and Sampling" -#define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Grid" -#define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field" -#define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label" -#define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts" -#define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text" -#define DALI_DEMO_STR_TITLE_TEXT_SCROLLING "Text Scrolling" -#define DALI_DEMO_STR_TITLE_TEXT_EDITOR "Text Editor" -#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size" -#define DALI_DEMO_STR_TITLE_POPUP "Popup" -#define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" -#define DALI_DEMO_STR_TITLE_LOGGING "Logging" -#define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph" -#define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting" -#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION "Metaball Explosion" -#define DALI_DEMO_STR_TITLE_METABALL_REFRAC "Metaball Refractions" -#define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" -#define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line" -#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" -#define DALI_DEMO_STR_TITLE_IMAGE_VIEW "Image View" -#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA "Image View Pixel Area" -#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING "Image View Alpha Blending" -#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG "Image View SVG" -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" -#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" -#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" -#define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual" -#define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" +#define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" +#define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" +#define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" +#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect" +#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect" +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" +#define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text" +#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING "Image Fitting and Sampling" +#define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Grid" +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW "Image View" +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING "Image View Alpha Blending" +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA "Image View Pixel Area" +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG "Image View SVG" +#define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View" +#define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS "Lights and shadows" +#define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line" +#define DALI_DEMO_STR_TITLE_LOGGING "Logging" +#define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier" +#define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph" +#define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting" +#define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual" +#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION "Metaball Explosion" +#define DALI_DEMO_STR_TITLE_METABALL_REFRAC "Metaball Refractions" +#define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur" +#define DALI_DEMO_STR_TITLE_MOTION_STRETCH "Motion Stretch" +#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" +#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size" +#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View" +#define DALI_DEMO_STR_TITLE_POPUP "Popup" +#define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" +#define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" +#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" +#define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" +#define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" +#define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle" +#define DALI_DEMO_STR_TITLE_STYLING "Styling" +#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" +#define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" +#define DALI_DEMO_STR_TITLE_TEXT_EDITOR "Text Editor" +#define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field" +#define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label" +#define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts" +#define DALI_DEMO_STR_TITLE_TEXT_SCROLLING "Text Scrolling" +#define DALI_DEMO_STR_TITLE_TILT_SENSOR "Tilt Sensor" +#define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar" #endif -#define DALI_DEMO_STR_TITLE_TILT_SENSOR "Tilt Sensor" - - #ifdef __cplusplus } #endif // __cplusplus -#endif // __DALI_DEMO_STRINGS_H__ +#endif // DALI_DEMO_STRINGS_H diff --git a/shared/view.h b/shared/view.h index 2606fd2..29e1012 100644 --- a/shared/view.h +++ b/shared/view.h @@ -94,7 +94,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, { Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New(); label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" ); + label.SetStyleName( "ToolbarLabel" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -118,6 +118,9 @@ Dali::Layer CreateView( Dali::Application& application, { Dali::Stage stage = Dali::Stage::GetCurrent(); + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + // Create default View. view = Dali::Toolkit::Control::New(); view.SetAnchorPoint( Dali::AnchorPoint::CENTER ); @@ -165,7 +168,7 @@ Dali::Layer CreateView( Dali::Application& application, Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text ) { Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( text ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" ); + label.SetStyleName( "ToolbarLabel" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );