text popup callbacks. 46/41946/5
authorVictor Cebollada <v.cebollada@samsung.com>
Thu, 18 Jun 2015 15:42:04 +0000 (16:42 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 19 Jun 2015 13:03:30 +0000 (14:03 +0100)
Change-Id: I2357b7cfdd2983dcdc021aad0dbb9645cd74f328
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h [new file with mode: 0644]
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/decorator/text-decorator.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index 84046fd..7aeb471 100644 (file)
@@ -41,7 +41,7 @@ int UtcDaliToolkitTextSelectionPopupNewP(void)
 
   DALI_TEST_CHECK( !textSelectionPopup );
 
 
   DALI_TEST_CHECK( !textSelectionPopup );
 
-  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY );
+  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY, NULL );
 
   DALI_TEST_CHECK( textSelectionPopup );
   END_TEST;
 
   DALI_TEST_CHECK( textSelectionPopup );
   END_TEST;
@@ -61,7 +61,7 @@ int UtcDaliToolkitTextSelectionPopupCopyConstructorP(void)
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
 
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
 
-  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY );
+  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY, NULL );
   TextSelectionPopup copy( textSelectionPopup );
 
   DALI_TEST_CHECK( copy == textSelectionPopup );
   TextSelectionPopup copy( textSelectionPopup );
 
   DALI_TEST_CHECK( copy == textSelectionPopup );
@@ -85,7 +85,7 @@ int UtcDaliToolkitTextSelectionPopupAssignmentOperatorP(void)
 {
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
 {
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
-  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY );
+  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY, NULL );
   TextSelectionPopup copy;
   copy = textSelectionPopup;
 
   TextSelectionPopup copy;
   copy = textSelectionPopup;
 
