Commit 065f23c98a05577a4f7052aa4ae910bd9d00c0a4

Authored by Richard Huang
2 parents a1ecdd9d 8178ca9a

[dali_1.0.43] Merge branch 'tizen'

Change-Id: I3f5e19c1e72727115078bedd42037e66eac878e2
com.samsung.dali-demo.xml
... ... @@ -86,7 +86,7 @@
86 86 <label>Emojis Text Label</label>
87 87 </ui-application>
88 88 <ui-application appid="text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
89   - <label>Text Label</label>
  89 + <label>Text Field</label>
90 90 </ui-application>
91 91 <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">
92 92 <label>Text Label</label>
... ...
demo/dali-demo.cpp
... ... @@ -53,6 +53,7 @@ int main(int argc, char **argv)
53 53 demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI));
54 54 demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING));
55 55 demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING));
  56 + demo.AddExample(Example("text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD));
56 57 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
57 58 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
58 59 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT));
... ...
demo/dali-table-view.cpp
... ... @@ -387,12 +387,12 @@ void DaliTableView::Populate()
387 387 const Example& example = ( *iter );
388 388  
389 389 Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true );
390   - FocusManager focusManager = FocusManager::Get();
391   - focusManager.SetFocusOrder( tile, ++exampleCount );
392   - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL,
  390 + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get();
  391 + accessibilityFocusManager.SetFocusOrder( tile, ++exampleCount );
  392 + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_LABEL,
393 393 example.title );
394   - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_TRAIT, "Tile" );
395   - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT,
  394 + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_TRAIT, "Tile" );
  395 + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_HINT,
396 396 "You can run this example" );
397 397  
398 398 tile.SetPadding( Padding( margin, margin, margin, margin ) );
... ... @@ -551,7 +551,7 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent&amp; event )
551 551 std::string name = actor.GetName();
552 552 ExampleMapConstIter iter = mExampleMap.find( name );
553 553  
554   - FocusManager focusManager = FocusManager::Get();
  554 + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get();
555 555  
556 556 if( iter != mExampleMap.end() )
557 557 {
... ... @@ -594,11 +594,11 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation&amp; source )
594 594 if( name == BUTTON_QUIT )
595 595 {
596 596 // Move focus to the OK button
597   - FocusManager focusManager = FocusManager::Get();
  597 + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get();
598 598  
599 599 // Enable the group mode and wrap mode
600   - focusManager.SetGroupMode( true );
601   - focusManager.SetWrapMode( true );
  600 + accessibilityFocusManager.SetGroupMode( true );
  601 + accessibilityFocusManager.SetWrapMode( true );
602 602 }
603 603 }
604 604 else
... ... @@ -630,8 +630,8 @@ void DaliTableView::OnScrollComplete( const Dali::Vector2&amp; position )
630 630 mScrolling = false;
631 631  
632 632 // move focus to 1st item of new page
633   - FocusManager focusManager = FocusManager::Get();
634   - focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
  633 + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get();
  634 + accessibilityFocusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
635 635 }
636 636  
637 637 bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
... ... @@ -890,7 +890,7 @@ void DaliTableView::PlayAnimation()
890 890 mAnimationTimer.SetInterval( BACKGROUND_ANIMATION_DURATION );
891 891 }
892 892  
893   -Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction )
  893 +Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction )
894 894 {
895 895 Actor nextFocusActor = proposed;
896 896  
... ... @@ -905,22 +905,22 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::
905 905 // in the given direction. We should work out which page to scroll to next.
906 906 int currentPage = mScrollView.GetCurrentPage();
907 907 int newPage = currentPage;
908   - if( direction == Dali::Toolkit::Control::Left )
  908 + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
909 909 {
910 910 newPage--;
911 911 }
912   - else if( direction == Dali::Toolkit::Control::Right )
  912 + else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT )
913 913 {
914 914 newPage++;
915 915 }
916 916  
917   - newPage = std::max(0, std::min(static_cast<int>(mScrollRulerX->GetTotalPages() - 1), newPage));
  917 + newPage = std::max(0, std::min(mTotalPages - 1, newPage));
918 918 if( newPage == currentPage )
919 919 {
920   - if( direction == Dali::Toolkit::Control::Left )
  920 + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
921 921 {
922   - newPage = mScrollRulerX->GetTotalPages() - 1;
923   - } else if( direction == Dali::Toolkit::Control::Right )
  922 + newPage = mTotalPages - 1;
  923 + } else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT )
924 924 {
925 925 newPage = 0;
926 926 }
... ... @@ -929,7 +929,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::
929 929 // Scroll to the page in the given direction
930 930 mScrollView.ScrollTo(newPage);
931 931  
932   - if( direction == Dali::Toolkit::Control::Left )
  932 + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
933 933 {
934 934 // Work out the cell position for the last tile
935 935 int remainingExamples = mExampleList.size() - newPage * EXAMPLES_PER_PAGE;
... ... @@ -937,7 +937,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::
937 937 int colPos = remainingExamples >= EXAMPLES_PER_PAGE ? EXAMPLES_PER_ROW - 1 : ( remainingExamples % EXAMPLES_PER_PAGE - rowPos * EXAMPLES_PER_ROW - 1 );
938 938  
939 939 // Move the focus to the last tile in the new page.
940   - nextFocusActor = mPages[newPage].GetChildAt(colPos * EXAMPLES_PER_ROW + rowPos);
  940 + nextFocusActor = mPages[newPage].GetChildAt(rowPos * EXAMPLES_PER_ROW + colPos);
941 941 }
942 942 else
943 943 {
... ...
demo/dali-table-view.h
... ... @@ -345,7 +345,7 @@ private: // Application callbacks &amp; implementation
345 345 * @param[in] direction The direction to move the focus
346 346 * @return The actor to move the keyboard focus to.
347 347 */
348   - Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction );
  348 + Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction );
349 349  
350 350 /**
351 351 * Callback when the keyboard focused actor is activated.
... ...
examples/animated-shapes/animated-shapes-example.cpp
... ... @@ -55,11 +55,12 @@ public:
55 55 // Get a handle to the stage
56 56 Stage stage = Stage::GetCurrent();
57 57  
58   - //Create a view
  58 + // Create a view
59 59 mView = Dali::Toolkit::Control::New();
60 60 mView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
61 61 mView.SetParentOrigin( Dali::ParentOrigin::CENTER );
62 62 mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  63 + mView.SetDrawMode( DrawMode::OVERLAY );
63 64 stage.Add( mView );
64 65  
65 66 //Set background image for the view
... ...
examples/cluster/cluster-impl.cpp
... ... @@ -23,7 +23,9 @@
23 23 #include <cstring> // for strcmp
24 24 #include <dali/public-api/animation/animation.h>
25 25 #include <dali/public-api/object/type-registry.h>
  26 +#include <dali/public-api/object/property-array.h>
26 27 #include <dali/devel-api/object/type-registry-helper.h>
  28 +#include <dali/devel-api/scripting/scripting.h>
27 29 #include <dali/integration-api/debug.h>
28 30  
29 31 // INTERNAL INCLUDES
... ... @@ -475,17 +477,21 @@ void Cluster::UpdateTitle(float duration)
475 477 }
476 478 }
477 479  
478   -void Cluster::DoExpandAction(const PropertyValueContainer& attributes)
  480 +void Cluster::DoExpandAction(const Property::Map& attributes)
479 481 {
480   - if(attributes.size() >= 1)
  482 + Property::Value* value = attributes.Find( "indices" );
  483 +
  484 + if( value )
481 485 {
482   - for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
  486 + if( value->GetType() == Property::ARRAY )
483 487 {
484   - const Property::Value& value = *iter;
485   -
486   - DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
487   - unsigned int index = value.Get<float>();
488   - ExpandChild( index );
  488 + Property::Array array = value->Get<Property::Array>();
  489 + for( size_t i = 0; i < array.Size(); i++ )
  490 + {
  491 + Property::Value& item = array[i];
  492 + DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER);
  493 + ExpandChild( item.Get<int>() );
  494 + }
489 495 }
490 496 }
491 497 else
... ... @@ -494,17 +500,21 @@ void Cluster::DoExpandAction(const PropertyValueContainer&amp; attributes)
494 500 }
495 501 }
496 502  
497   -void Cluster::DoCollapseAction(const PropertyValueContainer& attributes)
  503 +void Cluster::DoCollapseAction(const Property::Map& attributes)
498 504 {
499   - if(attributes.size() >= 1)
  505 + Property::Value* value = attributes.Find( "indices" );
  506 +
  507 + if( value )
500 508 {
501   - for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
  509 + if( value->GetType() == Property::ARRAY )
502 510 {
503   - const Property::Value& value = *iter;
504   -
505   - DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
506   - unsigned int index = value.Get<float>();
507   - CollapseChild( index, false );
  511 + Property::Array array = value->Get<Property::Array>();
  512 + for( size_t i = 0; i < array.Size(); i++ )
  513 + {
  514 + Property::Value& item = array[i];
  515 + DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER);
  516 + CollapseChild( item.Get<int>(), false );
  517 + }
508 518 }
509 519 }
510 520 else
... ... @@ -513,27 +523,33 @@ void Cluster::DoCollapseAction(const PropertyValueContainer&amp; attributes)
513 523 }
514 524 }
515 525  
516   -void Cluster::DoTransformAction(const PropertyValueContainer& attributes)
  526 +
  527 +void Cluster::DoTransformAction(const Property::Map& attributes)
517 528 {
518   - DALI_ASSERT_ALWAYS(attributes.size() >= 2);
  529 + typedef Dali::StringValuePair StringValuePair;
519 530  
520   - DALI_ASSERT_ALWAYS(attributes[0].GetType() == Property::FLOAT);
521   - unsigned int index = attributes[0].Get<float>();
  531 + int index = 0;
522 532 Vector3 position;
523 533 Vector3 scale(Vector3::ONE);
524 534 Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS );
525 535  
526   - DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3);
527   - attributes[1].Get(position);
528   -
529   - if(attributes.size()>2)
  536 + for(size_t i = 0; i < attributes.Count(); i++)
530 537 {
531   - attributes[2].Get(scale);
532   - }
  538 + StringValuePair& stringValue = attributes.GetPair(i);
  539 + Property::Type type = stringValue.second.GetType();
533 540  
534   - if(attributes.size()>3)
535   - {
536   - attributes[3].Get(rotation);
  541 + if( Property::VECTOR3 == type && "position" == stringValue.first )
  542 + {
  543 + stringValue.second.Get(position);
  544 + }
  545 + else if( Property::VECTOR3 == type && "scale" == stringValue.first )
  546 + {
  547 + stringValue.second.Get(scale);
  548 + }
  549 + else if( "rotation" == stringValue.first )
  550 + {
  551 + (void)Scripting::SetRotation(stringValue.second, rotation);
  552 + }
537 553 }
538 554  
539 555 // wrap index around -1 => size - 1
... ... @@ -547,7 +563,7 @@ void Cluster::OnControlChildRemove(Actor&amp; child)
547 563 child.RemoveConstraints();
548 564 }
549 565  
550   -bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
  566 +bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes)
551 567 {
552 568 bool ret = false;
553 569  
... ...
examples/cluster/cluster-impl.h
... ... @@ -212,7 +212,7 @@ private:
212 212 * @param[in] attributes list of indices of actors to expand.
213 213 * (if no attributes specifies, then all actors expand)
214 214 */
215   - void DoExpandAction(const PropertyValueContainer& attributes);
  215 + void DoExpandAction(const Property::Map& attributes);
216 216  
217 217 /**
218 218 * Action: Collapse
... ... @@ -221,7 +221,7 @@ private:
221 221 * @param[in] attributes list of indices of actors to collapse.
222 222 * (if no attributes specifies, then all actors collapse)
223 223 */
224   - void DoCollapseAction(const PropertyValueContainer& attributes);
  224 + void DoCollapseAction(const Property::Map& attributes);
225 225  
226 226 /**
227 227 * Action: Transform
... ... @@ -230,7 +230,7 @@ private:
230 230 *
231 231 * @param[in] attributes index and transform values.
232 232 */
233   - void DoTransformAction(const PropertyValueContainer& attributes);
  233 + void DoTransformAction(const Property::Map& attributes);
234 234  
235 235 private: // From Control
236 236 /**
... ... @@ -248,7 +248,7 @@ public:
248 248 * @param[in] attributes The attributes with which to perfrom this action.
249 249 * @return true if action has been accepted by this control
250 250 */
251   - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
  251 + static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
252 252  
253 253 private: // From Control
254 254  
... ...
examples/item-view/item-view-example.cpp
... ... @@ -313,7 +313,7 @@ public:
313 313 mWhiteImage = BufferImage::WHITE();
314 314 }
315 315  
316   - Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocusNavigationDirection direction )
  316 + Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction )
317 317 {
318 318 if ( !current && !proposed )
319 319 {
... ...
examples/path-animation/path-animation.cpp
... ... @@ -140,8 +140,6 @@ public:
140 140 */
141 141 void DrawPath( unsigned int resolution )
142 142 {
143   - Stage stage = Dali::Stage::GetCurrent();
144   -
145 143 //Create path mesh actor
146 144 Dali::MeshData meshData = MeshFactory::NewPath( mPath, resolution );
147 145 Dali::Material material = Material::New("LineMaterial");
... ... @@ -150,12 +148,12 @@ public:
150 148 Dali::Mesh mesh = Dali::Mesh::New( meshData );
151 149 if( mMeshPath )
152 150 {
153   - stage.Remove( mMeshPath );
  151 + mContentLayer.Remove( mMeshPath );
154 152 }
155 153 mMeshPath = Dali::MeshActor::New( mesh );
156 154 mMeshPath.SetAnchorPoint( AnchorPoint::TOP_LEFT );
157 155 mMeshPath.SetParentOrigin( ParentOrigin::TOP_LEFT );
158   - stage.Add( mMeshPath );
  156 + mContentLayer.Add( mMeshPath );
159 157  
160 158  
161 159 ////Create mesh connecting interpolation points and control points
... ... @@ -192,12 +190,12 @@ public:
192 190 mesh = Dali::Mesh::New( meshData );
193 191 if( mMeshHandlers )
194 192 {
195   - stage.Remove( mMeshHandlers );
  193 + mContentLayer.Remove( mMeshHandlers );
196 194 }
197 195 mMeshHandlers = Dali::MeshActor::New( mesh );
198 196 mMeshHandlers.SetAnchorPoint( AnchorPoint::TOP_LEFT );
199 197 mMeshHandlers.SetParentOrigin( ParentOrigin::TOP_LEFT );
200   - stage.Add( mMeshHandlers );
  198 + mContentLayer.Add( mMeshHandlers );
201 199  
202 200  
203 201 //Create actors representing interpolation points
... ... @@ -456,6 +454,7 @@ public:
456 454 BACKGROUND_IMAGE,
457 455 TOOLBAR_IMAGE,
458 456 "" );
  457 + mContentLayer.SetDrawMode( DrawMode::OVERLAY );
459 458  
460 459 mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer);
461 460  
... ... @@ -475,7 +474,7 @@ public:
475 474 mActor = ImageActor::New( img );
476 475 mActor.SetAnchorPoint( AnchorPoint::CENTER );
477 476 mActor.SetSize( 100, 50, 1 );
478   - stage.Add( mActor );
  477 + mContentLayer.Add( mActor );
479 478  
480 479 CreateAnimation();
481 480 CreateControls();
... ...
examples/text-field/text-field-example.cpp
... ... @@ -22,7 +22,9 @@
22 22  
23 23 // EXTERNAL INCLUDES
24 24 #include <dali-toolkit/dali-toolkit.h>
  25 +#include <dali-toolkit/devel-api/controls/popup/popup.h>
25 26 #include <iostream>
  27 +#include <dali/public-api/events/touch-point.h>
26 28  
27 29 // INTERNAL INCLUDES
28 30 #include "shared/multi-language-strings.h"
... ... @@ -35,38 +37,11 @@ using namespace MultiLanguageStrings;
35 37 namespace
36 38 {
37 39  
38   - const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  40 + const char* const FOLDER_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_bg.png";
39 41  
40 42 const float BORDER_WIDTH = 4.0f;
41 43  
42   - const unsigned int KEY_ZERO = 10;
43   - const unsigned int KEY_ONE = 11;
44   - const unsigned int KEY_F = 41;
45   - const unsigned int KEY_H = 43;
46   - const unsigned int KEY_V = 55;
47   - const unsigned int KEY_M = 58;
48   - const unsigned int KEY_L = 46;
49   - const unsigned int KEY_S = 39;
50   - const unsigned int KEY_PLUS = 21;
51   - const unsigned int KEY_MINUS = 20;
52   -
53   - const char* H_ALIGNMENT_STRING_TABLE[] =
54   - {
55   - "BEGIN",
56   - "CENTER",
57   - "END"
58   - };
59   -
60   - const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] );
61   -
62   - const char* V_ALIGNMENT_STRING_TABLE[] =
63   - {
64   - "TOP",
65   - "CENTER",
66   - "BOTTOM"
67   - };
68   -
69   - const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] );
  44 + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 );
