Clipping API feature in Actor 15/65815/17
authorTom Robinson <tom.robinson@samsung.com>
Tue, 12 Apr 2016 15:55:40 +0000 (16:55 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Thu, 8 Sep 2016 14:21:23 +0000 (07:21 -0700)
Change-Id: Id8702d5deda4b3aaa0968144e26d8b0a5d36d6fc

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h
plugins/dali-script-v8/src/constants/constants-wrapper.cpp

index 3f2e6e5..0054e59 100644 (file)
@@ -130,6 +130,18 @@ bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams&
   return FindIndexFromMethodAndParams( method, params ) > -1;
 }
 
+bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const
+{
+  for( size_t i = startIndex; i < mCallStack.size(); ++i )
+  {
+    if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) )
+    {
+      startIndex = i;
+      return true;
+    }
+  }
+  return false;
+}
 
 /**
  * Search for a method in the stack with the given parameter list
index 137bfaf..e1882ea 100644 (file)
@@ -102,6 +102,19 @@ public:
   bool FindMethodAndParams(std::string method, const NamedParams& params) const;
 
   /**
+   * Search for a method in the stack with the given parameter list.
+   * The search is done from a given index.
+   * This allows the order of methods and parameters to be checked.
+   * @param[in] method The name of the method
+   * @param[in] params A comma separated list of parameter values
+   * @param[in/out] startIndex The method index to start looking from.
+   *                This is updated if a method is found so subsequent
+   *                calls can search for methods occuring after this one.
+   * @return True if the method was in the stack
+   */
+  bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const;
+
+  /**
    * Search for a method in the stack with the given parameter list
    * @param[in] method The name of the method
    * @param[in] params A comma separated list of parameter values
index 2248668..f3670fd 100644 (file)
@@ -386,6 +386,10 @@ void TextSelectionPopup::OnInitialize()
   Actor self = Self();
   self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
   self.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
+
+  // 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::OnStageConnection( int depth )
index b87dab2..b217be5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -163,10 +163,10 @@ void TextSelectionToolbar::OnStageConnection( int depth )
 void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize )
 {
   mMaxSize = maxSize;
-  if (mScrollView && mStencilLayer )
+  if (mScrollView && mToolbarLayer )
   {
     mScrollView.SetMaximumSize( mMaxSize );
-    mStencilLayer.SetMaximumSize( mMaxSize );
+    mToolbarLayer.SetMaximumSize( mMaxSize );
   }
 }
 
@@ -198,23 +198,18 @@ void TextSelectionToolbar::SetUpScrollView()
 void TextSelectionToolbar::SetUp()
 {
   Actor self = Self();
-  self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
 
-  // Create Layer and Stencil.  Layer enable's clipping when content exceed maximum defined width.
-  mStencilLayer = Layer::New();
-  mStencilLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
-  mStencilLayer.SetParentOrigin( ParentOrigin::CENTER );
+  self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
 
-  BufferImage stencilImage = BufferImage::WHITE(); // ImageView needs an Image or does nothing
-  Toolkit::ImageView stencil = Toolkit::ImageView::New(stencilImage);
-  stencil.SetDrawMode( DrawMode::STENCIL );
-  stencil.SetVisible( true );
-  stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-  stencil.SetParentOrigin( ParentOrigin::CENTER );
+  // Create Layer to house the toolbar.
+  mToolbarLayer = Layer::New();
+  mToolbarLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+  mToolbarLayer.SetAnchorPoint( AnchorPoint::CENTER );
+  mToolbarLayer.SetParentOrigin( ParentOrigin::CENTER );
 
-  if ( !mScrollView )
+  if( !mScrollView )
   {
-    mScrollView  = Toolkit::ScrollView::New();
+    mScrollView = Toolkit::ScrollView::New();
   }
   SetUpScrollView();
 
@@ -224,10 +219,10 @@ void TextSelectionToolbar::SetUp()
   mTableOfButtons.SetParentOrigin( ParentOrigin::CENTER_LEFT );
   mTableOfButtons.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
 
-  mStencilLayer.Add( stencil );
-  mStencilLayer.Add( mScrollView );
   mScrollView.Add( mTableOfButtons );
-  self.Add( mStencilLayer );
+  mToolbarLayer.Add( mScrollView );
+
+  self.Add( mToolbarLayer );
 }
 
 void TextSelectionToolbar::OnScrollStarted( const Vector2& position )
@@ -265,7 +260,7 @@ void TextSelectionToolbar::ResizeDividers( Size& size )
 
 void TextSelectionToolbar::RaiseAbove( Layer target )
 {
-  mStencilLayer.RaiseAbove( target );
+  mToolbarLayer.RaiseAbove( target );
 }
 
 void TextSelectionToolbar::ConfigureScrollview( const Property::Map& properties )
index 7997bfa..46e633b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -160,7 +160,7 @@ private:
 
 private: // Data
 
-  Layer mStencilLayer;                                ///< The stencil layer
+  Layer mToolbarLayer;                                ///< The layer used to house the toolbar.
   Toolkit::TableView mTableOfButtons;                 ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
   Toolkit::ScrollView mScrollView;                    ///< Provides scrolling of Toolbar when content does not fit.
   RulerPtr mRulerX;                                   ///< Ruler to clamp horizontal scrolling. Updates on Relayout
@@ -196,4 +196,4 @@ inline const Toolkit::Internal::TextSelectionToolbar& GetImpl( const Toolkit::Te
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
index 15252da..5ea93df 100644 (file)
@@ -159,7 +159,6 @@ const IntegerPair EnumTable[] =
 
     { "DRAW_MODE_NORMAL",                                   DrawMode::NORMAL     },
     { "DRAW_MODE_OVERLAY_2D",                               DrawMode::OVERLAY_2D },
-    { "DRAW_MODE_STENCIL",                                  DrawMode::STENCIL    },
 
     { "RESOURCE_LOADING",                                   Dali::ResourceLoading },
     { "RESOURCE_LOADING_SUCCEEDED",                         Dali::ResourceLoadingSucceeded  },
@@ -278,14 +277,11 @@ const IntegerPair EnumTable[] =
     { "ALPHA_FUNCTION_SIN",                   AlphaFunction::SIN                  },
     { "ALPHA_FUNCTION_EASE_OUT_BACK",         AlphaFunction::EASE_OUT_BACK        },
 
+    { "CLIPPING_MODE_DISABLED",                     ClippingMode::DISABLED                     },
+    { "CLIPPING_MODE_CLIP_CHILDREN",                ClippingMode::CLIP_CHILDREN                },
 };
 const unsigned int EnumTableCount = sizeof(EnumTable)/sizeof(EnumTable[0]);
 
-
-
-
-
-
 } // un-named name space