@@ -97,7 +97,7 @@ int UtcDaliToolkitTextSelectionPopupDownCastP(void)
 {
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
 {
   ToolkitTestApplication application;
   TextSelectionPopup textSelectionPopup;
-  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY );
+  textSelectionPopup = TextSelectionPopup::New( TextSelectionPopup::COPY, NULL );
 
   TextSelectionPopup cast = TextSelectionPopup::DownCast( textSelectionPopup );
 
 
   TextSelectionPopup cast = TextSelectionPopup::DownCast( textSelectionPopup );
 
diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h
new file mode 100644 (file)
index 0000000..e903b77
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef __DALI_TOOLKIT_TEXT_SELECTION_POPUP_CALLBACK_INTERFACE_H__
+#define __DALI_TOOLKIT_TEXT_SELECTION_POPUP_CALLBACK_INTERFACE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @brief Interface used to receive the TextSelectionPopup's button callbacks.
+ */
+class TextSelectionPopupCallbackInterface
+{
+public:
+  /**
+   * @brief Virtual destructor.
+   */
+  virtual ~TextSelectionPopupCallbackInterface()
+  {}
+
+  /**
+   * @brief Called when a button is touched.
+   *
+   * @param[in] button The button identifier.
+   */
+  virtual void TextPopupButtonTouched( TextSelectionPopup::Buttons button ) = 0;
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+
+#endif // __DALI_TOOLKIT_TEXT_SELECTION_POPUP_CALLBACK_INTERFACE_H__
index a1237f2..5b85fac 100644 (file)
@@ -29,9 +29,11 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
-TextSelectionPopup TextSelectionPopup::New( Buttons enabledButtons )
+TextSelectionPopup TextSelectionPopup::New( Buttons enabledButtons,
+                                            TextSelectionPopupCallbackInterface* callbackInterface )
 {
 {
-  return Internal::TextSelectionPopup::New( enabledButtons );
+  return Internal::TextSelectionPopup::New( enabledButtons,
+                                            callbackInterface );
 }
 
 TextSelectionPopup::TextSelectionPopup()
 }
 
 TextSelectionPopup::TextSelectionPopup()
index c2ad190..3d6d5d0 100644 (file)
@@ -27,6 +27,8 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
+class TextSelectionPopupCallbackInterface;
+
 namespace Internal DALI_INTERNAL
 {
 class TextSelectionPopup;
 namespace Internal DALI_INTERNAL
 {
 class TextSelectionPopup;
@@ -90,9 +92,11 @@ public:
   /**
    * Create the TextSelectionPopup control with the given set of buttons.
    * @param[in] enabledButtons The given set of buttons to enable
   /**
    * Create the TextSelectionPopup control with the given set of buttons.
    * @param[in] enabledButtons The given set of buttons to enable
+   * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
    * @return A handle to the TextSelectionPopup control.
    */
    * @return A handle to the TextSelectionPopup control.
    */
-  static TextSelectionPopup New( Buttons enabledButtons );
+  static TextSelectionPopup New( Buttons enabledButtons,
+                                 TextSelectionPopupCallbackInterface* callbackInterface );
 
   /**
    * @brief Creates an empty handle.
 
   /**
    * @brief Creates an empty handle.
index 305d61c..126518d 100644 (file)
@@ -873,7 +873,8 @@ void TextField::OnInitialize()
 
   mController = Text::Controller::New( *this );
 
 
   mController = Text::Controller::New( *this );
 
-  mDecorator = Text::Decorator::New( *mController );
+  mDecorator = Text::Decorator::New( *mController,
+                                     *mController );
 
   mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
 
 
   mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
 
index ee0d950..91ef03b 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
@@ -88,7 +89,7 @@ const char* const OPTION_CLIPBOARD("option-clipboard");
 
 BaseHandle Create()
 {
 
 BaseHandle Create()
 {
-  return Toolkit::TextSelectionPopup::New( Toolkit::TextSelectionPopup::NONE );
+  return Toolkit::TextSelectionPopup::New( Toolkit::TextSelectionPopup::NONE, NULL );
 }
 
 // Setup properties, signals and actions using the type-registry.
 }
 
 // Setup properties, signals and actions using the type-registry.
@@ -112,10 +113,11 @@ DALI_TYPE_REGISTRATION_END()
 } // namespace
 
 
 } // namespace
 
 
-Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable )
+Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable,
+                                                           TextSelectionPopupCallbackInterface* callbackInterface )
 {
    // Create the implementation, temporarily owned by this handle on stack
 {
    // Create the implementation, temporarily owned by this handle on stack
-  IntrusivePtr< TextSelectionPopup > impl = new TextSelectionPopup();
+  IntrusivePtr< TextSelectionPopup > impl = new TextSelectionPopup( callbackInterface );
 
   // Pass ownership to CustomActor handle
   Dali::Toolkit::TextSelectionPopup handle( *impl );
 
   // Pass ownership to CustomActor handle
   Dali::Toolkit::TextSelectionPopup handle( *impl );
@@ -128,6 +130,7 @@ Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New( Toolkit::TextSelectio
 
   return handle;
 }
 
   return handle;
 }
+
 void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 {
   Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast( Dali::BaseHandle( object ) );
 void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 {
   Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast( Dali::BaseHandle( object ) );
@@ -299,8 +302,63 @@ void TextSelectionPopup::OnInitialize()
   CreatePopup();
 }
 
   CreatePopup();
 }
 
-bool TextSelectionPopup::OnButtonPressed( Toolkit::Button button )
+bool TextSelectionPopup::OnCutButtonPressed( Toolkit::Button button )
 {
 {
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Toolkit::TextSelectionPopup::CUT );
+  }
+
+  return true;
+}
+
+bool TextSelectionPopup::OnCopyButtonPressed( Toolkit::Button button )
+{
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::COPY );
+  }
+
+  return true;
+}
+
+bool TextSelectionPopup::OnPasteButtonPressed( Toolkit::Button button )
+{
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::PASTE );
+  }
+
+  return true;
+}
+
+bool TextSelectionPopup::OnSelectButtonPressed( Toolkit::Button button )
+{
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::SELECT );
+  }
+
+  return true;
+}
+
+bool TextSelectionPopup::OnSelectAllButtonPressed( Toolkit::Button button )
+{
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::SELECT_ALL );
+  }
+
+  return true;
+}
+
+bool TextSelectionPopup::OnClipboardButtonPressed( Toolkit::Button button )
+{
+  if( mCallbackInterface )
+  {
+    mCallbackInterface->TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::CLIPBOARD );
+  }
+
   return true;
 }
 
   return true;
 }
 
@@ -507,8 +565,13 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
    std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() );
  }
 
    std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() );
  }
 
- void TextSelectionPopup::AddOption( const std::string& name, const std::string& caption, const Image iconImage, bool showDivider, bool showIcons, bool showCaption  )
+ void TextSelectionPopup::AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption  )
  {
  {
+
+   const std::string& name = button.name;
+   const std::string& caption = button.caption;
+   Image iconImage = button.icon;
+
    // 1. Create the backgrounds for the popup option both normal and pressed.
    // Both containers will be added to a button.
 
    // 1. Create the backgrounds for the popup option both normal and pressed.
    // Both containers will be added to a button.
 
@@ -581,7 +644,45 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
    option.SetName( name );
    option.SetAnimationTime( 0.0f );
    option.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
    option.SetName( name );
    option.SetAnimationTime( 0.0f );
    option.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
-   option.ClickedSignal().Connect( this, &TextSelectionPopup::OnButtonPressed );
+
+   switch( button.id )
+   {
+     case Toolkit::TextSelectionPopup::CUT:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnCutButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::COPY:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnCopyButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::PASTE:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnPasteButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::SELECT:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnSelectButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::SELECT_ALL:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnSelectAllButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::CLIPBOARD:
+     {
+       option.ClickedSignal().Connect( this, &TextSelectionPopup::OnClipboardButtonPressed );
+       break;
+     }
+     case Toolkit::TextSelectionPopup::NONE:
+     {
+       // Nothing to do:
+       break;
+     }
+   }
 
    // 5. Set the normal option image.
    option.SetButtonImage( optionContainer );
 
    // 5. Set the normal option image.
    option.SetButtonImage( optionContainer );
@@ -631,7 +732,7 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
      if ( button.enabled )
      {
        numberOfOptionsAdded++;
      if ( button.enabled )
      {
        numberOfOptionsAdded++;
-       AddOption(  button.name, button.caption, button.icon, ( numberOfOptionsAdded < numberOfOptionsRequired ) , showIcons, showCaptions );
+       AddOption(  button, ( numberOfOptionsAdded < numberOfOptionsRequired ) , showIcons, showCaptions );
      }
    }
  }
      }
    }
  }
@@ -653,13 +754,14 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
    }
  }
 
    }
  }
 
-TextSelectionPopup::TextSelectionPopup()
+TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface )
 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mToolbar(),
   mMaxSize(),
   mMinSize(),
   mOptionDividerSize( Size( 2.0f, 0.0f) ),
   mEnabledButtons( Toolkit::TextSelectionPopup::NONE ),
 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mToolbar(),
   mMaxSize(),
   mMinSize(),
   mOptionDividerSize( Size( 2.0f, 0.0f) ),
   mEnabledButtons( Toolkit::TextSelectionPopup::NONE ),
+  mCallbackInterface( callbackInterface ),
   mLineColor( DEFAULT_POPUP_LINE_COLOR ),
   mIconColor( DEFAULT_OPTION_ICON ),
   mPressedColor( DEFAULT_OPTION_ICON_PRESSED ),
   mLineColor( DEFAULT_POPUP_LINE_COLOR ),
   mIconColor( DEFAULT_OPTION_ICON ),
   mPressedColor( DEFAULT_OPTION_ICON_PRESSED ),
index 8d75848..c409983 100644 (file)
@@ -99,9 +99,11 @@ public:
   /**
    * @brief New constructor with provided buttons to enable.
    * @param[in] buttonsToEnable bit mask of buttons to enable
   /**
    * @brief New constructor with provided buttons to enable.
    * @param[in] buttonsToEnable bit mask of buttons to enable
+   * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
    * @return A handle to the TextSelectionPopup control.
    */
    * @return A handle to the TextSelectionPopup control.
    */
-  static Toolkit::TextSelectionPopup New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable );
+  static Toolkit::TextSelectionPopup New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable,
+                                          TextSelectionPopupCallbackInterface* callbackInterface );
 
   // Properties
 
 
   // Properties
 
@@ -132,11 +134,46 @@ private: // From Control
 private: // Implementation
 
   /**
 private: // Implementation
 
   /**
-   * @brief When a popup button is pressed
+   * @brief When the cut button is pressed.
    * @param[in] button the button pressed
    * @param[in] button the button pressed
-   * @return bool
+   * @return @e true to consume the event.
    */
    */
-  bool OnButtonPressed( Toolkit::Button button );
+  bool OnCutButtonPressed( Toolkit::Button button );
+
+  /**
+   * @brief When the copy button is pressed.
+   * @param[in] button the button pressed
+   * @return @e true to consume the event.
+   */
+  bool OnCopyButtonPressed( Toolkit::Button button );
+
+  /**
+   * @brief When the paste button is pressed.
+   * @param[in] button the button pressed
+   * @return @e true to consume the event.
+   */
+  bool OnPasteButtonPressed( Toolkit::Button button );
+
+  /**
+   * @brief When the select button is pressed.
+   * @param[in] button the button pressed
+   * @return @e true to consume the event.
+   */
+  bool OnSelectButtonPressed( Toolkit::Button button );
+
+  /**
+   * @brief When the select all button is pressed.
+   * @param[in] button the button pressed
+   * @return @e true to consume the event.
+   */
+  bool OnSelectAllButtonPressed( Toolkit::Button button );
+
+  /**
+   * @brief When the clipboard button is pressed.
+   * @param[in] button the button pressed
+   * @return @e true to consume the event.
+   */
+  bool OnClipboardButtonPressed( Toolkit::Button button );
 
   /**
    * @brief Method to set the dimension or dimension constraint on certain aspects of the Popup.
 
   /**
    * @brief Method to set the dimension or dimension constraint on certain aspects of the Popup.
@@ -171,7 +208,7 @@ private: // Implementation
 
   void CreateOrderedListOfPopupOptions();
 
 
   void CreateOrderedListOfPopupOptions();
 
-  void AddOption( const std::string& name, const std::string& caption, const Image iconImage, bool showDivider, bool showIcons, bool showCaption );
+  void AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption );
 
   std::size_t GetNumberOfEnabledOptions();
 
 
   std::size_t GetNumberOfEnabledOptions();
 
@@ -182,7 +219,7 @@ private: // Implementation
   /**
    * Construct a new TextField.
    */
   /**
    * Construct a new TextField.
    */
-  TextSelectionPopup();
+  TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -220,6 +257,7 @@ private: // Data
   std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.
 
   Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons
   std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.
 
   Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons
+  Toolkit::TextSelectionPopupCallbackInterface* mCallbackInterface;
 
   Vector4 mLineColor;                   // Color of the line around the text input popup
   Vector4 mIconColor;                   // Color of the popup icon.
 
   Vector4 mLineColor;                   // Color of the line around the text input popup
   Vector4 mIconColor;                   // Color of the popup icon.
index 392fde1..7934b6f 100644 (file)
@@ -228,9 +228,11 @@ struct Decorator::Impl : public ConnectionTracker
     int offset;
   };
 
     int offset;
   };
 
