Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-demo.git] / examples / text-editor / text-editor-example.cpp
index 44b08c8..c775f19 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -22,7 +22,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <sstream>
 
 // INTERNAL INCLUDES
@@ -42,7 +41,7 @@ const float   TOOLBAR_TITLE_PERCENTAGE = 0.7f;                      ///< The tit
 const float   TOOLBAR_HEIGHT_PERCENTAGE = 0.05f;                    ///< The toolbar's height as a percentage of the stage's height.
 const float   TOOLBAR_PADDING = 4.f;                                ///< The padding in pixels.
 const float   BUTTON_PERCENTAGE = 0.8f;                             ///< The button's height as a percentage of the space for the buttons in the toolbar.
-const Vector3 TEXT_EDITOR_RELATIVE_SIZE( 1.f, 0.45f, 1.0f );        ///< The size of the text editor as a percentage of the stage's size.
+const Vector3 TEXT_EDITOR_RELATIVE_SIZE( 0.9f, 0.5f, 1.0f );        ///< The size of the text editor as a percentage of the stage's size.
 const Vector4 TEXT_EDITOR_BACKGROUND_COLOR( 1.f, 1.f, 1.f, 0.15f ); ///< The background color of the text editor.
 
 const Vector4 COLORS[] = { Color::RED,
@@ -130,7 +129,7 @@ public:
     // Add border to highlight harder-to-see colors.
     // We use a color rather than border visual as the container will always be behind the button.
     Property::Map colorMap;
-    colorMap.Insert( Visual::Property::TYPE, Visual::COLOR);
+    colorMap.Insert( Toolkit::Visual::Property::TYPE, Visual::COLOR);
     colorMap.Insert( ColorVisual::Property::MIX_COLOR, Color::BLACK );
     mColorContainer.SetProperty( Control::Property::BACKGROUND, colorMap );
 
@@ -153,7 +152,7 @@ public:
     mEditor = TextEditor::New();
     mEditor.SetParentOrigin( ParentOrigin::TOP_CENTER );
     mEditor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
-    mEditor.SetPosition( 0.f, toolBarHeight, 0.f );
+    mEditor.SetPosition( 0.f, toolBarHeight * 2.0f, 0.f );
     mEditor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mEditor.SetSizeModeFactor( TEXT_EDITOR_RELATIVE_SIZE );
 
@@ -276,11 +275,11 @@ public:
   void SetButtonColor( Button& button, const Vector4& color )
   {
     Property::Map colorVisualMap;
-    colorVisualMap.Add( Visual::Property::TYPE, Visual::COLOR )
+    colorVisualMap.Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
                   .Add( ColorVisual::Property::MIX_COLOR, color );
 
-    button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, colorVisualMap );
-    button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, colorVisualMap );
+    button.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, colorVisualMap );
+    button.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, colorVisualMap );
   }
 
 private:
@@ -295,20 +294,11 @@ private:
   Toolkit::TableView  mButtonContainer;
 };
 
-void RunTest( Application& application )
-{
-  TextEditorExample test( application );
-
-  application.MainLoop();
-}
-
-/** Entry point for Linux & Tizen applications */
-int main( int argc, char **argv )
+int DALI_EXPORT_API main( int argc, char **argv )
 {
   // DALI_DEMO_THEME_PATH not passed to Application so TextEditor example uses default Toolkit style sheet.
   Application application = Application::New( &argc, &argv );
-
-  RunTest( application );
-
+  TextEditorExample test( application );
+  application.MainLoop();
   return 0;
 }