70 45  
71 46 } // unnamed namespace
72 47  
... ... @@ -78,9 +53,7 @@ class TextFieldExample : public ConnectionTracker
78 53 public:
79 54  
80 55 TextFieldExample( Application& application )
81   - : mApplication( application ),
82   - mLanguageId( 0u ),
83   - mAlignment( 0u )
  56 + : mApplication( application )
84 57 {
85 58 // Connect to the Application's Init signal
86 59 mApplication.InitSignal().Connect( this, &TextFieldExample::Create );
... ... @@ -98,40 +71,119 @@ public:
98 71 {
99 72 Stage stage = Stage::GetCurrent();
100 73  
101   - mTapGestureDetector = TapGestureDetector::New();
102   - mTapGestureDetector.Attach( stage.GetRootLayer() );
103   - mTapGestureDetector.DetectedSignal().Connect( this, &TextFieldExample::OnTap );
104   -
  74 + stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
105 75 stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
106 76  
  77 + mButton = CreateFolderButton();
  78 + mButton.ClickedSignal().Connect( this, &TextFieldExample::OnButtonClicked );
  79 + stage.Add( mButton );
  80 + }
  81 +
  82 + PushButton CreateFolderButton()
  83 + {
  84 + PushButton button = PushButton::New();
  85 + ResourceImage image = ResourceImage::New( FOLDER_ICON_IMAGE );
  86 + ImageActor folderButton = ImageActor::New( image );
  87 + folderButton.SetColor( Color::WHITE );
  88 + button.SetButtonImage( folderButton );
  89 + button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  90 + button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  91 + button.SetSize( image.GetWidth(), image.GetHeight() );
  92 +
  93 + return button;
  94 + }
  95 +
  96 + bool OnButtonClicked( Toolkit::Button button )
  97 + {
  98 + Stage stage = Stage::GetCurrent();
107 99 Vector2 stageSize = stage.GetSize();
108 100  
109   - Control container = Control::New();
110   - container.SetName( "Container" );
111   - container.SetParentOrigin( ParentOrigin::CENTER );
112   - container.SetSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) );
113   - container.SetBackgroundColor( Color::WHITE );
114   - container.GetChildAt(0).SetZ(-1.0f);
115   - stage.Add( container );
  101 + // Launch a pop-up containing TextField
  102 + mField = CreateTextField( stageSize, mButtonLabel );
  103 + mPopup = CreatePopup( stageSize.width * 0.8f );
  104 + mPopup.Add( mField );
  105 + mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched );
  106 + mPopup.Show();
  107 +
  108 + return true;
  109 + }
116 110  
117   - mField = TextField::New();
118   - mField.SetAnchorPoint( AnchorPoint::TOP_LEFT );
119   - mField.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
120   - mField.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
121   - mField.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
122   - mField.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
123   - mField.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
  111 + TextField CreateTextField( const Vector2& stageSize, const std::string& text )
  112 + {
  113 + TextField field = TextField::New();
  114 + field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  115 + field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  116 + field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  117 + field.SetProperty( TextField::Property::TEXT, text );
  118 + field.SetProperty( TextField::Property::TEXT_COLOR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ) ); // CYAN
  119 + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
  120 + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
  121 + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
  122 +
  123 + return field;
  124 + }
124 125  
125   - container.Add( mField );
  126 + Popup CreatePopup( float width )
  127 + {
  128 + Popup popup = Popup::New();
  129 + popup.SetParentOrigin( ParentOrigin::CENTER );
  130 + popup.SetAnchorPoint( AnchorPoint::CENTER );
  131 + popup.SetSize( width, 0.0f );
  132 + popup.HideTail();
  133 + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT );
  134 + popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT );
  135 + popup.TouchedSignal().Connect( this, &TextFieldExample::OnPopupTouched );
  136 +
  137 + return popup;
  138 + }
126 139  
127   - Property::Value fieldText = mField.GetProperty( TextField::Property::TEXT );
  140 + void OnPopupOutsideTouched()
  141 + {
  142 + // Update the folder text
  143 + if( mButton && mField )
  144 + {
  145 + Property::Value text = mField.GetProperty( TextField::Property::TEXT );
  146 + mButtonLabel = text.Get< std::string >();
  147 + mButton.SetLabel( mButtonLabel );
  148 + }
128 149  
129   - std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl;
  150 + // Hide & discard the pop-up
  151 + if( mPopup )
  152 + {
  153 + mPopup.Hide();
  154 + }
  155 + mField.Reset();
  156 + mPopup.Reset();
130 157 }
131 158  
132   - void OnTap( Actor actor, const TapGesture& tapGesture )
  159 + bool OnPopupTouched( Actor actor, const TouchEvent& event )