-  Impl( ControllerInterface& controller )
+  Impl( ControllerInterface& controller,
+        TextSelectionPopupCallbackInterface& callbackInterface )
   : mController( controller ),
     mEnabledPopupButtons( TextSelectionPopup::NONE ),
   : mController( controller ),
     mEnabledPopupButtons( TextSelectionPopup::NONE ),
+    mTextSelectionPopupCallbackInterface( callbackInterface ),
     mBoundingBox( Rect<int>() ),
     mHighlightColor( LIGHT_BLUE ),
     mActiveCursor( ACTIVE_CURSOR_NONE ),
     mBoundingBox( Rect<int>() ),
     mHighlightColor( LIGHT_BLUE ),
     mActiveCursor( ACTIVE_CURSOR_NONE ),
@@ -405,7 +407,7 @@ struct Decorator::Impl : public ConnectionTracker
       UnparentAndReset( mCopyPastePopup.actor );
       if ( !mCopyPastePopup.actor )
       {
       UnparentAndReset( mCopyPastePopup.actor );
       if ( !mCopyPastePopup.actor )
       {
-        mCopyPastePopup.actor = TextSelectionPopup::New( mEnabledPopupButtons );
+        mCopyPastePopup.actor = TextSelectionPopup::New( mEnabledPopupButtons, &mTextSelectionPopupCallbackInterface );
 #ifdef DECORATOR_DEBUG
         mCopyPastePopup.actor.SetName("mCopyPastePopup");
 #endif
 #ifdef DECORATOR_DEBUG
         mCopyPastePopup.actor.SetName("mCopyPastePopup");
 #endif
@@ -1213,6 +1215,7 @@ struct Decorator::Impl : public ConnectionTracker
 
   PopupImpl           mCopyPastePopup;
   TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons
 
   PopupImpl           mCopyPastePopup;
   TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons
+  TextSelectionPopupCallbackInterface& mTextSelectionPopupCallbackInterface;
 
   Image               mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT];
   Image               mCursorImage;
 
   Image               mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT];
   Image               mCursorImage;
