Updated demos to remove indicator where appropriate
[platform/core/uifw/dali-demo.git] / examples / text-field / text-field-example.cpp
index ce4e212..1b21b48 100644 (file)
@@ -37,8 +37,8 @@ using namespace MultiLanguageStrings;
 namespace
 {
 
-  const char* const FOLDER_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_bg.png";
-  const char* const FOLDER_OPEN_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_open_bg.png";
+  const char* const FOLDER_ICON_IMAGE = DEMO_IMAGE_DIR "folder_appicon_empty_bg.png";
+  const char* const FOLDER_OPEN_ICON_IMAGE = DEMO_IMAGE_DIR "folder_appicon_empty_open_bg.png";
 
   const float BORDER_WIDTH = 4.0f;
 
@@ -75,6 +75,9 @@ public:
     stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
     stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
 
+    // Hide the indicator bar
+    application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+
     mButton = CreateFolderButton();
     mButton.ClickedSignal().Connect( this, &TextFieldExample::OnButtonClicked );
     stage.Add( mButton );
@@ -87,8 +90,8 @@ public:
     button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE );
     button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
-    ResourceImage imageClosed = ResourceImage::New( FOLDER_ICON_IMAGE );
-    button.SetSize( imageClosed.GetWidth(), imageClosed.GetHeight() );
+    ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE );
+    button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() );
 
     return button;
   }
@@ -106,7 +109,8 @@ public:
     mPopup = CreatePopup( stageSize.width * 0.8f );
     mPopup.Add( mField );
     mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched );
-    mPopup.Show();
+    stage.Add( mPopup );
+    mPopup.SetDisplayState( Popup::SHOWN );
 
     return true;
   }
@@ -114,7 +118,7 @@ public:
   TextField CreateTextField( const Vector2& stageSize, const std::string& text )
   {
     TextField field = TextField::New();
-    field.SetName("text-field");
+    field.SetName("textField");
     field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
     field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
@@ -133,10 +137,9 @@ public:
     popup.SetParentOrigin( ParentOrigin::CENTER );
     popup.SetAnchorPoint( AnchorPoint::CENTER );
     popup.SetSize( width, 0.0f );
-    popup.HideTail();
     popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT );
     popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT );
-    popup.TouchedSignal().Connect( this, &TextFieldExample::OnPopupTouched );
+    popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched );
 
     return popup;
   }
@@ -154,20 +157,19 @@ public:
     // Hide & discard the pop-up
     if( mPopup )
     {
-      mPopup.Hide();
+      mPopup.SetDisplayState( Popup::HIDDEN );
     }
     mField.Reset();
   }
 
-  bool OnPopupTouched( Actor actor, const TouchEvent& event )
+  bool OnPopupTouched( Actor actor, const TouchData& event )
   {
     // End edit mode for TextField if parent Popup touched.
     if(event.GetPointCount() > 0)
     {
-      const TouchPoint& point = event.GetPoint(0);
-      switch(point.state)
+      switch( event.GetState( 0 ) )
       {
-        case TouchPoint::Down:
+        case PointState::DOWN:
         {
           // Update the folder text and lose focus for Key events
           if( mButton && mField )
@@ -224,7 +226,7 @@ void RunTest( Application& application )
 }
 
 /** 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 TextField example uses default Toolkit style sheet.
   Application application = Application::New( &argc, &argv );