[dali_1.0.38] Merge branch 'tizen' 64/38264/1
authorFerran Sole <ferran.sole@samsung.com>
Wed, 15 Apr 2015 11:58:26 +0000 (12:58 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Wed, 15 Apr 2015 11:58:27 +0000 (12:58 +0100)
Change-Id: I272bd0a2d84b0e598a2c2eb33d4945ef2eef095c

60 files changed:
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/cluster/cluster-impl.cpp
dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.h
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-connector-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp
dali-toolkit/internal/controls/view/view-impl.cpp
dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp
dali-toolkit/internal/text/character-set-conversion.h
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-parameters.h
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/text-backend.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-view-interface.h
dali-toolkit/internal/text/text-view.cpp
dali-toolkit/internal/text/text-view.h
dali-toolkit/internal/text/visual-model-impl.cpp
dali-toolkit/internal/text/visual-model-impl.h
dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
dali-toolkit/public-api/controls/buttons/push-button.cpp
dali-toolkit/public-api/controls/cluster/cluster-style.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h
dali-toolkit/public-api/controls/text-controls/text-label.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/focus-manager/keyboard-focus-manager.cpp
docs/content/programming-guide/custom-actor.h
docs/content/programming-guide/size-negotiation-controls.h
docs/content/programming-guide/size-negotiation.h
packaging/dali-toolkit.spec
plugins/dali-script-v8/src/animation/animation-api.cpp
plugins/dali-script-v8/src/signals/signal-manager.cpp

index 5c19f09..62d0174 100644 (file)
@@ -37,6 +37,8 @@ SET(TC_SOURCES
    utc-Dali-SpotEffect.cpp
    utc-Dali-SquareDissolveEffect.cpp
    utc-Dali-TableView.cpp
+   utc-Dali-TextField.cpp
+   utc-Dali-TextLabel.cpp
    utc-Dali-ToolBar.cpp
    utc-Dali-View.cpp
    utc-Dali-WaterEffect.cpp
index b094fde..36cb94b 100644 (file)
  */
 
 // EXTERNAL INCLUDES
+#include <cstdio>  // fprintf
 #include <sstream>
 #include <string>
+#include <cstring> // for strcpy, strncpy
 #include <map>
 
 // INTERNAL INCLUDES
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
new file mode 100644 (file)
index 0000000..9069525
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_textfield_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_textfield_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+const char* const PROPERTY_NAME_RENDERING_BACKEND = "rendering-backend";
+const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholder-text";
+const char* const PROPERTY_NAME_FONT_FAMILY = "font-family";
+const char* const PROPERTY_NAME_FONT_STYLE = "font-style";
+const char* const PROPERTY_NAME_POINT_SIZE = "point-size";
+const char* const PROPERTY_NAME_EXCEED_POLICY = "exceed-policy";
+const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR = "primary-cursor-color";
+const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR = "secondary-cursor-color";
+const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK = "enable-cursor-blink";
+const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL = "cursor-blink-interval";
+const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION = "cursor-blink-duration";
+const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE = "grab-handle-image";
+const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decoration-bounding-box";
+const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontal-alignment";
+const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "vertical-alignment";
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+  gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+int UtcDaliTextFieldNew(void)
+{
+  ToolkitTestApplication application;
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  //Additional check to ensure object is created by checking if it's registered
+  ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+  DALI_TEST_CHECK( registry );
+
+  gObjectCreatedCallBackCalled = false;
+  registry.ObjectCreatedSignal().Connect(&TestCallback);
+  {
+    TextField field = TextField::New();
+  }
+  DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+  END_TEST;
+}
+
+int UtcDaliTextFieldGetSetProperty(void)
+{
+  ToolkitTestApplication application;
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  // Check Property Indices are correct
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextField::Property::RENDERING_BACKEND );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == TextField::Property::PLACEHOLDER_TEXT );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextField::Property::FONT_FAMILY );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextField::Property::FONT_STYLE );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextField::Property::POINT_SIZE );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_EXCEED_POLICY ) == TextField::Property::EXCEED_POLICY );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PRIMARY_CURSOR_COLOR ) == TextField::Property::PRIMARY_CURSOR_COLOR );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SECONDARY_CURSOR_COLOR ) == TextField::Property::SECONDARY_CURSOR_COLOR );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_CURSOR_BLINK ) == TextField::Property::ENABLE_CURSOR_BLINK );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_INTERVAL ) == TextField::Property::CURSOR_BLINK_INTERVAL );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_DURATION ) == TextField::Property::CURSOR_BLINK_DURATION );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_IMAGE ) == TextField::Property::GRAB_HANDLE_IMAGE );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_DECORATION_BOUNDING_BOX ) == TextField::Property::DECORATION_BOUNDING_BOX );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextField::Property::HORIZONTAL_ALIGNMENT );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextField::Property::VERTICAL_ALIGNMENT );
+
+  // Check exceed policy
+  field.SetProperty( TextField::Property::EXCEED_POLICY, TextField::EXCEED_POLICY_CLIP );
+  DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::EXCEED_POLICY ), TextField::EXCEED_POLICY_CLIP, TEST_LOCATION );
+
+  // Check cursor properties
+  field.SetProperty( TextField::Property::ENABLE_CURSOR_BLINK, true );
+  DALI_TEST_EQUALS( field.GetProperty<bool>( TextField::Property::ENABLE_CURSOR_BLINK ), true, TEST_LOCATION );
+  field.SetProperty( TextField::Property::PRIMARY_CURSOR_COLOR, Color::RED );
+  DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::PRIMARY_CURSOR_COLOR ), Color::RED, TEST_LOCATION );
+  field.SetProperty( TextField::Property::SECONDARY_CURSOR_COLOR, Color::BLUE );
+  DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::SECONDARY_CURSOR_COLOR ), Color::BLUE, TEST_LOCATION );
+  field.SetProperty( TextField::Property::CURSOR_BLINK_DURATION, 10.0f );
+  DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::CURSOR_BLINK_DURATION ), 10.0f, TEST_LOCATION );
+
+  // Blink interval gets converted to milliseconds....
+  field.SetProperty( TextField::Property::CURSOR_BLINK_INTERVAL, 1.0f );
+  DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::CURSOR_BLINK_INTERVAL ), 1000.0f, TEST_LOCATION );
+
+  // Decoration bounding box
+  field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
+  DALI_TEST_EQUALS( field.GetProperty<Rect <int > >( TextField::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
+
+  // Check that the Alignment properties can be correctly set
+  field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
+  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::HORIZONTAL_ALIGNMENT ), "BEGIN", TEST_LOCATION );
+  field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "TOP" );
+  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::VERTICAL_ALIGNMENT ), "TOP", TEST_LOCATION );
+  END_TEST;
+}
+
+int utcDaliTextFieldBasicRender(void)
+{
+  ToolkitTestApplication application;
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
+
+  try
+  {
+    // Render some text with the basic backend
+    field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
+    application.SendNotification();
+    application.Render();
+  }
+  catch( ... )
+  {
+    tet_result(TET_FAIL);
+  }
+  END_TEST;
+}
+
+int utcDaliTextFieldAtlasRender(void)
+{
+  ToolkitTestApplication application;
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+  try
+  {
+    // Render some text with the shared atlas backend
+    field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
+    application.SendNotification();
+    application.Render();
+  }
+  catch( ... )
+  {
+    tet_result(TET_FAIL);
+  }
+  END_TEST;
+}
+
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
new file mode 100644 (file)
index 0000000..3365605
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_textlabel_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_textlabel_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+const char* const PROPERTY_NAME_RENDERING_BACKEND = "rendering-backend";
+const char* const PROPERTY_NAME_TEXT = "text";
+const char* const PROPERTY_NAME_FONT_FAMILY = "font-family";
+const char* const PROPERTY_NAME_FONT_STYLE = "font-style";
+const char* const PROPERTY_NAME_POINT_SIZE = "point-size";
+const char* const PROPERTY_NAME_MULTI_LINE =  "multi-line";
+const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontal-alignment";
+const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "vertical-alignment";
+const char* const PROPERTY_NAME_TEXT_COLOR = "text-color";
+const char* const PROPERTY_NAME_SHADOW_OFFSET = "shadow-offset";
+const char* const PROPERTY_NAME_SHADOW_COLOR = "shadow-color";
+const char* const PROPERTY_NAME_UNDERLINE_ENABLED = "underline-enabled";
+const char* const PROPERTY_NAME_UNDERLINE_COLOR = "underline-color";
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+  gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+int UtcDaliTextLabelNew(void)
+{
+  ToolkitTestApplication application;
+  TextLabel label = TextLabel::New("Test Text");
+  DALI_TEST_CHECK( label );
+
+  //Additional check to ensure object is created by checking if it's registered
+  ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+  DALI_TEST_CHECK( registry );
+
+  gObjectCreatedCallBackCalled = false;
+  registry.ObjectCreatedSignal().Connect(&TestCallback);
+  {
+    TextLabel label = TextLabel::New("Test Text");
+  }
+  DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+  END_TEST;
+}
+
+int UtcDaliTextLabelGetSetProperty(void)
+{
+  ToolkitTestApplication application;
+  TextLabel label = TextLabel::New("Test Text");
+  DALI_TEST_CHECK( label );
+
+  // Check Property Indices are correct
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextLabel::Property::RENDERING_BACKEND );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW_OFFSET ) == TextLabel::Property::SHADOW_OFFSET );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW_COLOR ) == TextLabel::Property::SHADOW_COLOR );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_ENABLED ) == TextLabel::Property::UNDERLINE_ENABLED );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_COLOR ) == TextLabel::Property::UNDERLINE_COLOR );
+
+  // Check label defaults are correct
+  DALI_TEST_EQUALS( label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
+  DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::WHITE, TEST_LOCATION );
+  DALI_TEST_EQUALS( label.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ), Vector2::ZERO, TEST_LOCATION );
+  DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::SHADOW_COLOR ), Vector4::ZERO, TEST_LOCATION );
+  DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::UNDERLINE_ENABLED ), false, TEST_LOCATION );
+
+  // Check that text can be correctly reset
+  label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
+  DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), "Setting Text", TEST_LOCATION );
+
+  // Check that the Alignment properties can be correctly set
+  label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
+  DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "BEGIN", TEST_LOCATION );
+  label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "TOP" );
+  DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "TOP", TEST_LOCATION );
+
+  // Check that shadow parameters can be correctly set
+  label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 3.0f, 3.0f ) );
+  DALI_TEST_EQUALS( label.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ), Vector2( 3.0f, 3.0f ), TEST_LOCATION );
+  label.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLUE );
+  DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::SHADOW_COLOR ), Color::BLUE, TEST_LOCATION );
+
+  // Check that underline parameters can be correctly set
+  label.SetProperty( TextLabel::Property::UNDERLINE_ENABLED, true );
+  DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::UNDERLINE_ENABLED ), true, TEST_LOCATION );
+  label.SetProperty( TextLabel::Property::UNDERLINE_COLOR, Color::RED );
+  DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::UNDERLINE_COLOR ), Color::RED, TEST_LOCATION );
+
+  // Toggle multi-line
+  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+  DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
+  END_TEST;
+}
+
+int utcDaliTextlabelBasicRender(void)
+{
+  ToolkitTestApplication application;
+  TextLabel label = TextLabel::New("Test Text");
+  DALI_TEST_CHECK( label );
+
+  label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
+  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+  try
+  {
+    // Render some text with the basic backend
+    label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
+    application.SendNotification();
+    application.Render();
+  }
+  catch( ... )
+  {
+    tet_result(TET_FAIL);
+  }
+  END_TEST;
+}
+
+int utcDaliTextlabelAtlasRender(void)
+{
+  ToolkitTestApplication application;
+  TextLabel label = TextLabel::New("Test Text");
+  DALI_TEST_CHECK( label );
+
+  // Turn on all the effects
+  label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+  label.SetProperty( TextLabel::Property::UNDERLINE_ENABLED, true );
+  label.SetProperty( TextLabel::Property::UNDERLINE_COLOR, Color::RED );
+  label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
+  label.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLUE );
+  try
+  {
+    // Render some text with the shared atlas backend
+    label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
+    application.SendNotification();
+    application.Render();
+  }
+  catch( ... )
+  {
+    tet_result(TET_FAIL);
+  }
+  END_TEST;
+}
+
index c42531f..d1f30bc 100644 (file)
@@ -19,6 +19,7 @@
 #include "button-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
index cc90db8..88e5364 100644 (file)
@@ -80,7 +80,7 @@ CheckBoxButton::~CheckBoxButton()
 void CheckBoxButton::OnButtonInitialize()
 {
   // Wrap around all children
-  Self().SetResizePolicy( FIT_TO_CHILDREN, ALL_DIMENSIONS );
+  Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
 }
 
 void CheckBoxButton::OnLabelSet()
index 3910e43..cf34f85 100644 (file)
@@ -62,8 +62,8 @@ void SizeOfActorIfLarger( Actor root, Vector3& size )
   if ( root )
   {
     // RelayoutSize retreived for Actor to use any padding set to it.
-    size.width = std::max( root.GetRelayoutSize( WIDTH ), size.width );
-    size.height = std::max( root.GetRelayoutSize( HEIGHT ), size.height );
+    size.width = std::max( root.GetRelayoutSize( Dimension::WIDTH ), size.width );
+    size.height = std::max( root.GetRelayoutSize( Dimension::HEIGHT ), size.height );
   }
 }
 
@@ -102,7 +102,7 @@ void PushButton::OnButtonInitialize()
   self.SetLeaveRequired( true );
 
   // Set resize policy to natural size so that buttons will resize to background images
-  self.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  self.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
 }
 
 void PushButton::OnLabelSet()
@@ -113,7 +113,15 @@ void PushButton::OnLabelSet()
   {
     label.SetAnchorPoint( AnchorPoint::CENTER );
     label.SetParentOrigin( ParentOrigin::CENTER );
-    label.SetSize( mSize );
+    label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+    Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( label );
+    if( textLabel )
+    {
+      textLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+      textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+      textLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+    }
   }
 }
 
