Commit ea8d5e7931fcbcf33c4dc03de26f8c169402b217

Authored by Victor Cebollada
2 parents db0f431e 87d45c11

[dali_1.2.53] Merge branch 'devel/master'

Change-Id: I537bf589dad3e8df8f86a478ac7c348bd2fc8a29
examples/text-label/text-label-example.cpp
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 22
23 // EXTERNAL INCLUDES 23 // EXTERNAL INCLUDES
24 #include <dali/devel-api/object/handle-devel.h> 24 #include <dali/devel-api/object/handle-devel.h>
  25 +#include <dali/devel-api/actors/actor-devel.h>
25 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h> 26 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
26 #include <dali-toolkit/dali-toolkit.h> 27 #include <dali-toolkit/dali-toolkit.h>
27 #include <iostream> 28 #include <iostream>
@@ -43,6 +44,7 @@ const unsigned int KEY_ONE = 11; @@ -43,6 +44,7 @@ const unsigned int KEY_ONE = 11;
43 const unsigned int KEY_A = 38; 44 const unsigned int KEY_A = 38;
44 const unsigned int KEY_F = 41; 45 const unsigned int KEY_F = 41;
45 const unsigned int KEY_H = 43; 46 const unsigned int KEY_H = 43;
  47 +const unsigned int KEY_U = 30;
46 const unsigned int KEY_V = 55; 48 const unsigned int KEY_V = 55;
47 const unsigned int KEY_M = 58; 49 const unsigned int KEY_M = 58;
48 const unsigned int KEY_L = 46; 50 const unsigned int KEY_L = 46;
@@ -113,6 +115,7 @@ public: @@ -113,6 +115,7 @@ public:
113 mLabel(), 115 mLabel(),
114 mContainer(), 116 mContainer(),
115 mGrabCorner(), 117 mGrabCorner(),
  118 + mBorder(),
116 mPanGestureDetector(), 119 mPanGestureDetector(),
117 mLayoutSize(), 120 mLayoutSize(),
118 mLanguageId( 0u ), 121 mLanguageId( 0u ),
@@ -160,17 +163,33 @@ public: @@ -160,17 +163,33 @@ public:
160 mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan ); 163 mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan );
161 164
162 mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); 165 mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" );
  166 +
163 mLabel.SetName( "TextLabel" ); 167 mLabel.SetName( "TextLabel" );
164 mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 168 mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
165 - mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );  
166 - mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); 169 + mLabel.SetSize(mLayoutSize);
167 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); 170 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
168 - mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::BLUE ); 171 + mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::GREEN );
169 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); 172 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
170 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); 173 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
171 mLabel.SetBackgroundColor( Color::WHITE ); 174 mLabel.SetBackgroundColor( Color::WHITE );
172 mContainer.Add( mLabel ); 175 mContainer.Add( mLabel );
173 176
  177 + // Add a border for the container so you can see the container is being resized while grabbing the handle.
  178 + mBorder = Control::New();
  179 + mBorder.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  180 + mBorder.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  181 + mBorder.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
  182 +
  183 + Dali::Property::Map border;
  184 + border.Insert( Visual::Property::TYPE, Visual::BORDER );
  185 + border.Insert( BorderVisual::Property::COLOR, Color::WHITE );
  186 + border.Insert( BorderVisual::Property::SIZE, 2.f );
  187 + mBorder.SetProperty( Control::Property::BACKGROUND, border );
  188 + mContainer.Add( mBorder );
  189 + mBorder.SetVisible(false);
  190 +
  191 + DevelActor::RaiseToTop(mGrabCorner);
  192 +
174 mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f ); 193 mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f );
175 Renderer bgRenderer = mLabel.GetRendererAt(0); 194 Renderer bgRenderer = mLabel.GetRendererAt(0);
176 mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR ); 195 mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR );
@@ -187,7 +206,7 @@ public: @@ -187,7 +206,7 @@ public:
187 206
188 // Animate the text color 3 times from source color to RED 207 // Animate the text color 3 times from source color to RED
189 Animation animation = Animation::New( 2.f ); 208 Animation animation = Animation::New( 2.f );
190 - animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); 209 + animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::YELLOW, AlphaFunction::SIN );
191 animation.SetLoopCount( 3 ); 210 animation.SetLoopCount( 3 );
192 animation.Play(); 211 animation.Play();
193 212
@@ -210,6 +229,9 @@ public: @@ -210,6 +229,9 @@ public:
210 { 229 {
211 mLayoutSize.y = 2.0f; 230 mLayoutSize.y = 2.0f;
212 } 231 }
  232 +
  233 + // Only show the border during the panning
  234 + mBorder.SetVisible(true);
213 } 235 }
214 236
215 mLayoutSize.x += gesture.displacement.x * 2.0f; 237 mLayoutSize.x += gesture.displacement.x * 2.0f;
@@ -224,6 +246,13 @@ public: @@ -224,6 +246,13 @@ public:
224 246
225 mContainer.SetSize( clampedSize ); 247 mContainer.SetSize( clampedSize );
226 } 248 }
  249 +
  250 + if( gesture.state == Gesture::Cancelled || gesture.state == Gesture::Finished )
  251 + {
  252 + // Resize the text label to match the container size when panning is finished
  253 + mLabel.SetSize(mLayoutSize);
  254 + mBorder.SetVisible(false);
  255 + }
227 } 256 }
228 257
229 /** 258 /**
@@ -252,7 +281,7 @@ public: @@ -252,7 +281,7 @@ public:
252 { 281 {
253 Animation animation = Animation::New( 2.f ); 282 Animation animation = Animation::New( 2.f );
254 animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); 283 animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN );
255 - animation.SetLooping( true ); 284 + animation.SetLoopCount( 3 );
256 animation.Play(); 285 animation.Play();
257 break; 286 break;
258 } 287 }
@@ -318,6 +347,12 @@ public: @@ -318,6 +347,12 @@ public:
318 } 347 }
319 break; 348 break;
320 } 349 }
  350 + case KEY_U: // Markup
  351 + {
  352 + mLabel.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
  353 + mLabel.SetProperty( TextLabel::Property::TEXT, "<font family='DejaVuSerif' size='18'>H<color value='blue'>ello</color> <font weight='bold'>world</font> demo</font>" );
  354 + break;
  355 + }
321 case KEY_PLUS: // Increase shadow offset 356 case KEY_PLUS: // Increase shadow offset
322 { 357 {
323 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); 358 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) );
@@ -342,6 +377,7 @@ private: @@ -342,6 +377,7 @@ private:
342 377
343 Control mContainer; 378 Control mContainer;
344 Control mGrabCorner; 379 Control mGrabCorner;
  380 + Control mBorder;
345 381
346 PanGestureDetector mPanGestureDetector; 382 PanGestureDetector mPanGestureDetector;
347 383
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.2.52 5 +Version: 1.2.53
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0