#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
#include "radial-sweep-view.h"
#include "radial-sweep-view-impl.h"
void RadialMenuExample::OnInit(Application& app)
{
+ Stage stage = Dali::Stage::GetCurrent();
+
// The Init signal is received once (only) during the Application lifetime
- Stage::GetCurrent().KeyEventSignal().Connect(this, &RadialMenuExample::OnKeyEvent);
+ stage.KeyEventSignal().Connect(this, &RadialMenuExample::OnKeyEvent);
// Create toolbar & view
Toolkit::ToolBar toolBar;
TOOLBAR_IMAGE,
APPLICATION_TITLE );
- mIconPlay = Image::New( PLAY_ICON );
- mIconStop = Image::New( STOP_ICON );
+ mIconPlay = ResourceImage::New( PLAY_ICON );
+ mIconStop = ResourceImage::New( STOP_ICON );
mPlayStopButton = Toolkit::PushButton::New();
mPlayStopButton.SetBackgroundImage( mIconStop );
Toolkit::Alignment::HorizontalRight,
DemoHelper::DEFAULT_PLAY_PADDING );
- Vector2 imgSize = Image::GetImageSize(TEST_OUTER_RING_FILENAME);
- float scale = Stage::GetCurrent().GetSize().width / imgSize.width;
+ Vector2 imgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME);
+ Vector2 stageSize = stage.GetSize();
+ float minStageDimension = std::min(stageSize.width, stageSize.height);
+
+ if(stageSize.height <= stageSize.width)
+ {
+ minStageDimension -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight * 2.0f;
+ }
+ float scale = minStageDimension / imgSize.width;
mRadialSweepView1 = CreateSweepView( TEST_OUTER_RING_FILENAME, Degree(-90.0f), Degree(-90.0f));
mRadialSweepView2 = CreateSweepView( TEST_INNER_RING_FILENAME, Degree(90.0f), Degree(0.0f));
mRadialSweepView3.SetInitialActorAngle(Degree(-110));
mRadialSweepView3.SetFinalActorAngle(Degree(0));
- Image dial = Image::New( TEST_DIAL_FILENAME );
+ Image dial = ResourceImage::New( TEST_DIAL_FILENAME );
mDialActor = ImageActor::New( dial );
+ mDialActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
mDialActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
mDialActor.SetScale(scale);
Layer dialLayer = Layer::New();
dialLayer.Add(mDialActor);
dialLayer.SetPositionInheritanceMode(USE_PARENT_POSITION);
- dialLayer.SetSize(Stage::GetCurrent().GetSize());
+ dialLayer.SetSize(stage.GetSize());
mContents.Add(dialLayer);
mRadialSweepView1.SetScale(scale);
mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f);
mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f);
mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f);
- mAnimation.OpacityTo(mDialActor, 1.0f, AlphaFunctions::EaseIn, 0.0f, 0.8f);
- mAnimation.OpacityTo(mRadialSweepView1, 1.0f, AlphaFunctions::EaseIn, 0.0f, 0.5f);
+ mAnimation.AnimateTo( Property( mDialActor, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.8f ) );
+ mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.5f ) );
mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished );
mAnimationState = PLAYING;
Degree finalAngle)
{
// Create the image
- Image image = Image::New(imageName);
+ Image image = ResourceImage::New(imageName);
mImageActor = ImageActor::New(image);
mImageActor.SetParentOrigin(ParentOrigin::CENTER);
mImageActor.SetAnchorPoint(AnchorPoint::CENTER);
+ mImageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
// Create the stencil
- Vector2 imageSize = Image::GetImageSize(imageName);
+ Vector2 imageSize = ResourceImage::GetImageSize(imageName);
float diameter = std::max(imageSize.width, imageSize.height);
RadialSweepView radialSweepView = RadialSweepView::New();
radialSweepView.SetDiameter( diameter );