@@ -121,7 +129,7 @@ void PushButton::OnButtonImageSet()
 {
   Actor& buttonImage = GetButtonImage();
 
-  buttonImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  buttonImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   buttonImage.RelayoutRequestTree();
 
@@ -132,7 +140,7 @@ void PushButton::OnSelectedImageSet()
 {
   Actor& selectedImage = GetSelectedImage();
 
-  selectedImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  selectedImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   selectedImage.RelayoutRequestTree();
 
@@ -143,7 +151,7 @@ void PushButton::OnBackgroundImageSet()
 {
   Actor& backgroundImage = GetBackgroundImage();
 
-  backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  backgroundImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   backgroundImage.RelayoutRequestTree();
 
@@ -154,14 +162,14 @@ void PushButton::OnSelectedBackgroundImageSet()
 {
   Actor& selectedBackgroundImage = GetSelectedBackgroundImage();
 
-  selectedBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  selectedBackgroundImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 }
 
 void PushButton::OnDisabledImageSet()
 {
   Actor& disabledImage = GetDisabledImage();
 
-  disabledImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  disabledImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   disabledImage.RelayoutRequestTree();
 
@@ -172,7 +180,7 @@ void PushButton::OnDisabledBackgroundImageSet()
 {
   Actor& disabledBackgroundImage = GetDisabledBackgroundImage();
 
-  disabledBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  disabledBackgroundImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   disabledBackgroundImage.RelayoutRequestTree();
 
index 96b588c..81b6a5d 100644 (file)
@@ -77,7 +77,7 @@ void RadioButton::OnButtonInitialize()
   Actor self = Self();
 
   // Wrap size of radio button around all its children
-  self.SetResizePolicy( FIT_TO_CHILDREN, ALL_DIMENSIONS );
+  self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
 
   Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR );
   Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR );
@@ -109,6 +109,12 @@ void RadioButton::OnLabelSet()
     label.SetParentOrigin( ParentOrigin::CENTER_LEFT );
     label.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
 
+    // Radio button width is FIT_TO_CHILDREN, so the label must have a sensible policy to fill out the space
+    if( label.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FILL_TO_PARENT )
+    {
+      label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
+    }
+
     if( IsSelected() )
     {
       label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
index d4daf3c..d43d63a 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <algorithm>
+#include <cstring> // for strcmp
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
index 239d94e..8a38163 100644 (file)
@@ -266,14 +266,14 @@ void GaussianBlurView::OnInitialize()
 
   // Create an ImageActor for performing a horizontal blur on the texture
   mImageActorHorizBlur = ImageActor::New();
-  mImageActorHorizBlur.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mImageActorHorizBlur.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mImageActorHorizBlur.SetParentOrigin(ParentOrigin::CENTER);
   mImageActorHorizBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
   mImageActorHorizBlur.SetShaderEffect( mHorizBlurShader );
 
   // Create an ImageActor for performing a vertical blur on the texture
   mImageActorVertBlur = ImageActor::New();
-  mImageActorVertBlur.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mImageActorVertBlur.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mImageActorVertBlur.SetParentOrigin(ParentOrigin::CENTER);
   mImageActorVertBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
   mImageActorVertBlur.SetShaderEffect( mVertBlurShader );
@@ -285,7 +285,7 @@ void GaussianBlurView::OnInitialize()
   if(!mBlurUserImage)
   {
     mImageActorComposite = ImageActor::New();
-    mImageActorComposite.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mImageActorComposite.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mImageActorComposite.SetParentOrigin(ParentOrigin::CENTER);
     mImageActorComposite.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
     mImageActorComposite.SetOpacity(GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH); // ensure alpha is enabled for this object and set default value
@@ -296,7 +296,7 @@ void GaussianBlurView::OnInitialize()
 
     // Create an ImageActor for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
     mTargetActor = ImageActor::New();
-    mTargetActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mTargetActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mTargetActor.SetParentOrigin(ParentOrigin::CENTER);
     mTargetActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
 
index 84eb4e4..26956dc 100644 (file)
@@ -19,6 +19,7 @@
 #include "navigation-control-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/events/key-event.h>
 #include <dali/public-api/object/type-registry.h>
index 42981a3..a5aed9b 100755 (executable)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/popup/popup-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/adaptor-framework/physical-keyboard.h>
 #include <dali/public-api/animation/constraints.h>
@@ -121,14 +122,14 @@ void Popup::OnInitialize()
   Actor self = Self();
   self.SetSensitive(false);
   // Reisize to fit the height of children
-  self.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+  self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
 
   // Create Layer
   mLayer = Layer::New();
   mLayer.SetName( "POPUP_LAYER" );
   mLayer.SetParentOrigin(ParentOrigin::CENTER);
   mLayer.SetAnchorPoint(AnchorPoint::CENTER);
-  mLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mLayer.SetDrawMode( DrawMode::OVERLAY );
 
   // Any content after this point which is added to Self() will be reparented to
@@ -147,8 +148,8 @@ void Popup::OnInitialize()
   mPopupLayout.SetName( "POPUP_LAYOUT_TABLE" );
   mPopupLayout.SetParentOrigin(ParentOrigin::CENTER);
   mPopupLayout.SetAnchorPoint(AnchorPoint::CENTER);
-  mPopupLayout.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-  mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+  mPopupLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+  mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
   mPopupLayout.SetFitHeight( 0 );   // Set row to fit
   mPopupLayout.SetFitHeight( 1 );   // Set row to fit
   self.Add( mPopupLayout );
@@ -223,7 +224,7 @@ void Popup::SetBackgroundImage( Actor image )
   // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
   mBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
 
-  mBackgroundImage.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS );
+  mBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
   mBackgroundImage.SetAnchorPoint( AnchorPoint::CENTER );
   mBackgroundImage.SetParentOrigin( ParentOrigin::CENTER );
 
@@ -250,7 +251,7 @@ void Popup::SetButtonAreaImage( Actor image )
   // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
   mButtonAreaImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
 
-  mButtonAreaImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mButtonAreaImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mButtonAreaImage.SetAnchorPoint( AnchorPoint::CENTER );
   mButtonAreaImage.SetParentOrigin( ParentOrigin::CENTER );
 
@@ -276,8 +277,8 @@ void Popup::SetTitle( const std::string& text )
   if( mPopupLayout )
   {
     mTitle.SetPadding( Padding( 0.0f, 0.0f, mPopupStyle->margin, mPopupStyle->margin ) );
-    mTitle.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-    mTitle.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+    mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+    mTitle.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
     mPopupLayout.AddChild( mTitle, Toolkit::TableView::CellPosition( 0, 0 ) );
   }
 
@@ -302,7 +303,7 @@ void Popup::CreateFooter()
     mBottomBg = Actor::New();
     mBottomBg.SetName( "POPUP_BOTTOM_BG" );
     mBottomBg.SetRelayoutEnabled( true );
-    mBottomBg.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mBottomBg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     mPopupLayout.SetFixedHeight( 2, mPopupStyle->bottomSize.height );   // Buttons
     mPopupLayout.AddChild( mBottomBg, Toolkit::TableView::CellPosition( 2, 0 ) );
@@ -312,7 +313,7 @@ void Popup::CreateFooter()
 void Popup::AddButton( Toolkit::Button button )
 {
   mButtons.push_back( button );
-  button.SetResizePolicy( USE_ASSIGNED_SIZE, ALL_DIMENSIONS );    // Size will be assigned to it
+  button.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );    // Size will be assigned to it
 
   // If this is the first button added
   if( mButtons.size() == 1 )
@@ -422,7 +423,7 @@ void Popup::CreateBacking()
   mBacking = Dali::Toolkit::CreateSolidColorActor( mPopupStyle->backingColor );
   mBacking.SetName( "POPUP_BACKING" );
 
-  mBacking.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mBacking.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mBacking.SetSensitive(true);
 
   mLayer.Add( mBacking );
@@ -687,23 +688,23 @@ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container )
   }
 }
 
-void Popup::OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+void Popup::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 {
   if( mPopupLayout )
   {
-    if( policy == FIT_TO_CHILDREN )
+    if( policy == ResizePolicy::FIT_TO_CHILDREN )
     {
-      mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, dimension );
-      if( dimension & HEIGHT )
+      mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, dimension );
+      if( dimension & Dimension::HEIGHT )
       {
         mPopupLayout.SetFitHeight( 1 );
       }
     }
     else
     {
-      mPopupLayout.SetResizePolicy( FILL_TO_PARENT, dimension );
+      mPopupLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, dimension );
       // Make the content cell fill the whole of the available space
-      if( dimension & HEIGHT )
+      if( dimension & Dimension::HEIGHT )
       {
         mPopupLayout.SetRelativeHeight( 1, 1.0f );
       }
index efdac51..f695c74 100755 (executable)
@@ -259,7 +259,7 @@ private:
   /**
    * @copydoc Control::OnSetResizePolicy()
    */
-  virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension );
+  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
 
   /**
    * @copydoc Control::OnKeyEvent()
index d57f2a4..0d7b833 100755 (executable)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/object/type-registry.h>
index 9ad835f..a3f222e 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <algorithm>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
index 613b0e8..a789981 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/scrollable/scroll-connector-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/object/property-index-ranges.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
index 09582cf..496d20f 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/mouse-wheel-event.h>
index 3db2f3e..5f7cf72 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 
index 67b5262..2011b7f 100644 (file)
@@ -169,9 +169,9 @@ void ShadowView::SetShadowPlane(Actor shadowPlane)
 
   ConstrainCamera();
 
-  mShadowPlane.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mShadowPlane.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
-  mBlurRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mBlurRootActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 }
 
 void ShadowView::SetPointLight(Actor pointLight)
@@ -227,7 +227,7 @@ void ShadowView::OnInitialize()
   // root actor to parent all user added actors. Used as source actor for shadow render task.
   mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
   mChildrenRoot.SetRelayoutEnabled( true );
-  mChildrenRoot.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mChildrenRoot.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mCameraActor = CameraActor::New(stageSize);
index 7ab8438..4c1b2fa 100755 (executable)
@@ -19,7 +19,9 @@
 #include <dali-toolkit/internal/controls/slider/slider-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <sstream>
+#include <limits>
 #include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
index 624e973..f2b8a5f 100644 (file)
@@ -143,7 +143,7 @@ void SuperBlurView::OnInitialize()
   for(unsigned int i=0; i<=mBlurLevels;i++)
   {
     mImageActors[i] = ImageActor::New(  );
-    mImageActors[i].SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mImageActors[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mImageActors[i].SetParentOrigin( ParentOrigin::CENTER );
     mImageActors[i].SetZ(-static_cast<float>(i)*0.01f);
     mImageActors[i].SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
index db2910a..ec8e324 100644 (file)
@@ -38,9 +38,9 @@ namespace
  * @param[in] actor The child actor to test against
  * @param[dimension] The dimnesion to test against
  */
-bool FitToChild( Actor actor, Dimension dimension )
+bool FitToChild( Actor actor, Dimension::Type dimension )
 {
-  return actor.GetResizePolicy( dimension ) != FILL_TO_PARENT && actor.GetRelayoutSize( dimension ) > 0.0f;
+  return actor.GetResizePolicy( dimension ) != ResizePolicy::FILL_TO_PARENT && actor.GetRelayoutSize( dimension ) > 0.0f;
 }
 
 #if defined(DEBUG_ENABLED)
@@ -671,29 +671,29 @@ void TableView::CalculateRowColumnData()
   }
 }
 
-void TableView::OnCalculateRelayoutSize( Dimension dimension )
+void TableView::OnCalculateRelayoutSize( Dimension::Type dimension )
 {
   CalculateRowColumnData();
 
-  if( dimension & WIDTH )
+  if( dimension & Dimension::WIDTH )
   {
-    CalculateFixedSizes( mColumnData, WIDTH );
+    CalculateFixedSizes( mColumnData, Dimension::WIDTH );
     mFixedTotals.width = CalculateTotalFixedSize( mColumnData );
   }
 
-  if( dimension & HEIGHT )
+  if( dimension & Dimension::HEIGHT )
   {
-    CalculateFixedSizes( mRowData, HEIGHT );
+    CalculateFixedSizes( mRowData, Dimension::HEIGHT );
     mFixedTotals.height = CalculateTotalFixedSize( mRowData );
   }
 }
 
