Merge "Fix the warning log in Control causing the wrong position" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-selection-popup-impl.cpp
index 2248668..459e534 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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,7 @@
 #include <libintl.h>
 #include <cfloat>
 #include <dali/public-api/animation/animation.h>
-#include <dali/public-api/images/nine-patch-image.h>
+#include <dali/devel-api/images/nine-patch-image.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/math/vector4.h>
@@ -34,6 +34,8 @@
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 namespace Dali
 {
@@ -386,15 +388,10 @@ void TextSelectionPopup::OnInitialize()
   Actor self = Self();
   self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
   self.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
-}
-
-void TextSelectionPopup::OnStageConnection( int depth )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "TextSelectionPopup::OnStageConnection\n" );
-  // Call the Control::OnStageConnection() to set the depth of the background.
-  Control::OnStageConnection( depth );
 
-  // TextSelectionToolbar::OnStageConnection() will set the depths of all the popup's components.
+  // The Popup Control background is a nine-patch image. We clip against this so the
+  // contents are correctly clipped against the edges of the nine-patch.
+  self.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
 }
 
 void TextSelectionPopup::HideAnimationFinished( Animation& animation )
@@ -705,7 +702,7 @@ std::string TextSelectionPopup::GetPressedImage() const
 
      // Label properties.
      Property::Map buttonLabelProperties;
-     buttonLabelProperties.Insert( "text", button.caption );
+     buttonLabelProperties.Insert( Toolkit::TextVisual::Property::TEXT, button.caption );
      option.SetProperty( Toolkit::Button::Property::LABEL, buttonLabelProperties );
    }
    if( showIcons )
@@ -800,7 +797,7 @@ std::string TextSelectionPopup::GetPressedImage() const
  }
 
 TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface )
-: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
   mToolbar(),
   mPopupMaxSize(),
   mOptionMaxSize(),