Commit efa341d5ca5e10b93499358cb38c19aa2b1fef80

Authored by Nick Holland
2 parents 4a0542cd 0c5eaf99

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

Change-Id: I53776d49f53aaddd7a30eb9fe0fdf7ba017d618f
com.samsung.dali-demo.xml
@@ -97,8 +97,8 @@ @@ -97,8 +97,8 @@
97 <ui-application appid="text-fonts.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-fonts.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 97 <ui-application appid="text-fonts.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-fonts.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
98 <label>Text Fonts</label> 98 <label>Text Fonts</label>
99 </ui-application> 99 </ui-application>
100 - <ui-application appid="text-message-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-message-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">  
101 - <label>Text Label</label> 100 + <ui-application appid="text-scrolling.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-scrolling.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  101 + <label>Text Scrolling</label>
102 </ui-application> 102 </ui-application>
103 <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 103 <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
104 <label>Logging</label> 104 <label>Logging</label>
demo/dali-demo.cpp
@@ -57,6 +57,7 @@ int DALI_EXPORT_API main(int argc, char **argv) @@ -57,6 +57,7 @@ int DALI_EXPORT_API main(int argc, char **argv)
57 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); 57 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
58 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE)); 58 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
59 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); 59 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT));
  60 + demo.AddExample(Example("text-scrolling.example", DALI_DEMO_STR_TITLE_TEXT_SCROLLING));
60 demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); 61 demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE));
61 demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP)); 62 demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP));
62 demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS)); 63 demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS));
examples/flex-container/flex-container-example.cpp
@@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
20 20
21 #include <dali/dali.h> 21 #include <dali/dali.h>
22 #include <dali-toolkit/dali-toolkit.h> 22 #include <dali-toolkit/dali-toolkit.h>
23 -#include <dali-toolkit/devel-api/controls/flex-container/flex-container.h>  
24 23
25 using namespace Dali; 24 using namespace Dali;
26 using namespace Dali::Toolkit; 25 using namespace Dali::Toolkit;
@@ -200,8 +199,8 @@ public: @@ -200,8 +199,8 @@ public:
200 199
201 // Add a text label to the container for showing the recently updated flexbox property value 200 // Add a text label to the container for showing the recently updated flexbox property value
202 mFlexPropertyLabel = TextLabel::New( FLEX_DIRECTION[mCurrentFlexDirection] ); 201 mFlexPropertyLabel = TextLabel::New( FLEX_DIRECTION[mCurrentFlexDirection] );
203 - mFlexPropertyLabel.RegisterProperty("flexMargin", Vector4(10.0f, 10.0f, 10.0f, 10.0f), Property::READ_WRITE);  
204 - mFlexPropertyLabel.RegisterProperty("flex", 0.05f, Property::READ_WRITE); // 5 pecent of the container size in the main axis 202 + mFlexPropertyLabel.SetProperty(FlexContainer::ChildProperty::FLEX_MARGIN, Vector4(10.0f, 10.0f, 10.0f, 10.0f));
  203 + mFlexPropertyLabel.SetProperty(FlexContainer::ChildProperty::FLEX, 0.05f); // 5 pecent of the container size in the main axis
205 mFlexPropertyLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER"); 204 mFlexPropertyLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
206 mFlexPropertyLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER"); 205 mFlexPropertyLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
207 mFlexContainer.Add( mFlexPropertyLabel ); 206 mFlexContainer.Add( mFlexPropertyLabel );
@@ -211,9 +210,9 @@ public: @@ -211,9 +210,9 @@ public:
211 mFlexItemContainer.SetParentOrigin(ParentOrigin::TOP_LEFT); 210 mFlexItemContainer.SetParentOrigin(ParentOrigin::TOP_LEFT);
212 mFlexItemContainer.SetAnchorPoint(AnchorPoint::TOP_LEFT); 211 mFlexItemContainer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
213 mFlexItemContainer.SetBackgroundColor( Color::YELLOW ); 212 mFlexItemContainer.SetBackgroundColor( Color::YELLOW );
214 - mFlexItemContainer.RegisterProperty("flex", 0.95f, Property::READ_WRITE); // 95 pecent of the container size in the main axis  
215 mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, mCurrentFlexDirection); 213 mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, mCurrentFlexDirection);
216 mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_WRAP, mCurrentFlexWrap); 214 mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_WRAP, mCurrentFlexWrap);
  215 + mFlexItemContainer.SetProperty(FlexContainer::ChildProperty::FLEX, 0.95f); // 95 pecent of the container size in the main axis