-void TableView::OnLayoutNegotiated( float size, Dimension dimension )
+void TableView::OnLayoutNegotiated( float size, Dimension::Type dimension )
 {
   CalculateRowColumnData();
 
   // Calculate the value of all relative sized rows and columns
-  if( dimension & WIDTH )
+  if( dimension & Dimension::WIDTH )
   {
     float remainingSize = size - mFixedTotals.width;
     if( remainingSize < 0.0f )
@@ -704,7 +704,7 @@ void TableView::OnLayoutNegotiated( float size, Dimension dimension )
     CalculateRelativeSizes( mColumnData, remainingSize );
   }
 
-  if( dimension & HEIGHT )
+  if( dimension & Dimension::HEIGHT )
   {
     float remainingSize = size - mFixedTotals.height;
     if( remainingSize < 0.0f )
@@ -1234,7 +1234,7 @@ Vector3 TableView::GetNaturalSize()
   return Vector3( mFixedTotals.width, mFixedTotals.height, 1.0f );
 }
 
-float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
+float TableView::CalculateChildSize( const Actor& child, Dimension::Type dimension )
 {
   CalculateRowColumnData();
 
@@ -1258,7 +1258,7 @@ float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
         {
           switch( dimension )
           {
-            case WIDTH:
+            case Dimension::WIDTH:
             {
               float cellSize = 0.0f;
 
@@ -1279,7 +1279,7 @@ float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
               return cellSize;
             }
 
-            case HEIGHT:
+            case Dimension::HEIGHT:
             {
               float cellSize = 0.0f;
 
@@ -1313,7 +1313,7 @@ float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
   return 0.0f;    // Child not found
 }
 
-bool TableView::RelayoutDependentOnChildren( Dimension dimension )
+bool TableView::RelayoutDependentOnChildren( Dimension::Type dimension )
 {
   if ( Control::RelayoutDependentOnChildren( dimension ) )
   {
@@ -1416,8 +1416,31 @@ float TableView::CalculateTotalFixedSize( const RowColumnArray& data )
   return totalSize;
 }
 
-void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension dimension )
+Vector2 TableView::GetCellPadding( Dimension::Type dimension )
 {
+  switch( dimension )
+  {
+    case Dimension::WIDTH:
+    {
+      return Vector2( mPadding.x, mPadding.x );
+    }
+    case Dimension::HEIGHT:
+    {
+      return Vector2( mPadding.y, mPadding.y );
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return Vector2();
+}
+
+void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimension )
+{
+  Vector2 cellPadding = GetCellPadding( dimension );
+
   const unsigned int dataCount = data.Size();
 
   for( unsigned int i = 0; i < dataCount; ++i )
@@ -1429,12 +1452,12 @@ void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension dimension )
       // Find the size of the biggest actor in the row or column
       float maxActorHeight = 0.0f;
 
-      unsigned int fitCount = ( dimension == WIDTH ) ? mCellData.GetRows() : mCellData.GetColumns();
+      unsigned int fitCount = ( dimension == Dimension::WIDTH ) ? mCellData.GetRows() : mCellData.GetColumns();
 
       for( unsigned int j = 0; j < fitCount; ++j )
       {
-        unsigned int row = ( dimension == WIDTH ) ? j : i;
-        unsigned int column = ( dimension == WIDTH ) ? i : j;
+        unsigned int row = ( dimension == Dimension::WIDTH ) ? j : i;
+        unsigned int column = ( dimension == Dimension::WIDTH ) ? i : j;
         DALI_ASSERT_DEBUG( row < mCellData.GetRows() );
         DALI_ASSERT_DEBUG( column < mCellData.GetColumns() );
 
@@ -1443,7 +1466,7 @@ void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension dimension )
         {
           if( FitToChild( actor, dimension ) )
           {
-            maxActorHeight = std::max( maxActorHeight, actor.GetRelayoutSize( dimension ) );
+            maxActorHeight = std::max( maxActorHeight, actor.GetRelayoutSize( dimension ) + cellPadding.x + cellPadding.y );
           }
         }
       }
index 55a7d7b..be41e47 100644 (file)
@@ -251,7 +251,7 @@ private: // From Control
   /**
    * @copydoc Control::CalculateChildSize
    */
-  virtual float CalculateChildSize( const Actor& child, Dimension dimension );
+  virtual float CalculateChildSize( const Actor& child, Dimension::Type dimension );
 
   /**
    * @copydoc Control::OnInitialize()
@@ -271,17 +271,17 @@ private: // From Control
   /**
    * @copydoc Control::RelayoutDependentOnChildren()
    */
-  virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
+  virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
 
   /**
    * @copydoc Control::OnCalculateRelayoutSize
    */
-  virtual void OnCalculateRelayoutSize( Dimension dimension );
+  virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
 
   /**
    * @copydoc Control::OnLayoutNegotiated
    */
-  virtual void OnLayoutNegotiated( float size, Dimension dimension );
+  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
 
 private: // Implementation
 
@@ -404,9 +404,9 @@ private:
    * @brief Calculate the fixed sizes for a row or column
    *
    * @param[in] data The row or column data to process
-   * @param[in] dimension The dimension being calculated: row == HEIGHT, column == WIDTH
+   * @param[in] dimension The dimension being calculated: row == Dimension::HEIGHT, column == Dimension::WIDTH
    */
-  void CalculateFixedSizes( RowColumnArray& data, Dimension dimension );
+  void CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimension );
 
   /**
    * @brief Calculate the value of the relative sizes
@@ -430,6 +430,14 @@ private:
   void CalculateRowColumnData();
 
   /**
+   * @brief Return the cell padding for a given dimension
+   *
+   * @param[in] dimension The dimension to return the padding for
+   * @return Return the padding (x = low, y = high)
+   */
+  Vector2 GetCellPadding( Dimension::Type dimension );
+
+  /**
    * A reference counted object may only be deleted by calling Unreference()
    */
   virtual ~TableView();
index f189207..f17ea34 100644 (file)
@@ -426,8 +426,8 @@ void TextField::OnInitialize()
   }
 
   // Fill-parent area by default
-  self.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-  self.SetResizePolicy( FILL_TO_PARENT, HEIGHT );
+  self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+  self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
 }
 
 void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
index 60ca46e..afe74e2 100644 (file)
@@ -88,6 +88,7 @@ DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-offset",        VECTOR2, SHADOW_O
 DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-color",         VECTOR4, SHADOW_COLOR         )
 DALI_PROPERTY_REGISTRATION( TextLabel, "underline-enabled",    BOOLEAN, UNDERLINE_ENABLED    )
 DALI_PROPERTY_REGISTRATION( TextLabel, "underline-color",      VECTOR4, UNDERLINE_COLOR      )
+DALI_PROPERTY_REGISTRATION( TextLabel, "underline-height",     FLOAT,   UNDERLINE_HEIGHT       )
 DALI_TYPE_REGISTRATION_END()
 
 } // namespace
@@ -289,6 +290,20 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
         }
         break;
       }
+
+      case Toolkit::TextLabel::Property::UNDERLINE_HEIGHT:
+      {
+        if( impl.mController )
+        {
+          float height = value.Get< float >();
+          if ( impl.mController->GetUnderlineHeight() != height )
+          {
+            impl.mController->SetUnderlineHeight( height );
+            impl.RequestTextRelayout();
+          }
+        }
+        break;
+      }
     }
   }
 }
@@ -387,6 +402,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
         }
         break;
       }
+      case Toolkit::TextLabel::Property::UNDERLINE_HEIGHT:
+      {
+        if ( impl.mController )
+        {
+          value = impl.mController->GetUnderlineHeight();
+        }
+        break;
+      }
     }
   }
 
@@ -400,8 +423,8 @@ void TextLabel::OnInitialize()
   mController = Text::Controller::New( *this );
 
   // Use height-for-width negotiation by default
-  self.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-  self.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+  self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+  self.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 }
 
 void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
index 6db6845..01ede36 100644 (file)
@@ -439,23 +439,19 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part )
    // Both containers will be added to a button.
    Actor optionContainer = Actor::New();
    optionContainer.SetRelayoutEnabled( true );
-   optionContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    optionContainer.SetDrawMode( DrawMode::OVERLAY );
    optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 
    ImageActor optionPressedContainer = Toolkit::CreateSolidColorActor( mBackgroundPressedColor );
-   optionPressedContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
    optionPressedContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 
    // 2. Add text.
    Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New();
-   captionTextLabel.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
    // optionContainer.Add( captionTextLabel ); Temporary removed.
 
    Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
-   pressedCaptionTextLabel.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
    // optionPressedContainer.Add( pressedCaptionTextLabel ); Temporary removed.
 
@@ -518,7 +514,6 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part )
 
    // 5. Create a option.
    Toolkit::PushButton option = Toolkit::PushButton::New();
-   option.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    option.SetSize( optionSize );
    option.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    option.SetX( mContentSize.width );
@@ -544,7 +539,6 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part )
      const Size size( POPUP_DIVIDER_WIDTH, mContentSize.height );
 
      ImageActor divider =  Toolkit::CreateSolidColorActor( Color::WHITE );
-     divider.SetResizePolicy( FIXED, ALL_DIMENSIONS );
      divider.SetSize( size );
      divider.SetParentOrigin( ParentOrigin::TOP_LEFT );
      divider.SetAnchorPoint( AnchorPoint::TOP_LEFT );
@@ -565,15 +559,13 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part )
    Actor scrollview = Actor::New(); //todo make a scrollview
    stencil.SetRelayoutEnabled( true );
 
-   self.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    self.SetSize( mRequiredPopUpSize ); // control matches stencil size
 
-   mStencilLayer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
    mStencilLayer.SetSize( size ); // matches stencil size
 
-   stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
-   scrollview.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
-   mButtons.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+   stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+   scrollview.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+   mButtons.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
    mStencilLayer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
    scrollview.SetAnchorPoint(AnchorPoint::TOP_LEFT);
index 274ca56..0bcfe26 100644 (file)
@@ -125,9 +125,9 @@ void ToolBar::AddControl( Actor control, float relativeSize, Toolkit::Alignment:
 
   // Create an alignment container where to place the control.
   Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( alignment );
-  alignmentContainer.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
+  alignmentContainer.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
   alignmentContainer.SetPadding( padding );
-  alignmentContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  alignmentContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   alignmentContainer.Add( control );
 
   // Insert the control in the table view.
@@ -322,7 +322,7 @@ void ToolBar::OnInitialize()
   // Layout
   mLayout = Toolkit::TableView::New( 1, 1 );
   mLayout.SetName( "TOOLBAR_LAYOUT" );
-  mLayout.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  mLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mLayout.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
   Self().Add( mLayout );
index 24229f3..19dd781 100644 (file)
@@ -19,6 +19,7 @@
 #include "view-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/type-registry.h>
@@ -132,7 +133,7 @@ void View::SetBackground( ImageActor backgroundImage )
     mBackgroundLayer = Layer::New();
 
     mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
-    mBackgroundLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mBackgroundLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     // Add background layer to custom actor.
     Self().Add( mBackgroundLayer );
@@ -152,8 +153,8 @@ void View::SetBackground( ImageActor backgroundImage )
   }
 
   backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
-  backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
-  backgroundImage.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO );
+  backgroundImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  backgroundImage.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
   mBackgroundLayer.Add( backgroundImage );
 
   RelayoutRequest();
index 5a3a611..b1f3c14 100644 (file)
@@ -19,6 +19,7 @@
 #include "focus-manager-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/adaptor-framework/accessibility-manager.h>
 #include <dali/public-api/adaptor-framework/sound-player.h>
@@ -674,7 +675,7 @@ void FocusManager::CreateDefaultFocusIndicatorActor()
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
-  focusIndicator.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   SetFocusIndicatorActor(focusIndicator);
 }
index 038f99c..5b0bcb5 100644 (file)
@@ -19,6 +19,7 @@
 #include "keyboard-focus-manager-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/adaptor-framework/accessibility-manager.h>
 #include <dali/public-api/adaptor-framework/singleton-service.h>
@@ -477,7 +478,7 @@ void KeyboardFocusManager::CreateDefaultFocusIndicatorActor()
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
-  focusIndicator.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+  focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   SetFocusIndicatorActor(focusIndicator);
 }
index 5d7d4be..9fee428 100644 (file)
@@ -19,6 +19,7 @@
 #include "keyinput-focus-manager-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
 
index c8da542..7a62498 100644 (file)
@@ -38,7 +38,7 @@ namespace Toolkit
  *
  * @return The number of characters.
  */
-DALI_IMPORT_API uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length );
+uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length );
 
 /**
  * @brief Retrieves the number of bytes needed to encode in UTF8 the given text array encoded in UTF32.
@@ -48,7 +48,7 @@ DALI_IMPORT_API uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, u
  *
  * @return The number of bytes.
  */
-DALI_IMPORT_API uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters );
+uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters );
 
 /**
  * @brief Converts a text array encoded in UTF8 into a text array encoded in UTF32.
@@ -61,7 +61,7 @@ DALI_IMPORT_API uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint
  *
  * @return The number of characters.
  */
-DALI_IMPORT_API uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 );
+uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 );
 
 /**
  * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
@@ -74,7 +74,7 @@ DALI_IMPORT_API uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length
  *
  * @return The number of bytes.
  */
-DALI_IMPORT_API uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 );
+uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 );
 
 } // namespace Toolkit
 
index d834e48..67ae642 100644 (file)
@@ -345,7 +345,7 @@ struct Decorator::Impl : public ConnectionTracker
 #endif
 
       mActiveLayer.SetParentOrigin( ParentOrigin::CENTER );
-      mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+      mActiveLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
       mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
 
       parent.Add( mActiveLayer );
@@ -379,7 +379,7 @@ struct Decorator::Impl : public ConnectionTracker
 #endif
       mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
       mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
-      mGrabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
+      mGrabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
       mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
       mGrabHandle.Add( mGrabArea );
 
@@ -413,7 +413,7 @@ struct Decorator::Impl : public ConnectionTracker
 #ifdef DECORATOR_DEBUG
       primary.grabArea.SetName("SelectionHandleOneGrabArea");
 #endif
-      primary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
+      primary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
       primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
       primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
@@ -446,7 +446,7 @@ struct Decorator::Impl : public ConnectionTracker
 #ifdef DECORATOR_DEBUG
       secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
 #endif
-      secondary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
+      secondary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
       secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
       secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
index 1a97dd4..e165103 100644 (file)
@@ -40,6 +40,7 @@ namespace
 {
 
 const float MAX_FLOAT = std::numeric_limits<float>::max();
+const bool RTL = true;
 
 } //namespace
 
@@ -48,12 +49,40 @@ const float MAX_FLOAT = std::numeric_limits<float>::max();
  */
 struct LineLayout
 {
+  LineLayout()
+  : glyphIndex( 0u ),
+    characterIndex( 0u ),
+    numberOfCharacters( 0u ),
+    numberOfGlyphs( 0u ),
+    length( 0.f ),
+    widthAdvanceDiff( 0.f ),
+    wsLengthEndOfLine( 0.f ),
+    ascender( 0.f ),
+    descender( MAX_FLOAT )
+  {}
+
+  ~LineLayout()
+  {}
+
+  void Clear()
+  {
+    glyphIndex = 0u;
+    characterIndex = 0u;
+    numberOfCharacters = 0u;
+    numberOfGlyphs = 0u;
+    length = 0.f;
+    widthAdvanceDiff = 0.f;
+    wsLengthEndOfLine = 0.f;
+    ascender = 0.f;
+    descender = MAX_FLOAT;
+  }
+
   GlyphIndex     glyphIndex;         ///< Index of the first glyph to be laid-out.
   CharacterIndex characterIndex;     ///< Index of the first character to be laid-out.
   Length         numberOfCharacters; ///< The number of characters which fit in one line.
   Length         numberOfGlyphs;     ///< The number of glyph which fit in one line.
   float          length;             ///< The length of the glyphs which fit in one line.
-  float          widthAdvanceDiff;   ///< The difference between the width and the advance of the last glyph.
+  float          widthAdvanceDiff;   ///< The difference between the xBearing + width and the advance of the last glyph.
   float          wsLengthEndOfLine;  ///< The length of the white spaces at the end of the line.
   float          ascender;           ///< The maximum ascender of all fonts in the line.
   float          descender;          ///< The minimum descender of all fonts in the line.
@@ -70,114 +99,118 @@ struct LayoutEngine::Impl
   }
 
   /**
-   * Retrieves the line layout for a given box width.
+   * @brief Updates the line ascender and descender with the metrics of a new font.
+   *
+   * @param[in] fontId The id of the new font.
+   * @param[in,out] lineLayout The line layout.
    */
