Commit 75344c184bd58a71d94b5e6af3f892cb7a6436ed
[dali_1.4.15] Merge branch 'devel/master'
Change-Id: I0a8b6fd3425265194191aed274f8ef10cde25822
Showing
35 changed files
with
1405 additions
and
4 deletions
com.samsung.dali-demo.xml
| @@ -278,6 +278,24 @@ | @@ -278,6 +278,24 @@ | ||
| 278 | <ui-application appid="drag-and-drop.example" exec="/usr/apps/com.samsung.dali-demo/bin/drag-and-drop.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 278 | <ui-application appid="drag-and-drop.example" exec="/usr/apps/com.samsung.dali-demo/bin/drag-and-drop.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 279 | <label>Drag And Drop</label> | 279 | <label>Drag And Drop</label> |
| 280 | </ui-application> | 280 | </ui-application> |
| 281 | + <ui-application appid="simple-text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 282 | + <label>Simple Text Label</label> | ||
| 283 | + </ui-application> | ||
| 284 | + <ui-application appid="simple-bitmap-font-text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-bitmap-font-text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 285 | + <label>Simple Bitmap Font Text Label</label> | ||
| 286 | + </ui-application> | ||
| 287 | + <ui-application appid="simple-text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 288 | + <label>Simple Text Field</label> | ||
| 289 | + </ui-application> | ||
| 290 | + <ui-application appid="simple-text-visual.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-visual.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 291 | + <label>Text Visual</label> | ||
| 292 | + </ui-application> | ||
| 293 | + <ui-application appid="simple-text-renderer.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-renderer.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 294 | + <label>Simple Text Renderer</label> | ||
| 295 | + </ui-application> | ||
| 296 | + <ui-application appid="gestures.example" exec="/usr/apps/com.samsung.dali-demo/bin/gestures.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 297 | + <label>Gestures</label> | ||
| 298 | + </ui-application> | ||
| 281 | 299 | ||
| 282 | <privileges> | 300 | <privileges> |
| 283 | <privilege>http://tizen.org/privilege/mediastorage</privilege> | 301 | <privilege>http://tizen.org/privilege/mediastorage</privilege> |
examples-reel/dali-examples-reel.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2018 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -50,6 +50,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -50,6 +50,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 50 | demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND)); | 50 | demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND)); |
| 51 | demo.AddExample(Example("frame-callback.example", DALI_DEMO_STR_TITLE_FRAME_CALLBACK)); | 51 | demo.AddExample(Example("frame-callback.example", DALI_DEMO_STR_TITLE_FRAME_CALLBACK)); |
| 52 | demo.AddExample(Example("focus-integration.example", DALI_DEMO_STR_TITLE_FOCUS_INTEGRATION)); | 52 | demo.AddExample(Example("focus-integration.example", DALI_DEMO_STR_TITLE_FOCUS_INTEGRATION)); |
| 53 | + demo.AddExample(Example("gestures.example", DALI_DEMO_STR_TITLE_GESTURES)); | ||
| 53 | demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT)); | 54 | demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT)); |
| 54 | demo.AddExample(Example("hello-world.example", DALI_DEMO_STR_TITLE_HELLO_WORLD)); | 55 | demo.AddExample(Example("hello-world.example", DALI_DEMO_STR_TITLE_HELLO_WORLD)); |
| 55 | demo.AddExample(Example("image-policies.example", DALI_DEMO_STR_TITLE_IMAGE_POLICIES)); | 56 | demo.AddExample(Example("image-policies.example", DALI_DEMO_STR_TITLE_IMAGE_POLICIES)); |
examples/gestures/gesture-example.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +// EXTERNAL INCLUDES | ||
| 19 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 20 | +#include <string> | ||
| 21 | + | ||
| 22 | +using namespace Dali; | ||
| 23 | +using namespace Dali::Toolkit; | ||
| 24 | + | ||
| 25 | +namespace | ||
| 26 | +{ | ||
| 27 | +const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 167.0f, 207.0f, 223.0f, 255.0f ) / 255.0f; | ||
| 28 | +const Vector4 BACKGROUND_GRADIENT_2 = Vector4( 0.0f, 64.0f, 137.0f, 255.0f ) / 255.0f; | ||
| 29 | +const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f ); | ||
| 30 | +const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f, 0.5f ); | ||
| 31 | + | ||
| 32 | +const Vector4 CONTROL_GRADIENT_1 = Vector4( 234.0f, 185.0f, 45.0f, 255.0f ) / 255.0f; | ||
| 33 | +const Vector4 CONTROL_GRADIENT_2 = Vector4( 199.0f, 152.0f, 16.0f, 255.0f ) / 255.0f; | ||
| 34 | +const Vector2 CONTROL_GRADIENT_CENTER( Vector2::ZERO ); | ||
| 35 | +const float CONTROL_GRADIENT_RADIUS( 0.5f ); | ||
| 36 | + | ||
| 37 | +const float HELP_ANIMATION_DURATION( 25.0f ); | ||
| 38 | +const float HELP_ANIMATION_SEGMENT_TIME( 5.0f ); | ||
| 39 | +const float HELP_ANIMATION_TRANSITION_DURATION( 0.75f ); | ||
| 40 | +const Vector2 HELP_TEXT_POSITION_MULTIPLIER( 0.25f, 0.13f ); | ||
| 41 | + | ||
| 42 | +const float SHAKY_ANIMATION_DURATION( 0.1f ); | ||
| 43 | +const float SHAKY_ANIMATION_SEGMENT_TIME( 0.05f ); | ||
| 44 | +const float SHAKY_ANIMATION_ANGLE( 1.0f ); | ||
| 45 | + | ||
| 46 | +const float TOUCH_MODE_ANIMATION_DURATION( 0.1f ); | ||
| 47 | +const Vector4 TOUCH_MODE_COLOR( 1.0f, 0.7f, 0.7f, 1.0f ); | ||
| 48 | + | ||
| 49 | +const float PAN_MODE_CHANGE_ANIMATION_DURATION( 0.25f ); | ||
| 50 | +const Vector3 PAN_MODE_START_ANIMATION_SCALE( 1.2f, 1.2f, 1.0f ); | ||
| 51 | +const Vector3 PAN_MODE_END_ANIMATION_SCALE( 0.8f, 0.8f, 1.0f ); | ||
| 52 | + | ||
| 53 | +const float TAP_ANIMATION_DURATON( 0.5f ); | ||
| 54 | +const Vector4 TAP_ANIMATION_COLOR( 0.8f, 0.5, 0.2f, 0.6f ); | ||
| 55 | + | ||
| 56 | +const Vector3 MINIMUM_SCALE( Vector3::ONE ); | ||
| 57 | +const Vector3 MAXIMUM_SCALE( Vector3::ONE * 2.0f ); | ||
| 58 | +const float SCALE_BACK_ANIMATION_DURATION( 0.25f ); | ||
| 59 | + | ||
| 60 | +/** | ||
| 61 | + * @brief Creates a background with a linear gradient which matches parent size & is placed in the center. | ||
| 62 | + */ | ||
| 63 | +Actor CreateBackground() | ||
| 64 | +{ | ||
| 65 | + Actor background = Control::New(); | ||
| 66 | + background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 67 | + background.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 68 | + background.SetProperty( | ||
| 69 | + Control::Property::BACKGROUND, | ||
| 70 | + Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT ) | ||
| 71 | + .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 ) | ||
| 72 | + .Add( BACKGROUND_GRADIENT_2 ) ) | ||
| 73 | + .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION ) | ||
| 74 | + .Add( GradientVisual::Property::END_POSITION, BACKGROUND_GRADIENT_END_POSITION ) ); | ||
| 75 | + return background; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +/** | ||
| 79 | + * @brief Create a control with a circular gradient & a specific size & is placed in the center of its parent. | ||
| 80 | + * | ||
| 81 | + * @param[in] size The size we want the control to be. | ||
| 82 | + */ | ||
| 83 | +Actor CreateTouchControl( const Vector2& size ) | ||
| 84 | +{ | ||
| 85 | + Actor touchControl = Control::New(); | ||
| 86 | + touchControl.SetSize( size ); | ||
| 87 | + touchControl.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 88 | + touchControl.SetProperty( | ||
| 89 | + Control::Property::BACKGROUND, | ||
| 90 | + Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT ) | ||
| 91 | + .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( CONTROL_GRADIENT_1 ) | ||
| 92 | + .Add( CONTROL_GRADIENT_2 ) ) | ||
| 93 | + .Add( GradientVisual::Property::CENTER, CONTROL_GRADIENT_CENTER ) | ||
| 94 | + .Add( GradientVisual::Property::RADIUS, CONTROL_GRADIENT_RADIUS ) | ||
| 95 | + ); | ||
| 96 | + return touchControl; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +/** | ||
| 100 | + * @brief Shows the given string between the given start and end times. | ||
| 101 | + * | ||
| 102 | + * Appropriately animates the string into and out of the scene. | ||
| 103 | + * | ||
| 104 | + * @param[in] string The label to display, this is an rvalue reference & will be moved | ||
| 105 | + * @param[in] parent The parent to add the label to | ||
| 106 | + * @param[in] animation The animation to add the animators created in this function | ||
| 107 | + * @param[in] startTime When to start the animators | ||
| 108 | + * @param[in] endTime When to end the animators | ||
| 109 | + */ | ||
| 110 | +void AddHelpInfo( const std::string&& string, Actor parent, Animation animation, float startTime, float endTime ) | ||
| 111 | +{ | ||
| 112 | + Actor text = TextLabel::New( std::move( string ) ); | ||
| 113 | + Vector3 position( Stage::GetCurrent().GetSize() * HELP_TEXT_POSITION_MULTIPLIER ); | ||
| 114 | + | ||
| 115 | + text.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 116 | + text.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 117 | + text.SetPosition( position ); | ||
| 118 | + text.SetOpacity( 0.0f ); | ||
| 119 | + text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, Text::HorizontalAlignment::CENTER ); | ||
| 120 | + parent.Add( text ); | ||
| 121 | + | ||
| 122 | + // Animate IN | ||
| 123 | + TimePeriod timePeriod( startTime, HELP_ANIMATION_TRANSITION_DURATION ); | ||
| 124 | + animation.AnimateTo( Property( text, Actor::Property::COLOR_ALPHA ), 1.0f, timePeriod ); | ||
| 125 | + animation.AnimateBy( Property( text, Actor::Property::POSITION_X ), -position.x, timePeriod ); | ||
| 126 | + | ||
| 127 | + // Animate OUT | ||
| 128 | + timePeriod.delaySeconds = endTime; | ||
| 129 | + animation.AnimateTo( Property( text, Actor::Property::COLOR_ALPHA ), 0.0f, timePeriod ); | ||
| 130 | + animation.AnimateBy( Property( text, Actor::Property::POSITION_X ), -position.x, timePeriod ); | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +} // unnamed namespace | ||
| 134 | + | ||
| 135 | +/** | ||
| 136 | + * @brief This example shows how to use the different gesture detectors available. | ||
| 137 | + * | ||
| 138 | + * - Tapping on the control shows a small rotation animation. | ||
| 139 | + * - A Long press on the control puts it into Pan Mode. | ||
| 140 | + * - When in Pan mode, the control can be panned (moved). | ||
| 141 | + * - When the pan ends, we exit the Pan mode via an animation. | ||
| 142 | + * - Pinching the control changes the scale of the control. | ||
| 143 | + */ | ||
| 144 | +class GestureExample : public ConnectionTracker | ||
| 145 | +{ | ||
| 146 | +public: | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * @brief Constructor. | ||
| 150 | + * | ||
| 151 | + * @param[in] application Reference to the application | ||
| 152 | + */ | ||
| 153 | + GestureExample( Application &application ) | ||
| 154 | + : mApplication( application ) | ||
| 155 | + { | ||
| 156 | + // Connect to the Application's Init signal | ||
| 157 | + application.InitSignal().Connect( this, &GestureExample::Create ); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | +private: | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * @brief Creates the scene as described in this class' description. | ||
| 164 | + * | ||
| 165 | + * @param[in] application Reference to the application class | ||
| 166 | + */ | ||
| 167 | + void Create( Application& application ) | ||
| 168 | + { | ||
| 169 | + // Get a handle to the stage & connect to the key event signal | ||
| 170 | + Stage stage = Stage::GetCurrent(); | ||
| 171 | + stage.KeyEventSignal().Connect(this, &GestureExample::OnKeyEvent); | ||
| 172 | + | ||
| 173 | + // Create a background with a gradient | ||
| 174 | + Actor background = CreateBackground(); | ||
| 175 | + stage.Add( background ); | ||
| 176 | + | ||
| 177 | + // Create a control that we'll use for the gestures to be a quarter of the size of the stage | ||
| 178 | + Actor touchControl = CreateTouchControl( stage.GetSize() * 0.25f ); | ||
| 179 | + background.Add( touchControl ); | ||
| 180 | + | ||
| 181 | + // Connect to the touch signal | ||
| 182 | + touchControl.TouchSignal().Connect( this, &GestureExample::OnTouch ); | ||
| 183 | + touchControl.SetLeaveRequired( true ); | ||
| 184 | + | ||
| 185 | + // Create a long press gesture detector, attach the actor & connect | ||
| 186 | + mLongPressDetector = LongPressGestureDetector::New(); | ||
| 187 | + mLongPressDetector.Attach( touchControl ); | ||
| 188 | + mLongPressDetector.DetectedSignal().Connect( this, &GestureExample::OnLongPress ); | ||
| 189 | + | ||
| 190 | + // Create a pan gesture detector, attach the actor & connect | ||
| 191 | + mPanDetector = PanGestureDetector::New(); | ||
| 192 | + mPanDetector.Attach( touchControl ); | ||
| 193 | + mPanDetector.DetectedSignal().Connect( this, &GestureExample::OnPan ); | ||
| 194 | + | ||
| 195 | + // Create a tap gesture detector, attach the actor & connect | ||
| 196 | + mTapDetector = TapGestureDetector::New(); | ||
| 197 | + mTapDetector.Attach( touchControl ); | ||
| 198 | + mTapDetector.DetectedSignal().Connect( this, &GestureExample::OnTap ); | ||
| 199 | + | ||
| 200 | + // Create a pinch gesture detector, attach the actor & connect | ||
| 201 | + mPinchDetector = PinchGestureDetector::New(); | ||
| 202 | + mPinchDetector.Attach( touchControl ); | ||
| 203 | + mPinchDetector.DetectedSignal().Connect( this, &GestureExample::OnPinch ); | ||
| 204 | + | ||
| 205 | + // Create an animation which shakes the actor when in Pan mode | ||
| 206 | + mShakeAnimation = Animation::New( SHAKY_ANIMATION_DURATION ); | ||
| 207 | + mShakeAnimation.AnimateBy( Property( touchControl, Actor::Property::ORIENTATION ), | ||
| 208 | + Quaternion( Degree( SHAKY_ANIMATION_ANGLE ), Vector3::ZAXIS ), | ||
| 209 | + AlphaFunction::BOUNCE, | ||
| 210 | + TimePeriod( 0.0f, SHAKY_ANIMATION_SEGMENT_TIME ) ); | ||
| 211 | + mShakeAnimation.AnimateBy( Property( touchControl, Actor::Property::ORIENTATION ), | ||
| 212 | + Quaternion( Degree( -SHAKY_ANIMATION_ANGLE ), Vector3::ZAXIS ), | ||
| 213 | + AlphaFunction::BOUNCE, | ||
| 214 | + TimePeriod( SHAKY_ANIMATION_SEGMENT_TIME, SHAKY_ANIMATION_SEGMENT_TIME ) ); | ||
| 215 | + | ||
| 216 | + // Animate help information | ||
| 217 | + // Here we just animate some text on the screen to show tips on how to use this example | ||
| 218 | + // The help animation loops | ||
| 219 | + Animation helpAnimation = Animation::New( HELP_ANIMATION_DURATION ); | ||
| 220 | + | ||
| 221 | + float startTime( 0.0f ); | ||
| 222 | + float endTime( startTime + HELP_ANIMATION_SEGMENT_TIME ); | ||
| 223 | + | ||
| 224 | + AddHelpInfo( "Tap image for animation", background, helpAnimation, startTime, endTime ); | ||
| 225 | + AddHelpInfo( "Press & Hold image to drag", background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME ); | ||
| 226 | + AddHelpInfo( "Pinch image to resize", background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME ); | ||
| 227 | + helpAnimation.SetLooping( true ); | ||
| 228 | + helpAnimation.Play(); | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + /** | ||
| 232 | + * @brief Called when our actor is touched. | ||
| 233 | + * | ||
| 234 | + * @param[in] actor The touched actor | ||
| 235 | + * @param[in] touch The touch event | ||
| 236 | + */ | ||
| 237 | + bool OnTouch( Actor actor, const TouchData& touch ) | ||
| 238 | + { | ||
| 239 | + switch( touch.GetState( 0 ) ) | ||
| 240 | + { | ||
| 241 | + case PointState::DOWN: | ||
| 242 | + { | ||
| 243 | + // When we get a touch point, change the color of the actor. | ||
| 244 | + | ||
| 245 | + Animation anim = Animation::New( TOUCH_MODE_ANIMATION_DURATION ); | ||
| 246 | + anim.AnimateTo( Property( actor, Actor::Property::COLOR ), TOUCH_MODE_COLOR ); | ||
| 247 | + anim.Play(); | ||
| 248 | + break; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + case PointState::LEAVE: | ||
| 252 | + case PointState::UP: | ||
| 253 | + case PointState::INTERRUPTED: | ||
| 254 | + { | ||
| 255 | + if( ! mPanStarted ) | ||
| 256 | + { | ||
| 257 | + // If we're not panning, change the color back to normal. | ||
| 258 | + | ||
| 259 | + Animation anim = Animation::New( TOUCH_MODE_ANIMATION_DURATION ); | ||
| 260 | + anim.AnimateTo( Property( actor, Actor::Property::COLOR ), Vector4::ONE ); | ||
| 261 | + anim.Play(); | ||
| 262 | + | ||
| 263 | + // Stop the shake animation from looping. | ||
| 264 | + mShakeAnimation.SetLooping( false ); | ||
| 265 | + } | ||
| 266 | + break; | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + default: | ||
| 270 | + { | ||
| 271 | + break; | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + return true; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + /** | ||
| 278 | + * @brief Called when a long-press gesture is detected on our control. | ||
| 279 | + * | ||
| 280 | + * @param[in] actor The actor that's been long-pressed | ||
| 281 | + * @param[in] longPress The long-press gesture information | ||
| 282 | + */ | ||
| 283 | + void OnLongPress( Actor actor, const LongPressGesture& longPress ) | ||
| 284 | + { | ||
| 285 | + switch( longPress.state ) | ||
| 286 | + { | ||
| 287 | + case Gesture::Started: | ||
| 288 | + { | ||
| 289 | + // When we first receive a long press, change state to pan mode. | ||
| 290 | + | ||
| 291 | + // Do a small animation to indicate to the user that we are in pan mode. | ||
| 292 | + Animation anim = Animation::New( PAN_MODE_CHANGE_ANIMATION_DURATION ); | ||
| 293 | + anim.AnimateTo( Property( actor, Actor::Property::SCALE ), actor.GetCurrentScale() * PAN_MODE_START_ANIMATION_SCALE, AlphaFunction::BOUNCE ); | ||
| 294 | + anim.Play(); | ||
| 295 | + mPanMode = true; | ||
| 296 | + | ||
| 297 | + // Start the shake animation so the user knows when they are in pan mode. | ||
| 298 | + mShakeAnimation.SetLooping( true ); | ||
| 299 | + mShakeAnimation.Play(); | ||
| 300 | + break; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + case Gesture::Finished: | ||
| 304 | + case Gesture::Cancelled: | ||
| 305 | + { | ||
| 306 | + // We get this state when all touches are released after a long press. We end pan mode... | ||
| 307 | + mPanMode = false; | ||
| 308 | + break; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + default: | ||
| 312 | + { | ||
| 313 | + break; | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + /** | ||
| 319 | + * @brief Called when a pan gesture is detected on our control. | ||
| 320 | + * | ||
| 321 | + * @param[in] actor The actor that's been panned | ||
| 322 | + * @param[in] pan The pan gesture information | ||
| 323 | + */ | ||
| 324 | + void OnPan( Actor actor, const PanGesture& pan ) | ||
| 325 | + { | ||
| 326 | + if( mPanMode || mPanStarted ) | ||
| 327 | + { | ||
| 328 | + // When we are in Pan mode, just move the actor by the displacement. | ||
| 329 | + | ||
| 330 | + // As the displacement is in local actor coords, we will have to multiply the displacement by the | ||
| 331 | + // actor's scale so that it moves the correct amount in the parent's coordinate system. | ||
| 332 | + Vector3 scaledDisplacement( pan.displacement ); | ||
| 333 | + scaledDisplacement *= actor.GetCurrentScale(); | ||
| 334 | + | ||
| 335 | + Vector3 currentPosition; | ||
| 336 | + actor.GetProperty( Actor::Property::POSITION ).Get( currentPosition ); | ||
| 337 | + | ||
| 338 | + Vector3 newPosition = currentPosition + scaledDisplacement; | ||
| 339 | + actor.SetPosition( newPosition ); | ||
| 340 | + | ||
| 341 | + switch( pan.state ) | ||
| 342 | + { | ||
| 343 | + case Gesture::Started: | ||
| 344 | + { | ||
| 345 | + mPanStarted = true; | ||
| 346 | + break; | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + case Gesture::Finished: | ||
| 350 | + case Gesture::Cancelled: | ||
| 351 | + { | ||
| 352 | + // If we cancel or finish the pan, do an animation to indicate this and stop the shake animation. | ||
| 353 | + | ||
| 354 | + Animation anim = Animation::New( PAN_MODE_CHANGE_ANIMATION_DURATION ); | ||
| 355 | + anim.AnimateTo( Property( actor, Actor::Property::COLOR ), Vector4::ONE ); | ||
| 356 | + anim.AnimateTo( Property( actor, Actor::Property::SCALE ), actor.GetCurrentScale() * PAN_MODE_END_ANIMATION_SCALE, AlphaFunction::BOUNCE ); | ||
| 357 | + | ||
| 358 | + // Move actor back to center if we're out of bounds | ||
| 359 | + Vector2 halfStageSize = Stage::GetCurrent().GetSize() * 0.5f; | ||
| 360 | + if( ( std::abs( newPosition.x ) > halfStageSize.width ) || | ||
| 361 | + ( std::abs( newPosition.y ) > halfStageSize.height ) ) | ||
| 362 | + { | ||
| 363 | + anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3::ZERO, AlphaFunction::EASE_IN ); | ||
| 364 | + } | ||
| 365 | + anim.Play(); | ||
| 366 | + | ||
| 367 | + mShakeAnimation.SetLooping( false ); | ||
| 368 | + mPanStarted = false; | ||
| 369 | + break; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + default: | ||
| 373 | + { | ||
| 374 | + break; | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + } | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + /** | ||
| 381 | + * @brief Called when a tap gesture is detected on our control. | ||
| 382 | + * | ||
| 383 | + * @param[in] actor The actor that's been tapped | ||
| 384 | + * @param[in] tap The tap gesture information | ||
| 385 | + */ | ||
| 386 | + void OnTap( Actor actor, const TapGesture& tap ) | ||
| 387 | + { | ||
| 388 | + // Do a short animation to show a tap has happened. | ||
| 389 | + | ||
| 390 | + Animation anim = Animation::New( TAP_ANIMATION_DURATON ); | ||
| 391 | + anim.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Degree( 360.0f ), Vector3::ZAXIS ) ); | ||
| 392 | + anim.AnimateTo( Property( actor, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::LINEAR ); | ||
| 393 | + anim.AnimateTo( Property( actor, Actor::Property::COLOR ), TAP_ANIMATION_COLOR, AlphaFunction::BOUNCE ); | ||
| 394 | + anim.Play(); | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + /** | ||
| 398 | + * @brief Called when a pinch gesture is detected on our control. | ||
| 399 | + * | ||
| 400 | + * @param[in] actor The actor that's been pinched | ||
| 401 | + * @param[in] pinch The pinch gesture information | ||
| 402 | + */ | ||
| 403 | + void OnPinch( Actor actor, const PinchGesture& pinch ) | ||
| 404 | + { | ||
| 405 | + switch( pinch.state ) | ||
| 406 | + { | ||
| 407 | + case Gesture::Started: | ||
| 408 | + { | ||
| 409 | + // Starting scale is required so that we know what to multiply the pinch.scale by. | ||
| 410 | + mStartingScale = actor.GetCurrentScale(); | ||
| 411 | + break; | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + case Gesture::Finished: | ||
| 415 | + case Gesture::Cancelled: | ||
| 416 | + { | ||
| 417 | + Vector3 scale( actor.GetCurrentScale() ); | ||
| 418 | + | ||
| 419 | + // Ensure the actor sizes itself to be within the limits defined. | ||
| 420 | + if ( scale.x < MINIMUM_SCALE.x ) | ||
| 421 | + { | ||
| 422 | + scale = MINIMUM_SCALE; | ||
| 423 | + } | ||
| 424 | + else if ( scale.x > MAXIMUM_SCALE.x ) | ||
| 425 | + { | ||
| 426 | + scale = MAXIMUM_SCALE; | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + // Do an animation to come back to go back to the limits. | ||
| 430 | + Animation anim = Animation::New( SCALE_BACK_ANIMATION_DURATION ); | ||
| 431 | + anim.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, AlphaFunction::LINEAR ); | ||
| 432 | + anim.Play(); | ||
| 433 | + break; | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + default: | ||
| 437 | + { | ||
| 438 | + break; | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | + | ||
| 442 | + actor.SetScale( mStartingScale * pinch.scale ); | ||
| 443 | + } | ||
| 444 | + | ||
| 445 | + /** | ||
| 446 | + * @brief Called when any key event is received. | ||
| 447 | + * | ||
| 448 | + * Will use this to quit the application if Back or the Escape key is received. | ||
| 449 | + * @param[in] event The key event information | ||
| 450 | + */ | ||
| 451 | + void OnKeyEvent( const KeyEvent& event ) | ||
| 452 | + { | ||
| 453 | + if( event.state == KeyEvent::Down ) | ||
| 454 | + { | ||
| 455 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | ||
| 456 | + { | ||
| 457 | + mApplication.Quit(); | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + } | ||
| 461 | + | ||
| 462 | +private: | ||
| 463 | + Application& mApplication; | ||
| 464 | + | ||
| 465 | + PanGestureDetector mPanDetector; | ||
| 466 | + LongPressGestureDetector mLongPressDetector; | ||
| 467 | + TapGestureDetector mTapDetector; | ||
| 468 | + PinchGestureDetector mPinchDetector; | ||
| 469 | + | ||
| 470 | + Vector3 mStartingScale; ///< Set to the scale of the control when pinch starts. | ||
| 471 | + Animation mShakeAnimation; ///< "Shake" animation to show when we are in panning mode. | ||
| 472 | + bool mPanMode = false; ///< Set to true when we have long-pressed to put us into panning mode. | ||
| 473 | + bool mPanStarted = false; ///< Set to true to state that panning has started. | ||
| 474 | +}; | ||
| 475 | + | ||
| 476 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 477 | +{ | ||
| 478 | + Application application = Application::New( &argc, &argv ); | ||
| 479 | + GestureExample controller( application ); | ||
| 480 | + application.MainLoop(); | ||
| 481 | + return 0; | ||
| 482 | +} |
examples/simple-bitmap-font-text-label/simple-text-label-example.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file simple-text-label-example.cpp | ||
| 20 | + * @brief Basic usage of SimpleTextLabel control | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | + | ||
| 26 | +#include <dali/devel-api/text-abstraction/font-client.h> | ||
| 27 | +#include <dali/devel-api/text-abstraction/bitmap-font.h> | ||
| 28 | +#include <dali-toolkit/devel-api/text/bitmap-font.h> | ||
| 29 | + | ||
| 30 | +using namespace Dali; | ||
| 31 | +using namespace Dali::Toolkit; | ||
| 32 | + | ||
| 33 | +/** | ||
| 34 | + * @brief The main class of the demo. | ||
| 35 | + */ | ||
| 36 | +class SimpleTextLabelExample : public ConnectionTracker | ||
| 37 | +{ | ||
| 38 | +public: | ||
| 39 | + | ||
| 40 | + SimpleTextLabelExample( Application& application ) | ||
| 41 | + : mApplication( application ) | ||
| 42 | + { | ||
| 43 | + // Connect to the Application's Init signal | ||
| 44 | + mApplication.InitSignal().Connect( this, &SimpleTextLabelExample::Create ); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + ~SimpleTextLabelExample() | ||
| 48 | + { | ||
| 49 | + // Nothing to do here. | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * One-time setup in response to Application InitSignal. | ||
| 54 | + */ | ||
| 55 | + void Create( Application& application ) | ||
| 56 | + { | ||
| 57 | + Stage stage = Stage::GetCurrent(); | ||
| 58 | + | ||
| 59 | + stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent); | ||
| 60 | + | ||
| 61 | + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); | ||
| 62 | + | ||
| 63 | + DevelText::BitmapFontDescription fontDescription; | ||
| 64 | + fontDescription.name = "Digits"; | ||
| 65 | + fontDescription.underlinePosition = 0.f; | ||
| 66 | + fontDescription.underlineThickness = 0.f; | ||
| 67 | + | ||
| 68 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0030.png", "0", 34.f, 0.f } ); | ||
| 69 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0031.png", "1", 34.f, 0.f } ); | ||
| 70 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0032.png", "2", 34.f, 0.f } ); | ||
| 71 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0033.png", "3", 34.f, 0.f } ); | ||
| 72 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0034.png", "4", 34.f, 0.f } ); | ||
| 73 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0035.png", "5", 34.f, 0.f } ); | ||
| 74 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0036.png", "6", 34.f, 0.f } ); | ||
| 75 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0037.png", "7", 34.f, 0.f } ); | ||
| 76 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0038.png", "8", 34.f, 0.f } ); | ||
| 77 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0039.png", "9", 34.f, 0.f } ); | ||
| 78 | + fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u003a.png", ":", 34.f, 0.f } ); | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + DevelText::BitmapFontDescription colorFontDescription; | ||
| 82 | + colorFontDescription.name = "DigitsColor"; | ||
| 83 | + colorFontDescription.underlinePosition = 0.f; | ||
| 84 | + colorFontDescription.underlineThickness = 0.f; | ||
| 85 | + colorFontDescription.isColorFont = true; | ||
| 86 | + | ||
| 87 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0030_color.png", "0", 34.f, 0.f } ); | ||
| 88 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0031_color.png", "1", 34.f, 0.f } ); | ||
| 89 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0032_color.png", "2", 34.f, 0.f } ); | ||
| 90 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0033_color.png", "3", 34.f, 0.f } ); | ||
| 91 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0034_color.png", "4", 34.f, 0.f } ); | ||
| 92 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0035_color.png", "5", 34.f, 0.f } ); | ||
| 93 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0036_color.png", "6", 34.f, 0.f } ); | ||
| 94 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0037_color.png", "7", 34.f, 0.f } ); | ||
| 95 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0038_color.png", "8", 34.f, 0.f } ); | ||
| 96 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0039_color.png", "9", 34.f, 0.f } ); | ||
| 97 | + colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u003a_color.png", ":", 34.f, 0.f } ); | ||
| 98 | + | ||
| 99 | + TextAbstraction::BitmapFont bitmapFont; | ||
| 100 | + TextAbstraction::BitmapFont bitmapColorFont; | ||
| 101 | + | ||
| 102 | + DevelText::CreateBitmapFont( fontDescription, bitmapFont ); | ||
| 103 | + DevelText::CreateBitmapFont( colorFontDescription, bitmapColorFont ); | ||
| 104 | + | ||
| 105 | + fontClient.GetFontId( bitmapFont ); | ||
| 106 | + fontClient.GetFontId( bitmapColorFont ); | ||
| 107 | + | ||
| 108 | + TextLabel label01 = TextLabel::New(); | ||
| 109 | + label01.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 110 | + label01.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 111 | + label01.SetSize( 400.f, 50.f ); | ||
| 112 | + label01.SetPosition( 0.f, -100.f ); | ||
| 113 | + label01.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 114 | + | ||
| 115 | + label01.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); | ||
| 116 | + label01.SetProperty( TextLabel::Property::TEXT, "012<color 'value'='green'>345</color>6789:" ); | ||
| 117 | + label01.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED ); | ||
| 118 | + label01.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" ); | ||
| 119 | + | ||
| 120 | + label01.SetBackgroundColor( Color::BLACK ); | ||
| 121 | + | ||
| 122 | + stage.Add( label01 ); | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + TextLabel label02 = TextLabel::New(); | ||
| 126 | + label02.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 127 | + label02.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 128 | + label02.SetSize( 400.f, 50.f ); | ||
| 129 | + label02.SetPosition( 0.f, -50.f ); | ||
| 130 | + label02.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 131 | + | ||
| 132 | + label02.SetProperty( TextLabel::Property::TEXT, "0123456789:" ); | ||
| 133 | + label02.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE ); | ||
| 134 | + label02.SetProperty( TextLabel::Property::FONT_FAMILY, "DigitsColor" ); | ||
| 135 | + | ||
| 136 | + label02.SetBackgroundColor( Color::BLACK ); | ||
| 137 | + | ||
| 138 | + stage.Add( label02 ); | ||
| 139 | + | ||
| 140 | + TextLabel label03 = TextLabel::New(); | ||
| 141 | + label03.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 142 | + label03.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 143 | + label03.SetSize( 400.f, 50.f ); | ||
| 144 | + label03.SetPosition( 0.f, 0.f ); | ||
| 145 | + label03.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 146 | + | ||
| 147 | + label03.SetProperty( TextLabel::Property::TEXT, "0123456789:" ); | ||
| 148 | + label03.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" ); | ||
| 149 | + | ||
| 150 | + label03.SetBackgroundColor( Color::WHITE ); | ||
| 151 | + | ||
| 152 | + stage.Add( label03 ); | ||
| 153 | + | ||
| 154 | + TextLabel label04 = TextLabel::New(); | ||
| 155 | + label04.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 156 | + label04.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 157 | + label04.SetSize( 400.f, 50.f ); | ||
| 158 | + label04.SetPosition( 0.f, 50.f ); | ||
| 159 | + label04.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 160 | + | ||
| 161 | + label04.SetProperty( TextLabel::Property::TEXT, "0123456789:" ); | ||
| 162 | + label04.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" ); | ||
| 163 | + label04.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE ); | ||
| 164 | + | ||
| 165 | + label04.SetBackgroundColor( Color::BLACK ); | ||
| 166 | + | ||
| 167 | + stage.Add( label04 ); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * Main key event handler | ||
| 172 | + */ | ||
| 173 | + void OnKeyEvent(const KeyEvent& event) | ||
| 174 | + { | ||
| 175 | + if(event.state == KeyEvent::Down) | ||
| 176 | + { | ||
| 177 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 178 | + { | ||
| 179 | + mApplication.Quit(); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | +private: | ||
| 185 | + | ||
| 186 | + Application& mApplication; | ||
| 187 | +}; | ||
| 188 | + | ||
| 189 | +void RunTest( Application& application ) | ||
| 190 | +{ | ||
| 191 | + SimpleTextLabelExample test( application ); | ||
| 192 | + | ||
| 193 | + application.MainLoop(); | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +/** Entry point for Linux & Tizen applications */ | ||
| 197 | +int main( int argc, char **argv ) | ||
| 198 | +{ | ||
| 199 | + Application application = Application::New( &argc, &argv ); | ||
| 200 | + | ||
| 201 | + RunTest( application ); | ||
| 202 | + | ||
| 203 | + return 0; | ||
| 204 | +} |
examples/simple-text-field/simple-text-field.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file simple-text-field-example.cpp | ||
| 20 | + * @brief Very basic usage of TextField control | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | +#include <iostream> | ||
| 26 | + | ||
| 27 | +using namespace Dali; | ||
| 28 | +using namespace Dali::Toolkit; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * @brief The main class of the demo. | ||
| 33 | + */ | ||
| 34 | +class SimpleTextFieldExample : public ConnectionTracker | ||
| 35 | +{ | ||
| 36 | +public: | ||
| 37 | + | ||
| 38 | + SimpleTextFieldExample( Application& application ) | ||
| 39 | + : mApplication( application ) | ||
| 40 | + { | ||
| 41 | + // Connect to the Application's Init signal | ||
| 42 | + mApplication.InitSignal().Connect( this, &SimpleTextFieldExample::Create ); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + ~SimpleTextFieldExample() | ||
| 46 | + { | ||
| 47 | + // Nothing to do here. | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * One-time setup in response to Application InitSignal. | ||
| 52 | + */ | ||
| 53 | + void Create( Application& application ) | ||
| 54 | + { | ||
| 55 | + Stage stage = Stage::GetCurrent(); | ||
| 56 | + stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) ); | ||
| 57 | + | ||
| 58 | + TextField field = TextField::New(); | ||
| 59 | + field.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 60 | + field.SetSize( 300.f, 60.f ); | ||
| 61 | + field.SetBackgroundColor( Color::WHITE ); | ||
| 62 | + field.SetBackgroundColor( Vector4( 1.f, 1.f, 1.f, 0.15f ) ); | ||
| 63 | + | ||
| 64 | + field.SetProperty( TextField::Property::TEXT_COLOR, Color::BLACK ); | ||
| 65 | + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" ); | ||
| 66 | + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." ); | ||
| 67 | + | ||
| 68 | + stage.Add( field ); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | +private: | ||
| 72 | + | ||
| 73 | + Application& mApplication; | ||
| 74 | +}; | ||
| 75 | + | ||
| 76 | +void RunTest( Application& application ) | ||
| 77 | +{ | ||
| 78 | + SimpleTextFieldExample test( application ); | ||
| 79 | + | ||
| 80 | + application.MainLoop(); | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +/** Entry point for Linux & Tizen applications */ | ||
| 84 | +int main( int argc, char **argv ) | ||
| 85 | +{ | ||
| 86 | + // DALI_DEMO_THEME_PATH not passed to Application so TextField example uses default Toolkit style sheet. | ||
| 87 | + Application application = Application::New( &argc, &argv ); | ||
| 88 | + | ||
| 89 | + RunTest( application ); | ||
| 90 | + | ||
| 91 | + return 0; | ||
| 92 | +} |
examples/simple-text-label/simple-text-label-example.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file simple-text-label-example.cpp | ||
| 20 | + * @brief Basic usage of SimpleTextLabel control | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | + | ||
| 26 | +using namespace Dali; | ||
| 27 | +using namespace Dali::Toolkit; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * @brief The main class of the demo. | ||
| 31 | + */ | ||
| 32 | +class SimpleTextLabelExample : public ConnectionTracker | ||
| 33 | +{ | ||
| 34 | +public: | ||
| 35 | + | ||
| 36 | + SimpleTextLabelExample( Application& application ) | ||
| 37 | + : mApplication( application ) | ||
| 38 | + { | ||
| 39 | + // Connect to the Application's Init signal | ||
| 40 | + mApplication.InitSignal().Connect( this, &SimpleTextLabelExample::Create ); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + ~SimpleTextLabelExample() | ||
| 44 | + { | ||
| 45 | + // Nothing to do here. | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * One-time setup in response to Application InitSignal. | ||
| 50 | + */ | ||
| 51 | + void Create( Application& application ) | ||
| 52 | + { | ||
| 53 | + Stage stage = Stage::GetCurrent(); | ||
| 54 | + | ||
| 55 | + stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent); | ||
| 56 | + | ||
| 57 | + mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); | ||
| 58 | + mLabel.SetName( "SimpleTextLabel" ); | ||
| 59 | + mLabel.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 60 | + mLabel.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 61 | + mLabel.SetSize( 400.f, 400.f ); | ||
| 62 | + mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 63 | + mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK ); | ||
| 64 | + mLabel.SetBackgroundColor( Color::WHITE ); | ||
| 65 | + | ||
| 66 | + stage.Add( mLabel ); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * Main key event handler | ||
| 71 | + */ | ||
| 72 | + void OnKeyEvent(const KeyEvent& event) | ||
| 73 | + { | ||
| 74 | + if(event.state == KeyEvent::Down) | ||
| 75 | + { | ||
| 76 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 77 | + { | ||
| 78 | + mApplication.Quit(); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | +private: | ||
| 84 | + | ||
| 85 | + Application& mApplication; | ||
| 86 | + | ||
| 87 | + TextLabel mLabel; | ||
| 88 | +}; | ||
| 89 | + | ||
| 90 | +void RunTest( Application& application ) | ||
| 91 | +{ | ||
| 92 | + SimpleTextLabelExample test( application ); | ||
| 93 | + | ||
| 94 | + application.MainLoop(); | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +/** Entry point for Linux & Tizen applications */ | ||
| 98 | +int main( int argc, char **argv ) | ||
| 99 | +{ | ||
| 100 | + Application application = Application::New( &argc, &argv ); | ||
| 101 | + | ||
| 102 | + RunTest( application ); | ||
| 103 | + | ||
| 104 | + return 0; | ||
| 105 | +} |
examples/simple-text-renderer/simple-text-renderer-example.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file simple-text-renderer-example.cpp | ||
| 20 | + * @brief Basic usage of Text Renderer utility. | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali/devel-api/adaptor-framework/pixel-buffer.h> | ||
| 25 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 26 | +#include <dali-toolkit/devel-api/text/text-utils-devel.h> | ||
| 27 | +#include <devel-api/adaptor-framework/image-loading.h> | ||
| 28 | + | ||
| 29 | +#include <iostream> | ||
| 30 | +#include <fstream> | ||
| 31 | + | ||
| 32 | +using namespace std; | ||
| 33 | +using namespace Dali; | ||
| 34 | +using namespace Dali::Toolkit; | ||
| 35 | + | ||
| 36 | +namespace | ||
| 37 | +{ | ||
| 38 | + | ||
| 39 | +const std::string IMAGE1 = DEMO_IMAGE_DIR "application-icon-1.png"; | ||
| 40 | +const std::string IMAGE2 = DEMO_IMAGE_DIR "application-icon-6.png"; | ||
| 41 | + | ||
| 42 | +#define MAKE_SHADER(A)#A | ||
| 43 | + | ||
| 44 | +const std::string VERSION_3_ES = "#version 300 es\n"; | ||
| 45 | + | ||
| 46 | +const char* VERTEX_SHADER = MAKE_SHADER( | ||
| 47 | + precision mediump float; | ||
| 48 | + | ||
| 49 | + in vec2 aPosition; | ||
| 50 | + in vec2 aTexCoord; | ||
| 51 | + | ||
| 52 | + out vec2 vUV; | ||
| 53 | + | ||
| 54 | + uniform vec3 uSize; | ||
| 55 | + uniform mat4 uMvpMatrix; | ||
| 56 | + | ||
| 57 | + void main() | ||
| 58 | + { | ||
| 59 | + vec4 vertexPosition = vec4(aPosition, 0.0, 1.0); | ||
| 60 | + vertexPosition.xyz *= uSize; | ||
| 61 | + gl_Position = uMvpMatrix * vertexPosition; | ||
| 62 | + | ||
| 63 | + vUV = aTexCoord; | ||
| 64 | + } | ||
| 65 | +); | ||
| 66 | + | ||
| 67 | +const char* FRAGMENT_SHADER = MAKE_SHADER( | ||
| 68 | + precision mediump float; | ||
| 69 | + | ||
| 70 | + in vec2 vUV; | ||
| 71 | + | ||
| 72 | + out vec4 FragColor; | ||
| 73 | + | ||
| 74 | + uniform sampler2D sAlbedo; | ||
| 75 | + uniform vec4 uColor; | ||
| 76 | + | ||
| 77 | + void main() | ||
| 78 | + { | ||
| 79 | + vec4 color = texture( sAlbedo, vUV ); | ||
| 80 | + FragColor = vec4( color.rgb, uColor.a * color.a ); | ||
| 81 | + } | ||
| 82 | +); | ||
| 83 | + | ||
| 84 | +Renderer CreateRenderer() | ||
| 85 | +{ | ||
| 86 | + // Create the geometry. | ||
| 87 | + struct Vertex | ||
| 88 | + { | ||
| 89 | + Dali::Vector2 position; | ||
| 90 | + Dali::Vector2 texCoord; | ||
| 91 | + }; | ||
| 92 | + | ||
| 93 | + static const Vertex vertices[] = {{ Dali::Vector2( -0.5f, -0.5f ), Dali::Vector2( 0.0f, 0.0f ) }, | ||
| 94 | + { Dali::Vector2( 0.5f, -0.5f ), Dali::Vector2( 1.0f, 0.0f ) }, | ||
| 95 | + { Dali::Vector2( -0.5f, 0.5f ), Dali::Vector2( 0.0f, 1.0f ) }, | ||
| 96 | + { Dali::Vector2( 0.5f, 0.5f ), Dali::Vector2( 1.0f, 1.0f ) }}; | ||
| 97 | + | ||
| 98 | + Property::Map property; | ||
| 99 | + property.Add("aPosition", Property::VECTOR2).Add("aTexCoord", Property::VECTOR2); | ||
| 100 | + | ||
| 101 | + PropertyBuffer vertexBuffer = PropertyBuffer::New(property); | ||
| 102 | + | ||
| 103 | + vertexBuffer.SetData(vertices, sizeof(vertices) / sizeof(Vertex)); | ||
| 104 | + | ||
| 105 | + Geometry geometry = Geometry::New(); | ||
| 106 | + geometry.AddVertexBuffer(vertexBuffer); | ||
| 107 | + | ||
| 108 | + geometry.SetType(Geometry::TRIANGLE_STRIP); | ||
| 109 | + | ||
| 110 | + // Create the shader | ||
| 111 | + Shader shader = Shader::New( VERSION_3_ES + VERTEX_SHADER, VERSION_3_ES + FRAGMENT_SHADER ); | ||
| 112 | + | ||
| 113 | + // Create the renderer | ||
| 114 | + | ||
| 115 | + Renderer renderer = Renderer::New( geometry, shader ); | ||
| 116 | + | ||
| 117 | + return renderer; | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +TextureSet CreateTextureSet( const Dali::Toolkit::DevelText::RendererParameters& textParameters, const std::vector<std::string>& embeddedItems ) | ||
| 121 | +{ | ||
| 122 | + | ||
| 123 | + Dali::Vector<Dali::Toolkit::DevelText::EmbeddedItemInfo> embeddedItemLayout; | ||
| 124 | + | ||
| 125 | + Devel::PixelBuffer pixelBuffer = Toolkit::DevelText::Render( textParameters, embeddedItemLayout ); | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + const int dstWidth = static_cast<int>( pixelBuffer.GetWidth() ); | ||
| 129 | + const int dstHeight = static_cast<int>( pixelBuffer.GetHeight() ); | ||
| 130 | + | ||
| 131 | + unsigned int index = 0u; | ||
| 132 | + for( const auto& itemLayout : embeddedItemLayout ) | ||
| 133 | + { | ||
| 134 | + int width = static_cast<int>( itemLayout.size.width ); | ||
| 135 | + int height = static_cast<int>( itemLayout.size.height ); | ||
| 136 | + int x = static_cast<int>( itemLayout.position.x ); | ||
| 137 | + int y = static_cast<int>( itemLayout.position.y ); | ||
| 138 | + | ||
| 139 | + Dali::Devel::PixelBuffer itemPixelBuffer = Dali::LoadImageFromFile( embeddedItems[index++] ); | ||
| 140 | + itemPixelBuffer.Resize( width, height ); | ||
| 141 | + itemPixelBuffer.Rotate( itemLayout.angle ); | ||
| 142 | + | ||
| 143 | + width = static_cast<int>( itemPixelBuffer.GetWidth() ); | ||
| 144 | + height = static_cast<int>( itemPixelBuffer.GetHeight() ); | ||
| 145 | + | ||
| 146 | + Dali::Pixel::Format itemPixelFormat = itemPixelBuffer.GetPixelFormat(); | ||
| 147 | + | ||
| 148 | + // Check if the item is out of the buffer. | ||
| 149 | + | ||
| 150 | + if( ( x + width < 0 ) || | ||
| 151 | + ( x > dstWidth ) || | ||
| 152 | + ( y < 0 ) || | ||
| 153 | + ( y - height > dstHeight ) ) | ||
| 154 | + { | ||
| 155 | + // The embedded item is completely out of the buffer. | ||
| 156 | + continue; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + // Crop if it exceeds the boundaries of the destination buffer. | ||
| 160 | + int layoutX = 0; | ||
| 161 | + int layoutY = 0; | ||
| 162 | + int cropX = 0; | ||
| 163 | + int cropY = 0; | ||
| 164 | + int newWidth = width; | ||
| 165 | + int newHeight = height; | ||
| 166 | + | ||
| 167 | + bool crop = false; | ||
| 168 | + | ||
| 169 | + if( 0 > x ) | ||
| 170 | + { | ||
| 171 | + newWidth += x; | ||
| 172 | + cropX = std::abs( x ); | ||
| 173 | + crop = true; | ||
| 174 | + } | ||
| 175 | + else | ||
| 176 | + { | ||
| 177 | + layoutX = x; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + if( cropX + newWidth > dstWidth ) | ||
| 181 | + { | ||
| 182 | + crop = true; | ||
| 183 | + newWidth -= ( ( cropX + newWidth ) - dstWidth ); | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + layoutY = y; | ||
| 187 | + if( 0.f > layoutY ) | ||
| 188 | + { | ||
| 189 | + newHeight += layoutY; | ||
| 190 | + cropY = std::abs(layoutY); | ||
| 191 | + crop = true; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + if( cropY + newHeight > dstHeight ) | ||
| 195 | + { | ||
| 196 | + crop = true; | ||
| 197 | + newHeight -= ( ( cropY + newHeight ) - dstHeight ); | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + uint16_t uiCropX = static_cast<uint16_t>(cropX); | ||
| 201 | + uint16_t uiCropY = static_cast<uint16_t>(cropY); | ||
| 202 | + uint16_t uiNewWidth = static_cast<uint16_t>(newWidth); | ||
| 203 | + uint16_t uiNewHeight = static_cast<uint16_t>(newHeight); | ||
| 204 | + | ||
| 205 | + if( crop ) | ||
| 206 | + { | ||
| 207 | + itemPixelBuffer.Crop( uiCropX, uiCropY, uiNewWidth, uiNewHeight ); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + // Blend the item pixel buffer with the text's color according its blending mode. | ||
| 211 | + if( Dali::TextAbstraction::ColorBlendingMode::MULTIPLY == itemLayout.colorBlendingMode ) | ||
| 212 | + { | ||
| 213 | + Dali::Devel::PixelBuffer buffer = Dali::Devel::PixelBuffer::New( uiNewWidth, | ||
| 214 | + uiNewHeight, | ||
| 215 | + itemPixelFormat ); | ||
| 216 | + | ||
| 217 | + unsigned char* bufferPtr = buffer.GetBuffer(); | ||
| 218 | + const unsigned char* itemBufferPtr = itemPixelBuffer.GetBuffer(); | ||
| 219 | + const unsigned int bytesPerPixel = Dali::Pixel::GetBytesPerPixel(itemPixelFormat); | ||
| 220 | + const unsigned int size = uiNewWidth * uiNewHeight * bytesPerPixel; | ||
| 221 | + | ||
| 222 | + for (unsigned int i = 0u; i < size; i += bytesPerPixel) | ||
| 223 | + { | ||
| 224 | + *(bufferPtr + 0u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 0u) ) * textParameters.textColor.r ); | ||
| 225 | + *(bufferPtr + 1u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 1u) ) * textParameters.textColor.g ); | ||
| 226 | + *(bufferPtr + 2u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 2u) ) * textParameters.textColor.b ); | ||
| 227 | + *(bufferPtr + 3u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 3u) ) * textParameters.textColor.a ); | ||
| 228 | + | ||
| 229 | + itemBufferPtr += bytesPerPixel; | ||
| 230 | + bufferPtr += bytesPerPixel; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + itemPixelBuffer = buffer; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + Dali::Toolkit::DevelText::UpdateBuffer(itemPixelBuffer, pixelBuffer, layoutX, layoutY, true); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer ); | ||
| 240 | + | ||
| 241 | + Texture texture = Texture::New( TextureType::TEXTURE_2D, | ||
| 242 | + pixelData.GetPixelFormat(), | ||
| 243 | + pixelData.GetWidth(), | ||
| 244 | + pixelData.GetHeight() ); | ||
| 245 | + texture.Upload(pixelData); | ||
| 246 | + | ||
| 247 | + TextureSet textureSet = TextureSet::New(); | ||
| 248 | + textureSet.SetTexture( 0u, texture ); | ||
| 249 | + | ||
| 250 | + return textureSet; | ||
| 251 | +} | ||
| 252 | + | ||
| 253 | +} // namespace | ||
| 254 | + | ||
| 255 | + | ||
| 256 | +/** | ||
| 257 | + * @brief The main class of the demo. | ||
| 258 | + */ | ||
| 259 | +class SimpleTextRendererExample : public ConnectionTracker | ||
| 260 | +{ | ||
| 261 | +public: | ||
| 262 | + | ||
| 263 | + SimpleTextRendererExample( Application& application ) | ||
| 264 | + : mApplication( application ) | ||
| 265 | + { | ||
| 266 | + // Connect to the Application's Init signal | ||
| 267 | + mApplication.InitSignal().Connect( this, &SimpleTextRendererExample::Create ); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + ~SimpleTextRendererExample() | ||
| 271 | + { | ||
| 272 | + // Nothing to do here. | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + /** | ||
| 276 | + * One-time setup in response to Application InitSignal. | ||
| 277 | + */ | ||
| 278 | + void Create( Application& application ) | ||
| 279 | + { | ||
| 280 | + Stage stage = Stage::GetCurrent(); | ||
| 281 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 282 | + stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) ); | ||
| 283 | + | ||
| 284 | + stage.KeyEventSignal().Connect(this, &SimpleTextRendererExample::OnKeyEvent); | ||
| 285 | + | ||
| 286 | + const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + IMAGE1 + "'/>"; | ||
| 287 | + const std::string image2 = "<item 'width'=26 'height'=26/>"; | ||
| 288 | + | ||
| 289 | + Dali::Toolkit::DevelText::RendererParameters textParameters; | ||
| 290 | + textParameters.text = "Hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons."; | ||
| 291 | + textParameters.horizontalAlignment = "center"; | ||
| 292 | + textParameters.verticalAlignment = "center"; | ||
| 293 | + textParameters.circularAlignment = "center"; | ||
| 294 | + textParameters.fontFamily = "SamsungUI"; | ||
| 295 | + textParameters.fontWeight = ""; | ||
| 296 | + textParameters.fontWidth = ""; | ||
| 297 | + textParameters.fontSlant = ""; | ||
| 298 | + textParameters.layout = "circular"; | ||
| 299 | + textParameters.textColor = Color::BLACK; | ||
| 300 | + textParameters.fontSize = 25.f; | ||
| 301 | + textParameters.textWidth = 360u; | ||
| 302 | + textParameters.textHeight = 360u; | ||
| 303 | + textParameters.radius = 180u; | ||
| 304 | + textParameters.beginAngle = 15.f; | ||
| 305 | + textParameters.incrementAngle = 360.f; | ||
| 306 | + textParameters.ellipsisEnabled = true; | ||
| 307 | + textParameters.markupEnabled = true; | ||
| 308 | + | ||
| 309 | + std::vector<std::string> embeddedItems = { IMAGE2, IMAGE2, IMAGE2, IMAGE2, IMAGE2 }; | ||
| 310 | + | ||
| 311 | + TextureSet textureSet = CreateTextureSet( textParameters, embeddedItems ); | ||
| 312 | + | ||
| 313 | + Renderer renderer = CreateRenderer(); | ||
| 314 | + renderer.SetTextures( textureSet ); | ||
| 315 | + | ||
| 316 | + Actor actor = Actor::New(); | ||
| 317 | + actor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 318 | + actor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 319 | + actor.SetPosition( 0.f, 0.f); | ||
| 320 | + actor.SetSize( 360.f, 360.f ); | ||
| 321 | + actor.SetColor( Color::WHITE ); | ||
| 322 | + | ||
| 323 | + actor.AddRenderer( renderer ); | ||
| 324 | + | ||
| 325 | + stage.Add( actor ); | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + /** | ||
| 329 | + * Main key event handler | ||
| 330 | + */ | ||
| 331 | + void OnKeyEvent(const KeyEvent& event) | ||
| 332 | + { | ||
| 333 | + if(event.state == KeyEvent::Down) | ||
| 334 | + { | ||
| 335 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 336 | + { | ||
| 337 | + mApplication.Quit(); | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | +private: | ||
| 343 | + | ||
| 344 | + Application& mApplication; | ||
| 345 | +}; | ||
| 346 | + | ||
| 347 | +/** Entry point for Linux & Tizen applications */ | ||
| 348 | +int main( int argc, char **argv ) | ||
| 349 | +{ | ||
| 350 | + Application application = Application::New( &argc, &argv ); | ||
| 351 | + | ||
| 352 | + SimpleTextRendererExample test( application ); | ||
| 353 | + | ||
| 354 | + application.MainLoop(); | ||
| 355 | + | ||
| 356 | + return 0; | ||
| 357 | +} |
examples/simple-text-visual/simple-text-visual-example.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file text-visual-example.cpp | ||
| 20 | + * @brief Basic usage of Text Visual. | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | + | ||
| 26 | +using namespace Dali; | ||
| 27 | +using namespace Dali::Toolkit; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * @brief The main class of the demo. | ||
| 31 | + */ | ||
| 32 | +class TextVisualExample : public ConnectionTracker | ||
| 33 | +{ | ||
| 34 | +public: | ||
| 35 | + | ||
| 36 | + TextVisualExample( Application& application ) | ||
| 37 | + : mApplication( application ) | ||
| 38 | + { | ||
| 39 | + // Connect to the Application's Init signal | ||
| 40 | + mApplication.InitSignal().Connect( this, &TextVisualExample::Create ); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + ~TextVisualExample() | ||
| 44 | + { | ||
| 45 | + // Nothing to do here. | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * One-time setup in response to Application InitSignal. | ||
| 50 | + */ | ||
| 51 | + void Create( Application& application ) | ||
| 52 | + { | ||
| 53 | + Stage stage = Stage::GetCurrent(); | ||
| 54 | + | ||
| 55 | + stage.KeyEventSignal().Connect(this, &TextVisualExample::OnKeyEvent); | ||
| 56 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 57 | + | ||
| 58 | + Dali::Toolkit::Control control = Dali::Toolkit::ImageView::New(); | ||
| 59 | + control.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 60 | + | ||
| 61 | + const std::string markupText( "<color value='blue'><font size='50'>H</font></color>ello <color value='blue'><font size='50'>w</font></color>orld" ); | ||
| 62 | + | ||
| 63 | + Dali::Property::Map map; | ||
| 64 | + map.Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::TEXT ). | ||
| 65 | + Add( Dali::Toolkit::TextVisual::Property::ENABLE_MARKUP, true ). | ||
| 66 | + Add( Dali::Toolkit::TextVisual::Property::TEXT, markupText ). | ||
| 67 | + Add( Dali::Toolkit::TextVisual::Property::TEXT_COLOR, Dali::Vector4( 0.25f, 0.25f, 0.5f, 1.f ) ). | ||
| 68 | + Add( Dali::Toolkit::TextVisual::Property::FONT_FAMILY, "TizenSansRegular" ). | ||
| 69 | + Add( Dali::Toolkit::TextVisual::Property::POINT_SIZE, 30.f ). | ||
| 70 | + Add( Dali::Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, "END" ). | ||
| 71 | + Add( Dali::Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 72 | + | ||
| 73 | + control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); | ||
| 74 | + | ||
| 75 | + stage.Add( control ); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * Main key event handler | ||
| 80 | + */ | ||
| 81 | + void OnKeyEvent(const KeyEvent& event) | ||
| 82 | + { | ||
| 83 | + if(event.state == KeyEvent::Down) | ||
| 84 | + { | ||
| 85 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 86 | + { | ||
| 87 | + mApplication.Quit(); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | +private: | ||
| 93 | + | ||
| 94 | + Application& mApplication; | ||
| 95 | + | ||
| 96 | + TextLabel mLabel; | ||
| 97 | +}; | ||
| 98 | + | ||
| 99 | +void RunTest( Application& application ) | ||
| 100 | +{ | ||
| 101 | + TextVisualExample test( application ); | ||
| 102 | + | ||
| 103 | + application.MainLoop(); | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +/** Entry point for Linux & Tizen applications */ | ||
| 107 | +int main( int argc, char **argv ) | ||
| 108 | +{ | ||
| 109 | + Application application = Application::New( &argc, &argv ); | ||
| 110 | + | ||
| 111 | + RunTest( application ); | ||
| 112 | + | ||
| 113 | + return 0; | ||
| 114 | +} |
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.4.14 | 5 | +Version: 1.4.15 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/images/u0030.png
0 → 100644
473 Bytes
resources/images/u0030_color.png
0 → 100644
918 Bytes
resources/images/u0031.png
0 → 100644
371 Bytes
resources/images/u0031_color.png
0 → 100644
564 Bytes
resources/images/u0032.png
0 → 100644
441 Bytes
resources/images/u0032_color.png
0 → 100644
1.01 KB
resources/images/u0033.png
0 → 100644
454 Bytes
resources/images/u0033_color.png
0 → 100644
973 Bytes
resources/images/u0034.png
0 → 100644
495 Bytes
resources/images/u0034_color.png
0 → 100644
1000 Bytes
resources/images/u0035.png
0 → 100644
420 Bytes
resources/images/u0035_color.png
0 → 100644
797 Bytes
resources/images/u0036.png
0 → 100644
477 Bytes
resources/images/u0036_color.png
0 → 100644
1.1 KB
resources/images/u0037.png
0 → 100644
454 Bytes
resources/images/u0037_color.png
0 → 100644
806 Bytes
resources/images/u0038.png
0 → 100644
505 Bytes
resources/images/u0038_color.png
0 → 100644
954 Bytes
resources/images/u0039.png
0 → 100644
467 Bytes
resources/images/u0039_color.png
0 → 100644
879 Bytes
resources/images/u003a.png
0 → 100644
271 Bytes
resources/images/u003a_color.png
0 → 100644
262 Bytes
resources/po/en_GB.po
| @@ -40,6 +40,9 @@ msgstr "Clipping" | @@ -40,6 +40,9 @@ msgstr "Clipping" | ||
| 40 | msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER" | 40 | msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER" |
| 41 | msgstr "Clipping Draw Order" | 41 | msgstr "Clipping Draw Order" |
| 42 | 42 | ||
| 43 | +msgid "DALI_DEMO_STR_TITLE_GESTURES" | ||
| 44 | +msgstr "Gestures" | ||
| 45 | + | ||
| 43 | msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" | 46 | msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" |
| 44 | msgstr "Colour Gradient" | 47 | msgstr "Colour Gradient" |
| 45 | 48 |
resources/po/en_US.po
| @@ -40,6 +40,9 @@ msgstr "Clipping" | @@ -40,6 +40,9 @@ msgstr "Clipping" | ||
| 40 | msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER" | 40 | msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER" |
| 41 | msgstr "Clipping Draw Order" | 41 | msgstr "Clipping Draw Order" |
| 42 | 42 | ||
| 43 | +msgid "DALI_DEMO_STR_TITLE_GESTURES" | ||
| 44 | +msgstr "Gestures" | ||
| 45 | + | ||
| 43 | msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" | 46 | msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" |
| 44 | msgstr "Color Gradient" | 47 | msgstr "Color Gradient" |
| 45 | 48 | ||
| @@ -261,3 +264,12 @@ msgstr "Web View" | @@ -261,3 +264,12 @@ msgstr "Web View" | ||
| 261 | 264 | ||
| 262 | msgid "DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES" | 265 | msgid "DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES" |
| 263 | msgstr "Animated Vector Images" | 266 | msgstr "Animated Vector Images" |
| 267 | + | ||
| 268 | +msgid "DALI_DEMO_STR_TITLE_TEXT_RENDERER" | ||
| 269 | +msgstr "Text Renderer" | ||
| 270 | + | ||
| 271 | +msgid "DALI_DEMO_STR_TITLE_TEXT_VISUAL" | ||
| 272 | +msgstr "Text Visual" | ||
| 273 | + | ||
| 274 | +msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT" | ||
| 275 | +msgstr "Text Bitmap Font" |
shared/dali-demo-strings.h
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2018 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -46,6 +46,7 @@ extern "C" | @@ -46,6 +46,7 @@ extern "C" | ||
| 46 | #define DALI_DEMO_STR_TITLE_CARD_ACTIVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CARD_ACTIVE") | 46 | #define DALI_DEMO_STR_TITLE_CARD_ACTIVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CARD_ACTIVE") |
| 47 | #define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") | 47 | #define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") |
| 48 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER") | 48 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER") |
| 49 | +#define DALI_DEMO_STR_TITLE_GESTURES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_GESTURES") | ||
| 49 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") | 50 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") |
| 50 | #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS") | 51 | #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS") |
| 51 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS") | 52 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS") |
| @@ -119,6 +120,9 @@ extern "C" | @@ -119,6 +120,9 @@ extern "C" | ||
| 119 | #define DALI_DEMO_STR_TITLE_TOOLTIP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TOOLTIP") | 120 | #define DALI_DEMO_STR_TITLE_TOOLTIP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TOOLTIP") |
| 120 | #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS") | 121 | #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS") |
| 121 | #define DALI_DEMO_STR_TITLE_WEB_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WEB_VIEW") | 122 | #define DALI_DEMO_STR_TITLE_WEB_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WEB_VIEW") |
| 123 | +#define DALI_DEMO_STR_TITLE_TEXT_RENDERER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_RENDERER") | ||
| 124 | +#define DALI_DEMO_STR_TITLE_TEXT_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_VISUAL") | ||
| 125 | +#define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT") | ||
| 122 | 126 | ||
| 123 | #else // !INTERNATIONALIZATION_ENABLED | 127 | #else // !INTERNATIONALIZATION_ENABLED |
| 124 | 128 | ||
| @@ -136,6 +140,7 @@ extern "C" | @@ -136,6 +140,7 @@ extern "C" | ||
| 136 | #define DALI_DEMO_STR_TITLE_CARD_ACTIVE "Card Active" | 140 | #define DALI_DEMO_STR_TITLE_CARD_ACTIVE "Card Active" |
| 137 | #define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" | 141 | #define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" |
| 138 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER "Clipping Draw Order" | 142 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER "Clipping Draw Order" |
| 143 | +#define DALI_DEMO_STR_TITLE_GESTURES "Gestures" | ||
| 139 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" | 144 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" |
| 140 | #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS "Compressed Texture Formats" | 145 | #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS "Compressed Texture Formats" |
| 141 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards" | 146 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards" |
| @@ -209,6 +214,9 @@ extern "C" | @@ -209,6 +214,9 @@ extern "C" | ||
| 209 | #define DALI_DEMO_STR_TITLE_TOOLTIP "Tooltip" | 214 | #define DALI_DEMO_STR_TITLE_TOOLTIP "Tooltip" |
| 210 | #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS "Visual Transitions" | 215 | #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS "Visual Transitions" |
| 211 | #define DALI_DEMO_STR_TITLE_WEB_VIEW "Web View" | 216 | #define DALI_DEMO_STR_TITLE_WEB_VIEW "Web View" |
| 217 | +#define DALI_DEMO_STR_TITLE_TEXT_RENDERER "Text Renderer" | ||
| 218 | +#define DALI_DEMO_STR_TITLE_TEXT_VISUAL "Text Visual" | ||
| 219 | +#define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT "Text Bitmap Font" | ||
| 212 | #endif | 220 | #endif |
| 213 | 221 | ||
| 214 | #ifdef __cplusplus | 222 | #ifdef __cplusplus |
tests-reel/dali-tests-reel.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2018 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2019 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -49,6 +49,11 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -49,6 +49,11 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 49 | demo.AddExample(Example("text-memory-profiling.example", DALI_DEMO_STR_TITLE_TEXT_MEMORY_PROFILING)); | 49 | demo.AddExample(Example("text-memory-profiling.example", DALI_DEMO_STR_TITLE_TEXT_MEMORY_PROFILING)); |
| 50 | demo.AddExample(Example("text-overlap.example", DALI_DEMO_STR_TITLE_TEXT_OVERLAP)); | 50 | demo.AddExample(Example("text-overlap.example", DALI_DEMO_STR_TITLE_TEXT_OVERLAP)); |
| 51 | demo.AddExample(Example("visual-transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS)); | 51 | demo.AddExample(Example("visual-transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS)); |
| 52 | + demo.AddExample(Example("simple-text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); | ||
| 53 | + demo.AddExample(Example("simple-text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD)); | ||
| 54 | + demo.AddExample(Example("simple-text-renderer.example", DALI_DEMO_STR_TITLE_TEXT_RENDERER)); | ||
| 55 | + demo.AddExample(Example("simple-text-visual.example", DALI_DEMO_STR_TITLE_TEXT_VISUAL)); | ||
| 56 | + demo.AddExample(Example("simple-bitmap-font-text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT)); | ||
| 52 | 57 | ||
| 53 | demo.SortAlphabetically( true ); | 58 | demo.SortAlphabetically( true ); |
| 54 | 59 |