@@ -1245,9 +1248,11 @@ struct Decorator::Impl : public ConnectionTracker
   bool                mSwapSelectionHandles   : 1; ///< Whether to swap the selection handle images.
 };
 
   bool                mSwapSelectionHandles   : 1; ///< Whether to swap the selection handle images.
 };
 
-DecoratorPtr Decorator::New( ControllerInterface& controller )
+DecoratorPtr Decorator::New( ControllerInterface& controller,
+                             TextSelectionPopupCallbackInterface& callbackInterface )
 {
 {
-  return DecoratorPtr( new Decorator(controller) );
+  return DecoratorPtr( new Decorator( controller,
+                                      callbackInterface ) );
 }
 
 void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
 }
 
 void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
@@ -1479,10 +1484,11 @@ Decorator::~Decorator()
   delete mImpl;
 }
 
   delete mImpl;
 }
 
-Decorator::Decorator( ControllerInterface& controller )
+Decorator::Decorator( ControllerInterface& controller,
+                      TextSelectionPopupCallbackInterface& callbackInterface )
 : mImpl( NULL )
 {
 : mImpl( NULL )
 {
-  mImpl = new Decorator::Impl( controller );
+  mImpl = new Decorator::Impl( controller, callbackInterface );
 }
 
 } // namespace Text
 }
 
 } // namespace Text
index 29d1631..893d981 100644 (file)
@@ -38,6 +38,8 @@ class Vector4;
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
+class TextSelectionPopupCallbackInterface;
+
 namespace Internal
 {
 class Control;
 namespace Internal
 {
 class Control;
@@ -152,9 +154,12 @@ public:
    * @brief Create a new instance of a Decorator.
    *
    * @param[in] controller The controller which receives input events from Decorator components.
    * @brief Create a new instance of a Decorator.
    *
    * @param[in] controller The controller which receives input events from Decorator components.
+   * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
+   *
    * @return A pointer to a new Decorator.
    */
    * @return A pointer to a new Decorator.
    */
-  static DecoratorPtr New( ControllerInterface& controller );
+  static DecoratorPtr New( ControllerInterface& controller,
+                           TextSelectionPopupCallbackInterface& callbackInterface );
 
   /**
    * @brief Set the bounding box which handles, popup and similar decorations will not exceed.
 
   /**
    * @brief Set the bounding box which handles, popup and similar decorations will not exceed.
@@ -487,8 +492,10 @@ private:
   /**
    * @brief Private constructor.
    * @param[in] controller The controller which receives input events from Decorator components.
   /**
    * @brief Private constructor.
    * @param[in] controller The controller which receives input events from Decorator components.
+   * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
    */
    */
-  Decorator( ControllerInterface& controller );
+  Decorator( ControllerInterface& controller,
+             TextSelectionPopupCallbackInterface& callbackInterface );
 
   // Undefined
   Decorator( const Decorator& handle );
 
   // Undefined
   Decorator( const Decorator& handle );
index f63944a..4145a79 100644 (file)
@@ -1432,6 +1432,10 @@ void Controller::DecorationEvent( HandleType handleType, HandleState state, floa
   }
 }
 
   }
 }
 
+void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
+{
+}
+
 ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
 {
   bool update( false );
 ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
 {
   bool update( false );
index 66bf3a0..16e9e3b 100644 (file)
@@ -30,6 +30,7 @@
 #include <dali/public-api/object/ref-object.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/font-run.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/font-run.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
@@ -67,9 +68,11 @@ enum PlaceholderType
  * It provides a view of the text that can be used by rendering back-ends.
  *
  * For selectable/editable UI controls, the controller handles input events from the UI control
  * It provides a view of the text that can be used by rendering back-ends.
  *
  * For selectable/editable UI controls, the controller handles input events from the UI control
- * and decorations (grab handles etc) via an interface.
+ * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
+ *
+ * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
  */
  */
-class Controller : public RefObject, public Decorator::ControllerInterface
+class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface
 {
 public:
 
 {
 public:
 
@@ -539,6 +542,11 @@ public:
    */
   virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
 
    */
   virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
 
+  /**
+   * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
+   */
+  virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
+
 protected:
 
   /**
 protected:
 
   /**