217 mFlexContainer.Add(mFlexItemContainer); 216 mFlexContainer.Add(mFlexItemContainer);
218 217
219 // Create flex items and add them to the container 218 // Create flex items and add them to the container
examples/text-message-field/text-message-field-example.cpp deleted
1 -/*  
2 - * Copyright (c) 2015 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 message-field-example.cpp  
20 - * @brief Basic usage of TextField 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 -namespace  
30 -{  
31 - const char* DESKTOP_IMAGE( DEMO_IMAGE_DIR "woodEffect.jpg" );  
32 - const Vector2 DESKTOP_SIZE( Vector2( 1440, 1600 ) );  
33 - const Vector2 PHOTOBOX_SIZE( Vector2(330.0f, 80.0f ) );  
34 - const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;  
35 - const float SCREEN_BORDER = 5.0f; // Border around screen that Popups and handles will not exceed  
36 -}  
37 -/**  
38 - * @brief The main class of the demo.  
39 - */  
40 -class TextMessageFieldExample : public ConnectionTracker  
41 -{  
42 -public:  
43 -  
44 - TextMessageFieldExample( Application& application )  
45 - : mApplication( application ),  
46 - mTargetActorPosition(),  
47 - mTargetActorSize()  
48 - {  
49 - // Connect to the Application's Init signal  
50 - mApplication.InitSignal().Connect( this, &TextMessageFieldExample::Create );  
51 - }  
52 -  
53 - ~TextMessageFieldExample()  
54 - {  
55 - // Nothing to do here.  
56 - }  
57 -  
58 - /**  
59 - * One-time setup in response to Application InitSignal.  
60 - */  
61 - void Create( Application& application )  
62 - {  
63 - Stage stage = Stage::GetCurrent();  
64 - mStageSize = stage.GetSize();  
65 -  
66 - stage.KeyEventSignal().Connect(this, &TextMessageFieldExample::OnKeyEvent);  
67 -  
68 - // Create Root actor  
69 - Actor rootActor = Actor::New();  
70 - rootActor.SetName("rootActor");  
71 - rootActor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );  
72 - rootActor.SetSize( mStageSize );  
73 - rootActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );  
74 -  
75 - stage.Add( rootActor );  
76 -  
77 - const Size mTargetActorSize( mStageSize.width, DESKTOP_SIZE.height );  
78 -  
79 - // Create Desktop  
80 - ImageView desktop = ImageView::New( DESKTOP_IMAGE );  
81 - desktop.SetName("desktopActor");  
82 - desktop.SetAnchorPoint( AnchorPoint::TOP_LEFT );  
83 - desktop.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );  
84 - desktop.SetSize( mTargetActorSize );  
85 -  
86 - rootActor.Add( desktop ); // Add desktop (content) to offscreen actor  
87 -  
88 - // Create Photo Box A  
89 - Control photoBoxA = Control::New();  
90 -  
91 - Dali::Property::Map border;  
92 - border.Insert( "rendererType", "border" );  
93 - border.Insert( "borderColor", Color::WHITE );  
94 - border.Insert( "borderSize", 1.f );  
95 - photoBoxA.SetProperty( Control::Property::BACKGROUND, border );  
96 -  
97 - photoBoxA.SetName("photoBoxA");  
98 - photoBoxA.SetAnchorPoint( AnchorPoint::CENTER );  
99 - photoBoxA.SetParentOrigin( ParentOrigin::CENTER );  
100 - photoBoxA.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );  
101 - photoBoxA.SetSize( PHOTOBOX_SIZE );  
102 - photoBoxA.SetPosition( 0.0f, -500.0f, 1.0f );  
103 - desktop.Add( photoBoxA );  
104 -  
105 - // Create TextField  
106 - TextField field = TextField::New();  
107 - field.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );  
108 - field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
109 - field.SetPadding( Padding( 1.0f, 1.0f, 1.0f, 1.0f ) );  
110 - field.SetAnchorPoint( AnchorPoint::TOP_LEFT );  
111 - field.SetProperty( TextField::Property::TEXT, "Enter Title name" );  
112 - field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( SCREEN_BORDER, SCREEN_BORDER, mStageSize.width - SCREEN_BORDER*2, mStageSize.height - SCREEN_BORDER*2 ) );  
113 - photoBoxA.Add( field );  
114 -  
115 - mPanGestureDetector = PanGestureDetector::New();  
116 - mPanGestureDetector.DetectedSignal().Connect(this, &TextMessageFieldExample::OnPanGesture );  
117 - mPanGestureDetector.Attach( desktop );  
118 - }  
119 -  
120 - /**  
121 - * Main key event handler  
122 - */  
123 - void OnKeyEvent(const KeyEvent& event)  
124 - {  
125 - if(event.state == KeyEvent::Down)  
126 - {  
127 - if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )  
128 - {  
129 - mApplication.Quit();  
130 - }  
131 - }  
132 - }  
133 -  
134 - void OnPanGesture( Actor actor, const PanGesture& gesture )  
135 - {  
136 - if( gesture.state == Gesture::Continuing )  
137 - {  
138 - Vector2 position = Vector2( gesture.displacement );  
139 - mTargetActorPosition.y = mTargetActorPosition.y + position.y;  
140 - mTargetActorPosition.y = std::min( mTargetActorPosition.y, -mTargetActorSize.height );  
141 - mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mStageSize.height*0.25f ) );  
142 - actor.SetPosition( 0.0f, mTargetActorPosition.y );  
143 - }  
144 - }  
145 -  
146 -private:  
147 -  
148 - Application& mApplication;  
149 - PanGestureDetector mPanGestureDetector;  
150 -  
151 - Vector2 mTargetActorPosition;  
152 - Vector2 mTargetActorSize;  
153 - Vector2 mStageSize;  
154 -};  
155 -  
156 -void RunTest( Application& application )  
157 -{  
158 - TextMessageFieldExample test( application );  
159 -  
160 - application.MainLoop();  
161 -}  
162 -  
163 -/** Entry point for Linux & Tizen applications */  
164 -int DALI_EXPORT_API main( int argc, char **argv )  
165 -{  
166 - Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );  
167 -  
168 - RunTest( application );  
169 -  
170 - return 0;  
171 -}  
examples/text-scrolling/text-scrolling-example.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2016 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-scrolling-example.cpp
  20 + * @brief Shows text labels with scrolling text and allows a text label and text field control to be scrolled vertically
  21 + */
  22 +
  23 +// EXTERNAL INCLUDES
  24 +#include <dali-toolkit/dali-toolkit.h>
  25 +
  26 +using namespace Dali;
  27 +using namespace Dali::Toolkit;
  28 +
  29 +namespace
  30 +{
  31 +const char* DESKTOP_IMAGE( DEMO_IMAGE_DIR "woodEffect.jpg" );
  32 +const Vector2 DESKTOP_SIZE( Vector2( 1440.f, 1600.f ) );
  33 +const Vector2 BOX_SIZE( Vector2(330.0f, 80.0f ) );
  34 +const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) );
  35 +const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
  36 +const float SCREEN_BORDER = 5.0f; // Border around screen that Popups and handles will not exceed
  37 +
  38 +enum Labels
  39 +{
  40 + SMALL = 1u,
  41 + RTL = 1u << 1,
  42 + LARGE = 1u << 2,
  43 + RTL_LONG = 1u << 4,
  44 + NONE = 1u << 6,
  45 +};
  46 +}
  47 +/**
  48 + * @brief The main class of the demo.
  49 + */
  50 +class TextScrollingExample : public ConnectionTracker
  51 +{
  52 +public:
  53 +
  54 + TextScrollingExample( Application& application )
  55 + : mApplication( application ),
  56 + mTargetActorPosition(),
  57 + mTargetActorSize()
  58 + {
  59 + // Connect to the Application's Init signal
  60 + mApplication.InitSignal().Connect( this, &TextScrollingExample::Create );
  61 + }
  62 +
  63 + ~TextScrollingExample()
  64 + {
  65 + // Nothing to do here.
  66 + }
  67 +
  68 +
  69 + void CreateBox( const std::string& name, Actor& box, Actor parent, const Vector2& size )
  70 + {
  71 + box.SetName(name);
  72 + box.SetAnchorPoint( AnchorPoint::CENTER );
  73 + box.SetParentOrigin( ParentOrigin::CENTER );
  74 + box.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
  75 + box.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
  76 + box.SetSize( size.width, 0.f );
  77 + parent.Add( box );
  78 +
  79 + Dali::Property::Map border;
  80 + border.Insert( "rendererType", "border" );
  81 + border.Insert( "borderColor", Color::WHITE );
  82 + border.Insert( "borderSize", 1.f );
  83 + box.SetProperty( Control::Property::BACKGROUND, border );
  84 + }
  85 +
  86 + void CreateLabel( Actor& label, const std::string text, Actor parent, bool scrollOnStart, PushButton button )
  87 + {
  88 + label = TextLabel::New( text );
  89 + label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  90 + label.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  91 + label.SetPadding( Padding( 1.0f, 1.0f, 1.0f, 1.0f ) );
  92 + label.SetAnchorPoint( AnchorPoint::CENTER );
  93 + label.SetParentOrigin( ParentOrigin::CENTER );
  94 + parent.Add( label );
  95 +
  96 + if ( scrollOnStart )
  97 + {
  98 + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
  99 + }
  100 +
  101 + button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  102 + button.SetSize(BOX_SIZE.height,BOX_SIZE.height);
  103 + button.SetParentOrigin( ParentOrigin::TOP_RIGHT );
  104 + button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  105 + parent.Add(button);
  106 + }
  107 +
  108 +
  109 + /**
  110 + * One-time setup in response to Application InitSignal.
  111 + */
  112 + void Create( Application& application )
  113 + {
  114 + Stage stage = Stage::GetCurrent();
  115 + mStageSize = stage.GetSize();
  116 +
  117 + stage.KeyEventSignal().Connect(this, &TextScrollingExample::OnKeyEvent);
  118 +
  119 + // Create Root actor
  120 + Actor rootActor = Actor::New();
  121 + rootActor.SetName("rootActor");
  122 + rootActor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  123 + rootActor.SetSize( mStageSize );
  124 + rootActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  125 +
  126 + stage.Add( rootActor );
  127 +
  128 + const Size mTargetActorSize( mStageSize.width, DESKTOP_SIZE.height );
  129 +
  130 + // Create Desktop
  131 + ImageView desktop = ImageView::New( DESKTOP_IMAGE );
  132 + desktop.SetName("desktopActor");
  133 + desktop.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  134 + desktop.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  135 + desktop.SetSize( mTargetActorSize );
  136 +
  137 + rootActor.Add( desktop ); // Add desktop (content) to offscreen actor
  138 +
  139 + // Create Boxes
  140 + Control boxA = Control::New();
  141 + Control boxB = Control::New();
  142 + Control boxC = Control::New();
  143 + Control boxD = Control::New();
  144 + Control boxE = Control::New();
  145 +
  146 + CreateBox( "boxA", boxA, desktop, BOX_SIZE );
  147 + boxA.SetPosition( 0.0f, -500.0f, 1.0f );
  148 +
  149 + // Create TextField
  150 + TextField field = TextField::New();
  151 + field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  152 + field.SetPadding( Padding( 1.0f, 1.0f, 1.0f, 1.0f ) );
  153 + field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  154 + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Enter Folder Name" );
  155 + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( SCREEN_BORDER, SCREEN_BORDER, mStageSize.width - SCREEN_BORDER*2, mStageSize.height - SCREEN_BORDER*2 ) );
  156 + boxA.Add( field );
  157 + boxA.SetSize(BOX_SIZE);
  158 +
  159 + CreateBox( "boxB", boxB, desktop, SCROLLING_BOX_SIZE );
  160 + boxB.SetPosition( 0.0f, -400.0f, 1.0f );
  161 + Toolkit::PushButton scrollLargeButton = Toolkit::PushButton::New();
  162 + scrollLargeButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedLarge );
  163 + CreateLabel( mLargeLabel, "A Quick Brown Fox Jumps Over The Lazy Dog", boxB, false ,scrollLargeButton );
  164 +
  165 +
  166 + CreateBox( "boxC", boxC, desktop, SCROLLING_BOX_SIZE );
  167 + boxC.SetPosition( 0.0f, -300.0f, 1.0f );
  168 + Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New();
  169 + scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall );
  170 + CreateLabel( mSmallLabel, "A Quick Brown Fox", boxC , true, scrollSmallButton );
  171 + mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
  172 + mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
  173 + mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
  174 +
  175 + CreateBox( "boxD", boxD, desktop, SCROLLING_BOX_SIZE );
  176 + boxD.SetPosition( 0.0f, -200.0f, 1.0f );
  177 + Toolkit::PushButton scrollRtlButton = Toolkit::PushButton::New();
  178 + scrollRtlButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedRtl );
  179 + CreateLabel( mRtlLabel, "ู…ุฑุญุจุง ุจุงู„ุนุงู„ู…", boxD , true, scrollRtlButton );
  180 +
  181 + CreateBox( "boxE", boxE, desktop, SCROLLING_BOX_SIZE );
  182 + boxE.SetPosition( 0.0f, -100.0f, 1.0f );
  183 + Toolkit::PushButton scrollRtlLongButton = Toolkit::PushButton::New();
  184 + scrollRtlLongButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedRtlLong );
  185 + CreateLabel( mRtlLongLabel, " ู…ุฑุญุจุง ุจุงู„ุนุงู„ู… ู…ุฑุญุจุง ุจุงู„ุนุงู„ู… ู…ุฑุญุจุง ุจุงู„ุนุงู„ู…", boxE , false, scrollRtlLongButton );
  186 +
  187 +
  188 + mPanGestureDetector = PanGestureDetector::New();
  189 + mPanGestureDetector.DetectedSignal().Connect(this, &TextScrollingExample::OnPanGesture );
  190 + mPanGestureDetector.Attach( desktop );
  191 + }
  192 +
  193 + void EnableScrolling( Labels labels )
  194 + {
  195 + Actor label;
  196 + switch( labels )
  197 + {
  198 + case LARGE:
  199 + {
  200 + label = mLargeLabel;
  201 + break;
  202 + }
  203 + case RTL:
  204 + {
  205 + label = mRtlLabel;
  206 + break;
  207 + }
  208 + case SMALL:
  209 + {
  210 + label = mSmallLabel;
  211 + break;
  212 + }
  213 + case RTL_LONG:
  214 + {
  215 + label = mRtlLongLabel;
  216 + break;
  217 + }
  218 + case NONE:
  219 + {
  220 + return;
  221 + }
  222 + }
  223 +
  224 + if ( labels != NONE )
  225 + {
  226 + Property::Value value = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL);
  227 + if (value.Get< bool >())
  228 + {
  229 + label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
  230 + }
  231 + else
  232 + {
  233 + label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
  234 + }
  235 + }
  236 + }
  237 +
  238 + bool OnButtonClickedSmall( Toolkit::Button button )
  239 + {
  240 + EnableScrolling( SMALL );
  241 + return true;
  242 + }
  243 +
  244 + bool OnButtonClickedLarge( Toolkit::Button button )
  245 + {
  246 + EnableScrolling( LARGE );
  247 + return true;
  248 + }
  249 +
  250 + bool OnButtonClickedRtl( Toolkit::Button button )
  251 + {
  252 + EnableScrolling( RTL );
  253 + return true;
  254 + }
  255 +
  256 + bool OnButtonClickedRtlLong( Toolkit::Button button )
  257 + {
  258 + EnableScrolling( RTL_LONG );
  259 + return true;
  260 + }
  261 +
  262 + /**
  263 + * Main key event handler
  264 + */
  265 + void OnKeyEvent(const KeyEvent& event)
  266 + {
  267 + if(event.state == KeyEvent::Down)
  268 + {
  269 + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
  270 + {
  271 + mApplication.Quit();
  272 + }
  273 + }
  274 + }
  275 +
  276 + void OnPanGesture( Actor actor, const PanGesture& gesture )
  277 + {
  278 + if( gesture.state == Gesture::Continuing )
  279 + {
  280 + Vector2 position = Vector2( gesture.displacement );
  281 + mTargetActorPosition.y = mTargetActorPosition.y + position.y;
  282 + mTargetActorPosition.y = std::min( mTargetActorPosition.y, -mTargetActorSize.height );
  283 + mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mStageSize.height*0.25f ) );
  284 + actor.SetPosition( 0.0f, mTargetActorPosition.y );
  285 + }
  286 + }
  287 +
  288 +private:
  289 +
  290 + Application& mApplication;
  291 + PanGestureDetector mPanGestureDetector;
  292 +
  293 + Vector2 mTargetActorPosition;
  294 + Vector2 mTargetActorSize;
  295 + Vector2 mStageSize;
  296 +
  297 + TextLabel mLargeLabel;
  298 + TextLabel mSmallLabel;
  299 + TextLabel mRtlLabel;
  300 + TextLabel mRtlLongLabel;
  301 +};
  302 +
  303 +void RunTest( Application& application )
  304 +{
  305 + TextScrollingExample test( application );
  306 +
  307 + application.MainLoop();
  308 +}
  309 +
  310 +/** Entry point for Linux & Tizen applications */
  311 +int DALI_EXPORT_API main( int argc, char **argv )
  312 +{
  313 + Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
  314 +
  315 + RunTest( application );
  316 +
  317 + return 0;
  318 +}
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.1.34 5 +Version: 1.1.35
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0
shared/dali-demo-strings.h
@@ -87,6 +87,7 @@ extern &quot;C&quot; @@ -87,6 +87,7 @@ extern &quot;C&quot;
87 #define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label" 87 #define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label"
88 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts" 88 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts"
89 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text" 89 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text"
  90 +#define DALI_DEMO_STR_TITLE_TEXT_SCROLLING "Text Scrolling"
90 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size" 91 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size"
91 #define DALI_DEMO_STR_TITLE_POPUP "Popup" 92 #define DALI_DEMO_STR_TITLE_POPUP "Popup"
92 #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" 93 #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons"