#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.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>
+#include <dali-toolkit/devel-api/transition-effects/cube-transition-wave-effect.h>
+
using namespace Dali;
const char * const APPLICATION_TITLE_CROSS( "Cube Transition: Cross" );
const char * const APPLICATION_TITLE_FOLD( "Cube Transition: Fold" );
const char * const EFFECT_WAVE_IMAGE( DALI_IMAGE_DIR "icon-effect-wave.png" );
+const char * const EFFECT_WAVE_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-effect-wave-selected.png" );
const char * const EFFECT_CROSS_IMAGE( DALI_IMAGE_DIR "icon-effect-cross.png" );
+const char * const EFFECT_CROSS_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-effect-cross-selected.png" );
const char * const EFFECT_FOLD_IMAGE( DALI_IMAGE_DIR "icon-effect-fold.png" );
+const char * const EFFECT_FOLD_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-effect-fold-selected.png" );
const char * const SLIDE_SHOW_START_ICON( DALI_IMAGE_DIR "icon-play.png" );
+const char * const SLIDE_SHOW_START_ICON_SELECTED( DALI_IMAGE_DIR "icon-play-selected.png" );
const char * const SLIDE_SHOW_STOP_ICON( DALI_IMAGE_DIR "icon-stop.png" );
+const char * const SLIDE_SHOW_STOP_ICON_SELECTED( DALI_IMAGE_DIR "icon-stop-selected.png" );
const char* IMAGES[] =
{
/**
* @brief Load an image, scaled-down to no more than the stage dimensions.
*
- * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at
+ * Uses image scaling mode SCALE_TO_FILL to resize the image at
* load time to cover the entire stage with pixels with no borders,
- * and filter mode ImageAttributes::BoxThenLinear to sample the image with
+ * and filter mode BOX_THEN_LINEAR to sample the image with
* maximum quality.
*/
ResourceImage LoadStageFillingImage( const char * const imagePath )
{
Size stageSize = Stage::GetCurrent().GetSize();
- ImageAttributes attributes;
- attributes.SetSize( stageSize.x, stageSize.y );
- attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
- attributes.SetScalingMode( ImageAttributes::ScaleToFill );
- return ResourceImage::New( imagePath, attributes );
+ return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
}
} // namespace
private:
Application& mApplication;
- Toolkit::View mView;
+ Toolkit::Control mView;
Toolkit::ToolBar mToolBar;
Layer mContent;
Toolkit::TextLabel mTitleActor;
Timer mViewTimer;
Toolkit::PushButton mSlideshowButton;
Image mIconSlideshowStart;
+ Image mIconSlideshowStartSelected;
Image mIconSlideshowStop;
+ Image mIconSlideshowStopSelected;
Vector2 mPanPosition;
Vector2 mPanDisplacement;
Image mImageWave;
+ Image mImageWaveSelected;
Image mImageCross;
+ Image mImageCrossSelected;
Image mImageFold;
+ Image mImageFoldSelected;
Toolkit::PushButton mEffectChangeButton;
};
void CubeTransitionApp::OnInit( Application& application )
{
- DemoHelper::RequestThemeChange();
-
Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
// Creates a default view with a default tool bar, the view is added to the stage.
// Add an effect-changing button on the right of the tool bar.
mImageWave = ResourceImage::New( EFFECT_WAVE_IMAGE );
+ mImageWaveSelected = ResourceImage::New( EFFECT_WAVE_IMAGE_SELECTED );
mImageCross = ResourceImage::New( EFFECT_CROSS_IMAGE );
+ mImageCrossSelected = ResourceImage::New( EFFECT_CROSS_IMAGE_SELECTED );
mImageFold = ResourceImage::New( EFFECT_FOLD_IMAGE );
+ mImageFoldSelected = ResourceImage::New( EFFECT_FOLD_IMAGE_SELECTED );
mEffectChangeButton = Toolkit::PushButton::New();
- mEffectChangeButton.SetBackgroundImage(mImageWave);
+ mEffectChangeButton.SetButtonImage( mImageWave );
+ mEffectChangeButton.SetSelectedImage( mImageWaveSelected );
mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
//Add an slideshow icon on the right of the title
mIconSlideshowStart = ResourceImage::New( SLIDE_SHOW_START_ICON );
+ mIconSlideshowStartSelected = ResourceImage::New( SLIDE_SHOW_START_ICON_SELECTED );
mIconSlideshowStop = ResourceImage::New( SLIDE_SHOW_STOP_ICON );
+ mIconSlideshowStopSelected = ResourceImage::New( SLIDE_SHOW_STOP_ICON_SELECTED );
mSlideshowButton = Toolkit::PushButton::New();
- mSlideshowButton.SetBackgroundImage( mIconSlideshowStart );
+ mSlideshowButton.SetButtonImage( mIconSlideshowStart );
+ mSlideshowButton.SetSelectedImage( mIconSlideshowStartSelected );
mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked );
mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
// show the first image
mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
- mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
- mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
+ mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
mParent.Add( mCurrentImage );
mCurrentEffect = mCubeWaveEffect;
mNextImage = ImageActor::New( image );
mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
- mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
- mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
- mNextImage.SetRelayoutEnabled( false );
+ mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
mCurrentEffect.SetTargetImage(mNextImage);
if( image.GetLoadingState() == ResourceLoadingSucceeded )
{
{
mCurrentEffect = mCubeCrossEffect;
mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
- mEffectChangeButton.SetBackgroundImage(mImageCross);
+ mEffectChangeButton.SetButtonImage( mImageCross );
+ mEffectChangeButton.SetSelectedImage( mImageCrossSelected );
}
else if(mCurrentEffect == mCubeCrossEffect)
{
mCurrentEffect = mCubeFoldEffect;
mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
- mEffectChangeButton.SetBackgroundImage(mImageFold);
+ mEffectChangeButton.SetButtonImage( mImageFold );
+ mEffectChangeButton.SetSelectedImage( mImageFoldSelected );
}
else
{
mCurrentEffect = mCubeWaveEffect;
mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
- mEffectChangeButton.SetBackgroundImage(mImageWave);
+ mEffectChangeButton.SetButtonImage( mImageWave );
+ mEffectChangeButton.SetSelectedImage( mImageWaveSelected );
}
// Set the current image to cube transition effect
if( mSlideshow )
{
mPanGestureDetector.Detach( mParent );
- mSlideshowButton.SetBackgroundImage( mIconSlideshowStop );
+ mSlideshowButton.SetButtonImage( mIconSlideshowStop );
+ mSlideshowButton.SetSelectedImage( mIconSlideshowStopSelected );
mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f );
mPanDisplacement = Vector2( -10.f, 0.f );
mViewTimer.Start();
else
{
mPanGestureDetector.Attach( mParent );
- mSlideshowButton.SetBackgroundImage( mIconSlideshowStart );
+ mSlideshowButton.SetButtonImage( mIconSlideshowStart );
+ mSlideshowButton.SetSelectedImage( mIconSlideshowStartSelected );
mViewTimer.Stop();
}
return true;
// Entry point for Linux & Tizen applications
int main( int argc, char **argv )
{
- Application application = Application::New( &argc, &argv );
+ Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
CubeTransitionApp test( application );
application.MainLoop();