/builder/dali-builder
/examples/*.demo
/mo
+compile_commands.json
#Replace @DEMO_STYLE_IMAGE_DIR@ in following files
CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json )
CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json )
+CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json )
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 )
###########################################################################
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE")
-SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
INCLUDE_DIRECTORIES(${ROOT_SRC_DIR})
#INCLUDE_DIRECTORIES(${DEMO_SRC_DIR})
SET(BUILDER_SRC_DIR ${ROOT_SRC_DIR}/builder)
SET(DALI_BUILDER_SRCS ${BUILDER_SRC_DIR}/dali-builder.cpp)
+SET(DALI_BUILDER_SRCS ${DALI_BUILDER_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS})
TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS})
INSTALL(TARGETS dali-builder DESTINATION ${BINDIR})
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()
+SET(DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie)
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()
+ SET(SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS})
TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie)
INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR})
/**
- * This file defines the location dali-demo resources
- It is used exclusively for Ubuntu builds where an application resource directory is explicity defined.
+ * This file defines the location dali-demo resources.
+ * It is used for builds where an application resource directory is NOT explicity defined.
*/
#include <cstdlib>
<ui-application appid="animated-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Animated shapes</label>
</ui-application>
- <ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
- <label>Atlas</label>
- </ui-application>
<ui-application appid="size-negotiation.example" exec="/usr/apps/com.samsung.dali-demo/bin/size-negotiation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Size Negotiation</label>
</ui-application>
<ui-application appid="tooltip.example" exec="/usr/apps/com.samsung.dali-demo/bin/tooltip.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Tooltip</label>
</ui-application>
+ <ui-application appid="clipping.example" exec="/usr/apps/com.samsung.dali-demo/bin/clipping.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+ <label>Clipping</label>
+ </ui-application>
</manifest>
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND));
demo.AddExample(Example("fpp-game.example", DALI_DEMO_STR_TITLE_FPP_GAME));
demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP));
+ demo.AddExample(Example("clipping.example", DALI_DEMO_STR_TITLE_CLIPPING));
demo.SortAlphabetically( true );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
};
const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) );
+const char * const SHAPE_IMAGE_TABLE[] =
+{
+ DEMO_IMAGE_DIR "shape-circle.png",
+ DEMO_IMAGE_DIR "shape-bubble.png"
+};
+const int NUMBER_OF_SHAPE_IMAGES( sizeof( SHAPE_IMAGE_TABLE ) / sizeof( SHAPE_IMAGE_TABLE[0] ) );
+
const int NUM_BACKGROUND_IMAGES = 18;
const float BACKGROUND_SWIPE_SCALE = 0.025f;
const float BACKGROUND_SPREAD_SCALE = 1.5f;
}
}
- // Set tableview position
- Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f );
- page.SetPosition( pagePos );
-
mPages.push_back( page );
if( iter == mExampleList.end() )
void DaliTableView::SetupBackground( Actor bubbleContainer )
{
- // Create distance field shapes.
- BufferImage distanceFields[2];
- Size imageSize( 512, 512 );
-
- 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, distanceFields );
+ AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES );
}
void DaliTableView::InitialiseBackgroundActors( Actor actor )
}
}
-void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* distanceField )
+void DaliTableView::AddBackgroundActors( Actor layer, int count )
{
for( int i = 0; i < count; ++i )
{
float randSize = Random::Range( 10.0f, 400.0f );
- int distanceFieldType = static_cast<int>( Random::Range( 0.0f, 1.0f ) + 0.5f );
- ImageView dfActor = ImageView::New( distanceField[ distanceFieldType ] );
+ int shapeType = static_cast<int>( Random::Range( 0.0f, NUMBER_OF_SHAPE_IMAGES - 1 ) + 0.5f );
+ ImageView dfActor = ImageView::New( SHAPE_IMAGE_TABLE[ shapeType ] );
dfActor.SetSize( Vector2( randSize, randSize ) );
dfActor.SetParentOrigin( ParentOrigin::CENTER );
layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
}
-void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
-{
- // this bitmap will hold the alpha map for the distance field shader
- distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 );
-
- // Generate bit pattern
- std::vector< unsigned char > imageDataA8;
- imageDataA8.reserve( size.width * size.height ); // A8
-
- switch( shapeType )
- {
- case CIRCLE:
- GenerateCircle( size, imageDataA8 );
- break;
- case BUBBLE:
- GenerateCircle( size, imageDataA8, true );
- break;
- default:
- break;
- }
-
- PixelBuffer* buffer = distanceFieldOut.GetBuffer();
- if( buffer )
- {
- GenerateDistanceFieldMap( &imageDataA8[ 0 ], size, buffer, size, 8.0f, size );
- distanceFieldOut.Update();
- }
-}
-
-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 );
-
- for( int h = 0; h < size.height; ++h )
- {
- for( int w = 0; w < size.width; ++w )
- {
- Vector2 pos( w, h );
- Vector2 dist = pos - center;
-
- 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 );
- }
- }
-}
-
ImageView DaliTableView::CreateLogo( std::string imagePath )
{
ImageView logo = ImageView::New( imagePath );
#define DALI_DEMO_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* @param[in] layer The layer to add the actors to
* @param[in] count The number of actors to generate
- * @param[in] distanceField A array (pointer) to 2 distance field types to use
*/
- void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField );
-
- /**
- * Create a bitmap with the specified shape and also output a distance field
- *
- * @param[in] shapeType The shape to generate
- * @param[in] size The size of the bitmap to create
- * @param[out] distanceFieldOut The return depth field alpha map
- */
- void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut );
-
- /**
- * Generate a square bit pattern and depth field
- *
- * @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
- */
- void GenerateSquare( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut );
-
- /**
- * Generate a circle bit pattern and depth field
- *
- * @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<unsigned char>& distanceFieldOut, bool hollow = false );
+ void AddBackgroundActors( Dali::Actor layer, int count );
/**
* Creates the logo.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include "shared/utility.h"
const char* const STATIC_GIF_LOGO( DEMO_IMAGE_DIR "dali-logo-static.gif" );
const char* const ANIMATE_GIF_LOGO( DEMO_IMAGE_DIR "dali-logo-anim.gif" );
+const char* const ANIMATE_PIXEL_AREA( "Animate PixelArea" );
+const char* const ANIMATE_PIXEL_AREA_AND_SCALE( "Animate PixelArea & Scale" );
+
const Vector4 DIM_COLOR( 0.85f, 0.85f, 0.85f, 0.85f );
}
// Tie-in input event handlers:
stage.KeyEventSignal().Connect( this, &AnimatedImageController::OnKeyEvent );
- mActorDog = CreateGifViewWithOverlayButton( STATIC_GIF_DOG );
+ mActorDog = CreateGifViewWithOverlayPlayButton( STATIC_GIF_DOG );
mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
mActorDog.SetY( -100.f );
stage.Add( mActorDog );
- mActorLogo = CreateGifViewWithOverlayButton( STATIC_GIF_LOGO );
+ mActorLogo = CreateGifViewWithOverlayPlayButton( STATIC_GIF_LOGO );
mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mActorLogo.SetY( 100.f );
stage.Add( mActorLogo );
+
+ mTapDetector = TapGestureDetector::New();
+ mTapDetector.DetectedSignal().Connect( this, &AnimatedImageController::OnTap );
}
/**
* Create the gif image view with an overlay play button.
*/
- Toolkit::ImageView CreateGifViewWithOverlayButton( const std::string& gifUrl )
+ Toolkit::ImageView CreateGifViewWithOverlayPlayButton( const std::string& gifUrl )
{
Toolkit::ImageView imageView = Toolkit::ImageView::New( gifUrl );
imageView.SetParentOrigin( ParentOrigin::CENTER );
// Create a push button, and add it as child of the image view
Toolkit::PushButton animateButton = Toolkit::PushButton::New();
- animateButton.SetUnselectedImage( PLAY_ICON );
- animateButton.SetSelectedImage( PLAY_ICON_SELECTED );
+ animateButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON );
+ animateButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED );
animateButton.SetParentOrigin( ParentOrigin::CENTER );
animateButton.SetAnchorPoint( AnchorPoint::CENTER );
animateButton.ClickedSignal().Connect( this, &AnimatedImageController::OnPlayButtonClicked );
return imageView;
}
+ Toolkit::ImageView CreateGifViewWithAnimatePixelAreaButton( const std::string& gifUrl, WrapMode::Type wrapModeU, WrapMode::Type wrapModeV, const std::string& buttonLabel )
+ {
+ Toolkit::ImageView imageView = Toolkit::ImageView::New();
+ imageView.SetProperty( Toolkit::ImageView::Property::IMAGE,
+ Property::Map().Add( Toolkit::ImageVisual::Property::URL, gifUrl )
+ .Add( Toolkit::ImageVisual::Property::WRAP_MODE_U, wrapModeU )
+ .Add( Toolkit::ImageVisual::Property::WRAP_MODE_V, wrapModeV ));
+ imageView.SetParentOrigin( ParentOrigin::CENTER );
+
+ // Create a push button, and add it as child of the image view
+ Toolkit::PushButton animateButton = Toolkit::PushButton::New();
+ animateButton.SetProperty( Toolkit::Button::Property::LABEL, buttonLabel );
+ animateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ animateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ animateButton.SetY( 20.f );
+
+ animateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ animateButton.SetProperty( Actor::Property::INHERIT_SCALE, false );
+ imageView.Add( animateButton );
+
+ mTapDetector.Attach( animateButton );
+ mTapDetector.Attach( imageView );
+
+ return imageView;
+ }
+
bool OnPlayButtonClicked( Toolkit::Button button )
{
Stage stage = Stage::GetCurrent();
// remove the static gif view, the play button is also removed as its child.
stage.Remove( mActorDog );
- mActorDog = Toolkit::ImageView::New( ANIMATE_GIF_DOG );
- mActorDog.SetParentOrigin( ParentOrigin::CENTER );
+ mActorDog = CreateGifViewWithAnimatePixelAreaButton( ANIMATE_GIF_DOG, WrapMode::REPEAT, WrapMode::DEFAULT, ANIMATE_PIXEL_AREA_AND_SCALE );
mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
mActorDog.SetY( -100.f );
stage.Add( mActorDog );
// remove the static gif view, the play button is also removed as its child.
stage.Remove( mActorLogo );
- mActorLogo = Toolkit::ImageView::New( ANIMATE_GIF_LOGO );
- mActorLogo.SetParentOrigin( ParentOrigin::CENTER );
+ mActorLogo = CreateGifViewWithAnimatePixelAreaButton( ANIMATE_GIF_LOGO, WrapMode::DEFAULT, WrapMode::MIRRORED_REPEAT, ANIMATE_PIXEL_AREA );
mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mActorLogo.SetY( 100.f );
stage.Add( mActorLogo );
return true;
}
+ void OnTap(Dali::Actor actor, const Dali::TapGesture& tap)
+ {
+ if( actor.GetParent() == mActorDog ) // "Animate Pixel Area" button is clicked
+ {
+ Animation animation = Animation::New( 3.f );
+ animation.AnimateTo( Property( mActorDog, ImageView::Property::PIXEL_AREA ), Vector4( -1.0, 0.0, 3.f, 1.f ), AlphaFunction::SIN );
+ animation.AnimateTo( Property( mActorDog, Actor::Property::SCALE_X ), 3.f, AlphaFunction::SIN );
+ animation.Play();
+ }
+ else if( actor.GetParent() == mActorLogo ) // "Animate Pixel Area" button is clicked
+ {
+ Animation animation = Animation::New( 3.f );
+ animation.AnimateTo( Property( mActorLogo, ImageView::Property::PIXEL_AREA ), Vector4( 0.0, 1.0, 1.f, 1.f ), AlphaFunction::SIN );
+ animation.Play();
+ }
+ else if( actor == mActorDog ) // stop the animated gif, switch to static view
+ {
+ Stage stage = Stage::GetCurrent();
+ stage.Remove( mActorDog );
+
+ mActorDog = CreateGifViewWithOverlayPlayButton( STATIC_GIF_DOG );
+ mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ mActorDog.SetY( -100.f );
+ stage.Add( mActorDog );
+ }
+ else if( actor == mActorLogo ) // stop the animated gif, switch to static view
+ {
+ Stage stage = Stage::GetCurrent();
+ stage.Remove( mActorLogo );
+
+ mActorLogo = CreateGifViewWithOverlayPlayButton( STATIC_GIF_LOGO );
+ mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ mActorLogo.SetY( 100.f );
+ stage.Add( mActorLogo );
+ }
+ }
void OnKeyEvent(const KeyEvent& event)
{
Application& mApplication;
Toolkit::ImageView mActorDog;
Toolkit::ImageView mActorLogo;
+ TapGestureDetector mTapDetector;
};
// Entry point for Linux & Tizen applications
+++ /dev/null
-/*
- * 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 <dali/dali.h>
-#include <dali/devel-api/images/atlas.h>
-
-#include "shared/view.h"
-#include <iostream>
-#include <cstdio>
-
-using namespace Dali;
-
-class AtlasController;
-
-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 LOSE_CONTEXT_IMAGE( DEMO_IMAGE_DIR "icon-cluster-wobble.png" );
-const char * const LOSE_CONTEXT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-cluster-wobble-selected.png" );
-
-Application gApplication;
-AtlasController* gAtlasController(NULL);
-}
-
-class AtlasController : public ConnectionTracker
-{
-public:
-
- AtlasController( Application& application )
- : mApplication( application )
- {
- // Connect to the Application's Init signal
- mApplication.InitSignal().Connect( this, &AtlasController::Create );
- }
-
- ~AtlasController()
- {
- // Nothing to do here;
- }
-
- void Create( Application& application )
- {
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor(Color::YELLOW);
-
- // Respond to a click anywhere on the stage
- stage.KeyEventSignal().Connect(this, &AtlasController::OnKeyEvent);
-
- mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
-
- mContentLayer = DemoHelper::CreateView( mApplication,
- mView,
- mToolBar,
- BACKGROUND_IMAGE,
- TOOLBAR_IMAGE,
- "Atlas" );
-
- mLoseContextButton = Toolkit::PushButton::New();
- mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
- mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
- mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked );
- mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
-
- mAtlas = Atlas::New( 400,700, Pixel::RGBA8888);
- mAtlas.Clear(Vector4(0.f,0.5f,0.5f,0.25f));
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-change.png", 50, 30 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-cluster-carousel.png", 100, 30 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-effects-on.png", 150, 30 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-effect-cross.png", 100, 80 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-effect-fold.png", 150, 80 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-effect-wave.png", 200, 80 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-item-view-layout-depth.png", 150, 130 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-item-view-layout-grid.png", 200, 130 );
- mAtlas.Upload( DEMO_IMAGE_DIR "icon-item-view-layout-spiral.png", 250, 130 );
-
- UploadBufferImages();
- UploadPixelData();
-
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-1.jpg", 4, 304 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-2.jpg", 136, 304 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-3.jpg", 268, 304 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-4.jpg", 4, 436 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-5.jpg", 136, 436 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-6.jpg", 268, 436 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-7.jpg", 4, 568 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-7.jpg", 136, 568 );
- mAtlas.Upload( DEMO_IMAGE_DIR "gallery-small-7.jpg", 268, 568 );
-
-
- Toolkit::ImageView imageView = Toolkit::ImageView::New( mAtlas );
-
- imageView.SetParentOrigin(ParentOrigin::CENTER);
- mContentLayer.Add( imageView );
-
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.DetectedSignal().Connect( this, &AtlasController::OnPanGesture );
- mPanGestureDetector.Attach( imageView );
-
- stage.ContextLostSignal().Connect( this, &AtlasController::OnContextLost );
- stage.ContextRegainedSignal().Connect( this, &AtlasController::OnContextRegained );
- }
-
- void UploadBufferImages()
- {
- mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 1.f, 0.5f ), 80, 90 ), 0, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.75f, 0.5f ), 80, 80 ), 40, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.5f, 0.5f ), 80, 70 ), 80, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.25f, 0.5f ), 80, 60 ), 120, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.f, 0.5f ), 80, 50 ), 160, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(0.75f, 0.75f, 0.f, 0.5f ), 80, 40 ), 200, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(0.5f, 0.5f, 0.f, 0.5f ), 80, 30 ), 240, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(0.25f, 0.25f, 0.f, 0.5f ), 80, 20 ), 280, 210 );
- mAtlas.Upload( CreateBufferImage( Vector4(0.1f, 0.1f, 0.f, 0.5f ), 80, 10 ), 320, 210 );
- }
-
- void UploadPixelData()
- {
- mAtlas.Upload( CreatePixelData( Vector3(1.f, 1.f, 0.f ), 40, 40 ), 320, 30 );
- mAtlas.Upload( CreatePixelData( Vector3(0.f, 1.f, 1.f ), 40, 40 ), 320, 80 );
- mAtlas.Upload( CreatePixelData( Vector3(1.f, 0.f, 1.f ), 40, 40 ), 320, 130 );
- }
-
- static void NewWindow(void)
- {
- PositionSize posSize(0, 0, 720, 1280);
- gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
- }
-
- bool OnLoseContextButtonClicked( Toolkit::Button button )
- {
- // Add as an idle callback to avoid ProcessEvents being recursively called.
- mApplication.AddIdle(MakeCallback( AtlasController::NewWindow ));
- 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) )
- {
- mApplication.Quit();
- }
- }
- }
-
- void OnPanGesture( Actor actor, const PanGesture& gesture )
- {
- if( gesture.state == Gesture::Continuing )
- {
- actor.TranslateBy( Vector3( gesture.displacement ) );
- }
- }
-
- void OnContextLost()
- {
- printf("Stage reporting context loss\n");
- }
-
- void OnContextRegained()
- {
- printf("Stage reporting context regain\n");
- UploadBufferImages();
- UploadPixelData();
- }
-
-private:
-
- BufferImage CreateBufferImage( const Vector4& color, const unsigned int width, const unsigned int height )
- {
- BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
-
- // Create the image
- PixelBuffer* pixbuf = imageData.GetBuffer();
- const unsigned int bitmapSize = width * height;
- for( size_t i = 0; i < bitmapSize; ++i )
- {
- pixbuf[i*4+0] = 0xFF * color.r;
- pixbuf[i*4+1] = 0xFF * color.g;
- pixbuf[i*4+2] = 0xFF * color.b;
- pixbuf[i*4+3] = 0xFF * color.a;
- }
-
- return imageData;
- }
-
- PixelData CreatePixelData( const Vector3& color, const unsigned int width, const unsigned int height )
- {
- unsigned int size = width*height;
- unsigned int bufferSize = size * Pixel::GetBytesPerPixel(Pixel::RGB888);
- unsigned char* pixels = new unsigned char [bufferSize];
- for( unsigned int i = 0; i < size; i++ )
- {
- pixels[i*3u] = 0xFF * color.x;
- pixels[i*3u+1u] = 0xFF * color.y;
- pixels[i*3u+2u] = 0xFF * color.z;
- }
- return PixelData::New( pixels, bufferSize, width, height, Pixel::RGB888, PixelData::DELETE_ARRAY );
- }
-
-
-private:
- Application& mApplication;
- PanGestureDetector mPanGestureDetector;
-
- Toolkit::Control mView; ///< The View instance.
- Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
- Layer mContentLayer; ///< Content layer (scrolling cluster content)
- Toolkit::PushButton mLoseContextButton;
- Atlas mAtlas;
-};
-
-void RunTest( Application& application )
-{
- gAtlasController = new AtlasController(application);
- application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
-}
-
-// Entry point for Linux & Tizen applications
-//
-int DALI_EXPORT_API main( int argc, char **argv )
-{
- gApplication = Application::New( &argc, &argv, DEMO_THEME_PATH );
-
- RunTest( gApplication );
-
- return 0;
-}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include "shared/view.h"
#include "shared/utility.h"
// Add a button to change background. (right of toolbar)
mChangeBackgroundButton = Toolkit::PushButton::New();
- mChangeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON );
- mChangeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED );
+ mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON );
+ mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED );
mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked );
toolBar.AddControl( mChangeBackgroundButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add a button to change bubble shape. ( left of bar )
mChangeBubbleShapeButton = Toolkit::PushButton::New();
- mChangeBubbleShapeButton.SetUnselectedImage( CHANGE_BUBBLE_SHAPE_ICON );
- mChangeBubbleShapeButton.SetSelectedImage( CHANGE_BUBBLE_SHAPE_ICON_SELECTED );
+ mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON );
+ mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON_SELECTED );
mChangeBubbleShapeButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked );
toolBar.AddControl( mChangeBubbleShapeButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/devel-api/builder/builder.h>
#include <dali-toolkit/devel-api/builder/tree-node.h>
#include <dali-toolkit/devel-api/builder/json-parser.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
// Create an edit mode button. (left of toolbar)
Toolkit::PushButton backButton = Toolkit::PushButton::New();
- backButton.SetUnselectedImage( EDIT_IMAGE );
- backButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
+ backButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE );
+ backButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED );
backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed);
backButton.SetLeaveRequired( true );
mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mRadioButtonImage1.SetPosition( 0, DP(radioY) );
- mRadioButtonImage1.SetSelected( true );
+ mRadioButtonImage1.SetProperty( Toolkit::Button::Property::SELECTED, true );
imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) );
imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
// Create select button
mUpdateButton = Toolkit::PushButton::New();
- mUpdateButton.SetLabelText( "Select" );
+ mUpdateButton.SetProperty( Toolkit::Button::Property::LABEL, "Select" );
mUpdateButton.SetName( "selectButton" );
mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButton.SetPosition( 0, 0 );
- radioButton.SetSelected( true );
+ radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton );
{
mCheckboxButton1 = Toolkit::CheckBoxButton::New();
mCheckboxButton1.SetName( "checkbox1" );
- mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" );
+ mCheckboxButton1.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected" );
mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
{
mCheckboxButton2 = Toolkit::CheckBoxButton::New();
mCheckboxButton2.SetName( "checkbox2" );
- mCheckboxButton2.SetLabelText( "CheckBox2 is selected" );
- mCheckboxButton2.SetSelected( true );
+ mCheckboxButton2.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected" );
+ mCheckboxButton2.SetProperty( Toolkit::Button::Property::SELECTED, true );
mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
{
mCheckboxButton3 = Toolkit::CheckBoxButton::New();
mCheckboxButton3.SetName( "checkbox3" );
- mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" );
+ mCheckboxButton3.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected" );
mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
contentTable.Add( toggleBackground );
mToggleButton = Toolkit::PushButton::New();
- mToggleButton.SetTogglableButton( true );
- mToggleButton.SetLabelText( "Unselected" );
+ mToggleButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true );
+ mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" );
mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected );
Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button );
if( pushButton )
{
- if( button.IsSelected() )
+ bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
+ if( isSelected )
{
- pushButton.SetLabelText( "Selected" );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Selected" );
}
else
{
- pushButton.SetLabelText( "Unselected" );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" );
}
}
bool EnableSelectButton( Toolkit::Button button )
{
- if( button.GetName() == "radioSelectEnable" && button.IsSelected() == true )
+ bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
+ if( !isSelected )
{
- mUpdateButton.SetDisabled( false );
+ return true;
+ }
+
+ if( button.GetName() == "radioSelectEnable" )
+ {
+ mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, false );
- mRadioButtonImage1.SetDisabled( false );
- mRadioButtonImage2.SetDisabled( false );
- mRadioButtonImage3.SetDisabled( false );
+ mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, false );
+ mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, false );
+ mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, false );
- mCheckboxButton1.SetDisabled( false );
- mCheckboxButton2.SetDisabled( false );
- mCheckboxButton3.SetDisabled( false );
+ mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, false );
+ mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, false );
+ mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, false );
- mToggleButton.SetDisabled( false );
+ mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, false );
}
- else if( button.GetName() == "radioSelectDisable" && button.IsSelected() == true )
+ else if( button.GetName() == "radioSelectDisable" )
{
- mUpdateButton.SetDisabled( true );
+ mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, true );
- mRadioButtonImage1.SetDisabled( true );
- mRadioButtonImage2.SetDisabled( true );
- mRadioButtonImage3.SetDisabled( true );
+ mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, true );
+ mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, true );
+ mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, true );
- mCheckboxButton1.SetDisabled( true );
- mCheckboxButton2.SetDisabled( true );
- mCheckboxButton3.SetDisabled( true );
+ mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, true );
+ mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, true );
+ mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, true );
- mToggleButton.SetDisabled( true );
+ mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, true );
}
return true;
bool OnButtonClicked(Toolkit::Button button)
{
- if( mRadioButtonImage1.IsSelected() )
+ if( mRadioButtonImage1.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() )
{
mImage.SetImage( BIG_IMAGE_1 );
}
- else if( mRadioButtonImage2.IsSelected() )
+ else if( mRadioButtonImage2.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() )
{
mImage.SetImage( BIG_IMAGE_2 );
}
- else if( mRadioButtonImage3.IsSelected() )
+ else if( mRadioButtonImage3.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() )
{
mImage.SetImage( BIG_IMAGE_3 );
}
bool OnCheckBoxesSelected( Toolkit::Button button )
{
+ bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
if( button.GetName() == "checkbox1" )
{
- if( button.IsSelected() )
+ if( isSelected )
{
- button.SetLabelText("CheckBox1 is selected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is selected");
}
else
{
- button.SetLabelText("CheckBox1 is unselected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected");
}
}
if( button.GetName() == "checkbox2" )
{
- if( button.IsSelected() )
+ if( isSelected )
{
- button.SetLabelText("CheckBox2 is selected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected");
}
else
{
- button.SetLabelText("CheckBox2 is unselected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is unselected");
}
}
if( button.GetName() == "checkbox3" )
{
- if( button.IsSelected() )
+ if( isSelected )
{
- button.SetLabelText("CheckBox3 is selected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is selected");
}
else
{
- button.SetLabelText("CheckBox3 is unselected");
+ button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected");
}
}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+
+// INTERNAL INCLUDES
+#include "clipping-item-factory.h"
+#include "item-view-orientation-constraint.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const char * const APPLICATION_TITLE( "Clipping Controls" );
+const Vector3 APPLICATION_TITLE_PARENT_ORIGIN( 0.5f, 0.03f, 0.5f ); // Set the parent origin to a small percentage below the top (so the demo will scale for different resolutions).
+
+const Vector3 ITEM_VIEW_LAYOUT_SIZE_SCALE( 0.75f, 0.5f, 0.75f );
+const float ITEM_VIEW_BORDER_SIZE = 2.0f;
+const float ITEM_VIEW_MAXIMUM_ROTATION_IN_DEGREES = 20.0f;
+const float ITEM_VIEW_LAYOUT_POSITION_CHANGE_MULTIPLIER = 3.0f;
+const float ITEM_VIEW_ROTATION_ANIMATION_TIME = 0.2f;
+
+const char * const BUTTON_LABEL( "Toggle Clipping Mode" );
+} // unnamed namespace
+
+/**
+ * @brief Demonstrates the control clipping of a UI Control.
+ *
+ * When an Actor is set to clip its children, the renderers have to be added manually in order to specify what its children
+ * need to clip to. UI Controls automate the creation of the renderers/visuals when they are set to clip their children.
+ *
+ * This example displays an item-view whose clipping mode is toggled without the need for adding any renderers to it.
+ *
+ * Additionally, a constraint is used to modify the item-view's orientation.
+ */
+class ClippingExample : public ConnectionTracker
+{
+public:
+
+ /**
+ * @brief Constructor.
+ * @param[in] application A reference to the Application class.
+ */
+ ClippingExample( Application& application )
+ : mApplication( application )
+ {
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &ClippingExample::Create );
+ }
+
+private:
+
+ /**
+ * @brief Called to initialise the application content.
+ * @param[in] application A reference to the Application class.
+ */
+ void Create( Application& application )
+ {
+ // Hide the indicator bar
+ application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+
+ // Connect to the stage's key signal to allow Back and Escape to exit.
+ Stage stage = Dali::Stage::GetCurrent();
+ stage.KeyEventSignal().Connect( this, &ClippingExample::OnKeyEvent );
+
+ // Create a TextLabel for the application title.
+ Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE );
+ label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ label.SetParentOrigin( APPLICATION_TITLE_PARENT_ORIGIN );
+ label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
+ stage.Add( label );
+
+ // Create an item-view which clips its children.
+ mItemView = ItemView::New( mClippingItemFactory );
+ mItemView.SetParentOrigin( ParentOrigin::CENTER );
+ mItemView.SetAnchorPoint( AnchorPoint::CENTER );
+ mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); // Enable clipping. No need to create any renderers.
+ stage.Add( mItemView );
+
+ // Create a Spiral Layout and add it to the Item View.
+ mItemView.AddLayout( * DefaultItemLayout::New( DefaultItemLayout::SPIRAL ) );
+ stage.GetRootLayer().SetBehavior( Layer::LAYER_3D ); // The item-view spiral layout requires Layer 3D behaviour.
+
+ // Calculate the size we would like our item-view layout to be, and then activate the layout.
+ const Vector2 stageSize = stage.GetSize();
+ const Vector3 itemViewLayoutSize( ITEM_VIEW_LAYOUT_SIZE_SCALE.x * stageSize.x, ITEM_VIEW_LAYOUT_SIZE_SCALE.y * stageSize.y, ITEM_VIEW_LAYOUT_SIZE_SCALE.z * stageSize.x );
+ mItemView.ActivateLayout( 0, itemViewLayoutSize, 0.0f );
+
+ // Connect to the scroll started and completed signals to apply orientation constraints & animations.
+ mItemView.ScrollStartedSignal().Connect( this, &ClippingExample::ScrollStarted );
+ mItemView.ScrollCompletedSignal().Connect( this, &ClippingExample::ScrollCompleted );
+
+ // Create a constraint for the item-view which we apply when we start scrolling and remove when we stop.
+ mItemViewOrientationConstraint = Constraint::New< Quaternion >( mItemView, Actor::Property::ORIENTATION, ItemViewOrientationConstraint( ITEM_VIEW_MAXIMUM_ROTATION_IN_DEGREES, ITEM_VIEW_LAYOUT_POSITION_CHANGE_MULTIPLIER ) );
+ mItemViewOrientationConstraint.AddSource( LocalSource( ItemView::Property::LAYOUT_POSITION ) );
+
+ // Create a border around item-view (as item-view is clipping its children, we should NOT add this as a child of item-view).
+ Control border = Control::New();
+ border.SetParentOrigin( ParentOrigin::CENTER );
+ border.SetAnchorPoint( AnchorPoint::CENTER );
+ border.SetProperty( Control::Property::BACKGROUND,
+ Property::Map().Add( Visual::Property::TYPE, Visual::BORDER )
+ .Add( BorderVisual::Property::COLOR, Color::WHITE )
+ .Add( BorderVisual::Property::SIZE, 2.0f )
+ .Add( BorderVisual::Property::ANTI_ALIASING, true ) );
+ border.SetSize( Vector3( itemViewLayoutSize.x + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.y + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.z + ITEM_VIEW_BORDER_SIZE * 2.0f ) );
+ stage.Add( border );
+
+ // Constrain the border's orientation to the orientation of item-view.
+ Constraint constraint = Constraint::New< Quaternion >( border, Actor::Property::ORIENTATION, EqualToConstraint() );
+ constraint.AddSource( Source( mItemView, Actor::Property::ORIENTATION ) );
+ constraint.Apply();
+
+ // Create a button to toggle the clipping mode
+ PushButton button = Toolkit::PushButton::New();
+ button.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ button.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ button.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+ button.SetProperty( Button::Property::LABEL, BUTTON_LABEL );
+ button.ClickedSignal().Connect( this, &ClippingExample::OnButtonClicked );
+ stage.Add( button );
+ }
+
+ /**
+ * @brief Called when the item-view starts to scroll.
+ *
+ * Here we want to apply the item-view constraint.
+ */
+ void ScrollStarted( const Vector2& /* currentScrollPosition */ )
+ {
+ mItemViewOrientationConstraint.Apply();
+ }
+
+ /**
+ * @brief Called when the item-view scrolling completes.
+ *
+ * Here we remove the item-view orientation constraint and perform an animation to return the item-view back to base-rotation.
+ */
+ void ScrollCompleted( const Vector2& /* currentScrollPosition */ )
+ {
+ Animation animation = Animation::New( ITEM_VIEW_ROTATION_ANIMATION_TIME );
+ animation.AnimateTo( Property( mItemView, Actor::Property::ORIENTATION ), Quaternion( Degree( 0.0f ), Vector3::XAXIS ), AlphaFunction::EASE_IN_SINE );
+ animation.Play();
+
+ mItemViewOrientationConstraint.Remove();
+ }
+
+ /**
+ * @brief Called when any key event is received
+ *
+ * Will use this to quit the application if Back or the Escape key is received
+ * @param[in] event The key event information
+ */
+ void OnKeyEvent( const KeyEvent& event )
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+ {
+ mApplication.Quit();
+ }
+ }
+ }
+
+ /**
+ * @brief Called when the button is clicked.
+ *
+ * Will use this to toggle between the clipping modes.
+ * @param[in] button The button that has been clicked.
+ */
+ bool OnButtonClicked( Toolkit::Button button )
+ {
+ if( mItemView )
+ {
+ ClippingMode::Type currentMode = static_cast< ClippingMode::Type >( mItemView.GetProperty( Actor::Property::CLIPPING_MODE ).Get< int >() );
+ mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ( currentMode == ClippingMode::CLIP_CHILDREN ) ? ClippingMode::DISABLED : ClippingMode::CLIP_CHILDREN );
+ }
+ return true;
+ }
+
+ // Data
+
+ Application& mApplication; ///< Reference to the application class.
+ ItemView mItemView; ///< The item view which whose children we would like to clip.
+ ClippingItemFactory mClippingItemFactory; ///< The ItemFactory used to create our items.
+ Constraint mItemViewOrientationConstraint; ///< The constraint used to control the orientation of item-view.
+};
+
+int DALI_EXPORT_API main( int argc, char **argv )
+{
+ Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
+ ClippingExample test(app);
+ app.MainLoop();
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "clipping-item-factory.h"
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-map.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const char * IMAGE_PATHS[] = {
+ DEMO_IMAGE_DIR "gallery-medium-1.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-2.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-3.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-4.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-5.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-6.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-7.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-8.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-9.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-10.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-11.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-12.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-13.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-14.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-15.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-16.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-17.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-18.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-19.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-20.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-21.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-22.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-23.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-24.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-25.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-26.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-27.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-28.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-29.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-30.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-31.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-32.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-33.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-34.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-35.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-36.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-37.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-38.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-39.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-40.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-41.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-42.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-43.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-44.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-45.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-46.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-47.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-48.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-49.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-50.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-51.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-52.jpg",
+ DEMO_IMAGE_DIR "gallery-medium-53.jpg",
+};
+const unsigned int NUM_IMAGES = sizeof( IMAGE_PATHS ) / sizeof( char * );
+const unsigned int NUM_IMAGES_MULTIPLIER = 10;
+
+const float ITEM_BORDER_SIZE = 2.0f;
+} // unnamed namespace
+
+ClippingItemFactory::ClippingItemFactory()
+{
+}
+
+unsigned int ClippingItemFactory::GetNumberOfItems()
+{
+ return NUM_IMAGES * NUM_IMAGES_MULTIPLIER;
+}
+
+Actor ClippingItemFactory::NewItem( unsigned int itemId )
+{
+ // Create an image view for this item
+ ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] );
+
+ // Add a border image child actor
+ ImageView borderActor = ImageView::New();
+ borderActor.SetParentOrigin( ParentOrigin::CENTER );
+ borderActor.SetAnchorPoint( AnchorPoint::CENTER );
+ borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
+ borderActor.SetSizeModeFactor( Vector3( 2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f ) );
+ borderActor.SetColorMode( USE_PARENT_COLOR );
+ borderActor.SetProperty( ImageView::Property::IMAGE,
+ Property::Map().Add( Visual::Property::TYPE, Visual::BORDER )
+ .Add( BorderVisual::Property::COLOR, Color::WHITE )
+ .Add( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE )
+ .Add( BorderVisual::Property::ANTI_ALIASING, true ) );
+ actor.Add(borderActor);
+
+ return actor;
+}
--- /dev/null
+#ifndef CLIPPING_ITEM_FACTORY_H
+#define CLIPPING_ITEM_FACTORY_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+
+/**
+ * @brief Factory used to create the items required in the item-view used by this example.
+ */
+class ClippingItemFactory : public Dali::Toolkit::ItemFactory
+{
+public:
+
+ /**
+ * @brief Constructor
+ */
+ ClippingItemFactory();
+
+private: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems();
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Dali::Actor NewItem( unsigned int itemId );
+
+private:
+
+ ClippingItemFactory( const ClippingItemFactory& ); ///< Undefined
+ ClippingItemFactory& operator=( const ClippingItemFactory& ); ///< Undefined
+};
+
+#endif // CLIPPING_ITEM_FACTORY_H
--- /dev/null
+#ifndef ITEM_VIEW_ORIENTATION_CONSTRAINT_H
+#define ITEM_VIEW_ORIENTATION_CONSTRAINT_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/radian.h>
+#include <dali/public-api/math/vector3.h>
+
+/**
+ * @brief Constraint used to constrain the orientation of the item-view depending on the position within the layout.
+ */
+class ItemViewOrientationConstraint
+{
+public:
+
+ /**
+ * @brief Constructor.
+ * @param[in] maximumRotationInDegrees The maximum rotation (in degrees) that we should rotate the item-view by.
+ * @param[in] layoutPositionChangeMultiplier This value is used to multiply the change in layout position
+ * (in order to exaggerate the amount moved so it's more visible).
+ */
+ ItemViewOrientationConstraint( float maximumRotationInDegrees, float layoutPositionChangeMultiplier )
+ : mMaximumRotationInDegrees( maximumRotationInDegrees ),
+ mLayoutPositionChangeMultiplier( layoutPositionChangeMultiplier ),
+ mStartingLayoutPosition( 0.0f ),
+ mStartingAngle( 0.0f ),
+ mFirstCall( true )
+ {
+ }
+
+ /**
+ * @brief Will be called by the Constraint.
+ *
+ * The first time this operator is called, it uses the values as it's base reference.
+ * Thereafter, the position in the layout is used to determine the rotation around the X-Axis.
+ *
+ * @param[in] rotation The rotation of the item-view.
+ * @param[in] inputs The constraint inputs:
+ * [0] ItemView::Property::LAYOUT_POSITION, float
+ */
+ void operator()( Dali::Quaternion& rotation, const Dali::PropertyInputContainer& inputs )
+ {
+ const float& layoutPosition = inputs[ 0 ]->GetFloat();
+
+ // Store values for base reference when called the first call.
+ if( mFirstCall )
+ {
+ mStartingLayoutPosition = layoutPosition;
+
+ Dali::Vector3 axis;
+ Dali::Radian angleInRadians;
+ rotation.ToAxisAngle( axis, angleInRadians );
+ Dali::Degree angleInDegrees( angleInRadians ); // Convert to Degrees
+
+ mStartingAngle = angleInDegrees.degree;
+ if( axis.x < 0.0f ) // We only rotate round the X-Axis. So if the X-Axis is negative, then the angle is also a negative angle.
+ {
+ mStartingAngle = -mStartingAngle;
+ }
+
+ mFirstCall = false;
+ }
+ else
+ {
+ // All subsequent calls should tilt the orientation of the item-view around the X-Axis depending on how much our position has changed in the layout.
+
+ Dali::Degree angle( mStartingAngle + mLayoutPositionChangeMultiplier * ( mStartingLayoutPosition - layoutPosition ) );
+ Dali::ClampInPlace( angle.degree, -mMaximumRotationInDegrees, mMaximumRotationInDegrees ); // Ensure the angle does not exceed maximum specified (in both directions).
+ rotation = Dali::Quaternion( angle, Dali::Vector3::XAXIS );
+ }
+ }
+
+private:
+
+ const float mMaximumRotationInDegrees; ///< The maximum allowable rotation of the item-view.
+ const float mLayoutPositionChangeMultiplier; ///< This value is used to multiply the change in layout position.
+ float mStartingLayoutPosition; ///< The starting layout position.
+ float mStartingAngle; ///< The starting angle (in degrees) of the item-view.
+ bool mFirstCall; ///< A boolean to state whether this is the first time the operator() is called. Allows us to set the starting values.
+};
+
+#endif // ITEM_VIEW_ORIENTATION_CONSTRAINT_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
#include <dali-toolkit/devel-api/transition-effects/cube-transition-effect.h>
#include <dali-toolkit/devel-api/transition-effects/cube-transition-cross-effect.h>
#include <dali-toolkit/devel-api/transition-effects/cube-transition-fold-effect.h>
Vector2 mPanPosition;
Vector2 mPanDisplacement;
-
- Toolkit::PushButton mEffectChangeButton;
};
CubeTransitionApp::CubeTransitionApp( Application& application )
mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );
mContent.SetBehavior( Layer::LAYER_3D );
- // Add an effect-changing button on the right of the tool bar.
- mEffectChangeButton = Toolkit::PushButton::New();
- mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE );
- mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED );
- mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
- mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+
+ // Add an effect changing toggle button
+ Toolkit::ToggleButton effectChangeToggleButton = Toolkit::ToggleButton::ToggleButton::New();
+
+ effectChangeToggleButton.SetProperty( Toolkit::ToggleButton::Property::STATE_VISUALS,
+ Property::Array().Add( EFFECT_WAVE_IMAGE )
+ .Add( EFFECT_CROSS_IMAGE)
+ .Add( EFFECT_FOLD_IMAGE )
+ );
+
+ effectChangeToggleButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
+ mToolBar.AddControl( effectChangeToggleButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add title to the tool bar.
mTitle = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE );
//Add an slideshow icon on the right of the title
mSlideshowButton = Toolkit::PushButton::New();
- mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON );
- mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED );
mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked );
mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
{
mCurrentEffect = mCubeCrossEffect;
mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
- mEffectChangeButton.SetUnselectedImage( EFFECT_CROSS_IMAGE );
- mEffectChangeButton.SetSelectedImage( EFFECT_CROSS_IMAGE_SELECTED );
-
}
else if(mCurrentEffect == mCubeCrossEffect)
{
mCurrentEffect = mCubeFoldEffect;
mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
- mEffectChangeButton.SetUnselectedImage( EFFECT_FOLD_IMAGE );
- mEffectChangeButton.SetSelectedImage( EFFECT_FOLD_IMAGE_SELECTED );
}
else
{
mCurrentEffect = mCubeWaveEffect;
mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
- mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE );
- mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED );
}
mContent.Add( mCurrentEffect );
if( mSlideshow )
{
mPanGestureDetector.Detach( mContent );
- mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_STOP_ICON );
- mSlideshowButton.SetSelectedImage( SLIDE_SHOW_STOP_ICON_SELECTED );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON_SELECTED );
mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f );
mPanDisplacement = Vector2( -10.f, 0.f );
mViewTimer.Start();
else
{
mPanGestureDetector.Attach( mContent );
- mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON );
- mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON );
+ mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED );
mViewTimer.Stop();
}
return true;
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/shader-effects/dissolve-effect.h>
using namespace Dali;
// Add an effect-changing button on the right of the tool bar.
mEffectChangeButton = Toolkit::PushButton::New();
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE );
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED );
mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked );
mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add an slide-show button on the right of the title
mPlayStopButton = Toolkit::PushButton::New();
- mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON );
- mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED );
mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked );
mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
if(mUseHighPrecision)
{
mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) );
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE );
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED );
}
else
{
mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) );
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE );
- mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE_SELECTED );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE_SELECTED );
}
return true;
mSlideshow = !mSlideshow;
if( mSlideshow )
{
- mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, STOP_ICON );
- mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, STOP_ICON_SELECTED );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_ICON );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_ICON_SELECTED );
mPanGestureDetector.Detach( mParent );
mViewTimer.Start();
mTimerReady = false;
}
else
{
- mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON );
- mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON );
+ mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED );
mTimerReady = true;
mPanGestureDetector.Attach( mParent );
}
//
-// Copyright (c) 2016 Samsung Electronics Co., Ltd.
+// Copyright (c) 2017 Samsung Electronics Co., Ltd.
//
// Licensed under the Flora License, Version 1.0 (the License);
// you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/effects-view/effects-view.h>
#include <sstream>
// Creates view change button.
Toolkit::PushButton viewButton = Toolkit::PushButton::New();
- viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE );
- viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE );
+ viewButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, VIEW_SWAP_IMAGE );
+ viewButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, VIEW_SWAP_SELECTED_IMAGE );
// Connects the view change button clicked signal to the OnView method.
viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize );
mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
using namespace Dali;
using namespace Dali::Toolkit;
// Create a flex direction toggle button. (left of toolbar)
mFlexDirectionButton = Toolkit::PushButton::New();
mFlexDirectionButton.SetName("mFlexDirectionButton");
- mFlexDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-change.png" );
- mFlexDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-change-selected.png" );
+ mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change.png" );
+ mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change-selected.png" );
mFlexDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexDirectionButtonClicked);
mFlexDirectionButton.SetLeaveRequired( true );
mToolBar.AddControl( mFlexDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a flex wrap toggle button. (left of toolbar)
mFlexWrapButton = Toolkit::PushButton::New();
mFlexWrapButton.SetName("mFlexWrapButton");
- mFlexWrapButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-edit.png" );
- mFlexWrapButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-edit-selected.png" );
+ mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit.png" );
+ mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit-selected.png" );
mFlexWrapButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexWrapButtonClicked);
mFlexWrapButton.SetLeaveRequired( true );
mToolBar.AddControl( mFlexWrapButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a content direction toggle button. (left of toolbar)
mContentDirectionButton = Toolkit::PushButton::New();
mContentDirectionButton.SetName("mContentDirectionButton");
- mContentDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-replace.png" );
- mContentDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-replace-selected.png" );
+ mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace.png" );
+ mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace-selected.png" );
mContentDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnContentDirectionButtonClicked);
mContentDirectionButton.SetLeaveRequired( true );
mToolBar.AddControl( mContentDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a justify content toggle button. (right of toolbar)
mJustifyContentButton = Toolkit::PushButton::New();
mJustifyContentButton.SetName("mJustifyContentButton");
- mJustifyContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-reset.png" );
- mJustifyContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-reset-selected.png" );
+ mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset.png" );
+ mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset-selected.png" );
mJustifyContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnJustifyContentButtonClicked);
mJustifyContentButton.SetLeaveRequired( true );
mToolBar.AddControl( mJustifyContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a align items toggle button. (right of toolbar)
mAlignItemsButton = Toolkit::PushButton::New();
mAlignItemsButton.SetName("mAlignItemsButton");
- mAlignItemsButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-highp.png" );
- mAlignItemsButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-highp-selected.png" );
+ mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp.png" );
+ mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp-selected.png" );
mAlignItemsButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignItemsButtonClicked);
mAlignItemsButton.SetLeaveRequired( true );
mToolBar.AddControl( mAlignItemsButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a align content toggle button. (right of toolbar)
mAlignContentButton = Toolkit::PushButton::New();
mAlignContentButton.SetName("mAlignContentButton");
- mAlignContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-effect-cross.png" );
- mAlignContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" );
+ mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross.png" );
+ mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross-selected.png" );
mAlignContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignContentButtonClicked);
mAlignContentButton.SetLeaveRequired( true );
mToolBar.AddControl( mAlignContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Set different background colour to help to identify different items
flexItem.SetBackgroundColor(Vector4(static_cast<float>(i) / NUM_FLEX_ITEMS, static_cast<float>(NUM_FLEX_ITEMS - i) / NUM_FLEX_ITEMS, 1.0f, 1.0f));
- flexItem.SetUnselectedImage("");
- flexItem.SetSelectedImage("");
+ flexItem.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, "" );
+ flexItem.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, "" );
// Add a label to the button so that we can identify each item more easily
std::ostringstream index;
index << i + 1;
- flexItem.SetLabelText(index.str());
+ flexItem.SetProperty( Toolkit::Button::Property::LABEL, index.str() );
flexItem.SetName("FlexItem " + index.str());
// Set a fixed size to the items so that we can wrap the line and test these
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
using namespace Dali;
using namespace Dali::Toolkit;
mLeftLabel.SetAnchorPoint( AnchorPoint::CENTER );
mLeftLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mLeftLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) );
- mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 ));
+ mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND,
+ Property::Map().Add( Visual::Property::TYPE, Visual::COLOR )
+ .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 ) ) );
mLeftLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White.
mLeftLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLeftLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mRightLabel.SetAnchorPoint( AnchorPoint::CENTER );
mRightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mRightLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) );
- mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 ));
+ mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND,
+ Property::Map().Add( Visual::Property::TYPE, Visual::COLOR )
+ .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 ) ) );
mRightLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White.
mRightLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mRightLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include "shared/view.h"
using namespace Dali;
APPLICATION_TITLE );
PushButton changeButton = Toolkit::PushButton::New();
- changeButton.SetUnselectedImage( CHANGE_ICON );
- changeButton.SetSelectedImage( CHANGE_ICON_SELECTED );
+ changeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_ICON );
+ changeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_ICON_SELECTED );
changeButton.ClickedSignal().Connect( this, &GradientController::OnChangeIconClicked );
toolBar.AddControl( changeButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetStyleName( STYLE_BUTTON_TEXT );
button.SetName( id );
- button.SetLabelText( label );
+ button.SetProperty( Toolkit::Button::Property::LABEL, label );
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( id );
- button.SetLabelText( id );
+ button.SetProperty( Toolkit::Button::Property::LABEL, id );
button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
if( button.GetName() == modeName )
{
mFittingMode = mode;
- mFittingModeButton.SetLabelText( modeName );
+ mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName );
ResizeImage();
mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
mPopup.Reset();
if( button.GetName() == modeName )
{
mSamplingMode = mode;
- mSamplingModeButton.SetLabelText( modeName );
+ mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName );
ResizeImage();
mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
mPopup.Reset();
else if ( event.keyPressedName == "f" )
{
mSamplingMode = NextFilterMode( mSamplingMode );
- mSamplingModeButton.SetLabelText( StringFromFilterMode( mSamplingMode ) );
+ mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromFilterMode( mSamplingMode ) );
}
// Cycle filter and scaling modes:
else if ( event.keyPressedName == "s" )
{
mFittingMode = NextScalingMode( mFittingMode );
- mFittingModeButton.SetLabelText( StringFromScalingMode( mFittingMode ) );
+ mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromScalingMode( mFittingMode ) );
}
else
{
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <algorithm>
#include <map>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <iostream>
// INTERNAL INCLUDES
// Create an image scaling toggle button. (right of toolbar)
Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New();
- toggleScalingButton.SetUnselectedImage( TOGGLE_SCALING_IMAGE );
- toggleScalingButton.SetSelectedImage( TOGGLE_SCALING_IMAGE_SELECTED );
+ toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE );
+ toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE_SELECTED );
toggleScalingButton.ClickedSignal().Connect( this, &ImageScalingIrregularGridController::OnToggleScalingTouched );
mToolBar.AddControl( toggleScalingButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+
#include "shared/view.h"
using namespace Dali;
// 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.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_ICON );
+ switchButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_ICON_SELECTED );
switchButton.ClickedSignal().Connect( this, &ImageViewPixelAreaApp::OnButtonClicked );
toolBar.AddControl( switchButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
// Push button, for changing the image set for displaying
Toolkit::PushButton changeButton = Toolkit::PushButton::New();
- changeButton.SetLabelText( "Next" );
+ changeButton.SetProperty( Toolkit::Button::Property::LABEL, "Next" );
changeButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
changeButton.SetParentOrigin( ParentOrigin::TOP_RIGHT );
stage.Add( changeButton );
// Push button, for resetting the actor size and position
Toolkit::PushButton resetButton = Toolkit::PushButton::New();
- resetButton.SetLabelText( "Reset" );
+ resetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" );
resetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
resetButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
stage.Add( resetButton );
buttonsTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
Toolkit::PushButton button = Toolkit::PushButton::New();
- button.SetLabelText( "Toggle on/off stage" );
+ button.SetProperty( Toolkit::Button::Property::LABEL, "Toggle on/off stage" );
button.SetParentOrigin( ParentOrigin::CENTER );
button.SetAnchorPoint( AnchorPoint::CENTER );
button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnStage );
buttonsTable.AddChild( button, Toolkit::TableView::CellPosition( 0, 0 ) );
Toolkit::PushButton button2 = Toolkit::PushButton::New();
- button2.SetLabelText( "Change Image" );
+ button2.SetProperty( Toolkit::Button::Property::LABEL, "Change Image" );
button2.SetParentOrigin( ParentOrigin::CENTER );
button2.SetAnchorPoint( AnchorPoint::CENTER );
button2.ClickedSignal().Connect( this, &ImageViewController::ChangeImageClicked );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
using namespace Dali;
using namespace Dali::Toolkit;
// Create an edit mode button. (left of toolbar)
Toolkit::PushButton editButton = Toolkit::PushButton::New();
- editButton.SetUnselectedImage( EDIT_IMAGE );
- editButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
+ editButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE );
+ editButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED );
editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked);
editButton.SetLeaveRequired( true );
mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create a layout toggle button. (right of toolbar)
mLayoutButton = Toolkit::PushButton::New();
- mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE );
- mLayoutButton.SetSelectedImage(SPIRAL_LAYOUT_IMAGE_SELECTED );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED );
mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked);
mLayoutButton.SetLeaveRequired( true );
mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
mDeleteButton.SetDrawMode( DrawMode::OVERLAY_2D );
- mDeleteButton.SetUnselectedImage( DELETE_IMAGE );
- mDeleteButton.SetSelectedImage( DELETE_IMAGE_SELECTED );
- mDeleteButton.SetBackgroundImage( TOOLBAR_IMAGE );
+ mDeleteButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DELETE_IMAGE );
+ mDeleteButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DELETE_IMAGE_SELECTED );
+ mDeleteButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
mDeleteButton.SetLeaveRequired( true );
mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
mInsertButton.SetDrawMode( DrawMode::OVERLAY_2D );
- mInsertButton.SetUnselectedImage( INSERT_IMAGE );
- mInsertButton.SetSelectedImage( INSERT_IMAGE_SELECTED );
- mInsertButton.SetBackgroundImage( TOOLBAR_IMAGE );
+ mInsertButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, INSERT_IMAGE );
+ mInsertButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, INSERT_IMAGE_SELECTED );
+ mInsertButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
mInsertButton.SetLeaveRequired( true );
mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
mReplaceButton.SetDrawMode( DrawMode::OVERLAY_2D );
- mReplaceButton.SetUnselectedImage( REPLACE_IMAGE );
- mReplaceButton.SetSelectedImage( REPLACE_IMAGE_SELECTED );
- mReplaceButton.SetBackgroundImage( TOOLBAR_IMAGE );
+ mReplaceButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE );
+ mReplaceButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE_SELECTED );
+ mReplaceButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
mReplaceButton.SetLeaveRequired( true );
{
case SPIRAL_LAYOUT:
{
- mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE );
- mLayoutButton.SetSelectedImage( SPIRAL_LAYOUT_IMAGE_SELECTED );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED );
break;
}
case GRID_LAYOUT:
{
- mLayoutButton.SetUnselectedImage( GRID_LAYOUT_IMAGE );
- mLayoutButton.SetSelectedImage( GRID_LAYOUT_IMAGE_SELECTED );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE_SELECTED );
break;
}
case DEPTH_LAYOUT:
{
- mLayoutButton.SetUnselectedImage( DEPTH_LAYOUT_IMAGE );
- mLayoutButton.SetSelectedImage( DEPTH_LAYOUT_IMAGE_SELECTED );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE );
+ mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE_SELECTED );
break;
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
radio.SetParentOrigin( ParentOrigin::TOP_LEFT );
radio.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- radio.SetSelected( i == 0 );
+ radio.SetProperty( Toolkit::Button::Property::SELECTED, i == 0 );
radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed );
mButtons[i] = radio;
modeSelectTableView.AddChild( radio, Toolkit::TableView::CellPosition( i, 0 ) );
elementCountTableView.SetFitWidth( 1 );
elementCountTableView.SetFitWidth( 2 );
mMinusButton = Toolkit::PushButton::New();
- mMinusButton.SetLabelText( "<<" );
+ mMinusButton.SetProperty( Toolkit::Button::Property::LABEL, "<<" );
mMinusButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
mMinusButton.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
Toolkit::PushButton mPlusButton = Toolkit::PushButton::New();
- mPlusButton.SetLabelText( ">>" );
+ mPlusButton.SetProperty( Toolkit::Button::Property::LABEL, ">>" );
mPlusButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
mPlusButton.SetAnchorPoint( AnchorPoint::CENTER_RIGHT );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButton.SetPosition( DP(radioX), DP(radioY) );
- radioButton.SetSelected( true );
+ radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( CREATE_BUTTON_ID );
- button.SetLabelText( CREATE_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, CREATE_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( DELETE_BUTTON_ID );
- button.SetLabelText( DELETE_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, DELETE_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( START_BUTTON_ID );
- button.SetLabelText( START_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, START_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( STOP_BUTTON_ID );
- button.SetLabelText( STOP_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, STOP_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( ENABLE_BUTTON_ID );
- button.SetLabelText( ENABLE_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, ENABLE_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( DISABLE_BUTTON_ID );
- button.SetLabelText( DISABLE_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, DISABLE_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT );
radioButton.SetName( FREQUENCY_2_RADIO_ID );
- radioButton.SetSelected( true );
+ radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect );
{
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetName( VSYNC_BUTTON_ID );
- button.SetLabelText( VSYNC_BUTTON_TEXT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, VSYNC_BUTTON_TEXT);
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
<< ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped")
<< ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled");
- mLogRadioButtons[i].SetLabelText( ss.str() );
+ mLogRadioButtons[i].SetProperty( Toolkit::Button::Property::LABEL, ss.str() );
}
}
bool LoggingRadioSelect( Toolkit::Button button )
{
- if( button.GetName() == LOGGER_1_RADIO_ID && button.IsSelected() == true )
+ bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
+ if( !isSelected )
+ {
+ return true;
+ }
+
+ if( button.GetName() == LOGGER_1_RADIO_ID )
{
mCurrentLogger = 0;
}
- else if( button.GetName() == LOGGER_2_RADIO_ID && button.IsSelected() == true )
+ else if( button.GetName() == LOGGER_2_RADIO_ID )
{
mCurrentLogger = 1;
}
- else if( button.GetName() == LOGGER_3_RADIO_ID && button.IsSelected() == true )
+ else if( button.GetName() == LOGGER_3_RADIO_ID )
{
mCurrentLogger = 2;
}
const unsigned int frequency = mLoggerStates[mCurrentLogger].frequency;
if( frequency == HIGH_FREQUENCY )
{
- mFrequencyRadioButtons[0].SetSelected( true );
+ mFrequencyRadioButtons[0].SetProperty( Toolkit::Button::Property::SELECTED, true );
}
else if( frequency == MEDIUM_FREQUENCY )
{
- mFrequencyRadioButtons[1].SetSelected( true );
+ mFrequencyRadioButtons[1].SetProperty( Toolkit::Button::Property::SELECTED, true );
}
else if( frequency == LOW_FREQUENCY )
{
- mFrequencyRadioButtons[2].SetSelected( true );
+ mFrequencyRadioButtons[2].SetProperty( Toolkit::Button::Property::SELECTED, true );
}
}
bool FrequencyRadioSelect( Toolkit::Button button )
{
- if( button.GetName() == FREQUENCY_1_RADIO_ID && button.IsSelected() == true )
+ bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
+ if( !isSelected )
+ {
+ return true;
+ }
+
+ if( button.GetName() == FREQUENCY_1_RADIO_ID )
{
if( mPerformanceLoggers[mCurrentLogger] )
{
mLoggerStates[mCurrentLogger].frequency = HIGH_FREQUENCY;
}
}
- else if( button.GetName() == FREQUENCY_2_RADIO_ID && button.IsSelected() == true )
+ else if( button.GetName() == FREQUENCY_2_RADIO_ID )
{
if( mPerformanceLoggers[mCurrentLogger] )
{
mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY;
}
}
- else if( button.GetName() == FREQUENCY_3_RADIO_ID && button.IsSelected() == true )
+ else if( button.GetName() == FREQUENCY_3_RADIO_ID )
{
if( mPerformanceLoggers[mCurrentLogger] )
{
modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked );
modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER );
modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- modelButton.SetLabelText( "Model" );
+ modelButton.SetProperty( Toolkit::Button::Property::LABEL, "Model" );
positionActorModel.Add( modelButton );
//Create button for shading mode changing.
shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked );
shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- shadingModeButton.SetLabelText( "Shading Mode" );
+ shadingModeButton.SetProperty( Toolkit::Button::Property::LABEL, "Shading Mode" );
positionActorModel.Add( shadingModeButton );
//Text label title for changing model or shading mode.
pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked );
pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) );
pauseButton.SetAnchorPoint( AnchorPoint::CENTER );
- pauseButton.SetLabelText( PAUSE );
+ pauseButton.SetProperty( Toolkit::Button::Property::LABEL, PAUSE );
layer.Add( pauseButton );
//Actor for positioning light position buttons.
lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked );
lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER );
lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- lightModeButton.SetLabelText( FIXED );
+ lightModeButton.SetProperty( Toolkit::Button::Property::LABEL, FIXED );
positionActorLight.Add( lightModeButton );
//Create button for switching between front and back light position.
lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked );
lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- lightSideButton.SetLabelText( FRONT );
+ lightSideButton.SetProperty( Toolkit::Button::Property::LABEL, FRONT );
positionActorLight.Add( lightSideButton );
//Text label title for light position mode.
mModels[i].rotationAnimation.Pause();
}
- button.SetLabelText( PLAY );
+ button.SetProperty( Toolkit::Button::Property::LABEL, PLAY );
}
else //Unpause all animations again.
{
mModels[i].rotationAnimation.Play();
}
- button.SetLabelText( PAUSE );
+ button.SetProperty( Toolkit::Button::Property::LABEL, PAUSE );
}
return true;
if( mLightFixed )
{
- button.SetLabelText( FIXED );
+ button.SetProperty( Toolkit::Button::Property::LABEL, FIXED );
}
else
{
- button.SetLabelText( MANUAL );
+ button.SetProperty( Toolkit::Button::Property::LABEL, MANUAL );
}
SetLightMode();
if( mLightFront )
{
- button.SetLabelText( FRONT );
+ button.SetProperty( Toolkit::Button::Property::LABEL, FRONT );
}
else
{
- button.SetLabelText( BACK );
+ button.SetProperty( Toolkit::Button::Property::LABEL, BACK );
}
//Change light image.
editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeModelClicked);
editButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
editButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- editButton.SetLabelText( "Change Model" );
+ editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Model" );
mButtonLayer.Add( editButton );
// Create button for shader changing
editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeLightingClicked);
editButton.SetParentOrigin( ParentOrigin::TOP_RIGHT );
editButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
- editButton.SetLabelText( "Change Shader" );
+ editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Shader" );
mButtonLayer.Add( editButton );
// Create button for pause/resume animation
editButton.ClickedSignal().Connect( this, &Model3dViewController::OnPauseAnimationsClicked);
editButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
editButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- editButton.SetLabelText( "Pause Animations" );
+ editButton.SetProperty( Toolkit::Button::Property::LABEL, "Pause Animations" );
mButtonLayer.Add( editButton );
//Create animations
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
-#include <dali-toolkit/devel-api/controls/popup/popup.h>
using namespace Dali;
using namespace Dali::Toolkit;
//Add an effects icon on the right of the title
mActorEffectsButton = Toolkit::PushButton::New();
- mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED );
mActorEffectsButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnEffectButtonClicked );
mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
// Creates a mode button.
// Create a effect toggle button. (right of toolbar)
Toolkit::PushButton layoutButton = Toolkit::PushButton::New();
- layoutButton.SetUnselectedImage( LAYOUT_IMAGE );
- layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED );
+ layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE );
+ layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED );
layoutButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnLayoutButtonClicked);
layoutButton.SetLeaveRequired( true );
mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
if(!mActorEffectsEnabled)
{
mActorEffectsEnabled = true;
- mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED );
}
else
{
mActorEffectsEnabled = false;
- mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED );
}
}
DeviceOrientation mOrientation; ///< Current Device orientation
Animation mRotateAnimation; ///< Animation for rotating between landscape and portrait.
-
- Popup mInstructionsPopup; ///< Info Popup
};
void RunTest(Application& app)
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h>
using namespace Dali;
//Add an slideshow icon on the right of the title
mActorEffectsButton = Toolkit::PushButton::New();
- mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED );
mActorEffectsButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnEffectButtonClicked );
mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
// Creates a mode button.
// Create a effect toggle button. (right of toolbar)
Toolkit::PushButton layoutButton = Toolkit::PushButton::New();
- layoutButton.SetUnselectedImage( LAYOUT_IMAGE );
- layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED );
+ layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE );
+ layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED );
layoutButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnLayoutButtonClicked);
layoutButton.SetLeaveRequired( true );
mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
if(!mActorEffectsEnabled)
{
mActorEffectsEnabled = true;
- mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED );
}
else
{
mActorEffectsEnabled = false;
- mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON );
- mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON );
+ mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED );
}
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent);
mButtonRefreshAlways = PushButton::New();
- mButtonRefreshAlways.SetTogglableButton( true );
- mButtonRefreshAlways.SetSelected( true );
- mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" );
+ mButtonRefreshAlways.SetProperty( Button::Property::TOGGLABLE, true );
+ mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, true );
+ mButtonRefreshAlways.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ALWAYS" );
mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT );
mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
stage.Add( mButtonRefreshAlways );
mButtonRefreshOnce = PushButton::New();
- mButtonRefreshOnce.SetLabelText( "Refresh ONCE" );
+ mButtonRefreshOnce.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ONCE" );
mButtonRefreshOnce.SetParentOrigin( ParentOrigin::TOP_RIGHT );
mButtonRefreshOnce.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
bool OnButtonSelected( Toolkit::Button button )
{
+ bool isSelected = mButtonRefreshAlways.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
+
Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button );
if( pushButton == mButtonRefreshAlways )
{
- if( mButtonRefreshAlways.IsSelected() )
+ if( isSelected )
{
mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
}
}
else if( pushButton == mButtonRefreshOnce )
{
- if( mButtonRefreshAlways.IsSelected() )
+ if( isSelected )
{
- mButtonRefreshAlways.SetSelected( false );
+ mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, false );
}
mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <cstdio>
}
mLoseContextButton = Toolkit::PushButton::New();
- mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
- mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
+ mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE );
+ mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED );
mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked );
mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
Toolkit::PushButton button = Toolkit::PushButton::New();
button.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
button.SetParentOrigin( ParentOrigin::TOP_RIGHT );
- button.SetUnselectedImage( CHANGE_IMAGE_ICON );
- button.SetSelectedImage( CHANGE_IMAGE_ICON_SELECTED );
+ button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON );
+ button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON_SELECTED );
button.SetLeaveRequired( true );
button.SetScale(1.5f);
button.PressedSignal().Connect( this, &PageTurnController::OnButtonClicked );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
// Create animation button.
mAnimationButton = Toolkit::PushButton::New();
- mAnimationButton.SetUnselectedImage( ANIMATION_FADE_ICON_IMAGE );
- mAnimationButton.SetSelectedImage( ANIMATION_ZOOM_ICON_IMAGE );
- mAnimationButton.SetTogglableButton( true );
+ mAnimationButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, ANIMATION_FADE_ICON_IMAGE );
+ mAnimationButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, ANIMATION_ZOOM_ICON_IMAGE );
+ mAnimationButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true );
mAnimationButton.ClickedSignal().Connect( this, &PopupExample::OnAnimationClicked );
mToolBar.AddControl( mAnimationButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create context button.
mContextButton = Toolkit::PushButton::New();
- mContextButton.SetUnselectedImage( CONTEXT_DISABLED_ICON_IMAGE );
- mContextButton.SetSelectedImage( CONTEXT_ENABLED_ICON_IMAGE );
- mContextButton.SetTogglableButton( true );
+ mContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CONTEXT_DISABLED_ICON_IMAGE );
+ mContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CONTEXT_ENABLED_ICON_IMAGE );
+ mContextButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true );
mContextButton.ClickedSignal().Connect( this, &PopupExample::OnContextClicked );
mToolBar.AddControl( mContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
bool OnContextClicked( Toolkit::Button button )
{
- mContextual = button.IsSelected();
+ mContextual = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
return true;
}
bool OnAnimationClicked( Toolkit::Button button )
{
- mAnimationFade = !button.IsSelected();
+ mAnimationFade = ! ( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() );
return true;
}
{
Toolkit::PushButton okayButton = Toolkit::PushButton::New();
okayButton.SetName( POPUP_CONTROL_OK_NAME );
- okayButton.SetLabelText( "OK!" );
+ okayButton.SetProperty( Toolkit::Button::Property::LABEL, "OK!" );
okayButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
{
Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME );
- cancelButton.SetLabelText( "Cancel" );
+ cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" );
cancelButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
{
Toolkit::PushButton popupButton = Toolkit::PushButton::New();
popupButton.SetName( POPUP_BUTTON_ITEMS[ itemId ].name );
- popupButton.SetLabelText( POPUP_BUTTON_ITEMS[ itemId ].text );
+ popupButton.SetProperty( Toolkit::Button::Property::LABEL, POPUP_BUTTON_ITEMS[ itemId ].text );
popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
popupButton.ClickedSignal().Connect( this, &PopupExample::OnButtonClicked );
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
#include <dali-toolkit/dali-toolkit.h>
#include <dali/public-api/object/property-map.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/public-api/controls/slider/slider.h>
using namespace Dali;
button.SetAnchorPoint( AnchorPoint::CENTER );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
button.SetPadding( Padding( elementPadding, elementPadding, elementPadding, elementPadding ) );
- button.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) );
- button.SetProperty( Button::Property::SELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) );
+ button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] );
+ button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] );
button.RegisterProperty( "modelNumber", Property::Value( modelNumber ) );
button.ClickedSignal().Connect( this, &PrimitiveShapesController::OnChangeShapeClicked );
namespace
{
-
+const char * const THEME_PATH( DEMO_STYLE_DIR "progress-bar-example-theme.json" ); ///< The theme used for this example
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 int MARGIN_SIZE = 10;
const int TOP_MARGIN = 85;
+const unsigned int TIMER_TIMEOUT_TIME = 50;
+const float PROGRESS_INCREMENT_VALUE = 0.01f;
+
} // namespace
-/** This example shows how to create and use PROGRESS BAR.
+/**
+ * @brief Shows how to create a default progress bar and custom styled progress bars.
*/
-
class ProgressBarExample: public ConnectionTracker
{
public:
mApplication.InitSignal().Connect( this, &ProgressBarExample::Create );
}
- ~ProgressBarExample()
- {
- // Nothing to do here
- }
+private:
void Create( Application& application )
{
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);
+ mProgressBarDefault = ProgressBar::New();
+ mProgressBarDefault.SetParentOrigin(ParentOrigin::TOP_CENTER);
+ mProgressBarDefault.SetAnchorPoint(AnchorPoint::TOP_CENTER);
+ mProgressBarDefault.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
+ mProgressBarDefault.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
+
+ mProgressBarCustomStyle1 = ProgressBar::New();
+ mProgressBarCustomStyle1.SetStyleName( "ProgressBarCustomStyle1" );
+ mProgressBarCustomStyle1.SetParentOrigin(ParentOrigin::TOP_CENTER);
+ mProgressBarCustomStyle1.SetAnchorPoint(AnchorPoint::TOP_CENTER);
+ mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
+ mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
+
+ mProgressBarCustomStyle2 = ProgressBar::New();
+ mProgressBarCustomStyle2.SetStyleName( "ProgressBarCustomStyle2" );
+ mProgressBarCustomStyle2.SetParentOrigin(ParentOrigin::TOP_CENTER);
+ mProgressBarCustomStyle2.SetAnchorPoint(AnchorPoint::TOP_CENTER);
+ mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
+ mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1);
contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
mContentLayer.Add( contentTable );
// Image selector for progress bar
- Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 );
+ Toolkit::TableView progressBackground = Toolkit::TableView::New( 3, 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 );
+
+ for( unsigned int i = 0; i < progressBackground.GetRows(); ++i )
+ {
+ progressBackground.SetFitHeight( i );
+ }
+
contentTable.Add( progressBackground );
- progressBackground.Add( mProgressBar );
+ progressBackground.Add( mProgressBarDefault );
+ progressBackground.Add( mProgressBarCustomStyle1 );
+ progressBackground.Add( mProgressBarCustomStyle2 );
// Create buttons
- Toolkit::TableView buttonBackground = Toolkit::TableView::New( 2, 1 );
+ Toolkit::TableView buttonBackground = Toolkit::TableView::New( 1, 1 );
buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR );
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.SetProperty( Toolkit::Button::Property::LABEL, "Reset" );
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:
+ // Create a timer to update the progress of all progress bars
+ mTimer = Timer::New( TIMER_TIMEOUT_TIME );
+ mTimer.TickSignal().Connect( this, &ProgressBarExample::OnTimerTick );
+ mTimer.Start();
+ }
+
+ bool OnTimerTick()
+ {
+ mProgressValue += PROGRESS_INCREMENT_VALUE;
+ mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
+ mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
+ mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
+
+ return ( mProgressValue < 1.0f ); // Only call again if progress has NOT got to the end
+ }
+
+ bool OnResetProgressButtonSelected( Toolkit::Button button )
+ {
+ mProgressValue = 0.0f;
+ mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ mTimer.Start();
+ 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();
+ }
+ }
+ }
+
+ // Data
Application& mApplication;
+ Timer mTimer;
Toolkit::Control mView; ///< The View instance.
Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
Layer mContentLayer; ///< Content layer.
- ProgressBar mProgressBar;
- Toolkit::PushButton mSetProgressButton;
+ ProgressBar mProgressBarDefault;
+ ProgressBar mProgressBarCustomStyle1;
+ ProgressBar mProgressBarCustomStyle2;
Toolkit::PushButton mResetProgressButton;
float mProgressValue;
};
-void RunTest( Application& application )
+int DALI_EXPORT_API main( int argc, char **argv )
{
+ Application application = Application::New( &argc, &argv, THEME_PATH );
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;
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <fstream>
#include <sstream>
// Add a button to change background. (right of toolbar)
mChangeTextureButton = Toolkit::PushButton::New();
- mChangeTextureButton.SetUnselectedImage( CHANGE_TEXTURE_ICON );
- mChangeTextureButton.SetSelectedImage( CHANGE_TEXTURE_ICON_SELECTED );
+ mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON );
+ mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON_SELECTED );
mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture );
toolBar.AddControl( mChangeTextureButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add a button to change mesh pattern. ( left of bar )
mChangeMeshButton = Toolkit::PushButton::New();
- mChangeMeshButton.SetUnselectedImage( CHANGE_MESH_ICON );
- mChangeMeshButton.SetSelectedImage( CHANGE_MESH_ICON_SELECTED );
+ mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON );
+ mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON_SELECTED );
mChangeMeshButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeMesh );
toolBar.AddControl( mChangeMeshButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
using namespace Dali;
using namespace Dali::Toolkit;
const char * const APPLICATION_TITLE( "ScrollView" );
const char * const EFFECT_CAROUSEL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-carousel.png" );
const char * const EFFECT_CAROUSEL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-carousel-selected.png" );
+const char * const EFFECT_CUBE_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube.png" );
+const char * const EFFECT_CUBE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube-selected.png" );
+const char * const EFFECT_SPIRAL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-spiral.png" );
+const char * const EFFECT_SPIRAL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-spiral-selected.png" );
+const char * const EFFECT_WAVE_IMAGE( DEMO_IMAGE_DIR "icon-effect-wave.png" );
+const char * const EFFECT_WAVE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-wave-selected.png" );
const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f);
mEffectIcon[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE;
mEffectIconSelected[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED;
- mEffectIcon[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE;
- mEffectIconSelected[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED;
- mEffectIcon[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE;
- mEffectIconSelected[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED;
- mEffectIcon[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE;
- mEffectIconSelected[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED;
+ mEffectIcon[ PageCubeEffect ] = EFFECT_CUBE_IMAGE;
+ mEffectIconSelected[ PageCubeEffect ] = EFFECT_CUBE_IMAGE_SELECTED;
+ mEffectIcon[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE;
+ mEffectIconSelected[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE_SELECTED;
+ mEffectIcon[ PageWaveEffect ] = EFFECT_WAVE_IMAGE;
+ mEffectIconSelected[ PageWaveEffect ] = EFFECT_WAVE_IMAGE_SELECTED;
// Create a effect change button. (right of toolbar)
mEffectChangeButton = Toolkit::PushButton::New();
ss << APPLICATION_TITLE << ": " << EFFECT_MODE_NAME[mEffectMode];
SetTitle(ss.str());
- mEffectChangeButton.SetUnselectedImage( mEffectIcon[ mEffectMode ] );
- mEffectChangeButton.SetSelectedImage( mEffectIconSelected[ mEffectMode ] );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, mEffectIcon[ mEffectMode ] );
+ mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, mEffectIconSelected[ mEffectMode ] );
// remove old Effect if exists.
if(mScrollViewEffect)
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
#include <iostream>
// Add an effect-changing button on the right of the tool bar.
Toolkit::PushButton effectChangeButton = Toolkit::PushButton::New();
- effectChangeButton.SetUnselectedImage( CHANGE_EFFECT_IMAGE );
- effectChangeButton.SetSelectedImage( CHANGE_EFFECT_IMAGE_SELECTED );
+ effectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE );
+ effectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE_SELECTED );
effectChangeButton.ClickedSignal().Connect( this, &TestApp::OnEffectButtonClicked );
toolBar.AddControl( effectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
//Add a reset button
Toolkit::PushButton resetButton = Toolkit::PushButton::New();
- resetButton.SetUnselectedImage( RESET_ICON );
- resetButton.SetSelectedImage( RESET_ICON_SELECTED );
+ resetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_ICON );
+ resetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_ICON_SELECTED );
resetButton.ClickedSignal().Connect( this, &TestApp::OnResetPressed );
toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
{
Toolkit::PushButton popupButton = Toolkit::PushButton::New();
popupButton.SetName( TABLEVIEW_BUTTON_ITEMS[ itemId ].name );
- popupButton.SetLabelText( TABLEVIEW_BUTTON_ITEMS[ itemId ].text );
+ popupButton.SetProperty( Toolkit::Button::Property::LABEL, TABLEVIEW_BUTTON_ITEMS[ itemId ].text );
popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform mediump vec4 uColor;\n
+ uniform mediump vec4 mixColor;\n
uniform mediump vec3 uChannels;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ;\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * mixColor * uColor * vec4(uChannels, 1.0) ;\n
}\n
);
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// External includes
#include <dali-toolkit/dali-toolkit.h>
-//#include <dali-toolkit/devel-api/controls/slider/slider.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include "image-channel-control.h"
#include <cstdio>
#include <sstream>
mRadioButtons[i].SetName( radioButtonStyleName.str() );
mRadioButtons[i].SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtons[i].SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mRadioButtons[i].SetSelected( false );
+ mRadioButtons[i].SetProperty( Button::Property::SELECTED, false );
mRadioButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnButtonStateChange );
radioButtonsLayout.AddChild( mRadioButtons[i], TableView::CellPosition( i, 0 ) );
radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
}
- mRadioButtons[0].SetSelected( true );
+ mRadioButtons[0].SetProperty( Button::Property::SELECTED, true );
mImagePlacement = Actor::New();
mImagePlacement.SetParentOrigin( ParentOrigin::CENTER );
mIcc1.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
mIcc1.SetParentOrigin( ParentOrigin::CENTER );
mIcc1.SetVisibility( true );
-
+
mImagePlacement.Add( mIcc1 );
mIcc2 = ImageChannelControl::New( BIG_IMAGE_2 );
mCheckButtons[i].SetName( checkBoxStyleName.str() );
mCheckButtons[i].SetParentOrigin( ParentOrigin::CENTER );
mCheckButtons[i].SetAnchorPoint( AnchorPoint::CENTER );
- mCheckButtons[i].SetSelected( true );
+ mCheckButtons[i].SetProperty( Button::Property::SELECTED, true );
mCheckButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnCheckButtonChange );
mCheckButtons[i].RegisterProperty( "channel", i, Property::READ_WRITE );
}
mResetButton = PushButton::New();
- mResetButton.SetLabelText( "Reset" );
+ mResetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" );
mResetButton.SetName("ResetButton");
mResetButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mResetButton.ClickedSignal().Connect( this, &StylingApplication::OnResetClicked );
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" );
+ mThemeButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Lite" ); // Lightweight changes on top of Dali
+ mThemeButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "App1" ); // Different application style
+ mThemeButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "App2" );
contentLayout.Add( themeButtonLayout );
}
PushButton okayButton = PushButton::New();
okayButton.SetName( POPUP_CONTROL_OK_NAME );
okayButton.SetStyleName( POPUP_CONTROL_OK_NAME );
- okayButton.SetLabelText( "Ok!" );
+ okayButton.SetProperty( Toolkit::Button::Property::LABEL, "Ok!" );
okayButton.ClickedSignal().Connect( this, &StylingApplication::OnReset );
okayButton.SetParentOrigin( ParentOrigin::CENTER );
okayButton.SetAnchorPoint( AnchorPoint::CENTER );
PushButton cancelButton = PushButton::New();
cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME );
cancelButton.SetStyleName( POPUP_CONTROL_CANCEL_NAME );
- cancelButton.SetLabelText( "Cancel" );
+ cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" );
cancelButton.ClickedSignal().Connect( this, &StylingApplication::OnResetCancelled );
cancelButton.SetParentOrigin( ParentOrigin::CENTER );
cancelButton.SetAnchorPoint( AnchorPoint::CENTER );
// Todo: save / restore slider states per image
- if( button.IsSelected() )
+ if( button.GetProperty<bool>(Button::Property::SELECTED) )
{
ImageChannelControl prevIcc = mImageChannelControl;
- if( mRadioButtons[0].IsSelected() )
+ if( mRadioButtons[0].GetProperty<bool>(Button::Property::SELECTED) )
{
mImageChannelControl = mIcc1;
}
- else if( mRadioButtons[1].IsSelected() )
+ else if( mRadioButtons[1].GetProperty<bool>(Button::Property::SELECTED) )
{
mImageChannelControl = mIcc2;
}
- else if( mRadioButtons[2].IsSelected() )
+ else if( mRadioButtons[2].GetProperty<bool>(Button::Property::SELECTED) )
{
mImageChannelControl = mIcc3;
}
{
int channel = button.GetProperty<int>( index );
float value = mChannelSliders[channel].GetProperty<float>( Slider::Property::VALUE );
- if( !button.IsSelected() )
+ if( !button.GetProperty<bool>(Button::Property::SELECTED) )
{
// "Turn off" the channel's contribution
value = 0.0f;
if( index != Property::INVALID_INDEX )
{
int channel = slider.GetProperty<int>( index );
- if( mCheckButtons[channel].IsSelected() )
+ if( mCheckButtons[channel].GetProperty<bool>(Button::Property::SELECTED) )
{
Property::Index channelIndex = GetChannelProperty( channel );
mImageChannelControl.SetProperty(channelIndex, value/100.0f);
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
#include "shared/view.h"
#include "shared/utility.h"
// Add a button to change background. (right of toolbar)
Toolkit::PushButton changeBackgroundButton = Toolkit::PushButton::New();
- changeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON );
- changeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED );
+ changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON );
+ changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED );
+
changeBackgroundButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBackgroundIconClicked );
mToolBar.AddControl( changeBackgroundButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
// Add a button to change the blur view. (left of toolbar)
Toolkit::PushButton changeBlurButton = Toolkit::PushButton::New();
- changeBlurButton.SetUnselectedImage( CHANGE_BLUR_ICON );
- changeBlurButton.SetSelectedImage( CHANGE_BLUR_ICON_SELECTED );
+ changeBlurButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON );
+ changeBlurButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON_SELECTED );
+
changeBlurButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBlurIconClicked );
mToolBar.AddControl( changeBlurButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
-#include <iostream>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <sstream>
// INTERNAL INCLUDES
mColorButtonOption.SetParentOrigin( ParentOrigin::CENTER );
mColorButtonOption.SetAnchorPoint( AnchorPoint::CENTER );
- mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, Color::BLACK );
- mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, Color::BLACK );
+ SetButtonColor( mColorButtonOption, Color::BLACK );
mColorButtonOption.ClickedSignal().Connect( this, &TextEditorExample::OnChangeColorButtonClicked );
mColorContainer.Add( mColorButtonOption );
s << "color" << index;
button.SetName( s.str() );
- button.SetProperty( Button::Property::UNSELECTED_COLOR, COLORS[index] );
- button.SetProperty( Button::Property::SELECTED_COLOR, COLORS[index] );
+ SetButtonColor( button, COLORS[index] );
button.ClickedSignal().Connect( this, &TextEditorExample::OnColorButtonClicked );
mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color );
}
- mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color );
- mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color );
+ SetButtonColor( mColorButtonOption, color );
mButtonContainer.SetVisible( false );
mButtonContainer.SetSensitive( false );
if( TextEditor::InputStyle::NONE != static_cast<TextEditor::InputStyle::Mask>( mask & TextEditor::InputStyle::COLOR ) )
{
const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
-
- mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color );
- mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color );
+ SetButtonColor( mColorButtonOption, color );
}
editor.Reset();
}
+ void SetButtonColor( Button& button, const Vector4& color )
+ {
+ Property::Map colorVisualMap;
+ colorVisualMap.Add( Visual::Property::TYPE, Visual::COLOR )
+ .Add( ColorVisual::Property::MIX_COLOR, color );
+
+ button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, colorVisualMap );
+ button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, colorVisualMap );
+ }
+
private:
Application& mApplication;
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <iostream>
#include <dali/public-api/events/touch-point.h>
PushButton CreateFolderButton()
{
PushButton button = PushButton::New();
- button.SetUnselectedImage( FOLDER_ICON_IMAGE );
- button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE );
+ button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE );
+ button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE );
button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE );
{
Property::Value text = mField.GetProperty( TextField::Property::TEXT );
mButtonLabel = text.Get< std::string >();
- mButton.SetLabelText( mButtonLabel );
+ mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel );
}
// Hide & discard the pop-up
{
Property::Value text = mField.GetProperty( TextField::Property::TEXT );
mButtonLabel = text.Get< std::string >();
- mButton.SetLabelText( mButtonLabel );
+ mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel );
mField.ClearKeyInputFocus();
}
break;
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "beat-control-impl.h"
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/public-api/object/type-registry-helper.h>
-#include <dali-toolkit/devel-api/align-enums.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
-
-#include <cstdio>
-
-using namespace Dali; // Needed for macros
-using namespace Dali::Toolkit;
-
-namespace Demo
-{
-namespace Internal
-{
-
-namespace
-{
-
-
-Dali::BaseHandle Create()
-{
- return Demo::BeatControl::New();
-}
-
-DALI_TYPE_REGISTRATION_BEGIN( BeatControl, Dali::Toolkit::Control, Create );
-
-DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "bounceTransition", STRING, BOUNCE_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "leftTransition", STRING, LEFT_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "upTransition", STRING, UP_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "beatVisual", MAP, BEAT_VISUAL );
-DALI_TYPE_REGISTRATION_END();
-
-
-Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value )
-{
- Toolkit::TransitionData transitionData;
-
- if( value.GetType() == Property::ARRAY )
- {
- transitionData = Toolkit::TransitionData::New( *value.GetArray());
- }
- else if( value.GetType() == Property::MAP )
- {
- transitionData = Toolkit::TransitionData::New( *value.GetMap() );
- }
- return transitionData;
-}
-
-} // anonymous namespace
-
-
-Internal::BeatControl::BeatControl()
-: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) )
-{
-}
-
-Internal::BeatControl::~BeatControl()
-{
-}
-
-Demo::BeatControl Internal::BeatControl::New()
-{
- IntrusivePtr<Internal::BeatControl> impl = new Internal::BeatControl();
- Demo::BeatControl handle = Demo::BeatControl( *impl );
- impl->Initialize();
- return handle;
-}
-
-
-void BeatControl::StartBounceAnimation()
-{
- if( mAnimation )
- {
- mAnimation.Stop();
- mAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnBounceAnimationFinished );
- OnBounceAnimationFinished(mAnimation);
- }
-
- mAnimation = CreateTransition( mBounceTransition );
- mAnimation.FinishedSignal().Connect( this, &BeatControl::OnBounceAnimationFinished );
- mAnimation.Play();
-}
-
-
-void BeatControl::StartXAnimation()
-{
- if( mXAnimation )
- {
- mXAnimation.Stop();
- mXAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnXAnimationFinished );
- OnXAnimationFinished(mXAnimation);
- }
-
- mXAnimation = CreateTransition( mLeftTransition );
- mXAnimation.FinishedSignal().Connect( this, &BeatControl::OnXAnimationFinished );
- mXAnimation.Play();
-}
-
-void BeatControl::StartYAnimation()
-{
- if( mYAnimation )
- {
- mYAnimation.Stop();
- mYAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnYAnimationFinished );
- OnYAnimationFinished(mYAnimation);
- }
-
- mYAnimation = CreateTransition( mUpTransition );
- mYAnimation.FinishedSignal().Connect( this, &BeatControl::OnYAnimationFinished );
- mYAnimation.Play();
-}
-
-
-void BeatControl::OnBounceAnimationFinished( Animation& src )
-{
- // Do stuff
-}
-void BeatControl::OnXAnimationFinished( Animation& src )
-{
- // Do stuff
-}
-void BeatControl::OnYAnimationFinished( Animation& src )
-{
- // Do stuff
-}
-
-void BeatControl::OnInitialize()
-{
- Actor self = Self();
-}
-
-void BeatControl::OnStageConnection( int depth )
-{
- Control::OnStageConnection( depth );
-}
-
-void BeatControl::OnStageDisconnection()
-{
- Control::OnStageDisconnection();
-}
-
-void BeatControl::OnSizeSet( const Vector3& targetSize )
-{
- Control::OnSizeSet( targetSize );
- RelayoutVisuals( Vector2( targetSize ) );
-}
-
-void BeatControl::OnRelayout( const Vector2& targetSize, RelayoutContainer& container )
-{
- RelayoutVisuals( targetSize );
-}
-
-void BeatControl::RelayoutVisuals( const Vector2& targetSize )
-{
- if( mVisual )
- {
- Vector2 size( targetSize );
- Property::Map transformMap;
- // Make the visual half the size of the control, but leave
- // origin and anchor point at center, position is relative, but Zer0
- transformMap[ DevelVisual::Transform::Property::SIZE ] = Vector2(0.5, 0.5);
- mVisual.SetTransformAndSize( transformMap, size );
-
- // @todo We must stop this clashing with a transform animation
- }
-}
-
-Vector3 BeatControl::GetNaturalSize()
-{
- if( mVisual )
- {
- Vector2 naturalSize;
- mVisual.GetNaturalSize(naturalSize);
- return Vector3(naturalSize);
- }
- return Vector3::ZERO;
-}
-
-void BeatControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
-{
- // Chain up.
- Control::OnStyleChange( styleManager, change );
-}
-
-
-///////////////////////////////////////////////////////////
-//
-// Properties
-//
-
-void BeatControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
-{
- Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) );
-
- if( beatControl )
- {
- BeatControl& impl = GetImpl( beatControl );
- Actor self = impl.Self();
- switch ( index )
- {
- case Demo::BeatControl::Property::BEAT_VISUAL:
- {
- Property::Map* map = value.GetMap();
- if( map )
- {
- impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map );
- impl.RegisterVisual( Demo::BeatControl::Property::BEAT_VISUAL, impl.mVisual );
- }
- break;
- }
- case Demo::BeatControl::Property::BOUNCE_TRANSITION:
- {
- impl.mBounceTransition = ConvertPropertyToTransition( value );
- break;
- }
- case Demo::BeatControl::Property::LEFT_TRANSITION:
- {
- impl.mLeftTransition = ConvertPropertyToTransition( value );
- break;
- }
- case Demo::BeatControl::Property::UP_TRANSITION:
- {
- impl.mUpTransition = ConvertPropertyToTransition( value );
- break;
- }
- }
- }
-}
-
-Property::Value BeatControl::GetProperty( BaseObject* object, Property::Index propertyIndex )
-{
- Property::Value value;
-
- Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) );
-
- if ( beatControl )
- {
- BeatControl& impl = GetImpl( beatControl );
- switch ( propertyIndex )
- {
- case Demo::BeatControl::Property::BEAT_VISUAL:
- {
- if( impl.mVisual )
- {
- Property::Map map;
- impl.mVisual.CreatePropertyMap(map);
- value = map;
- }
- break;
- }
- case Demo::BeatControl::Property::BOUNCE_TRANSITION:
- default:
- break;
- }
- }
-
- return value;
-}
-
-
-} // Internal
-} // Demo
+++ /dev/null
-#ifndef DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H
-#define DALI_DEMO_INTERNAL_BEAT_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 "beat-control.h"
-#include <dali/public-api/animation/animation.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
-#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
-
-namespace Demo
-{
-
-namespace Internal // To use TypeRegistry, handle and body classes need the same name
-{
-
-class BeatControl : public Dali::Toolkit::Internal::Control
-{
-public:
- /**
- * Instantiate a new BeatControl object
- */
- static Demo::BeatControl New();
- BeatControl();
- ~BeatControl();
-
-public: // API
- void StartBounceAnimation();
-
- void StartXAnimation();
-
- void StartYAnimation();
-
-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::OnRelayout()
- */
- virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container );
- /**
- * @copydoc Toolkit::Control::GetNaturalSize
- */
- virtual Dali::Vector3 GetNaturalSize();
-
- /**
- * @copydoc Toolkit::Control::OnStyleChange
- */
- virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change );
-
-private:
- void OnBounceAnimationFinished( Dali::Animation& handle );
- void OnXAnimationFinished( Dali::Animation& src );
- void OnYAnimationFinished( Dali::Animation& src );
-
- /**
- * Relayout the visuals as a result of size negotiation
- */
- void RelayoutVisuals( const Dali::Vector2& targetSize );
-
-private:
- //undefined
- BeatControl( const BeatControl& );
- BeatControl& operator=( const BeatControl& );
-
-private:
- // Implementation details
- Dali::Toolkit::Visual::Base mVisual;
- Dali::Toolkit::TransitionData mBounceTransition;
- Dali::Toolkit::TransitionData mLeftTransition;
- Dali::Toolkit::TransitionData mUpTransition;
- Dali::Animation mAnimation;
- Dali::Animation mXAnimation;
- Dali::Animation mYAnimation;
-};
-
-} // Internal
-
-inline Internal::BeatControl& GetImpl( Demo::BeatControl& handle )
-{
- DALI_ASSERT_ALWAYS( handle );
- Dali::RefObject& object = handle.GetImplementation();
- return static_cast<Internal::BeatControl&>(object);
-}
-
-inline const Internal::BeatControl& GetImpl( const Demo::BeatControl& handle )
-{
- DALI_ASSERT_ALWAYS( handle );
- const Dali::RefObject& object = handle.GetImplementation();
- return static_cast<const Internal::BeatControl&>(object);
-}
-
-} // Demo
-
-#endif // DALI_DEMO_BEAT_CONTROL_IMPL_H
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "beat-control.h"
-#include "beat-control-impl.h"
-
-namespace Demo
-{
-
-BeatControl::BeatControl()
-{
-}
-
-BeatControl::BeatControl( const BeatControl& beatControl )
-: Control( beatControl )
-{
-}
-
-BeatControl& BeatControl::operator= ( const BeatControl& rhs )
-{
- if( &rhs != this )
- {
- Control::operator=( rhs );
- }
- return *this;
-}
-
-BeatControl::~BeatControl()
-{
-}
-
-BeatControl BeatControl::New()
-{
- BeatControl beatControl = Internal::BeatControl::New();
- return beatControl;
-}
-
-BeatControl BeatControl::New( const std::string& url )
-{
- BeatControl beatControl = Internal::BeatControl::New();
- return beatControl;
-}
-
-BeatControl BeatControl::DownCast( BaseHandle handle )
-{
- return Control::DownCast< BeatControl, Internal::BeatControl > ( handle );
-}
-
-void BeatControl::StartBounceAnimation()
-{
- GetImpl(*this).StartBounceAnimation();
-}
-
-void BeatControl::StartXAnimation()
-{
- GetImpl(*this).StartXAnimation();
-}
-void BeatControl::StartYAnimation()
-{
- GetImpl(*this).StartYAnimation();
-}
-
-
-BeatControl::BeatControl( Internal::BeatControl& implementation )
-: Control( implementation )
-{
-}
-
-BeatControl::BeatControl( Dali::Internal::CustomActor* internal )
-: Control( internal )
-{
- VerifyCustomActorPointer< Internal::BeatControl >( internal ) ;
-}
-
-
-} //namespace Demo
+++ /dev/null
-#ifndef DALI_DEMO_BEAT_CONTROL_H
-#define DALI_DEMO_BEAT_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 <dali-toolkit/dali-toolkit.h>
-#include <string>
-
-namespace Demo
-{
-
-namespace Internal
-{
-// All type registered types need to have the same name for the body and the handle
-class BeatControl;
-}
-
-/**
- * Control that allows the RGB channels of an image to be altered.
- */
-class BeatControl : 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
- {
- BOUNCE_TRANSITION = PROPERTY_START_INDEX,
- LEFT_TRANSITION,
- UP_TRANSITION,
- BEAT_VISUAL
- };
- };
-
-public: // Construction / destruction
-
- /**
- * Create an uninitialized handle
- */
- BeatControl();
-
- /**
- * Create a new image channel control without an image. Use
- * SetImage to give this control an image
- */
- static BeatControl New();
-
- /**
- * Create a new image channel control from a given URL
- */
- static BeatControl New( const std::string& url );
-
- /**
- * Destructor. This is non-virtual since derived Handle types must not
- * contain data or virtual methods
- */
- ~BeatControl();
-
- /**
- * Copy Constructor
- */
- BeatControl( const BeatControl& beatControl );
-
- /**
- * Assignment Operator
- */
- BeatControl& operator=( const BeatControl& beatControl );
-
- /**
- * Downcast
- */
- static BeatControl DownCast( BaseHandle handle );
-
-public: // API
-
- void StartBounceAnimation();
-
- void StartXAnimation();
-
- void StartYAnimation();
-
-public: // Not for public use
- /**
- * Create a handle from an implementation
- */
- BeatControl( Internal::BeatControl& implementation );
-
- /**
- * Allow the creation of an BeatControl handle from an internal CustomActor pointer
- */
- BeatControl( Dali::Internal::CustomActor* internal );
-};
-
-} // namespace Demo
-
-#endif // DALI_DEMO_BEAT_CONTROL_H
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "shadow-button-impl.h"
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali-toolkit/devel-api/align-enums.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+
+#include <cstdio>
+
+using namespace Dali; // Needed for macros
+using namespace Dali::Toolkit;
+
+namespace Demo
+{
+namespace Internal
+{
+
+namespace
+{
+
+
+Dali::BaseHandle Create()
+{
+ return Demo::ShadowButton::New();
+}
+
+DALI_TYPE_REGISTRATION_BEGIN( ShadowButton, Dali::Toolkit::Button, Create );
+
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "activeTransition", ARRAY, ACTIVE_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "inactiveTransition", ARRAY, INACTIVE_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkTransition", ARRAY, CHECK_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "uncheckTransition", ARRAY, UNCHECK_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "backgroundVisual", MAP, BACKGROUND_VISUAL );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxBgVisual", MAP, CHECKBOX_BG_VISUAL );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxFgVisual", MAP, CHECKBOX_FG_VISUAL );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "labelVisual", MAP, LABEL_VISUAL );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, ACTIVE_STATE );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, CHECK_STATE );
+
+DALI_TYPE_REGISTRATION_END();
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_PROPERTIES )
+{ "backgroundVisual", Demo::ShadowButton::Property::BACKGROUND_VISUAL },
+{ "checkboxBgVisual", Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL},
+{ "checkboxFgVisual", Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL},
+{ "labelVisual", Demo::ShadowButton::Property::LABEL_VISUAL}
+DALI_ENUM_TO_STRING_TABLE_END( VISUAL_PROPERTIES )
+
+Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value )
+{
+ Toolkit::TransitionData transitionData;
+
+ if( value.GetType() == Property::ARRAY )
+ {
+ transitionData = Toolkit::TransitionData::New( *value.GetArray());
+ }
+ else if( value.GetType() == Property::MAP )
+ {
+ transitionData = Toolkit::TransitionData::New( *value.GetMap() );
+ }
+ return transitionData;
+}
+
+} // anonymous namespace
+
+
+Internal::ShadowButton::ShadowButton()
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mCheckState(false),
+ mActiveState(false)
+{
+}
+
+Internal::ShadowButton::~ShadowButton()
+{
+}
+
+Demo::ShadowButton Internal::ShadowButton::New()
+{
+ IntrusivePtr<Internal::ShadowButton> impl = new Internal::ShadowButton();
+ Demo::ShadowButton handle = Demo::ShadowButton( *impl );
+ impl->Initialize();
+ return handle;
+}
+
+void ShadowButton::SetActiveState( bool active )
+{
+ if( active != mActiveState )
+ {
+ mActiveState = active;
+ if( active )
+ {
+ StartTransition( Demo::ShadowButton::Property::ACTIVE_TRANSITION );
+ }
+ else
+ {
+ StartTransition( Demo::ShadowButton::Property::INACTIVE_TRANSITION );
+ }
+ }
+}
+
+bool ShadowButton::GetActiveState()
+{
+ return mActiveState;
+}
+
+void ShadowButton::SetCheckState( bool checkState )
+{
+ mCheckState = checkState;
+ EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, true );
+ if( Self().OnStage() )
+ {
+ if( checkState )
+ {
+ StartTransition( Demo::ShadowButton::Property::CHECK_TRANSITION );
+ }
+ else
+ {
+ StartTransition( Demo::ShadowButton::Property::UNCHECK_TRANSITION );
+ }
+ }
+ RelayoutRequest();
+}
+
+bool ShadowButton::GetCheckState()
+{
+ return mCheckState;
+}
+
+void ShadowButton::StartTransition( Property::Index transitionId )
+{
+ Transitions::iterator iter = FindTransition( transitionId );
+ if( iter != mTransitions.end() )
+ {
+ if( iter->mAnimation )
+ {
+ iter->mAnimation.Stop();
+ iter->mPlaying = false;
+
+ iter->mAnimation.FinishedSignal().Disconnect( this, &ShadowButton::OnTransitionFinished );
+ }
+
+ iter->mAnimation = CreateTransition( iter->mTransitionData );
+ StoreTargetLayouts( iter->mTransitionData );
+
+ iter->mAnimation.FinishedSignal().Connect( this, &ShadowButton::OnTransitionFinished );
+ iter->mAnimation.Play();
+ iter->mPlaying = true;
+ }
+}
+
+void ShadowButton::OnTransitionFinished( Animation& src )
+{
+ ShadowButton::Transitions::iterator iter = mTransitions.begin();
+ for( ; iter != mTransitions.end(); ++iter )
+ {
+ if( iter->mAnimation == src )
+ {
+ iter->mPlaying = false;
+ iter->mAnimation.Reset(); // Remove the animation when it's finished.
+ switch( iter->mTransitionId )
+ {
+ case Demo::ShadowButton::Property::ACTIVE_TRANSITION:
+ {
+ // Consider relayouting the text.
+ break;
+ }
+ case Demo::ShadowButton::Property::INACTIVE_TRANSITION:
+ {
+ // Consider relayouting the text.
+ break;
+ }
+ case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
+ {
+ EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, false );
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
+
+void ShadowButton::OnInitialize()
+{
+ Actor self = Self();
+}
+
+void ShadowButton::OnStageConnection( int depth )
+{
+ Control::OnStageConnection( depth );
+}
+
+void ShadowButton::OnStageDisconnection()
+{
+ Control::OnStageDisconnection();
+}
+
+void ShadowButton::OnSizeSet( const Vector3& targetSize )
+{
+ Control::OnSizeSet( targetSize );
+ RelayoutVisuals( Vector2( targetSize ) );
+}
+
+void ShadowButton::OnRelayout( const Vector2& targetSize, RelayoutContainer& container )
+{
+ RelayoutVisuals( targetSize );
+}
+
+void ShadowButton::RelayoutVisuals( const Vector2& targetSize )
+{
+ bool transitioning = false;
+ ShadowButton::Transitions::iterator iter = mTransitions.begin();
+ for( ; iter != mTransitions.end(); ++iter )
+ {
+ if( iter->mPlaying == true )
+ {
+ transitioning = true;
+ break;
+ }
+ }
+
+ if( ! transitioning )
+ {
+ for( ShadowButton::Transforms::iterator iter = mTransforms.begin();
+ iter != mTransforms.end(); ++iter )
+ {
+ switch( iter->mTransformId )
+ {
+ case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
+ {
+ mBackgroundVisual.SetTransformAndSize( iter->mTransform, targetSize );
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
+ {
+ mCheckboxBgVisual.SetTransformAndSize( iter->mTransform, targetSize );
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
+ {
+ mCheckboxFgVisual.SetTransformAndSize( iter->mTransform, targetSize );
+ break;
+ }
+ case Demo::ShadowButton::Property::LABEL_VISUAL:
+ {
+ mLabelVisual.SetTransformAndSize( iter->mTransform, targetSize );
+ break;
+ }
+ }
+ }
+ }
+}
+
+Vector3 ShadowButton::GetNaturalSize()
+{
+ int width;
+ int height;
+
+ Vector2 checkboxBgSize;
+ Vector2 checkboxFgSize;
+ Vector2 labelSize;
+ mCheckboxBgVisual.GetNaturalSize( checkboxBgSize );
+ mCheckboxFgVisual.GetNaturalSize( checkboxFgSize );
+ mLabelVisual.GetNaturalSize( labelSize );
+
+ width = std::max( checkboxBgSize.x, checkboxFgSize.x ) + labelSize.x;
+ height = std::max( std::max( checkboxFgSize.y, checkboxBgSize.y ), labelSize.y );
+
+ return Vector3( width, height, height );
+}
+
+void ShadowButton::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
+{
+ // Chain up.
+ Control::OnStyleChange( styleManager, change );
+}
+
+ShadowButton::Transitions::iterator ShadowButton::FindTransition( Property::Index index )
+{
+ bool found = false;
+ ShadowButton::Transitions::iterator iter = mTransitions.begin();
+ for( ; iter != mTransitions.end(); ++iter )
+ {
+ if( iter->mTransitionId == index )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( ! found )
+ {
+ iter = mTransitions.end();
+ }
+ return iter;
+}
+
+ShadowButton::Transforms::iterator ShadowButton::FindTransform( Property::Index index )
+{
+ bool found = false;
+ ShadowButton::Transforms::iterator iter = mTransforms.begin();
+ for( ; iter != mTransforms.end(); ++iter )
+ {
+ if( iter->mTransformId == index )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( ! found )
+ {
+ iter = mTransforms.end();
+ }
+ return iter;
+}
+
+void ShadowButton::ResetVisual(
+ Property::Index index,
+ Visual::Base& visual,
+ const Property::Value& value )
+{
+ if( visual )
+ {
+ // we are replacing an existing visual, so force relayout
+ RelayoutRequest();
+ }
+ Property::Map* map = value.GetMap();
+ if( map )
+ {
+ visual = Toolkit::VisualFactory::Get().CreateVisual( *map );
+
+ // Set the appropriate depth index.
+ // @todo Should be able to set this from the style sheet
+ switch( index )
+ {
+ case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
+ {
+ RegisterVisual( index, visual );
+ visual.SetDepthIndex(0.0f);
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
+ {
+ RegisterVisual( index, visual );
+ visual.SetDepthIndex(1.0f);
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
+ {
+ RegisterVisual( index, visual, mCheckState );
+ visual.SetDepthIndex(2.0f);
+ break;
+ }
+ case Demo::ShadowButton::Property::LABEL_VISUAL:
+ {
+ RegisterVisual( index, visual );
+ visual.SetDepthIndex(1.0f);
+ break;
+ }
+ }
+
+ // Extract transform maps out of the visual definition and store them
+ Property::Value* value = map->Find( DevelVisual::Property::TRANSFORM, "transform");
+ if( value )
+ {
+ Property::Map* transformMap = value->GetMap();
+ if( transformMap )
+ {
+ ShadowButton::Transforms::iterator iter = FindTransform( index );
+ if( iter != mTransforms.end() )
+ {
+ iter->mTransform = *transformMap;
+ }
+ else
+ {
+ mTransforms.push_back( Transform( index, *transformMap ) );
+ }
+ }
+ }
+ }
+}
+
+bool IsTransformProperty( const std::string& property )
+{
+ const char* transformProperties[]= { "size", "offset", "origin", "anchorPoint", "offsetSizeMode" };
+ const int NUM_TRANSFORM_PROPERTIES = sizeof( transformProperties ) / sizeof( const char * );
+
+ bool found=false;
+ for( int i=0; i<NUM_TRANSFORM_PROPERTIES; ++i )
+ {
+ if( property == transformProperties[i] )
+ {
+ found = true;
+ break;
+ }
+ }
+ return found;
+}
+
+void ShadowButton::StoreTargetLayouts( TransitionData transitionData )
+{
+ // Pseudo code
+ // foreach animator in transitionData
+ // if animator{"property"} in [ "size", "offset", "origin", "anchorPoint", "offsetSizeMode" ]
+ // transforms{ animator{"target"} }->{animator{"property"}} = animator{"targetValue"}
+
+
+ for( unsigned int i=0; i < transitionData.Count(); ++i )
+ {
+ Property::Map animator = transitionData.GetAnimatorAt(i);
+ Property::Value* target = animator.Find( "target" );
+ if( target )
+ {
+ // Convert to index
+ Property::Index index;
+ if( Scripting::GetEnumerationProperty( *target, VISUAL_PROPERTIES_TABLE, VISUAL_PROPERTIES_TABLE_COUNT, index ) )
+ {
+ ShadowButton::Transforms::iterator iter = FindTransform( index );
+ if( iter != mTransforms.end() )
+ {
+ Property::Value* property = animator.Find( "property" );
+ if( property )
+ {
+ std::string propertyString;
+ property->Get(propertyString);
+ if( IsTransformProperty( propertyString ) )
+ {
+ Property::Value* targetValue = animator.Find( "targetValue" );
+ if( targetValue )
+ {
+ iter->mTransform[ propertyString ] = *targetValue;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShadowButton::ResetTransition(
+ Property::Index index,
+ const Property::Value& value)
+{
+ ShadowButton::Transitions::iterator iter = FindTransition( index );
+ if( iter != mTransitions.end() )
+ {
+ // Already exists
+ iter->mTransitionData = ConvertPropertyToTransition( value );
+ iter->mAnimation.Stop();
+ iter->mAnimation.Clear();
+ }
+ else
+ {
+ mTransitions.push_back( Transition( index, ConvertPropertyToTransition( value ) ) );
+ }
+}
+
+
+void ShadowButton::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) );
+
+ if( shadowButton )
+ {
+ ShadowButton& impl = GetImpl( shadowButton );
+ switch ( index )
+ {
+ case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
+ {
+ impl.ResetVisual( index, impl.mBackgroundVisual, value );
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
+ {
+ impl.ResetVisual( index, impl.mCheckboxBgVisual, value );
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
+ {
+ impl.ResetVisual( index, impl.mCheckboxFgVisual, value );
+ impl.EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState );
+ break;
+ }
+ case Demo::ShadowButton::Property::LABEL_VISUAL:
+ {
+ impl.ResetVisual( index, impl.mLabelVisual, value );
+ break;
+ }
+ case Demo::ShadowButton::Property::ACTIVE_TRANSITION:
+ case Demo::ShadowButton::Property::INACTIVE_TRANSITION:
+ case Demo::ShadowButton::Property::CHECK_TRANSITION:
+ case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
+ {
+ impl.ResetTransition( index, value );
+ break;
+ }
+ }
+ }
+}
+
+Property::Value ShadowButton::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) );
+
+ if ( shadowButton )
+ {
+ ShadowButton& impl = GetImpl( shadowButton );
+ switch ( propertyIndex )
+ {
+ case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
+ {
+ Property::Map map;
+ impl.mBackgroundVisual.CreatePropertyMap(map);
+ value = map;
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
+ {
+ Property::Map map;
+ impl.mCheckboxBgVisual.CreatePropertyMap(map);
+ value = map;
+ break;
+ }
+ case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
+ {
+ Property::Map map;
+ impl.mCheckboxFgVisual.CreatePropertyMap(map);
+ value = map;
+ break;
+ }
+ case Demo::ShadowButton::Property::LABEL_VISUAL:
+ {
+ Property::Map map;
+ impl.mLabelVisual.CreatePropertyMap(map);
+ value = map;
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ return value;
+}
+
+
+} // Internal
+} // Demo
--- /dev/null
+#ifndef DALI_DEMO_INTERNAL_SHADOW_BUTTON_IMPL_H
+#define DALI_DEMO_INTERNAL_SHADOW_BUTTON_IMPL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "shadow-button.h"
+#include <dali/public-api/animation/animation.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+
+namespace Demo
+{
+
+namespace Internal // To use TypeRegistry, handle and body classes need the same name
+{
+
+class ShadowButton : public Dali::Toolkit::Internal::Control
+{
+public:
+ /**
+ * Instantiate a new ShadowButton object
+ */
+ static Demo::ShadowButton New();
+ ShadowButton();
+ ~ShadowButton();
+
+public: // API
+ /**
+ * @brief Set the button to be active or inactive.
+ *
+ * The button will perform a transition if there is a state change.
+ * @param[in] active The active state
+ */
+ void SetActiveState( bool active );
+
+ /**
+ * Get the active state
+ * @return the active state
+ */
+ bool GetActiveState();
+
+ /**
+ * Set the check state
+ * @param[in] checkState The state of the checkbox
+ */
+ void SetCheckState( bool checkState );
+
+ /**
+ * Get the check state
+ * @return the check state
+ */
+ bool GetCheckState();
+
+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::Button::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
+ * @copydoc Toolkit::Button::OnStageConnect()
+ */
+ virtual void OnStageConnection( int depth );
+
+ /**
+ * @copydoc Toolkit::Button::OnStageDisconnection()
+ */
+ virtual void OnStageDisconnection();
+
+ /**
+ * @copydoc Toolkit::Button::OnSizeSet()
+ */
+ virtual void OnSizeSet( const Dali::Vector3& targetSize );
+
+ /**
+ * @copydoc Toolkit::Button::OnRelayout()
+ */
+ virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container );
+ /**
+ * @copydoc Toolkit::Button::GetNaturalSize
+ */
+ virtual Dali::Vector3 GetNaturalSize();
+
+ /**
+ * @copydoc Toolkit::Button::OnStyleChange
+ */
+ virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change );
+
+private:
+ struct Transition
+ {
+ Dali::Property::Index mTransitionId;
+ Dali::Toolkit::TransitionData mTransitionData;
+ Dali::Animation mAnimation;
+ bool mPlaying;
+
+ Transition( Dali::Property::Index index, Dali::Toolkit::TransitionData transitionData )
+ : mTransitionId( index ),
+ mTransitionData( transitionData ),
+ mPlaying(false)
+ {
+ }
+ private:
+ Transition();
+ };
+
+ typedef std::vector<Transition> Transitions;
+
+ struct Transform
+ {
+ Dali::Property::Index mTransformId;
+ Dali::Property::Map mTransform;
+
+ Transform( Dali::Property::Index index, Dali::Property::Map& map )
+ : mTransformId(index),
+ mTransform( map )
+ {
+ }
+ };
+ typedef std::vector<Transform> Transforms;
+
+private:
+ void StartTransition( Dali::Property::Index transitionId );
+
+ void OnTransitionFinished( Dali::Animation& handle );
+
+ Transitions::iterator FindTransition( Dali::Property::Index index );
+
+ Transforms::iterator FindTransform( Dali::Property::Index index );
+
+ /**
+ * Relayout the visuals as a result of size negotiation using
+ * the transforms provided in the stylesheet
+ */
+ void RelayoutVisuals( const Dali::Vector2& targetSize );
+
+ /**
+ * Relayout the visuals as a result of size negotiation using
+ * programmatically generated transforms
+ */
+ void RelayoutVisualsManually( const Dali::Vector2& targetSize );
+
+ void ResetVisual( Dali::Property::Index index,
+ Dali::Toolkit::Visual::Base& visual,
+ const Dali::Property::Value& value );
+
+ void ResetTransition( Dali::Property::Index index,
+ const Dali::Property::Value& value );
+
+ void StoreTargetLayouts( Dali::Toolkit::TransitionData transitionData );
+
+private:
+ // undefined
+ ShadowButton( const ShadowButton& );
+ ShadowButton& operator=( const ShadowButton& );
+
+private:
+ // Data
+ Dali::Toolkit::Visual::Base mBackgroundVisual;
+ Dali::Toolkit::Visual::Base mCheckboxBgVisual;
+ Dali::Toolkit::Visual::Base mCheckboxFgVisual;
+ Dali::Toolkit::Visual::Base mLabelVisual;
+
+ Transitions mTransitions;
+ Transforms mTransforms;
+ bool mCheckState;
+ bool mActiveState;
+};
+
+} // Internal
+
+inline Internal::ShadowButton& GetImpl( Demo::ShadowButton& handle )
+{
+ DALI_ASSERT_ALWAYS( handle );
+ Dali::RefObject& object = handle.GetImplementation();
+ return static_cast<Internal::ShadowButton&>(object);
+}
+
+inline const Internal::ShadowButton& GetImpl( const Demo::ShadowButton& handle )
+{
+ DALI_ASSERT_ALWAYS( handle );
+ const Dali::RefObject& object = handle.GetImplementation();
+ return static_cast<const Internal::ShadowButton&>(object);
+}
+
+} // Demo
+
+#endif // DALI_DEMO_SHADOW_BUTTON_IMPL_H
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "shadow-button.h"
+#include "shadow-button-impl.h"
+
+namespace Demo
+{
+
+ShadowButton::ShadowButton()
+{
+}
+
+ShadowButton::ShadowButton( const ShadowButton& control )
+: Control( control )
+{
+}
+
+ShadowButton& ShadowButton::operator= ( const ShadowButton& rhs )
+{
+ if( &rhs != this )
+ {
+ Control::operator=( rhs );
+ }
+ return *this;
+}
+
+ShadowButton::~ShadowButton()
+{
+}
+
+ShadowButton ShadowButton::New()
+{
+ ShadowButton control = Internal::ShadowButton::New();
+ return control;
+}
+
+ShadowButton ShadowButton::New( const std::string& url )
+{
+ ShadowButton control = Internal::ShadowButton::New();
+ return control;
+}
+
+ShadowButton ShadowButton::DownCast( BaseHandle handle )
+{
+ return Control::DownCast< ShadowButton, Internal::ShadowButton > ( handle );
+}
+
+void ShadowButton::SetActiveState( bool active )
+{
+ GetImpl(*this).SetActiveState( active );
+}
+
+bool ShadowButton::GetActiveState()
+{
+ return GetImpl(*this).GetActiveState();
+}
+
+void ShadowButton::SetCheckState( bool checkState )
+{
+ GetImpl(*this).SetCheckState( checkState );
+}
+
+bool ShadowButton::GetCheckState()
+{
+ return GetImpl(*this).GetCheckState();
+}
+
+ShadowButton::ShadowButton( Internal::ShadowButton& implementation )
+: Control( implementation )
+{
+}
+
+ShadowButton::ShadowButton( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer< Internal::ShadowButton >( internal ) ;
+}
+
+
+} //namespace Demo
--- /dev/null
+#ifndef DALI_DEMO_SHADOW_BUTTON_H
+#define DALI_DEMO_SHADOW_BUTTON_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali-toolkit/dali-toolkit.h>
+#include <string>
+
+namespace Demo
+{
+
+// All type registered controls need to have the same name for the body
+// and the handle
+namespace Internal
+{
+class ShadowButton;
+}
+
+/**
+ * Button that allows the RGB channels of an image to be altered.
+ */
+class ShadowButton : 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
+ {
+ ACTIVE_TRANSITION = PROPERTY_START_INDEX,
+ INACTIVE_TRANSITION,
+ CHECK_TRANSITION,
+ UNCHECK_TRANSITION,
+ BACKGROUND_VISUAL,
+ CHECKBOX_BG_VISUAL,
+ CHECKBOX_FG_VISUAL,
+ LABEL_VISUAL,
+ ACTIVE_STATE,
+ CHECK_STATE,
+ };
+ };
+
+public: // Construction / destruction
+
+ /**
+ * Create an uninitialized handle
+ */
+ ShadowButton();
+
+ /**
+ * Create a new image channel button without an image. Use
+ * SetImage to give this button an image
+ */
+ static ShadowButton New();
+
+ /**
+ * Create a new image channel button from a given URL
+ */
+ static ShadowButton New( const std::string& url );
+
+ /**
+ * Destructor. This is non-virtual since derived Handle types must not
+ * contain data or virtual methods
+ */
+ ~ShadowButton();
+
+ /**
+ * Copy Constructor
+ */
+ ShadowButton( const ShadowButton& shadowButton );
+
+ /**
+ * Assignment Operator
+ */
+ ShadowButton& operator=( const ShadowButton& shadowButton );
+
+ /**
+ * Downcast
+ */
+ static ShadowButton DownCast( BaseHandle handle );
+
+public: // API
+
+ /**
+ * @brief Set the button to be active or inactive.
+ *
+ * The button will perform a transition if there is a state change.
+ * @param[in] active The active state
+ */
+ void SetActiveState( bool active );
+
+ /**
+ * @brief Get the button's active state
+ *
+ * @return The active state
+ */
+ bool GetActiveState();
+
+ /**
+ * Set the check state
+ * @param[in] checkState The state of the checkbox
+ */
+ void SetCheckState( bool checkState );
+
+ /**
+ * Get the check state
+ * @return the check state
+ */
+ bool GetCheckState();
+
+public: // Not for public use
+ /**
+ * Create a handle from an implementation
+ */
+ ShadowButton( Internal::ShadowButton& implementation );
+
+ /**
+ * Allow the creation of an ShadowButton handle from an internal CustomActor pointer
+ */
+ ShadowButton( Dali::Internal::CustomActor* internal );
+};
+
+} // namespace Demo
+
+#endif // DALI_DEMO_SHADOW_BUTTON_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// External includes
#include <dali-toolkit/dali-toolkit.h>
-#include "beat-control.h"
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include "shadow-button.h"
#include <cstdio>
#include <sstream>
using namespace Dali;
using namespace Dali::Toolkit;
+namespace
+{
+
+void SetLabelText( Button button, const char* label )
+{
+ button.SetProperty( Toolkit::Button::Property::LABEL, label );
+}
+
+}
+
namespace Demo
{
const char* TransitionApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" );
+const char* TransitionApplication::DEMO_THEME_TWO_PATH( DEMO_STYLE_DIR "style-example-theme-two.json" );
TransitionApplication::TransitionApplication( Application& application )
: mApplication( application ),
mTitle(),
- mBeatControl(),
+ mShadowButton(),
mActionButtons(),
mActionIndex( Property::INVALID_INDEX )
{
contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT );
contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT );
- contentLayout.SetCellPadding( Size( 10, 10 ) );
-
+ contentLayout.SetCellPadding( Vector2( 0.0f, 5.0f ) );
+ contentLayout.SetBackgroundColor( Vector4(0.949, 0.949, 0.949, 1.0) );
// Assign all rows the size negotiation property of fitting to children
stage.Add( contentLayout );
mTitle = TextLabel::New( "Custom Control Transition 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 );
- contentLayout.SetFitHeight(0);
-
- mBeatControl = BeatControl::New();
- mBeatControl.SetName("BeatControl");
- mBeatControl.SetAnchorPoint( AnchorPoint::CENTER );
- mBeatControl.SetParentOrigin( ParentOrigin::CENTER );
- mBeatControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- contentLayout.Add( mBeatControl );
- // beat control should fill the tableview cell, so no change to default parameters
-
- TableView actionButtonLayout = TableView::New( 1, 4 );
+ contentLayout.SetFitHeight(0); // Fill width
+
+ // Provide some padding around the center cell
+ TableView buttonLayout = TableView::New( 3, 3 );
+ buttonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ buttonLayout.SetFixedHeight(1, 100 );
+ buttonLayout.SetFixedWidth(1, 350 );
+ contentLayout.Add( buttonLayout );
+
+ mShadowButton = ShadowButton::New();
+ mShadowButton.SetName("ShadowButton");
+ mShadowButton.SetActiveState( false );
+ mShadowButton.SetAnchorPoint( AnchorPoint::CENTER );
+ mShadowButton.SetParentOrigin( ParentOrigin::CENTER );
+ mShadowButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ buttonLayout.AddChild( mShadowButton, TableView::CellPosition(1, 1) );
+
+ TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 );
actionButtonLayout.SetName("ThemeButtonsLayout");
- actionButtonLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) );
-
- actionButtonLayout.SetAnchorPoint( AnchorPoint::CENTER );
- actionButtonLayout.SetParentOrigin( ParentOrigin::CENTER );
actionButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
actionButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
- actionButtonLayout.SetCellPadding( Size( 10, 10 ) );
actionButtonLayout.SetFitHeight( 0 );
TextLabel label = TextLabel::New( "Action: ");
label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
label.SetStyleName("ActionLabel");
- label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- label.SetParentOrigin( ParentOrigin::TOP_CENTER );
actionButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) );
actionButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER );
- for( int i=0; i<3; ++i )
+ for( int i=0; i<NUMBER_OF_ACTION_BUTTONS; ++i )
{
mActionButtons[i] = PushButton::New();
mActionButtons[i].SetName("ActionButton");
mActionButtons[i].SetStyleName("ActionButton");
- mActionButtons[i].SetParentOrigin( ParentOrigin::CENTER );
- mActionButtons[i].SetAnchorPoint( ParentOrigin::CENTER );
mActionButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mActionButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
mActionIndex = mActionButtons[i].RegisterProperty( "actionId", i, Property::READ_WRITE );
mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked );
actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) );
}
- mActionButtons[0].SetLabelText( "Bounce" );
- mActionButtons[1].SetLabelText( "X" );
- mActionButtons[2].SetLabelText( "Y" );
+ SetLabelText( mActionButtons[0], "Activate" );
+ SetLabelText( mActionButtons[1], "Check" );
+ mActionButtons[1].SetProperty( Button::Property::DISABLED, true );
contentLayout.Add( actionButtonLayout );
contentLayout.SetFitHeight(2);
}
-
bool TransitionApplication::OnActionButtonClicked( Button button )
{
int action = button.GetProperty<int>( mActionIndex );
{
case 0:
{
- mBeatControl.StartBounceAnimation();
+ bool activeState = mShadowButton.GetActiveState();
+ mShadowButton.SetActiveState( ! activeState );
+ if( activeState )
+ {
+ SetLabelText( button, "Activate" );
+ }
+ else
+ {
+ SetLabelText( button, "Deactivate" );
+ }
+ mActionButtons[1].SetProperty( Button::Property::DISABLED, activeState );
break;
}
case 1:
{
- mBeatControl.StartXAnimation();
+ bool checkState = mShadowButton.GetCheckState();
+ mShadowButton.SetCheckState( ! checkState );
+ if( checkState )
+ {
+ SetLabelText( button, "Check" );
+ }
+ else
+ {
+ SetLabelText( button, "Uncheck" );
+ }
break;
}
case 2:
{
- mBeatControl.StartYAnimation();
+ break;
+ }
+ case 3:
+ {
break;
}
}
#define DALI_DEMO_TRANSITION_APPLICATION_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// External includes
#include <dali-toolkit/dali-toolkit.h>
-//#include <dali-toolkit/devel-api/controls/slider/slider.h>
-#include <dali-toolkit/devel-api/controls/popup/popup.h>
-#include "beat-control.h"
+#include "shadow-button.h"
#include <cstdio>
#include <sstream>
class TransitionApplication : public ConnectionTracker
{
public:
+ static const int NUMBER_OF_ACTION_BUTTONS=2;
+
+public:
// Constructor
TransitionApplication( Application& application );
// Key event handler
void OnKeyEvent( const KeyEvent& event );
- bool OnActionButtonClicked(Button button);
+ bool OnActionButtonClicked( Button button );
static const char* DEMO_THEME_ONE_PATH;
+ static const char* DEMO_THEME_TWO_PATH;
private:
+
+ /** Create a visual map
+ *
+ * @param[in] index The index of the visual to create
+ * @param[out] map The map to generate
+ */
+
Application& mApplication;
TextLabel mTitle;
- BeatControl mBeatControl;
- PushButton mActionButtons[3];
+ ShadowButton mShadowButton;
+ PushButton mActionButtons[NUMBER_OF_ACTION_BUTTONS];
+ Property::Index mVisualIndex;
Property::Index mActionIndex;
};
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
using namespace Dali;
using namespace Toolkit;
mResetButton.SetVisible( false );
mResetButton.SetDisabled( true );
- mPlayButton.SetUnselectedImage( PLAY_IMAGE );
- mPlayButton.SetSelectedImage( PLAY_IMAGE );
- mPauseButton.SetUnselectedImage( PAUSE_IMAGE );
- mPauseButton.SetSelectedImage( PAUSE_IMAGE );
+ mPlayButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_IMAGE );
+ mPlayButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_IMAGE );
+ mPauseButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE );
+ mPauseButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE );
- mStopButton.SetUnselectedImage( STOP_IMAGE );
- mStopButton.SetSelectedImage( STOP_IMAGE );
- mResetButton.SetUnselectedImage( RESET_IMAGE );
- mResetButton.SetSelectedImage( RESET_IMAGE );
+ mStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_IMAGE );
+ mStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_IMAGE );
+ mResetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_IMAGE );
+ mResetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_IMAGE );
- mBackwardButton.SetUnselectedImage( BACKWARD_IMAGE );
- mBackwardButton.SetSelectedImage( BACKWARD_IMAGE );
- mForwardButton.SetUnselectedImage( FORWARD_IMAGE );
- mForwardButton.SetSelectedImage( FORWARD_IMAGE );
+ mBackwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE );
+ mBackwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE );
+ mForwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE );
+ mForwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE );
mPanGestureDetector = PanGestureDetector::New();
mPanGestureDetector.Attach( mVideoView );
Name: com.samsung.dali-demo
Summary: The OpenGLES Canvas Core Demo
-Version: 1.2.20
+Version: 1.2.25
Release: 1
Group: System/Libraries
License: Apache-2.0
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "ক্লিক্"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Clipping"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "ঝুৰ্"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "Tasten"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Clipping"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "Farbverlauf"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "Buttons"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Clipping"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "Colour Gradient"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "Buttons"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Clipping"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "Color Gradient"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "Botones"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Recorte"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "Gradiente de color"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "Painikkeet"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "Leikkaaminen"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "Liukuväri"
msgid "DALI_DEMO_STR_TITLE_ANIMATED_IMAGES"
msgstr "애니메이션 이미지"
-
msgid "DALI_DEMO_STR_TITLE_ANIMATED_SHAPES"
msgstr "애니메이션 모양"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "버튼"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "깎는"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "색상 그라디언트"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "ബട്ടണുകൾ"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "ക്ലിപ്പിംഗ്"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "വർണ്ണ ഗ്രേഡിയന്റ്"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "بٹنوں"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "کاٹنا"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "رنگ میلان"
msgid "DALI_DEMO_STR_TITLE_BUTTONS"
msgstr "按钮"
+msgid "DALI_DEMO_STR_TITLE_CLIPPING"
+msgstr "剪裁"
+
msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
msgstr "颜色梯度"
demo-theme.json
contact-cards-example-theme.json
+progress-bar-example-theme.json
style-example-theme-three.json
style-example-theme-two.json
style-example-theme-one.json
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+ "styles":
+ {
+ "ProgressBarCustomStyle1":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png",
+ "size":[5,24]
+ },
+ "progressVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png",
+ "size":[5,24]
+ }
+ },
+
+ "ProgressBarCustomStyle2":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png",
+ "size":[5,7]
+ },
+ "progressVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png",
+ "size":[5,7]
+ }
+ }
+ }
+}
{
+ "constants":
+ {
+ "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style"
+ },
"styles":
{
"Title":{
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "initialValue":0,
- "targetValue":1,
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
- "targetValue":[1,1,1]
+ "property":"size",
+ "targetValue":[1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
+ "property":"size",
"targetValue":[1,1,1]
}
]
},
- "BeatControl":
+ "ShadowButton":
{
- "beatVisual":{
+ "backgroundVisual":{
"visualType":"IMAGE",
- "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png",
+ "mixColor":[1,1,1,0]
},
-
- "bounceTransition":
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":8,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
+ },
+ "activeTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"size",
+ "initialValue":[0.9, 0.9],
+ "targetValue":[1, 1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"labelVisual",
+ "property":"mixColor",
+ "initialValue":[0.2, 0.2, 0.2, 1.0],
+ "targetValue":[0, 0, 0, 1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "inactiveTransition":
[
{
- "target":"beatVisual",
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"labelVisual",
+ "property":"mixColor",
+ "targetValue":[0.4, 0.4, 0.4, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
"property":"size",
- "initialValue":[0.5, 0.5],
- "targetValue":[0.75, 0.75],
+ "targetValue":[0.9, 0.9],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_OUT_BACK",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.8,
"delay":0
}
}
}
],
-
- "leftTransition":
+ "checkTransition":
[
{
- "target":"beatVisual",
- "property":"offset",
- "initialValue":[0, 0],
- "targetValue":[0.25, 0],
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_IN",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.4,
"delay":0
}
}
}
],
-
- "upTransition":
+ "uncheckTransition":
[
{
- "target":"beatVisual",
- "property":"offset",
- "initialValue":[0, 0],
- "targetValue":[0, 0.25],
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_OUT",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.4,
"delay":0
}
}
[
{
"target":"imageVisual",
- "property":"scale",
- "initialValue":[0.1,0.1,0.1],
- "targetValue":[1,1,1],
+ "property":"size",
+ "initialValue":[0.1,0.1],
+ "targetValue":[1,1],
"animator":
{
"alphaFunction":"EASE_IN",
},
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":1
+ "property":"mixColor",
+ "targetValue":[1,1,1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"scale",
- "initialValue":[1,1,1],
- "targetValue":[0.1,0.1,0.1],
+ "property":"size",
+ "initialValue":[1,1],
+ "targetValue":[0.1,0.1],
"animator":
{
"alphaFunction":"EASE_OUT",
},
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_OUT",
// 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,
+ "unselectedVisual":
+ {
+ "visualType": "IMAGE",
+ "url": "{STYLE_DIR}/images/radio-button-unselected.png"
+ },
+ "selectedVisual":
+ {
+ "visualType": "IMAGE",
+ "url": "{STYLE_DIR}/images/radio-button-selected.png"
+ },
"label":{
"textColor": [0.1,1,1,1]
}
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "initialValue":0,
- "targetValue":1,
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
"delay":0
}
}
+ },
+ {
+ "target":"imageVisual",
+ "property":"size",
+ "targetValue":[1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
- "targetValue":[1,1,1]
+ "property":"size",
+ "targetValue":[1,1]
+ }
+ ]
+ },
+ "ShadowButton":
+ {
+ "backgroundVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png"
+ },
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":8,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
+ },
+ "activeTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "inactiveTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
}
]
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+ "styles":
+ {
+ "ProgressBarCustomStyle1":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png",
+ "size":[5,24]
+ },
+ "progressVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png",
+ "size":[5,24]
+ }
+ },
+
+ "ProgressBarCustomStyle2":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png",
+ "size":[5,7]
+ },
+ "progressVisual":{
+ "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png",
+ "size":[5,7]
+ }
+ }
+ }
+}
{
+ "constants":
+ {
+ "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style"
+ },
"styles":
{
"Title":{
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "initialValue":0,
- "targetValue":1,
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
- "targetValue":[1,1,1]
+ "property":"size",
+ "targetValue":[1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
+ "property":"size",
"targetValue":[1,1,1]
}
]
},
- "BeatControl":
+ "ShadowButton":
{
- "beatVisual":{
+ "backgroundVisual":{
"visualType":"IMAGE",
- "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png",
+ "mixColor":[1,1,1,0]
},
-
- "bounceTransition":
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":20,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
+ },
+ "activeTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"size",
+ "initialValue":[0.9, 0.9],
+ "targetValue":[1, 1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"labelVisual",
+ "property":"mixColor",
+ "initialValue":[0.2, 0.2, 0.2, 1.0],
+ "targetValue":[0, 0, 0, 1],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "inactiveTransition":
[
{
- "target":"beatVisual",
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"labelVisual",
+ "property":"mixColor",
+ "targetValue":[0.4, 0.4, 0.4, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"backgroundVisual",
"property":"size",
- "initialValue":[0.5, 0.5],
- "targetValue":[0.75, 0.75],
+ "targetValue":[0.9, 0.9],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_OUT_BACK",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.8,
"delay":0
}
}
}
],
-
- "leftTransition":
+ "checkTransition":
[
{
- "target":"beatVisual",
- "property":"offset",
- "initialValue":[0, 0],
- "targetValue":[0.25, 0],
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_IN",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.4,
"delay":0
}
}
}
],
-
- "upTransition":
+ "uncheckTransition":
[
{
- "target":"beatVisual",
- "property":"offset",
- "initialValue":[0, 0],
- "targetValue":[0, 0.25],
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
"animator":
{
- "alphaFunction":"BOUNCE",
+ "alphaFunction":"EASE_OUT",
"timePeriod":
{
- "duration":0.5,
+ "duration":0.4,
"delay":0
}
}
[
{
"target":"imageVisual",
- "property":"scale",
- "initialValue":[0.1,0.1,0.1],
- "targetValue":[1,1,1],
+ "property":"size",
+ "initialValue":[0.1,0.1],
+ "targetValue":[1,1],
"animator":
{
"alphaFunction":"EASE_IN",
},
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":1
+ "property":"mixColor",
+ "targetValue":[1,1,1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"scale",
- "initialValue":[1,1,1],
- "targetValue":[0.1,0.1,0.1],
+ "property":"size",
+ "initialValue":[1,1],
+ "targetValue":[0.1,0.1],
"animator":
{
"alphaFunction":"EASE_OUT",
},
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_OUT",
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "initialValue":0,
- "targetValue":1,
+ "property":"mixColor",
+ "initialValue":[1,1,1,0],
+ "targetValue":[1,1,1,1],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
- "targetValue":[1,1,1]
+ "property":"size",
+ "targetValue":[1,1]
}
],
"disableVisibilityTransition":
[
{
"target":"imageVisual",
- "property":"colorAlpha",
- "targetValue":0,
+ "property":"mixColor",
+ "targetValue":[1,1,1,0],
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
{
"target":"imageVisual",
- "property":"scale",
- "targetValue":[1,1,1]
+ "property":"size",
+ "targetValue":[1,1]
+ }
+ ]
+ },
+ "ShadowButton":
+ {
+ "backgroundVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png"
+ },
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":20,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
+ },
+ "activeTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.09, 0.28],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "inactiveTransition":
+ [
+ {
+ "target":"checkboxBgVisual",
+ "property":"size",
+ "initialValue":[0.12, 0.37],
+ "targetValue":[0.09, 0.28],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT_BACK",
+ "timePeriod":
+ {
+ "duration":0.8,
+ "delay":0
+ }
+ }
}
]
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#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_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING")
#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT")
#define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS")
#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION")
#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_CLIPPING "Clipping"
#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient"
#define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards"
#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect"
*/
#include <dali/dali.h>
-#include <dali/devel-api/images/atlas.h>
#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/texture.h>