[dali_1.2.28] Merge branch 'devel/master'
[platform/core/uifw/dali-demo.git] / examples / text-label / text-label-example.cpp
index c035ed6..85c51eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/object/handle-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <iostream>
 
@@ -79,17 +80,17 @@ struct HSVColorConstraint
   {
   }
 
-  void operator()(Vector4& current, const PropertyInputContainer& inputs )
+  void operator()(Vector3& current, const PropertyInputContainer& inputs )
   {
-    current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a));
+    current = hsv2rgb(Vector3(inputs[0]->GetFloat(), saturation, value));
   }
 
-  Vector4 hsv2rgb(Vector4 colorHSV)
+  Vector3 hsv2rgb(Vector3 colorHSV)
   {
     float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1));
     float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1));
     float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1));
-    return Vector4(r, g, b, colorHSV.a);
+    return Vector3(r, g, b);
   }
   float hue;
   float saturation;
@@ -107,8 +108,15 @@ public:
 
   TextLabelExample( Application& application )
   : mApplication( application ),
+    mLabel(),
+    mContainer(),
+    mGrabCorner(),
+    mPanGestureDetector(),
+    mLayoutSize(),
     mLanguageId( 0u ),
-    mAlignment( 0u )
+    mAlignment( 0u ),
+    mHueAngleIndex( Property::INVALID_INDEX ),
+    mOverrideMixColorIndex( Property::INVALID_INDEX )
   {
     // Connect to the Application's Init signal
     mApplication.InitSignal().Connect( this, &TextLabelExample::Create );
@@ -163,9 +171,9 @@ public:
 
     mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f );
     Renderer bgRenderer = mLabel.GetRendererAt(0);
-    mOverrideMixColorIndex = bgRenderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+    mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR );
 
-    Constraint constraint = Constraint::New<Vector4>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
+    Constraint constraint = Constraint::New<Vector3>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
     constraint.AddSource( Source( mLabel, mHueAngleIndex ) );
     constraint.SetRemoveAction( Constraint::Discard );
     constraint.Apply();