-  void GetLineLayoutForBox( const LayoutParameters& parameters,
-                            LineLayout& lineLayout )
+  void UpdateLineHeight( FontId fontId, LineLayout& lineLayout )
   {
-    // Initializes the line layout.
-    lineLayout.numberOfCharacters = 0u;
-    lineLayout.numberOfGlyphs = 0u;
-    lineLayout.length = 0.f;
-    lineLayout.wsLengthEndOfLine = 0.f;
-    lineLayout.ascender = 0.f;
-    lineLayout.descender = MAX_FLOAT;
-
-    // Get the last glyph index.
-    const GlyphIndex lastGlyphIndex = parameters.totalNumberOfGlyphs - 1u;
+    Text::FontMetrics fontMetrics;
+    mFontClient.GetFontMetrics( fontId, fontMetrics );
 
-    FontId lastFontId = 0u;
-    for( GlyphIndex glyphIndex = lineLayout.glyphIndex;
-         glyphIndex < parameters.totalNumberOfGlyphs;
-         ++glyphIndex )
+    // Sets the maximum ascender.
+    if( fontMetrics.ascender > lineLayout.ascender )
     {
-      // Get the glyph info.
-      const GlyphInfo& glyphInfo = *( parameters.glyphsBuffer + glyphIndex );
-
-      // Check whether is a white space.
-      const Character character = *( parameters.textBuffer + lineLayout.numberOfCharacters );
-      const bool isWhiteSpace = TextAbstraction::IsWhiteSpace( character );
-
-      // Get the character indices for the current glyph. The last character index is needed
-      // because there are glyphs formed by more than one character but their break info is
-      // given only for the last character.
-      const Length charactersPerGlyph = *( parameters.charactersPerGlyphBuffer + glyphIndex );
-
-      // Increase the number of characters.
-      lineLayout.numberOfCharacters += charactersPerGlyph;
-
-      // Increase the number of glyphs.
-      lineLayout.numberOfGlyphs++;
-
-      // Increase the accumulated length.
-      const float glyphLength = ( glyphIndex == lastGlyphIndex ) ? glyphInfo.width : glyphInfo.advance;
+      lineLayout.ascender = fontMetrics.ascender;
+    }
 
-      if( isWhiteSpace )
-      {
-        // Add the length to the length of white spaces at the end of the line.
-        lineLayout.wsLengthEndOfLine += glyphLength;
-      }
-      else
-      {
-        // Add as well any previous white space length.
-        lineLayout.length += lineLayout.wsLengthEndOfLine + glyphLength;
+    // Sets the minimum descender.
+    if( fontMetrics.descender < lineLayout.descender )
+    {
+      lineLayout.descender = fontMetrics.descender;
+    }
+  }
 
-        // Clear the white space length at the end of the line.
-        lineLayout.wsLengthEndOfLine = 0.f;
-      }
+  /**
+   * @brief Merges a temporary line layout into the line layout.
+   *
+   * @param[in,out] lineLayout The line layout.
+   * @param[in] tmpLineLayout A temporary line layout.
+   */
+  void MergeLineLayout( LineLayout& lineLayout,
+                        const LineLayout& tmpLineLayout )
+  {
+    lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
+    lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
+    lineLayout.length += tmpLineLayout.length;
 
-      if( lastFontId != glyphInfo.fontId )
-      {
-        Text::FontMetrics fontMetrics;
-        mFontClient.GetFontMetrics( glyphInfo.fontId, fontMetrics );
+    if( 0.f < tmpLineLayout.length )
+    {
+      lineLayout.length += lineLayout.wsLengthEndOfLine;
 
-        // Sets the maximum ascender.
-        if( fontMetrics.ascender > lineLayout.ascender )
-        {
-          lineLayout.ascender = fontMetrics.ascender;
-        }
+      lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
+      lineLayout.widthAdvanceDiff = tmpLineLayout.widthAdvanceDiff;
+    }
+    else
+    {
+      lineLayout.wsLengthEndOfLine += tmpLineLayout.wsLengthEndOfLine;
+    }
 
-        // Sets the minimum descender.
-        if( fontMetrics.descender < lineLayout.descender )
-        {
-          lineLayout.descender = fontMetrics.descender;
-        }
+    if( tmpLineLayout.ascender > lineLayout.ascender )
+    {
+      lineLayout.ascender = tmpLineLayout.ascender;
+    }
 
-        lastFontId = glyphInfo.fontId;
-      }
+    if( tmpLineLayout.descender < lineLayout.descender )
+    {
+      lineLayout.descender = tmpLineLayout.descender;
     }
   }
 
   /**
    * Retrieves the line layout for a given box width.
    */
-  void GetMultiLineLayoutForBox( const LayoutParameters& parameters,
-                                 LineLayout& lineLayout )
+  void GetLineLayoutForBox( const LayoutParameters& parameters,
+                            LineLayout& lineLayout )
   {
-    // Initializes the line layout.
-    lineLayout.numberOfCharacters = 0u;
-    lineLayout.numberOfGlyphs = 0u;
-    lineLayout.length = 0.f;
-    lineLayout.widthAdvanceDiff = 0.f;
-    lineLayout.wsLengthEndOfLine = 0.f;
-    lineLayout.ascender = 0.f;
-    lineLayout.descender = MAX_FLOAT;
-
     // Stores temporary line layout which has not been added to the final line layout.
     LineLayout tmpLineLayout;
-    tmpLineLayout.numberOfCharacters = 0u;
-    tmpLineLayout.numberOfGlyphs = 0u;
-    tmpLineLayout.length = 0.f;
-    tmpLineLayout.widthAdvanceDiff = 0.f;
-    tmpLineLayout.wsLengthEndOfLine = 0.f;
-    tmpLineLayout.ascender = 0.f;
-    tmpLineLayout.descender = MAX_FLOAT;
-
-    FontId lastFontId = 0u;
+
+    const bool isMultiline = mLayout == MULTI_LINE_BOX;
+    const GlyphIndex lastGlyphIndex = parameters.totalNumberOfGlyphs - 1u;
+
+    // If the first glyph has a negative bearing its absolute value needs to be added to the line length.
+    // In the case the line starts with a right to left character the bearing needs to be substracted to the line length.
+    const GlyphInfo& glyphInfo = *( parameters.glyphsBuffer + lineLayout.glyphIndex );
+    float initialHorizontalBearing = glyphInfo.xBearing;
+
+    lineLayout.characterIndex = *( parameters.glyphsToCharactersBuffer + lineLayout.glyphIndex );
+    const CharacterDirection firstCharacterDirection = ( NULL == parameters.characterDirectionBuffer ) ? false : *( parameters.characterDirectionBuffer + lineLayout.characterIndex );
+
+    if( RTL == firstCharacterDirection )
+    {
+      initialHorizontalBearing = -initialHorizontalBearing;
+
+      if( 0.f < glyphInfo.xBearing )
+      {
+        tmpLineLayout.length = glyphInfo.xBearing;
+        initialHorizontalBearing = 0.f;
+      }
+    }
+    else
+    {
+      if( 0.f > glyphInfo.xBearing )
+      {
+        tmpLineLayout.length = -glyphInfo.xBearing;
+        initialHorizontalBearing = 0.f;
+      }
+    }
+
+    // Calculate the line height if there is no characters.
+    FontId lastFontId = glyphInfo.fontId;
+    UpdateLineHeight( lastFontId, tmpLineLayout );
+
+    const float boundingBoxWidth = parameters.boundingBox.width - initialHorizontalBearing;
+
+    bool oneWordLaidOut = false;
+
     for( GlyphIndex glyphIndex = lineLayout.glyphIndex;
          glyphIndex < parameters.totalNumberOfGlyphs;
          ++glyphIndex )
     {
+      const bool isLastGlyph = glyphIndex == lastGlyphIndex;
+
       // Get the glyph info.
       const GlyphInfo& glyphInfo = *( parameters.glyphsBuffer + glyphIndex );
 
@@ -208,121 +241,62 @@ struct LayoutEngine::Impl
       if( isWhiteSpace )
       {
         // Add the length to the length of white spaces at the end of the line.
-        tmpLineLayout.wsLengthEndOfLine += glyphInfo.advance; // I use the advance as the width is always zero for the white spaces.
-        tmpLineLayout.widthAdvanceDiff = 0.f;
+        tmpLineLayout.wsLengthEndOfLine += glyphInfo.advance; // The advance is used as the width is always zero for the white spaces.
       }
       else
       {
         // Add as well any previous white space length.
         tmpLineLayout.length += tmpLineLayout.wsLengthEndOfLine + glyphInfo.advance;
-        tmpLineLayout.widthAdvanceDiff = glyphInfo.width - glyphInfo.advance;
+        if( RTL == firstCharacterDirection )
+        {
+          tmpLineLayout.widthAdvanceDiff = -glyphInfo.xBearing;
+        }
+        else
+        {
+          tmpLineLayout.widthAdvanceDiff = glyphInfo.xBearing + glyphInfo.width - glyphInfo.advance;
+        }
 
         // Clear the white space length at the end of the line.
         tmpLineLayout.wsLengthEndOfLine = 0.f;
       }
 
       // Check if the accumulated length fits in the width of the box.
-      if( lineLayout.length + tmpLineLayout.length + tmpLineLayout.widthAdvanceDiff + ( ( 0.f < tmpLineLayout.length ) ? lineLayout.wsLengthEndOfLine : 0.f ) > parameters.boundingBox.width )
+      if( isMultiline && oneWordLaidOut && !isWhiteSpace &&
+          ( lineLayout.length + lineLayout.wsLengthEndOfLine + tmpLineLayout.length + tmpLineLayout.widthAdvanceDiff > boundingBoxWidth ) )
       {
         // Current word does not fit in the box's width.
         return;
       }
 
-      if( TextAbstraction::LINE_MUST_BREAK == lineBreakInfo )
+      if( ( isMultiline || isLastGlyph ) &&
+          ( TextAbstraction::LINE_MUST_BREAK == lineBreakInfo ) )
       {
         // Must break the line. Update the line layout and return.
-        lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
-        lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
-        lineLayout.length += tmpLineLayout.length;
-        lineLayout.widthAdvanceDiff = tmpLineLayout.widthAdvanceDiff;
-
-        if( 0.f < tmpLineLayout.length )
-        {
-          lineLayout.length += lineLayout.wsLengthEndOfLine;
-
-          lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
-        }
-        else
-        {
-          lineLayout.wsLengthEndOfLine += tmpLineLayout.wsLengthEndOfLine;
-        }
-
-        if( tmpLineLayout.ascender > lineLayout.ascender )
-        {
-          lineLayout.ascender = tmpLineLayout.ascender;
-        }
+        MergeLineLayout( lineLayout, tmpLineLayout );
 
-        if( tmpLineLayout.descender < lineLayout.descender )
-        {
-          lineLayout.descender = tmpLineLayout.descender;
-        }
-
-        tmpLineLayout.numberOfCharacters = 0u;
-        tmpLineLayout.numberOfGlyphs = 0u;
-        tmpLineLayout.length = 0u;
-        tmpLineLayout.widthAdvanceDiff = 0u;
-        tmpLineLayout.wsLengthEndOfLine = 0u;
-        tmpLineLayout.ascender = 0.f;
-        tmpLineLayout.descender = MAX_FLOAT;
         return;
       }
 
-      if( TextAbstraction::WORD_BREAK == wordBreakInfo )
+      if( isMultiline &&
+          ( TextAbstraction::WORD_BREAK == wordBreakInfo ) )
       {
-        // Current glyph is the last one of the current word.
-        // Add the temporal layout to the current one.
-        lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
-        lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
-        lineLayout.length += tmpLineLayout.length;
-        lineLayout.widthAdvanceDiff = tmpLineLayout.widthAdvanceDiff;
-
-        if( 0.f < tmpLineLayout.length )
-        {
-          lineLayout.length += lineLayout.wsLengthEndOfLine;
-
-          lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
-        }
-        else
-        {
-          lineLayout.wsLengthEndOfLine += tmpLineLayout.wsLengthEndOfLine;
-        }
-
-        if( tmpLineLayout.ascender > lineLayout.ascender )
+        if( !oneWordLaidOut && !isWhiteSpace )
         {
-          lineLayout.ascender = tmpLineLayout.ascender;
+          oneWordLaidOut = true;
         }
 
-        if( tmpLineLayout.descender < lineLayout.descender )
-        {
-          lineLayout.descender = tmpLineLayout.descender;
-        }
+        // Current glyph is the last one of the current word.
+        // Add the temporal layout to the current one.
+        MergeLineLayout( lineLayout, tmpLineLayout );
 
-        tmpLineLayout.numberOfCharacters = 0u;
-        tmpLineLayout.numberOfGlyphs = 0u;
-        tmpLineLayout.length = 0u;
-        tmpLineLayout.widthAdvanceDiff = 0u;
-        tmpLineLayout.wsLengthEndOfLine = 0u;
-        tmpLineLayout.ascender = 0.f;
-        tmpLineLayout.descender = MAX_FLOAT;
+        tmpLineLayout.Clear();
       }
 
+      // Check if the font of the current glyph is the same of the previous one.
+      // If it's different the ascender and descender need to be updated.
       if( lastFontId != glyphInfo.fontId )
       {
-        Text::FontMetrics fontMetrics;
-        mFontClient.GetFontMetrics( glyphInfo.fontId, fontMetrics );
-
-        // Sets the maximum ascender.
-        if( fontMetrics.ascender > tmpLineLayout.ascender )
-        {
-          tmpLineLayout.ascender = fontMetrics.ascender;
-        }
-
-        // Sets the minimum descender.
-        if( -fontMetrics.descender < tmpLineLayout.descender )
-        {
-          tmpLineLayout.descender = fontMetrics.descender;
-        }
-
+        UpdateLineHeight( glyphInfo.fontId, tmpLineLayout );
         lastFontId = glyphInfo.fontId;
       }
     }
@@ -333,32 +307,77 @@ struct LayoutEngine::Impl
                    Vector<LineRun>& lines,
                    Size& actualSize )
   {
-    // TODO Switch between different layouts
-    bool update = false;
+    Vector2* glyphPositionsBuffer = glyphPositions.Begin();
 
-    switch( mLayout )
+    float penY = 0.f;
+    for( GlyphIndex index = 0u; index < layoutParameters.totalNumberOfGlyphs; )
     {
-      case LayoutEngine::SINGLE_LINE_BOX:
+      // Get the layout for the line.
+      LineLayout layout;
+      layout.glyphIndex = index;
+      GetLineLayoutForBox( layoutParameters,
+                           layout );
+
+      if( 0u == layout.numberOfGlyphs )
       {
-        update = SingleLineLayout( layoutParameters,
-                                   glyphPositions,
-                                   lines,
-                                   actualSize );
-        break;
+        // The width is too small and no characters are laid-out.
+        return false;
       }
-      case LayoutEngine::MULTI_LINE_BOX:
+
+      LineRun lineRun;
+      lineRun.glyphIndex = index;
+      lineRun.numberOfGlyphs = layout.numberOfGlyphs;
+      lineRun.characterRun.characterIndex = layout.characterIndex;
+      lineRun.characterRun.numberOfCharacters = layout.numberOfCharacters;
+      lineRun.width = layout.length + layout.widthAdvanceDiff;
+      lineRun.ascender = layout.ascender;
+      lineRun.descender = layout.descender;
+      lineRun.extraLength = layout.wsLengthEndOfLine > 0.f ? layout.wsLengthEndOfLine - layout.widthAdvanceDiff : 0.f;
+      lineRun.direction = false;
+
+      lines.PushBack( lineRun );
+
+      // Update the actual size.
+      if( lineRun.width > actualSize.width )
       {
-        update = MultiLineLayout( layoutParameters,
-                                  glyphPositions,
-                                  lines,
-                                  actualSize );
-        break;
+        actualSize.width = lineRun.width;
       }
-      default:
-        break;
+
+      actualSize.height += ( lineRun.ascender + -lineRun.descender );
+
+      // Traverse the glyphs and set the positions.
+
+      penY += layout.ascender;
+
+      // Check if the x bearing of the first character is negative.
+      // If it has a negative x bearing, it will exceed the boundaries of the actor,
+      // so the penX position needs to be moved to the right.
+      float penX = 0.f;
+
+      const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + index );
+      if( 0.f > glyph.xBearing )
+      {
+        penX = -glyph.xBearing;
+      }
+
+      for( GlyphIndex i = index; i < index + layout.numberOfGlyphs; ++i )
+      {
+        const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + i );
+        Vector2& position = *( glyphPositionsBuffer + i );
+
+        position.x = penX + glyph.xBearing;
+        position.y = penY - glyph.yBearing;
+
+        penX += glyph.advance;
+      }
+
+      penY += -layout.descender;
+
+      // Increase the glyph index.
+      index += layout.numberOfGlyphs;
     }
 