133 160 {
134   - mField.ClearKeyInputFocus();
  161 + // End edit mode for TextField if parent Popup touched.
  162 + if(event.GetPointCount() > 0)
  163 + {
  164 + const TouchPoint& point = event.GetPoint(0);
  165 + switch(point.state)
  166 + {
  167 + case TouchPoint::Down:
  168 + {
  169 + // Update the folder text and lose focus for Key events
  170 + if( mButton && mField )
  171 + {
  172 + Property::Value text = mField.GetProperty( TextField::Property::TEXT );
  173 + mButtonLabel = text.Get< std::string >();
  174 + mButton.SetLabel( mButtonLabel );
  175 + mField.ClearKeyInputFocus();
  176 + }
  177 + break;
  178 + }
  179 + default:
  180 + {
  181 + break;
  182 + }
  183 + } // end switch
  184 + }
  185 +
  186 + return true;
135 187 }
136 188  
137 189 /**
... ... @@ -145,73 +197,6 @@ public:
145 197 {
146 198 mApplication.Quit();
147 199 }
148   - else if( event.IsCtrlModifier() )
149   - {
150   - switch( event.keyCode )
151   - {
152   - // Select rendering back-end
153   - case KEY_ZERO: // fall through
154   - case KEY_ONE:
155   - {
156   - mField.SetProperty( TextField::Property::RENDERING_BACKEND, event.keyCode - 10 );
157   - break;
158   - }
159   - case KEY_H: // Horizontal alignment
160   - {
161   - if( ++mAlignment >= H_ALIGNMENT_STRING_COUNT )
162   - {
163   - mAlignment = 0u;
164   - }
165   -
166   - mField.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, H_ALIGNMENT_STRING_TABLE[ mAlignment ] );
167   - break;
168   - }
169   - case KEY_V: // Vertical alignment
170   - {
171   - if( ++mAlignment >= V_ALIGNMENT_STRING_COUNT )
172   - {
173   - mAlignment = 0u;
174   - }
175   -
176   - mField.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, V_ALIGNMENT_STRING_TABLE[ mAlignment ] );
177   - break;
178   - }
179   - case KEY_L: // Language
180   - {
181   - const Language& language = LANGUAGES[ mLanguageId ];
182   -
183   - mField.SetProperty( TextField::Property::TEXT, language.text );
184   -
185   - if( ++mLanguageId >= NUMBER_OF_LANGUAGES )
186   - {
187   - mLanguageId = 0u;
188   - }
189   - break;
190   - }
191   - case KEY_S: // Shadow color
192   - {
193   - if( Color::BLACK == mField.GetProperty<Vector4>( TextField::Property::SHADOW_COLOR ) )
194   - {
195   - mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::RED );
196   - }
197   - else
198   - {
199   - mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::BLACK );
200   - }
201   - break;
202   - }
203   - case KEY_PLUS: // Increase shadow offset
204   - {
205   - mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) );
206   - break;
207   - }
208   - case KEY_MINUS: // Decrease shadow offset
209   - {
210   - mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) - Vector2( 1.0f, 1.0f ) );
211   - break;
212   - }
213   - }
214   - }
215 200 }
216 201 }
217 202  
... ... @@ -219,12 +204,13 @@ private:
219 204  
220 205 Application& mApplication;
221 206  
222   - TextField mField;
223   -
224   - TapGestureDetector mTapGestureDetector;
  207 + // This button launches a pop-up containing TextField
  208 + PushButton mButton;
  209 + std::string mButtonLabel;
225 210  
226   - unsigned int mLanguageId;
227   - unsigned int mAlignment;
  211 + // Pop-up contents
  212 + TextField mField;
  213 + Popup mPopup;
228 214 };
229 215  
230 216 void RunTest( Application& application )
... ...
examples/text-label/text-label-example.cpp
... ... @@ -34,7 +34,7 @@ using namespace MultiLanguageStrings;
34 34  
35 35 namespace
36 36 {
37   - const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  37 + const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "grab-handle.png";
38 38  
39 39 const unsigned int KEY_ZERO = 10;
40 40 const unsigned int KEY_ONE = 11;
... ... @@ -107,16 +107,16 @@ public:
107 107 mContainer.SetParentOrigin( ParentOrigin::CENTER );
108 108 mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f);
109 109 mContainer.SetSize( mLayoutSize );
  110 + mContainer.SetDrawMode( DrawMode::OVERLAY );
110 111 stage.Add( mContainer );
111 112  
112 113 // Resize the center layout when the corner is grabbed
113 114 mGrabCorner = Control::New();
114 115 mGrabCorner.SetName( "GrabCorner" );
115   - mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
  116 + mGrabCorner.SetAnchorPoint( AnchorPoint::TOP_CENTER );
116 117 mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
117   - mGrabCorner.SetSize( Vector2(stageSize.width*0.1f, stageSize.width*0.1f) );
118   - mGrabCorner.SetZ(1.0f);
119   - mGrabCorner.SetBackgroundColor( Color::YELLOW );
  118 + mGrabCorner.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
  119 + mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
120 120 mContainer.Add( mGrabCorner );
121 121  
122 122 mPanGestureDetector = PanGestureDetector::New();
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.0.42
  5 +Version: 1.0.43
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/images/folder_appicon_empty_bg.png 0 โ†’ 100644

6.09 KB

resources/images/grab-handle.png 0 โ†’ 100644

5.02 KB

resources/scripts/animated-colors.json
... ... @@ -18,12 +18,10 @@
18 18 "stage": [
19 19 {
20 20 "type": "Control",
21   - "relayout-enabled": false,
  21 + "draw-mode": "OVERLAY",
22 22 "actors": [
23 23 {
24 24 "type": "Control",
25   - "relayout-enabled": true,
26   - "actors": [],
27 25 "name": "Control 8",
28 26 "position": [
29 27 0,
... ... @@ -62,12 +60,9 @@
62 60 },
63 61 {
64 62 "type": "Control",
65   - "relayout-enabled": false,
66 63 "actors": [
67 64 {
68 65 "type": "Control",
69   - "relayout-enabled": false,
70   - "actors": [],
71 66 "name": "Container 2",
72 67 "position": [
73 68 0,
... ... @@ -106,12 +101,9 @@
106 101 },
107 102 {
108 103 "type": "Control",
109   - "relayout-enabled": false,
110 104 "actors": [
111 105 {
112 106 "type": "Control",
113   - "relayout-enabled": false,
114   - "actors": [],
115 107 "name": "Container 4",
116 108 "position": [
117 109 0,
... ... @@ -187,12 +179,9 @@
187 179 },
188 180 {
189 181 "type": "Control",
190   - "relayout-enabled": false,
191 182 "actors": [
192 183 {
193 184 "type": "Control",
194   - "relayout-enabled": false,
195   - "actors": [],
196 185 "name": "Container 5",
197 186 "position": [
198 187 0,
... ... @@ -231,12 +220,9 @@
231 220 },
232 221 {
233 222 "type": "Control",
234   - "relayout-enabled": false,
235 223 "actors": [
236 224 {
237 225 "type": "Control",
238   - "relayout-enabled": false,
239   - "actors": [],
240 226 "name": "Container 7",
241 227 "position": [
242 228 0,
... ... @@ -312,12 +298,9 @@
312 298 },
313 299 {
314 300 "type": "Control",
315   - "relayout-enabled": false,
316 301 "actors": [
317 302 {
318 303 "type": "Control",
319   - "relayout-enabled": false,
320   - "actors": [],
321 304 "name": "Container 8",
322 305 "position": [
323 306 0,
... ... @@ -356,12 +339,9 @@
356 339 },
357 340 {
358 341 "type": "Control",
359   - "relayout-enabled": false,
360 342 "actors": [
361 343 {
362 344 "type": "Control",
363   - "relayout-enabled": false,
364   - "actors": [],
365 345 "name": "Container 10",
366 346 "position": [
367 347 0,
... ... @@ -548,12 +528,9 @@
548 528 },
549 529 {
550 530 "type": "Control",
551   - "relayout-enabled": false,
552 531 "actors": [
553 532 {
554 533 "type": "Control",
555   - "relayout-enabled": false,
556   - "actors": [],
557 534 "name": "Control 4",
558 535 "position": [
559 536 0,
... ... @@ -629,15 +606,12 @@
629 606 },
630 607 {
631 608 "type": "Control",
632   - "relayout-enabled": false,
633 609 "actors": [
634 610 {
635 611 "type": "Control",
636   - "relayout-enabled": false,
637 612 "actors": [
638 613 {
639 614 "type": "Control",
640   - "actors": [],
641 615 "name": "Container 13",
642 616 "position": [
643 617 0,
... ... @@ -713,8 +687,6 @@
713 687 },
714 688 {
715 689 "type": "Control",
716   - "relayout-enabled": false,
717   - "actors": [],
718 690 "name": "Container 11",
719 691 "position": [
720 692 0,
... ... @@ -753,16 +725,12 @@
753 725 },
754 726 {
755 727 "type": "Control",
756   - "relayout-enabled": false,
757 728 "actors": [
758 729 {
759 730 "type": "Control",
760   - "relayout-enabled": false,
761 731 "actors": [
762 732 {
763 733 "type": "Control",
764   - "relayout-enabled": false,
765   - "actors": [],
766 734 "name": "Container 15",
767 735 "position": [
768 736 0,
... ... @@ -838,8 +806,6 @@
838 806 },
839 807 {
840 808 "type": "Control",
841   - "relayout-enabled": false,
842   - "actors": [],
843 809 "name": "Container 16",
844 810 "position": [
845 811 0,
... ... @@ -949,7 +915,27 @@
949 915 0.3411764705882353,
950 916 1
951 917 ]
  918 + },
  919 + {
  920 + "type": "TextLabel",
  921 + "name": "text",
  922 + "parent-origin": "CENTER",
  923 + "anchor-point": "CENTER",
  924 + "text": "START",
  925 + "point-size": 20,
  926 + "signals": [
  927 + {
  928 + "name": "tapped",
  929 + "action": "play",
  930 + "animation": "Animation_1"
  931 + },
  932 + {
  933 + "name": "tapped",
  934 + "action": "play",
  935 + "animation": "HideText"
952 936 }
  937 + ]
  938 + }
953 939 ],
954 940 "name": "Container 1",
955 941 "position": [
... ... @@ -986,26 +972,6 @@
986 972 0.32941176470588235,
987 973 1
988 974 ]
989   - },
990   - {
991   - "type": "TextLabel",
992   - "name": "text",
993   - "parent-origin": "CENTER",
994   - "anchor-point": "CENTER",
995   - "text": "START",
996   - "point-size": 20,
997   - "signals": [
998   - {
999   - "name": "tapped",
1000   - "action": "play",
1001   - "animation": "Animation_1"
1002   - },
1003   - {
1004   - "name": "tapped",
1005   - "action": "play",
1006   - "animation": "HideText"
1007   - }
1008   - ]
1009 975 }
1010 976 ],
1011 977 "animations": {
... ...
resources/scripts/background-color.json
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -19,10 +19,13 @@
19 19 // A TextLabel with a red background
20 20 {
21 21 "type": "TextLabel",
  22 + "draw-mode": "OVERLAY",
22 23 "text": "Hello World",
23 24 "parent-origin": "TOP_CENTER",
24 25 "anchor-point": "TOP_CENTER",
25 26 "background-color": [1, 0, 0, 1],
  27 + "position": [0, 50, 0],
  28 + "point-size": 40,
26 29 "size": [400, 150, 1]
27 30 },
28 31  
... ...
resources/scripts/table-view.json
... ... @@ -21,6 +21,7 @@
21 21 "type":"TableView",
22 22 "background-color": [0.5,0.5,0,1],
23 23 "parent-origin": "CENTER",
  24 + "draw-mode": "OVERLAY",
24 25 "size":[400,500,1],
25 26 "cell-padding": [10, 5],
26 27 "layout-rows": { // set the height of the rows
... ...
shared/dali-demo-strings.h
... ... @@ -49,6 +49,7 @@ extern &quot;C&quot;
49 49 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI")
50 50 #define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING")
51 51 #define DALI_DEMO_STR_TITLE_IMAGE_SCALING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_SCALING")
  52 +#define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD")
52 53 #define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL")
53 54 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE")
54 55 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT")
... ... @@ -77,6 +78,7 @@ extern &quot;C&quot;
77 78 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI"
78 79 #define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING "Image Fitting and Sampling"
79 80 #define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Grid"
  81 +#define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field"
80 82 #define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label"
81 83 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts"
82 84 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text"
... ...