-    return update;
+    return true;
   }
 
   void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
@@ -371,6 +390,11 @@ struct LayoutEngine::Impl
 
       float penX = 0.f;
 
+      const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *bidiLine.visualToLogicalMap;
+      const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
+
+      penX = -glyph.xBearing;
+
       Vector2* glyphPositionsBuffer = glyphPositions.Begin();
 
       // Traverses the characters of the right to left paragraph.
@@ -462,125 +486,6 @@ struct LayoutEngine::Impl
     }
   }
 
-  bool SingleLineLayout( const LayoutParameters& layoutParameters,
-                         Vector<Vector2>& glyphPositions,
-                         Vector<LineRun>& lines,
-                         Size& actualSize )
-  {
-    LineLayout layout;
-    layout.glyphIndex = 0u;
-    GetLineLayoutForBox( layoutParameters,
-                         layout );
-
-    // Create a line run and add it to the lines.
-    const GlyphIndex lastGlyphIndex = layoutParameters.totalNumberOfGlyphs - 1u;
-
-    LineRun lineRun;
-    lineRun.glyphIndex = 0u;
-    lineRun.numberOfGlyphs = layoutParameters.totalNumberOfGlyphs;
-    lineRun.characterRun.characterIndex = 0u;
-    lineRun.characterRun.numberOfCharacters = *( layoutParameters.glyphsToCharactersBuffer + lastGlyphIndex ) + *( layoutParameters.charactersPerGlyphBuffer + lastGlyphIndex );
-    lineRun.width = layout.length;
-    lineRun.ascender = layout.ascender;
-    lineRun.descender = layout.descender;
-    lineRun.extraLength = layout.wsLengthEndOfLine;
-    lineRun.direction = false;
-
-    lines.PushBack( lineRun );
-
-    // Update the actual size.
-    actualSize.width = layout.length;
-    actualSize.height = lineRun.ascender + -lineRun.descender;
-
-    float penX = 0.f;
-    float penY = layout.ascender;
-
-    Vector2* glyphPositionsBuffer = glyphPositions.Begin();
-    for( GlyphIndex glyphIndex = 0u; glyphIndex < layout.numberOfGlyphs; ++glyphIndex )
-    {
-      const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + glyphIndex );
-      Vector2& position = *( glyphPositionsBuffer + glyphIndex );
-
-      position.x = penX + glyph.xBearing;
-      position.y = penY - glyph.yBearing;
-
-      penX += glyph.advance;
-    }
-
-    return true;
-  }
-
-  bool MultiLineLayout( const LayoutParameters& layoutParameters,
-                        Vector<Vector2>& glyphPositions,
-                        Vector<LineRun>& lines,
-                        Size& actualSize )
-  {
-    float penY = 0.f;
-    for( GlyphIndex index = 0u; index < layoutParameters.totalNumberOfGlyphs; )
-    {
-      float penX = 0.f;
-
-      // Get the layout for the line.
-      LineLayout layout;
-      layout.glyphIndex = index;
-      GetMultiLineLayoutForBox( layoutParameters,
-                                layout );
-
-      if( 0u == layout.numberOfGlyphs )
-      {
-        // The width is too small and no characters are laid-out.
-        return false;
-      }
-
-      // Create a line run and add it to the lines.
-      const GlyphIndex lastGlyphIndex = index + layout.numberOfGlyphs - 1u;
-
-      LineRun lineRun;
-      lineRun.glyphIndex = index;
-      lineRun.numberOfGlyphs = layout.numberOfGlyphs;
-      lineRun.characterRun.characterIndex = *( layoutParameters.glyphsToCharactersBuffer + index );
-      lineRun.characterRun.numberOfCharacters = ( *( layoutParameters.glyphsToCharactersBuffer + lastGlyphIndex ) + *( layoutParameters.charactersPerGlyphBuffer + lastGlyphIndex ) ) - lineRun.characterRun.characterIndex;
-      lineRun.width = layout.length + ( ( layout.widthAdvanceDiff > 0.f ) ? layout.widthAdvanceDiff : 0.f );
-      lineRun.ascender = layout.ascender;
-      lineRun.descender = layout.descender;
-      lineRun.extraLength = layout.wsLengthEndOfLine;
-      lineRun.direction = false;
-
-      lines.PushBack( lineRun );
-
-      // Update the actual size.
-      if( layout.length + layout.widthAdvanceDiff > actualSize.width )
-      {
-        actualSize.width = layout.length;
-      }
-
-      actualSize.height += ( lineRun.ascender + -lineRun.descender );
-
-      // Traverse the glyphs and set the positions.
-
-      penY += layout.ascender;
-
-      Vector2* glyphPositionsBuffer = glyphPositions.Begin();
-      for( GlyphIndex i = index; i < index + layout.numberOfGlyphs; ++i )
-      {
-        const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + i );
-        Vector2& position = *( glyphPositionsBuffer + i );
-
-        position.x = penX + glyph.xBearing;
-        position.y = penY - glyph.yBearing;
-
-        penX += glyph.advance;
-      }
-
-      penY += -layout.descender;
-
-      // Increase the glyph index.
-      index += layout.numberOfGlyphs;
-    }
-
-    return true;
-  }
-
   float CalculateHorizontalAlignment( float boxWidth,
                                       float lineLength,
                                       float extraLength,
index a370c02..8a49a91 100644 (file)
@@ -56,6 +56,7 @@ struct LayoutParameters
                     const Character* const textBuffer,
                     const LineBreakInfo* const lineBreakInfoBuffer,
                     const WordBreakInfo* const wordBreakInfoBuffer,
+                    const CharacterDirection* const characterDirectionBuffer,
                     Length totalNumberOfGlyphs,
                     const GlyphInfo* const glyphsBuffer,
                     const CharacterIndex* const glyphsToCharactersBuffer,
@@ -64,6 +65,7 @@ struct LayoutParameters
     textBuffer( textBuffer ),
     lineBreakInfoBuffer( lineBreakInfoBuffer ),
     wordBreakInfoBuffer( wordBreakInfoBuffer ),
+    characterDirectionBuffer( characterDirectionBuffer ),
     totalNumberOfGlyphs( totalNumberOfGlyphs ),
     glyphsBuffer( glyphsBuffer ),
     glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
@@ -74,18 +76,19 @@ struct LayoutParameters
     numberOfBidirectionalInfoRuns( 0u )
   {}
 
-  Vector2                     boundingBox;
-  const Character* const      textBuffer;
-  const LineBreakInfo* const  lineBreakInfoBuffer;
-  const WordBreakInfo* const  wordBreakInfoBuffer;
-  Length                      totalNumberOfGlyphs;
-  const GlyphInfo* const      glyphsBuffer;
-  const CharacterIndex* const glyphsToCharactersBuffer;
-  const Length* const         charactersPerGlyphBuffer;
-  GlyphIndex*                 charactersToGlyphsBuffer;        ///< The character to glyph conversion table.
-  Length*                     glyphsPerCharacterBuffer;        ///< The number of glyphs per character.
-  BidirectionalLineInfoRun*   lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
-  Length                      numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
+  Vector2                         boundingBox;
+  const Character* const          textBuffer;
+  const LineBreakInfo* const      lineBreakInfoBuffer;
+  const WordBreakInfo* const      wordBreakInfoBuffer;
+  const CharacterDirection* const characterDirectionBuffer;
+  Length                          totalNumberOfGlyphs;
+  const GlyphInfo* const          glyphsBuffer;
+  const CharacterIndex* const     glyphsToCharactersBuffer;
+  const Length* const             charactersPerGlyphBuffer;
+  GlyphIndex*                     charactersToGlyphsBuffer;        ///< The character to glyph conversion table.
+  Length*                         glyphsPerCharacterBuffer;        ///< The number of glyphs per character.
+  BidirectionalLineInfoRun*       lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
+  Length                          numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
 };
 
 } // namespace Text
index cbfa754..6a10947 100644 (file)
@@ -34,7 +34,7 @@ class AtlasGlyphManager;
 }
 
 
-class DALI_IMPORT_API AtlasGlyphManager : public BaseHandle
+class AtlasGlyphManager : public BaseHandle
 {
 public:
 
index fda82f4..b06d4e6 100644 (file)
@@ -41,6 +41,10 @@ namespace
   const Vector2 DEFAULT_ATLAS_SIZE( 512.0f, 512.0f );
   const Vector2 DEFAULT_BLOCK_SIZE( 16.0f, 16.0f );
   const Vector2 PADDING( 4.0f, 4.0f ); // Allow for variation in font glyphs
+  const float ZERO( 0.0f );
+  const float HALF( 0.5f );
+  const float ONE( 1.0f );
+  const float TWO( 2.0f );
 }
 
 struct AtlasRenderer::Impl : public ConnectionTracker
@@ -102,19 +106,21 @@ struct AtlasRenderer::Impl : public ConnectionTracker
                   const Vector4& textColor,
                   const Vector2& shadowOffset,
                   const Vector4& shadowColor,
-                  float underlineEnabled,
-                  const Vector4& underlineColor )
+                  bool underlineEnabled,
+                  const Vector4& underlineColor,
+                  float underlineHeight )
   {
     AtlasManager::AtlasSlot slot;
     std::vector< MeshRecord > meshContainer;
     Vector< Extent > extents;
 
-    float currentUnderlinePosition = 0.0f;
-    float currentUnderlineThickness = 0.0f;
+    float currentUnderlinePosition = ZERO;
+    float currentUnderlineThickness = underlineHeight;
+
     FontId lastFontId = 0;
     Style style = STYLE_NORMAL;
 
-    if ( shadowOffset.x != 0.0f || shadowOffset.y != 0.0f )
+    if ( fabsf( shadowOffset.x ) > Math::MACHINE_EPSILON_1 || fabsf( shadowOffset.y ) > Math::MACHINE_EPSILON_1 )
     {
       style = STYLE_DROP_SHADOW;
     }
@@ -140,13 +146,33 @@ struct AtlasRenderer::Impl : public ConnectionTracker
           // We need to fetch fresh font underline metrics
           FontMetrics fontMetrics;
           mFontClient.GetFontMetrics( glyph.fontId, fontMetrics );
-          currentUnderlinePosition = fontMetrics.underlinePosition;
-          currentUnderlineThickness = fontMetrics.underlineThickness;
+          currentUnderlinePosition = ceil( fabsf( fontMetrics.underlinePosition ) );
+          float descender = ceil( fabsf( fontMetrics.descender ) );
+
+          if ( underlineHeight == ZERO )
+          {
+            currentUnderlineThickness = fontMetrics.underlineThickness;
+
+            // Ensure underline will be at least a pixel high
+            if ( currentUnderlineThickness < ONE )
+            {
+              currentUnderlineThickness = ONE;
+            }
+            else
+            {
+              currentUnderlineThickness = ceil( currentUnderlineThickness );
+            }
+          }
 
-          // Ensure that an underline is at least 1 pixel high
-          if ( currentUnderlineThickness < 1.0f )
+          // Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
+          if ( currentUnderlinePosition > descender )
           {
-            currentUnderlineThickness = 1.0f;
+            currentUnderlinePosition = descender;
+          }
+          if ( ZERO == currentUnderlinePosition )
+          {
+            // Move offset down by one ( EFL behavior )
+            currentUnderlinePosition = ONE;
           }
         }
 
@@ -289,14 +315,13 @@ struct AtlasRenderer::Impl : public ConnectionTracker
       uint32_t index = 0;
       for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(); mIt != meshContainer.end(); ++mIt, ++index )
       {
-        if ( slot.mAtlasId == mIt->mAtlasId )
+        if ( slot.mAtlasId == mIt->mAtlasId && color == mIt->mColor )
         {
           // Stitch the mesh to the existing mesh and adjust any extents
           mGlyphManager.StitchMesh( mIt->mMeshData, newMeshData );
           AdjustExtents( extents,
                          meshContainer,
                          index,
-                         color,
                          left,
                          right,
                          baseLine,
@@ -318,7 +343,6 @@ struct AtlasRenderer::Impl : public ConnectionTracker
       AdjustExtents( extents,
                      meshContainer,
                      meshContainer.size() - 1u,
-                     color,
                      left,
                      right,
                      baseLine,
@@ -331,7 +355,6 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   void AdjustExtents( Vector< Extent >& extents,
                       std::vector< MeshRecord>& meshRecords,
                       uint32_t index,
-                      const Vector4& color,
                       float left,
                       float right,
                       float baseLine,
@@ -343,21 +366,17 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     {
       if ( Equals( baseLine, eIt->mBaseLine ) )
       {
-        // If we've found an extent with the same color then we don't need to create a new extent
-        if ( color == meshRecords[ index ].mColor )
+        foundExtent = true;
+        if ( left < eIt->mLeft )
         {
-          foundExtent = true;
-          if ( left < eIt->mLeft )
-          {
-            eIt->mLeft = left;
-          }
-          if ( right > eIt->mRight  )
-          {
-            eIt->mRight = right;
-          }
+          eIt->mLeft = left;
         }
-        // Font metrics use negative values for lower underline positions
-        if ( underlinePosition < eIt->mUnderlinePosition )
+        if ( right > eIt->mRight  )
+        {
+          eIt->mRight = right;
+        }
+
+        if ( underlinePosition > eIt->mUnderlinePosition )
         {
           eIt->mUnderlinePosition = underlinePosition;
         }
@@ -437,9 +456,6 @@ struct AtlasRenderer::Impl : public ConnectionTracker
                            const Vector4& textColor )
   {
     MeshData newMeshData;
-    const float zero = 0.0f;
-    const float half = 0.5f;
-
     for ( Vector< Extent >::ConstIterator eIt = extents.Begin(); eIt != extents.End(); ++eIt )
     {
       MeshData::VertexContainer newVerts;
@@ -448,28 +464,28 @@ struct AtlasRenderer::Impl : public ConnectionTracker
       Vector2 uv = mGlyphManager.GetAtlasSize( meshRecords[ index ].mAtlasId );
 
       // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
-      float u = half / uv.x;
-      float v = half / uv.y;
+      float u = HALF / uv.x;
+      float v = HALF / uv.y;
       float thickness = eIt->mUnderlineThickness;
-      float baseLine = eIt->mBaseLine - eIt->mUnderlinePosition - ( thickness * 0.5f );
+      float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - ( thickness * HALF );
       float tlx = eIt->mLeft;
       float brx = eIt->mRight;
 
-      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine, zero ),
-                                            Vector2( zero, zero ),
-                                            Vector3( zero, zero, zero ) ) );
+      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine, ZERO ),
+                                            Vector2::ZERO,
+                                            Vector3::ZERO ) );
 
-      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine, zero ),
-                                            Vector2( u, zero ),
-                                            Vector3( zero, zero, zero ) ) );
+      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine, ZERO ),
+                                            Vector2( u, ZERO ),
+                                            Vector3::ZERO ) );
 
-      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine + thickness, zero ),
-                                            Vector2( zero, v ),
-                                            Vector3( zero, zero, zero ) ) );
+      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine + thickness, ZERO ),
+                                            Vector2( ZERO, v ),
+                                            Vector3::ZERO ) );
 
-      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine + thickness, zero ),
+      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine + thickness, ZERO ),
                                             Vector2( u, v ),
-                                            Vector3( zero, zero, zero ) ) );
+                                            Vector3::ZERO ) );
 
       newMeshData.SetVertices( newVerts );
       newMeshData.SetFaceIndices( mFace );
@@ -500,12 +516,10 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   {
     // Scan vertex buffer to determine width and height of effect buffer needed
     MeshData::VertexContainer verts = meshRecord.mMeshData.GetVertices();
-    const float one = 1.0f;
-    const float zero = 0.0f;
     float tlx = verts[ 0 ].x;
     float tly = verts[ 0 ].y;
-    float brx = zero;
-    float bry = zero;
+    float brx = ZERO;
+    float bry = ZERO;
 
     for ( uint32_t i = 0; i < verts.size(); ++i )
     {
@@ -529,8 +543,8 @@ struct AtlasRenderer::Impl : public ConnectionTracker
 
     float width = brx - tlx;
     float height = bry - tly;
-    float divWidth = 2.0f / width;
-    float divHeight = 2.0f / height;
+    float divWidth = TWO / width;
+    float divHeight = TWO / height;
 
     // Create a buffer to render to
     meshRecord.mBuffer = FrameBufferImage::New( width, height );
@@ -539,21 +553,21 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     MeshData::VertexContainer vertices;
     MeshData::FaceIndices face;
 
-    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, tly + shadowOffset.y, zero ),
-                                          Vector2( zero, zero ),
-                                          Vector3( zero, zero, zero ) ) );
+    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
+                                          Vector2::ZERO,
+                                          Vector3::ZERO ) );
 
-    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, tly + shadowOffset.y, zero ),
-                                          Vector2( one, zero ),
-                                          Vector3( zero, zero, zero ) ) );
+    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
+                                          Vector2( ONE, ZERO ),
+                                          Vector3::ZERO ) );
 
-    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, bry + shadowOffset.y, zero ),
-                                          Vector2( zero, one ),
-                                          Vector3( zero, zero, zero ) ) );
+    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
+                                          Vector2( ZERO, ONE ),
+                                          Vector3::ZERO ) );
 
-    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, bry + shadowOffset.y, zero ),
-                                          Vector2( one, one ),
-                                          Vector3( zero, zero, zero ) ) );
+    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
+                                          Vector2::ONE,
+                                          Vector3::ZERO ) );
 
     MeshData meshData;
     Material newMaterial = Material::New("effect buffer");
@@ -578,8 +592,8 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     for ( uint32_t i = 0; i < verts.size(); ++i )
     {
       MeshData::Vertex vertex = verts[ i ];
-      vertex.x = ( ( vertex.x - tlx ) * divWidth ) - one;
-      vertex.y = ( ( vertex.y - tly ) * divHeight ) - one;
+      vertex.x = ( ( vertex.x - tlx ) * divWidth ) - ONE;
+      vertex.y = ( ( vertex.y - tly ) * divHeight ) - ONE;
       newVerts.push_back( vertex );
     }
 
@@ -676,7 +690,8 @@ RenderableActor AtlasRenderer::Render( Text::ViewInterface& view )
                       view.GetShadowOffset(),
                       view.GetShadowColor(),
                       view.IsUnderlineEnabled(),
-                      view.GetUnderlineColor() );
+                      view.GetUnderlineColor(),
+                      view.GetUnderlineHeight() );
   }
   return mImpl->mActor;
 }
index df7bfa2..42eacff 100644 (file)
@@ -41,7 +41,7 @@ class Backend;
 /**
  * @brief Provides access to different text rendering backends.
  */
-class DALI_IMPORT_API Backend : public BaseHandle
+class Backend : public BaseHandle
 {
 public:
 
index 2a3631f..705b44b 100644 (file)
@@ -989,6 +989,7 @@ struct Controller::Impl
     mVisualModel->SetShadowOffset( Vector2::ZERO );
     mVisualModel->SetShadowColor( Vector4::ZERO );
     mVisualModel->SetUnderlineEnabled( false );
+    mVisualModel->SetUnderlineHeight( 0.0f );
   }
 
   ~Impl()
@@ -1212,6 +1213,11 @@ bool Controller::IsUnderlineEnabled() const
   return mImpl->mVisualModel->IsUnderlineEnabled();
 }
 
+float Controller::GetUnderlineHeight() const
+{
+  return mImpl->mVisualModel->GetUnderlineHeight();
+}
+
 void Controller::SetTextColor( const Vector4& textColor )
 {
   mImpl->mVisualModel->SetTextColor( textColor );
@@ -1237,6 +1243,11 @@ void Controller::SetUnderlineEnabled( bool enabled )
   mImpl->mVisualModel->SetUnderlineEnabled( enabled );
 }
 
+void Controller::SetUnderlineHeight( float height )
+{
+  mImpl->mVisualModel->SetUnderlineHeight( height );
+}
+
 void Controller::EnableTextInput( DecoratorPtr decorator )
 {
   if( !mImpl->mTextInput )
@@ -1804,6 +1815,7 @@ bool Controller::DoRelayout( const Size& size,
 
     Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
     Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
+    Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
     Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
     Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
     Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
@@ -1813,6 +1825,7 @@ bool Controller::DoRelayout( const Size& size,
                                        mImpl->mLogicalModel->mText.Begin(),
                                        lineBreakInfo.Begin(),
                                        wordBreakInfo.Begin(),
+                                       ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
                                        numberOfGlyphs,
                                        glyphs.Begin(),
                                        glyphsToCharactersMap.Begin(),
index 0234e7c..a5dd91b 100644 (file)
@@ -243,6 +243,20 @@ public:
   bool IsUnderlineEnabled() const;
 
   /**
+   * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
+   *
+   * @param[in] height The height in pixels of the underline
+   */
+  void SetUnderlineHeight( float height );
+
+  /**
+   * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
+   *
+   * @return The height of the underline, or 0 if height is not overrided.
+   */
+  float GetUnderlineHeight() const;
+
+  /**
    * @brief Called to enable text input.
    *
    * @note Only selectable or editable controls should calls this.
index 116ad50..68d5e97 100644 (file)
@@ -117,12 +117,19 @@ public:
   virtual const Vector4& GetUnderlineColor() const = 0;
 
   /**
-   * @brief Returns whether is underline is enabled or not.
+   * @brief Returns whether underline is enabled or not.
    *
    * @return The underline state.
    */
   virtual bool IsUnderlineEnabled() const = 0;
 
+  /**
+   * @brief Retrieves the underline height override
+   *
+   * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
+   */
+  virtual float GetUnderlineHeight() const = 0;
+
 };
 
 } // namespace Text
index b0825f6..61073fe 100644 (file)
@@ -101,6 +101,16 @@ bool View::IsUnderlineEnabled() const
   return false;
 }
 
+float View::GetUnderlineHeight() const
+{
+  if ( mImpl->mVisualModel )
+  {
+    VisualModel& model = *mImpl->mVisualModel;
+    return model.GetUnderlineHeight();
+  }
+  return 0.0f;
+}
+
 Length View::GetNumberOfGlyphs() const
 {
   if( mImpl->mVisualModel )
index b9bd7fc..e611c3c 100644 (file)
@@ -101,6 +101,11 @@ public:
    */
   virtual bool IsUnderlineEnabled() const;
 
+  /**
+   * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
+   */
+  virtual float GetUnderlineHeight() const;
+
 private:
 
   // Undefined
index c070179..922f309 100644 (file)
@@ -441,6 +441,11 @@ void VisualModel::SetUnderlineEnabled( bool enabled )
   mUnderlineEnabled = enabled;
 }
 
+void VisualModel::SetUnderlineHeight( float height )
+{
+  mUnderlineHeight = height;
+}
+
 const Vector4& VisualModel::GetTextColor() const
 {
   return mTextColor;
@@ -466,6 +471,11 @@ bool VisualModel::IsUnderlineEnabled() const
   return mUnderlineEnabled;
 }
 
+float VisualModel::GetUnderlineHeight() const
+{
+  return mUnderlineHeight;
+}
+
 void VisualModel::ClearCaches()
 {
   mCachedLineIndex = 0u;
@@ -487,6 +497,7 @@ VisualModel::VisualModel()
   mShadowColor(),
   mUnderlineColor(),
   mShadowOffset(),
+  mUnderlineHeight( 0.0f ),
   mNaturalSize(),
   mActualSize(),
   mCachedLineIndex( 0u ),
index aa8a75f..fb9f7bc 100644 (file)
@@ -477,6 +477,20 @@ public:
    */
   void ClearCaches();
 
+  /**
+   * @brief Set the override used for underline height, 0 indicates height will be come from font metrics
+   *
+   * @param[in] height The height in pixels of the underline
+   */
+  void SetUnderlineHeight( float height );
+
+  /**
+   * @brief Retrieves the underline height override
+   *
+   * @return Returns the override height for an underline, 0 indicates that font metrics will determine the height
+   */
+  float GetUnderlineHeight() const;
+
 protected:
 
   /**
@@ -511,6 +525,9 @@ public:
   Vector4                mShadowColor;          ///< Color of drop shadow
   Vector4                mUnderlineColor;       ///< Color of underline
   Vector2                mShadowOffset;         ///< Offset for drop shadow, 0 indicates no shadow
+  float                  mUnderlineHeight;      ///< Fixed height for underline to override font metrics.
+
+
 
 private:
 
@@ -521,8 +538,10 @@ private:
   LineIndex mCachedLineIndex; ///< Used to increase performance in consecutive calls to GetLineOfGlyph() or GetLineOfCharacter() with consecutive glyphs or characters.
 
 public:
+
   bool                   mUnderlineEnabled:1;   ///< Underline enabled flag
   bool                   mUnderlineColorSet:1;  ///< Has the underline color been explicitly set?
+
 };
 
 } // namespace Text
index 1a58f8d..888322a 100644 (file)
@@ -19,6 +19,7 @@
 #include "cube-transition-effect-impl.h"
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/object/type-registry.h>
index f128778..d9e395e 100644 (file)
@@ -77,7 +77,7 @@ PushButton PushButton::DownCast( BaseHandle handle )
 void PushButton::SetButtonImage( Image image )
 {
   Actor imageActor = ImageActor::New( image );
-  imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
   Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor );
 }
 
@@ -94,7 +94,7 @@ Actor PushButton::GetButtonImage() const
 void PushButton::SetBackgroundImage( Image image )
 {
   Actor imageActor = ImageActor::New( image );
-  imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
   Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( imageActor );
 }
 
@@ -111,7 +111,7 @@ Actor PushButton::GetBackgroundImage() const
 void PushButton::SetSelectedImage( Image image )
 {
   Actor imageActor = ImageActor::New( image );
-  imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
   Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor );
 }
 
@@ -143,7 +143,7 @@ Actor PushButton::GetSelectedBackgroundImage() const
 void PushButton::SetDisabledBackgroundImage( Image image )
 {
   Actor imageActor = ImageActor::New( image );
-  imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
   Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( imageActor );
 }
 
@@ -160,7 +160,7 @@ Actor PushButton::GetDisabledBackgroundImage() const
 void PushButton::SetDisabledImage( Image image )
 {
   Actor imageActor = ImageActor::New( image );
-  imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
   Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( imageActor );
 }
 
index 6ef28a6..0e2d988 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
 
+// EXTERNAL INCLUDES
+#include <limits>
+
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/cluster/cluster-style-impl.h>
 
index f8eded1..d65c16b 100644 (file)
@@ -19,6 +19,8 @@
 #include <dali-toolkit/public-api/controls/control-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+#include <limits>
 #include <stack>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/mesh-actor.h>
@@ -418,13 +420,13 @@ Vector3 Control::GetNaturalSize()
   return mImpl->mNaturalSize;
 }
 
-float Control::CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+float Control::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
 {
   // Could be overridden in derived classes.
   return CalculateChildSizeBase( child, dimension );
 }
 
-bool Control::RelayoutDependentOnChildren( Dimension dimension )
+bool Control::RelayoutDependentOnChildren( Dimension::Type dimension )
 {
   return RelayoutDependentOnChildrenBase( dimension );
 }
@@ -898,11 +900,11 @@ void Control::OnControlSizeSet( const Vector3& size )
 {
 }
 
-void Control::OnCalculateRelayoutSize( Dimension dimension )
+void Control::OnCalculateRelayoutSize( Dimension::Type dimension )
 {
 }
 
-void Control::OnLayoutNegotiated( float size, Dimension dimension )
+void Control::OnLayoutNegotiated( float size, Dimension::Type dimension )
 {
 }
 
@@ -914,7 +916,7 @@ void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
   }
 }
 
-void Control::OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 {
 }
 
index a816989..5c29c39 100644 (file)
@@ -384,7 +384,7 @@ protected:
   /**
    * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildren()
    */
-  virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
+  virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
 
 private:
 
@@ -550,12 +550,12 @@ private:
   /**
    * @copydoc Dali::CustomActorImpl::OnCalculateRelayoutSize()
    */
-  virtual void OnCalculateRelayoutSize( Dimension dimension );
+  virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::OnLayoutNegotiated()
    */
-  virtual void OnLayoutNegotiated( float size, Dimension dimension );
+  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::OnRelayout()
@@ -565,12 +565,12 @@ private:
   /**
    * @copydoc Dali::CustomActorImpl::OnSetResizePolicy()
    */
-  virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension );
+  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::CalculateChildSize()
    */
-  virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension );
+  virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
 
   // From CustomActorImpl, derived classes should NOT override these.
 
index d41a704..ee9ca7d 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <boost/function.hpp>
 #include <dali/public-api/animation/alpha-functions.h>
 #include <dali/public-api/common/vector-wrapper.h>
 
index 7ecb200..b11bd13 100644 (file)
@@ -57,19 +57,20 @@ public:
   {
     enum
     {
-      RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend",    The type or rendering e.g. bitmap-based,      type INT
-      TEXT,                                     ///< name "text",                 The text to display in UTF-8 format,          type STRING
-      FONT_FAMILY,                              ///< name "font-family",          The requested font family,                    type STRING
-      FONT_STYLE,                               ///< name "font-style",           The requested font style e.g. Regular/Italic, type STRING
-      POINT_SIZE,                               ///< name "point-size",           The size of font in points,                   type FLOAT
-      MULTI_LINE,                               ///< name "multi-line",           The single-line or multi-line layout option,  type BOOLEAN
-      HORIZONTAL_ALIGNMENT,                     ///< name "horizontal-alignment", The line horizontal alignment,                type STRING,  values "BEGIN", "CENTER", "END"
-      VERTICAL_ALIGNMENT,                       ///< name "vertical-alignment",   The line vertical alignment,                  type STRING,  values   "TOP",   "CENTER",   "BOTTOM"
-      TEXT_COLOR,                               ///< name "text-color",           The text color,                               type VECTOR4
-      SHADOW_OFFSET,                            ///< name "shadow-offset",        The drop shadow offset 0 indicates no shadow, type VECTOR2
-      SHADOW_COLOR,                             ///< name "shadow-color",         The color of a drop shadow,                   type VECTOR4
-      UNDERLINE_ENABLED,                        ///< name "underline-enabled",    The underline enabled flag                    type BOOLEAN
-      UNDERLINE_COLOR,                          ///< name "underline-color",      The color of the underline                    type VECTOR4
+      RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend",    The type or rendering e.g. bitmap-based,          type INT
+      TEXT,                                     ///< name "text",                 The text to display in UTF-8 format,              type STRING
+      FONT_FAMILY,                              ///< name "font-family",          The requested font family,                        type STRING
+      FONT_STYLE,                               ///< name "font-style",           The requested font style e.g. Regular/Italic,     type STRING
+      POINT_SIZE,                               ///< name "point-size",           The size of font in points,                       type FLOAT
+      MULTI_LINE,                               ///< name "multi-line",           The single-line or multi-line layout option,      type BOOLEAN
+      HORIZONTAL_ALIGNMENT,                     ///< name "horizontal-alignment", The line horizontal alignment,                    type STRING,  values "BEGIN", "CENTER", "END"
+      VERTICAL_ALIGNMENT,                       ///< name "vertical-alignment",   The line vertical alignment,                      type STRING,  values   "TOP",   "CENTER",   "BOTTOM"
+      TEXT_COLOR,                               ///< name "text-color",           The text color,                                   type VECTOR4
+      SHADOW_OFFSET,                            ///< name "shadow-offset",        The drop shadow offset 0 indicates no shadow,     type VECTOR2
+      SHADOW_COLOR,                             ///< name "shadow-color",         The color of a drop shadow,                       type VECTOR4
+      UNDERLINE_ENABLED,                        ///< name "underline-enabled",    The underline enabled flag,                       type BOOLEAN
+      UNDERLINE_COLOR,                          ///< name "underline-color",      The color of the underline,                       type VECTOR4
+      UNDERLINE_HEIGHT                          ///< name "underline-height",     Overrides the underline height from font metrics, type FLOAT
     };
   };
 
index 8c0acda..8cfc291 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 37;
+const unsigned int TOOLKIT_MICRO_VERSION = 38;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 45d0fbf..cc315c0 100644 (file)
@@ -20,6 +20,7 @@
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 
 // INTERNAL INCLUDES
 
index 147ad73..808bfca 100644 (file)
@@ -2,7 +2,7 @@
  * The Dali::CustomActor is used as a base class for UI controls.  It is a proxy object to enable derived classes access
  * to a subset of the methods defined in the internal Actor class.
  *
- * Classes deriving from Custom Actor should follow the same design principle as the rest of the Dali API.
+ * Classes deriving from Custom Actor should follow the same handle - body design principle as the rest of the Dali API.
  *
  * One class of the new UI control should inherit from Dali::CustomActor, while a second should inherit
  * Dali::CustomActorImpl.  This implementation class contains a number of pure virtual methods that enable the new UI
  *
  * In the New() method for the myNewButton class, the user should then create a new instance of the myNewButtonImpl class
  * and pass this to the constructor of the myNewButton object.  Internally the connection will be made
- * between the new widget actor and Dali, thus allowing messages such as OnSizeSet to be received by the new actor.
+ * between the new widget actor and Dali, thus allowing messages such as OnPropertySet to be received by the new actor.
  *
  * It is the responsibility of the implementation of the new UI control to implement the method bodies for the inherited
  * pure virtual methods from Dali::CustomActorImpl.  Obviously the application won't compile if the methods are not
  * overidden, but the user does not need to fill in the code for methods they don't want or need to use.
  *
- * The following code shows the static New() method from the implementation part of the TextView UI control:
- * \code
- * Dali::Toolkit::TextView TextView::New()
- * {
- *   // Create the implementation, temporarily owned on stack
- *   boost::intrusive_ptr< TextView > textView = new TextView;
- *
- *   // Pass ownership to CustomActor
- *   Dali::Toolkit::TextView handle( *textView );
- *
- *   // Second-phase init of the implementation
- *   // This can only be done after the CustomActor connection has been made...
- *   textView->Initialize();
- *
- *   return handle;
- * }
- * \endcode
- *
  * After the implementation object is created it is passed back to the basic Text View through the constructor,the
  * constructor uses this passed in object to initialise the internal implementation objects.
  *
  * handler methods, and do all the rest of their widget processing the the main myNewButton class.  Access to the
  * implementation class can be gained using the GetImpl(*this) method.  For example:
  *
- * \code
- * void TextView::SetFont(const Font newFont)
- * {
- *  GetImpl(*this).SetFont(newFont);
- * }
- * \endcode
  */
index 1663e79..d0a8a93 100644 (file)
@@ -27,7 +27,7 @@ Relayout requests are put in automatically when a property is changed on an acto
 
 In addition to the resize policies detailed in the Size Negotiation Programming Guide there is one additional policy available to control writers:
 
-- USE_ASSIGNED_SIZE: Tells the actor to use the size that was passed into the size negotiation algorithm for it. This is used in the OnRelayout
+- ResizePolicy::USE_ASSIGNED_SIZE: Tells the actor to use the size that was passed into the size negotiation algorithm for it. This is used in the OnRelayout
 method derived from Actor when passing back controls to be negotiated using the container argument to the method.
 
 <h2 class="pg">Creating a Control: Popups</h2>
@@ -47,42 +47,42 @@ and resized by the popup. The following screen shot shows an example popup.
 \image html size-negotiation/PopupExample.png
 
 The first step is to set the default resize policies. This is done in the OnInitialize method. In the following snippet the popup
-is set to have a height resize policy of FIT_TO_CHILDREN. This assumes that the width of the popup will be specified by the user of
+is set to have a height resize policy of ResizePolicy::FIT_TO_CHILDREN. This assumes that the width of the popup will be specified by the user of
 the popup and that the desired behaviour is to fit the height of the popup to the size of its content.
 @code
 void Popup::OnInitialize()
 ...
 Actor self = Self();
-self.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
 @endcode
 The popup will use a layer to place its content in. The layer is created and specified to fill the whole screen by using the following command.
 @code
-mLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+mLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 @endcode
 A half transparent backing image is added to the layer and told to fill the layer with the following.
 @code
-mBacking.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+mBacking.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 @endcode
 The popup control is added to the layer and a background image is specified to fill the size of the popup and add a border by the following.
 @code
-mBackgroundImage.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS );
+mBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
 Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f );
 mBackgroundImage.SetSizeModeFactor( border );
 @endcode
 A table view is added to the popup to specify layout. It will fill to the width of the popup and expand/contract around its children cell heights.
 @code
-mPopupLayout.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+mPopupLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
 @endcode
 Override the OnRelayout method to position and resize the buttons. The trick to this is that the buttons do not know they are part of a popup and are
 about to be resized so could already have had their sizes negotiated. The call to PropagateRelayoutFlags on the button will ensure that it and all
 its child dependents are ready for a new size negotiation pass. The container.Add call will add the button to the relayout queue to be processed this frame.
 The buttonSize parameter is the desired size for the button. The desired size will only be set if the size policy of the button has already been changed to
-USE_ASSIGNED_SIZE, which is what happens when a button is added to the popup.
+ResizePolicy::USE_ASSIGNED_SIZE, which is what happens when a button is added to the popup.
 @code
 void Popup::AddButton( Toolkit::Button button )
 ...
-button.SetResizePolicy( USE_ASSIGNED_SIZE, ALL_DIMENSIONS );
+button.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );
 ...
 
 void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container )
@@ -96,22 +96,22 @@ container.Add( button, buttonSize );
 Another aspect to the popup is that depending which resize policies are active on it then the inner table view requires different resize policies itself.
 OnSetResizePolicy can be overridden to receive notice that the resize policy has changed on the control and action can be taken.
 @code
-void Popup::OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+void Popup::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 ...
-if( policy == FIT_TO_CHILDREN )
+if( policy == ResizePolicy::FIT_TO_CHILDREN )
 {
   // Make content fit to children
-  mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, dimension );
-  if( dimension & HEIGHT )
+  mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, dimension );
+  if( dimension & Dimension::HEIGHT )
   {
     mPopupLayout.SetFitHeight( 1 );
   }
 }
 else
 {
-  mPopupLayout.SetResizePolicy( FILL_TO_PARENT, dimension );
+  mPopupLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, dimension );
   // Make the content cell fill the whole of the available space
-  if( dimension & HEIGHT )
+  if( dimension & Dimension::HEIGHT )
   {
     mPopupLayout.SetRelativeHeight( 1, 1.0f );
   }
@@ -137,7 +137,7 @@ These overridable methods in control provide customization points for the size n
 <h4>Responding to the Change of Size on a Control</h4>
 
 OnRelayout is called during the relayout process at the end of the frame immediately after the new size has been set on the actor. If the actor has calculated
-the size of child actors then add them to container with their desired size and set the USE_ASSIGNED_SIZE resize policy on them.
+the size of child actors then add them to container with their desired size and set the ResizePolicy::USE_ASSIGNED_SIZE resize policy on them.
 At this point the size of the actor has been calculated so it is a good place to calculate positions of child actors etc.
 @code virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) @endcode
 
@@ -148,11 +148,11 @@ children of an actor that is not a control.
 
 The OnCalculateRelayoutSize is called right before the size is calculated for an actor's dimension during the size negotiation phase. At this point all other actors this actor is
 dependent on have been negotiated so calculations depending on these actors can be performed before the size for this actor is calculated. Useful for container size calculations.
-@code virtual void OnCalculateRelayoutSize( Dimension dimension ) @endcode
+@code virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) @endcode
 
 OnLayoutNegotiated is called right after the size in a given dimension has been negotiated for an actor. This allows calculations to be performed in response to the change
 in a given dimension but before OnRelayout is called.
-@code virtual void OnLayoutNegotiated( float size, Dimension dimension ) @endcode
+@code virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) @endcode
 
 <h4>Calculating Sizes</h4>
 
@@ -160,11 +160,11 @@ Calculate the natural size for this control. This will be called when a control'
 For example, TableView will calculated the size of the table given its various cell properties.
 @code virtual Vector3 GetNaturalSize() @endcode
 
-Given an input width return the correct height for this control. This will be called when the resize policy is set to DIMENSION_DEPENDENCY and
+Given an input width return the correct height for this control. This will be called when the resize policy is set to ResizePolicy::DIMENSION_DEPENDENCY and
 height has a dependency on width.
 @code virtual float GetHeightForWidth( float width ) @endcode
 
-Given the input height return the correct width for this control. This will be called when the resize policy is set to DIMENSION_DEPENDENCY and
+Given the input height return the correct width for this control. This will be called when the resize policy is set to ResizePolicy::DIMENSION_DEPENDENCY and
 width has a dependency on height.
 @code virtual float GetWidthForHeight( float height ) @endcode
 
@@ -172,15 +172,15 @@ width has a dependency on height.
 
 Return true from this method if this control is dependent on any of its children to calculate its own size. All relayout containers that can be dependent on their
 children for their own size need to return true from this.
-@code virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS ) @endcode
+@code virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) @endcode
 
-This will be called by children when they are using the FILL_TO_PARENT resize policy. It is the parent's responsibility to calculate the child's correct size.
-@code virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension ) @endcode
+This will be called by children when they are using the ResizePolicy::FILL_TO_PARENT resize policy. It is the parent's responsibility to calculate the child's correct size.
+@code virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) @endcode
 
 <h4>Events</h4>
 
 OnSetResizePolicy is called when the resize policy is set on an actor. Allows deriving actors to respond to changes in resize policy.
-@code virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension ) @endcode
+@code virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) @endcode
 
 <h2 class="pg">Creating a Control: TableView</h2>
 
@@ -197,19 +197,19 @@ We need to be able to calculate the fixed sizes of all actors placed into table
 this is called every actor the table view is dependent on has already had their sizes calculated. Calculations can be made that the main calculation
 for the actor can then use.
 @code
-void TableView::OnCalculateRelayoutSize( Dimension dimension )
+void TableView::OnCalculateRelayoutSize( Dimension::Type dimension )
 ...
 CalculateRowColumnData();
 
-if( dimension & WIDTH )
+if( dimension & Dimension::WIDTH )
 {
-  CalculateFixedSizes( mColumnData, WIDTH );
+  CalculateFixedSizes( mColumnData, Dimension::WIDTH );
   mFixedTotals.width = CalculateTotalFixedSize( mColumnData );
 }
 
-if( dimension & HEIGHT )
+if( dimension & Dimension::HEIGHT )
 {
-  CalculateFixedSizes( mRowData, HEIGHT );
+  CalculateFixedSizes( mRowData, Dimension::HEIGHT );
   mFixedTotals.height = CalculateTotalFixedSize( mRowData );
 }
 ...
@@ -225,7 +225,7 @@ return Vector3( mFixedTotals.width, mFixedTotals.height, 1.0f );
 
 When the time comes to calculate the size of each child in the table cells the following method will be called.
 @code
-float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
+float TableView::CalculateChildSize( const Actor& child, Dimension::Type dimension )
 ...
 // Use cell data to calculate child size
 @endcode
@@ -233,7 +233,7 @@ float TableView::CalculateChildSize( const Actor& child, Dimension dimension )
 The table view is dependent on its children if its size policy is set to USE_NATURAL_SIZE or a row or column is set to "fit" an actor.
 The following code shows calling the base class RelayoutDependentOnChildren to check the resize policy and then searches for fit row or columns.
 @code
-bool TableView::RelayoutDependentOnChildren( Dimension dimension )
+bool TableView::RelayoutDependentOnChildren( Dimension::Type dimension )
 {
   if ( Control::RelayoutDependentOnChildren( dimension ) )
   {
index c8bcb89..8259359 100644 (file)
@@ -18,10 +18,10 @@ The topics covered are:
 The notion of width and height is generalised into the concept of a Dimension. Several methods take a Dimension parameter.
 
 The Dimension enum specifies the available dimensions as bitfields:
-- WIDTH
-- HEIGHT
+- Dimension::WIDTH
+- Dimension::HEIGHT
 
-If a method can process width and height at the same time then the ALL_DIMENSIONS mask can be specified.
+If a method can process width and height at the same time then the Dimension::ALL_DIMENSIONS mask can be specified.
 
 <h2 class="pg">Resize Policies</h2>
 
@@ -29,13 +29,13 @@ If a method can process width and height at the same time then the ALL_DIMENSION
 The ResizePolicy enum specifies a range of options for controlling the way actors resize. These are powerful rules that enable much automatic
 resizing behaviour. They are as following:
 
-- FIXED: This is the option to use when you want the specific definite size as set by SetSize (This is the default for all actors)
-- USE_NATURAL_SIZE: Use this option for objects such as images or text to get their natural size e.g. The dimensions of the image, or the size of the text without wrapping. Also use this on TableViews when the size of the table is dependent on its children.
-- FILL_TO_PARENT: Size will fill up to the size of its parent's size, taking a size factor into account to allow proportionate filling
-- SIZE_RELATIVE_TO_PARENT: Fill up the parent with a relative scale. Use SetSizeModeFactor to specify the ratio to fill up to the parent.
-- SIZE_FIXED_OFFSET_FROM_PARENT: Fill up the parent and add a fixed offset using SetSizeModeFactor.
-- FIT_TO_CHILDREN: Size will scale around the size of the actor's children. E.g. A popup's height may resize itself around it's contents.
-- DIMENSION_DEPENDENCY: This covers rules such as width-for-height and height-for-width. You specify that one dimension depends on another.
+- ResizePolicy::FIXED: This is the option to use when you want the specific definite size as set by SetSize (This is the default for all actors)
+- ResizePolicy::USE_NATURAL_SIZE: Use this option for objects such as images or text to get their natural size e.g. The dimensions of the image, or the size of the text without wrapping. Also use this on TableViews when the size of the table is dependent on its children.
+- ResizePolicy::FILL_TO_PARENT: Size will fill up to the size of its parent's size, taking a size factor into account to allow proportionate filling
+- ResizePolicy::SIZE_RELATIVE_TO_PARENT: Fill up the parent with a relative scale. Use SetSizeModeFactor to specify the ratio to fill up to the parent.
+- ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: Fill up the parent and add a fixed offset using SetSizeModeFactor.
+- ResizePolicy::FIT_TO_CHILDREN: Size will scale around the size of the actor's children. E.g. A popup's height may resize itself around it's contents.
+- ResizePolicy::DIMENSION_DEPENDENCY: This covers rules such as width-for-height and height-for-width. You specify that one dimension depends on another.
 
 \image html size-negotiation/ResizePolicies.png
 
@@ -58,11 +58,11 @@ placed on the stage it will use its natural size by default. However if the user
 size policy is overridden by the FIXED size policy and the actor will take on the size specified.
 
 The next step is to specify how an actor will be size negotiated. The resize policies for an actor may be specified by the following method:
-@code void SetResizePolicy( ResizePolicy policy, Dimension dimension ) @endcode
+@code void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) @endcode
 It is common to specifiy different policies for the different dimensions of width and height to achive different layouts. Different actors have
 different resize policies specified by default. For example ImageActors are set to use USE_NATURAL_SIZE.
 
-The following example code snippet shows rootActor having its width policy set to FILL_TO_PARENT and its height policy set to FIT_TO_CHILDREN.
+The following example code snippet shows rootActor having its width policy set to ResizePolicy::FILL_TO_PARENT and its height policy set to ResizePolicy::FIT_TO_CHILDREN.
 It has an ImageActor added to it with an explicit call to USE_NATURAL_SIZE in both dimensions called on it. This will make an actor that will
 fill up the space of its parent in the width dimension and fit to its child in the height dimension. As the image actor child is using natural size
 the height of the root actor will fit to the height of the child image.
@@ -70,10 +70,10 @@ the height of the root actor will fit to the height of the child image.
 @code
 Actor rootActor = Actor::New();
 rootActor.SetRelayoutEnabled( true );
-rootActor.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-rootActor.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+rootActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+rootActor.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
 ImageActor image = ImageActor::New( Image::New( MY_IMAGE_PATH ) );
-image.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+image.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
 rootActor.Add( image );
 @endcode
 
@@ -87,15 +87,15 @@ After:
 This example shows an actor rootActor set to expand to its parent's width and contract/expand around its child's height. The child image actor
 is set to natural size which means it will display at the acutal size of the image.
 
-To specify that a dimension has a dependency on another dimension use DIMENSION_DEPENDENCY. For example if dimension is HEIGHT and dependency is
-WIDTH then there is a height-for-width dependency in effect. The classic use case for this
+To specify that a dimension has a dependency on another dimension use ResizePolicy::DIMENSION_DEPENDENCY. For example if dimension is Dimension::HEIGHT and dependency is
+Dimension::WIDTH then there is a height-for-width dependency in effect. The classic use case for this
 is a text view that wraps its text. The following example snippet shows a text view that expands its width to the size of its parent, wraps its
 contents and then determines its height based on the width.
 @code
 TextView text = TextView::New( "Example" );
 text.SetMultilinePolicy( SplitByWord );
-text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 @endcode
 
 <h3>Specifying Sizes and Size Limits</h3>
@@ -112,10 +112,10 @@ void SetMaximumSize( const Vector2& size )
 <h3>Altering Negotiated Size</h3>
 
 When an actor is required to maintain the aspect ratio of its natural size the following method can be used. This is useful for size negotiating images
-to ensure they maintain their aspect ratio while still fitting within the bounds they have been allocated. This can be one of USE_SIZE_SET, FIT_WITH_ASPECT_RATIO
-or FILL_WITH_ASPECT_RATIO. The first is the default. The second will fit the actor within the bounds it has been allocated while maintaining aspect ratio. The
+to ensure they maintain their aspect ratio while still fitting within the bounds they have been allocated. This can be one of SizeScalePolicy::USE_SIZE_SET, SizeScalePolicy::FIT_WITH_ASPECT_RATIO
+or SizeScalePolicy::FILL_WITH_ASPECT_RATIO. The first is the default. The second will fit the actor within the bounds it has been allocated while maintaining aspect ratio. The
 third will fill all available space, potentially overflowing its bounds, while maintaining apsect ratio.
-@code void SetSizeScalePolicy( SizeScalePolicy policy ) @endcode
+@code void SetSizeScalePolicy( SizeScalePolicy::Type policy ) @endcode
 
 <h3>Using Actors in Containers</h3>
 
@@ -133,8 +133,8 @@ mPopup.SetTitle( "Warning" );
 
 // Content
 Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
-content.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
 content.SetFitHeight( 0 );
 content.SetFitHeight( 1 );
 content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
@@ -145,22 +145,22 @@ text.SetText( "Do you really want to quit?" );
 text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
 text.SetWidthExceedPolicy( Toolkit::TextView::Split );
 text.SetLineJustification( Toolkit::TextView::Left );
-text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 
 content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
 
 // Image
 ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
-image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
 content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
 
 // Checkbox and text
 Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
-root.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
 root.SetFitHeight( 0 );
 root.SetFitWidth( 0 );
 root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
@@ -190,42 +190,42 @@ The resulting popup with additional buttons added is shown below.
 \image html size-negotiation/Popup.png
 
 The key things to pick out from this example are the use of the size negotiation API.
-The content table view is set to FILL_TO_PARENT for its width and USE_NATURAL_SIZE for its height. This will result
+The content table view is set to ResizePolicy::FILL_TO_PARENT for its width and USE_NATURAL_SIZE for its height. This will result
 in the table view expanding its width to fit the available space in the popup while also expanding/contracting its
 height based on the size of the contents in its cells.
 @code
-content.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
 @endcode
 To add a little space around the left, right and bottom of the table view, some padding is added.
 @code
 content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
 @endcode
-The first text view has its width set to FILL_TO_PARENT and its height has a dimension dependency on its width. This
+The first text view has its width set to ResizePolicy::FILL_TO_PARENT and its height has a dimension dependency on its width. This
 will result in a text view that fills up its width to available space in the table cell and then then calculates its
 height based on its new width. The table view will then fit its height taking the height of the text view into account.
 @code
-text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 @endcode
 The image view performs a similar relayout. It fits its width to the size of the cell and calculates its height based on the new
 width. Some padding is added to the left of it as well to center it more.
 @code
-image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
 image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
 @endcode
 The sub table view is similar as well in that it expands its width to the size of its cell. When it is added to the table view it
 will span two columns. Its height is set to natural size so that it will grow or shrink based on its children cells. Note that for
-a container like table view, USE_NATURAL_SIZE acts in a similar manner to FIT_TO_CHILDREN in that the size of the container could
+a container like table view, USE_NATURAL_SIZE acts in a similar manner to ResizePolicy::FIT_TO_CHILDREN in that the size of the container could
 grow or shrink based on the sizes of the child actors.
 @code
-root.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
 @endcode
 The checkbox is set to have a fixed size.
 @code
-checkBox.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+checkBox.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
 @endcode
 The second text view has not specified a resize policy so will use its default of USE_NATURAL_SIZE.
 
@@ -236,10 +236,10 @@ describe a pitfall to avoid when creating scenes and a way to print debug output
 
 <h3>Infinite Dependency Loops</h3>
 Despite the power of the resize rules there is one pitfall to be aware of: infinite dependency loops. The most simplest form of this is
-shown by a parent actor with resize policy set to FIT_TO_CHILDREN with a child that has a resize policy of FILL_TO_PARENT. Who should
-determine the size in this case? A more complex loop occurs when DIMENSION_DEPENDENCY comes into play. Say a parent has a width policy
-of DIMENSION_DEPENDENCY with height and a height policy of FIT_TO_CHILDREN. The parent has a single child with a height policy DIMENSION_DEPENDENCY
-with width. If the child's width policy is FILL_TO_PARENT then a loop will occur. These are two simple examples but the loops could occur
+shown by a parent actor with resize policy set to ResizePolicy::FIT_TO_CHILDREN with a child that has a resize policy of ResizePolicy::FILL_TO_PARENT. Who should
+determine the size in this case? A more complex loop occurs when ResizePolicy::DIMENSION_DEPENDENCY comes into play. Say a parent has a width policy
+of ResizePolicy::DIMENSION_DEPENDENCY with height and a height policy of ResizePolicy::FIT_TO_CHILDREN. The parent has a single child with a height policy ResizePolicy::DIMENSION_DEPENDENCY
+with width. If the child's width policy is ResizePolicy::FILL_TO_PARENT then a loop will occur. These are two simple examples but the loops could occur
 over larger spreads of parent child relationships. These loops are detected by the relayout algorithm with the result being that actors will
 receive zero sizes. These loops are not common but are still something to watch out for.
 
@@ -256,7 +256,7 @@ PushButton, OKAY_BUTTON - Pos: [185, 0, 0.1] Size: [165, 76, 76], Dirty: (FALSE,
 
 The format is as follows:
 
-[Actor type], [Actor name] – Pos:[X, Y, Z] Size[WIDTH, HEIGHT, DEPTH], Dirty:(WIDTH, HEIGHT), Negotiated: (WIDTH, HEIGHT), Enabled: BOOLEAN, (Object address)
+[Actor type], [Actor name] – Pos:[X, Y, Z] Size[Dimension::WIDTH, Dimension::HEIGHT, DEPTH], Dirty:(Dimension::WIDTH, Dimension::HEIGHT), Negotiated: (Dimension::WIDTH, Dimension::HEIGHT), Enabled: BOOLEAN, (Object address)
 - <i>Actor type</i>: The type name of the actor E.g. PushButton
 - <i>Actor name</i>: The name set on the actor with SetName(). Useful for debugging.
 - <i>Pos</i>: The position of the actor
index e4d037a..07f1c1e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.37
+Version:    1.0.38
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index 3fba14a..1a11440 100644 (file)
 #include "animation-api.h"
 #include "path-wrapper.h"
 
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+#include <dali/integration-api/debug.h>
+
+
 // INTERNAL INCLUDES
 #include <v8-utils.h>
-#include <dali/integration-api/debug.h>
 #include <animation/animation-wrapper.h>
 #include <object/property-value-wrapper.h>
-#include <dali/public-api/common/map-wrapper.h>
 
 namespace Dali
 {
@@ -43,7 +46,6 @@ struct AlphaFuncStruct
 };
 /**
  * Contains a list of alpha functions that can be used.
- * We use a stl map as lookup to map a string name to the function
  */
 const AlphaFuncStruct AlphaFunctionTable[]=
 {
index 55d4a0e..d8359e2 100644 (file)
 // CLASS HEADER
 #include "signal-manager.h"
 
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+#include <dali/public-api/images/resource-image.h>
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/events/pan-gesture-detector.h>
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/hover-event.h>
+#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/key-event.h>
+#include <dali/public-api/events/pan-gesture.h>
+
 // INTERNAL INCLUDES
 #include <v8-utils.h>
 #include <object/handle-wrapper.h>
 #include <events/pan-gesture-detector-wrapper.h>
 #include <toolkit/focus-manager/keyboard-focus-manager-wrapper.h>
 #include <signals/dali-any-javascript-converter.h>
-#include <dali/public-api/images/resource-image.h>
-#include <dali/public-api/object/any.h>
-#include <dali/public-api/events/pan-gesture-detector.h>
-#include <dali/public-api/object/any.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/events/touch-event.h>
-#include <dali/public-api/events/hover-event.h>
-#include <dali/public-api/events/mouse-wheel-event.h>
-#include <dali/public-api/events/key-event.h>
-#include <dali/public-api/events/pan-gesture.h>