[dali_1.0.12] Merge branch 'tizen' 03/28503/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 8 Oct 2014 10:15:00 +0000 (11:15 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 8 Oct 2014 10:15:22 +0000 (11:15 +0100)
Change-Id: I960227afa2ef3ad4c230ef34830e480b267583c9

base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.h
base/dali-toolkit/public-api/controls/control-impl.cpp
base/dali-toolkit/public-api/controls/control-impl.h
optional/dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index d2c6c86..7cb426a 100644 (file)
@@ -354,16 +354,20 @@ std::string TextInput::GetMarkupText() const
   return markupString;
 }
 
+void TextInput::ShowPlaceholderText( const MarkupProcessor::StyledTextArray& stylePlaceHolderText )
+{
+  mDisplayedTextView.SetText( stylePlaceHolderText );
+  mPlaceHolderSet = true;
+  mDisplayedTextView.SetScrollPosition( Vector2( 0.0f,0.0f ) );
+}
+
 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
 {
   // Get the placeholder styled text array from the markup string.
   MarkupProcessor::GetStyledTextArray( placeHolderText, mStyledPlaceHolderText, IsMarkupProcessingEnabled() );
-
   if( mStyledText.empty() )
   {
-    // Set the placeholder text only if the styled text is empty.
-    mDisplayedTextView.SetText( mStyledPlaceHolderText );
-    mPlaceHolderSet = true;
+    ShowPlaceholderText( mStyledPlaceHolderText );
   }
 }
 
@@ -403,9 +407,7 @@ void TextInput::SetText(const std::string& initialText)
 
   if( mStyledText.empty() )
   {
-    // If the initial text is empty, set the placeholder text.
-    mDisplayedTextView.SetText( mStyledPlaceHolderText );
-    mPlaceHolderSet = true;
+    ShowPlaceholderText( mStyledPlaceHolderText );
   }
   else
   {
@@ -2271,9 +2273,7 @@ ImfManager::ImfCallbackData TextInput::ImfEventReceived( Dali::ImfManager& imfMa
 
         if( mStyledText.empty() )
         {
-          // Styled text is empty, so set the placeholder text.
-          mDisplayedTextView.SetText( mStyledPlaceHolderText );
-          mPlaceHolderSet = true;
+          ShowPlaceholderText( mStyledPlaceHolderText );
         }
       }
       break;
@@ -2330,14 +2330,13 @@ bool TextInput::PreEditReceived(const std::string& keyString, std::size_t cursor
 
         if( mStyledText.empty() )
         {
-          // Styled text is empty, so set the placeholder text.
-          mDisplayedTextView.SetText( mStyledPlaceHolderText );
-          mPlaceHolderSet = true;
+          ShowPlaceholderText( mStyledPlaceHolderText );
         }
         else
         {
           mDisplayedTextView.RemoveTextFrom( mPreEditStartPosition, numberOfCharactersToReplace );
         }
+
         GetTextLayoutInfo();
         EmitTextModified();
       }
@@ -2558,13 +2557,12 @@ void TextInput::DeleteHighlightedText( bool inheritStyle )
 
     mStyledText.erase( start, end ); // erase range of characters
 
-    // Remove text from TextView.
+    // Remove text from TextView and update place holder text if required
 
+    // Set the placeholder text only if the styled text is empty.
     if( mStyledText.empty() )
     {
-      // Styled text is empty, so set the placeholder text.
-      mDisplayedTextView.SetText( mStyledPlaceHolderText );
-      mPlaceHolderSet = true;
+      ShowPlaceholderText( mStyledPlaceHolderText );
     }
     else
     {
@@ -2691,9 +2689,7 @@ void TextInput::DeleteCharacter( std::size_t positionToDelete )
 
     if( mStyledText.empty() )
     {
-      // Styled text is empty, so set the placeholder text.
-      mDisplayedTextView.SetText( mStyledPlaceHolderText );
-      mPlaceHolderSet = true;
+      ShowPlaceholderText( mStyledPlaceHolderText );
     }
     else
     {
@@ -5095,9 +5091,8 @@ std::size_t TextInput::DoInsertAt( const Text& text, const std::size_t position,
   if( textToInsert.empty() && emptyTextView )
   {
     // No character has been added and the text-view was empty.
-    // Set the placeholder text.
-    mDisplayedTextView.SetText( mStyledPlaceHolderText );
-    mPlaceHolderSet = true;
+    // Show the placeholder text.
+    ShowPlaceholderText( mStyledPlaceHolderText );
   }
   else
   {
index a410205..5801137 100644 (file)
@@ -1346,6 +1346,12 @@ public:  // Public to allow internal testing.
    */
   const Vector4& GetOffsetFromText() const;
 
+  /**
+   * Show the Placeholder text with an already created StyleTextArray
+   * @param[in] stylePlaceHolderText Required placeholder text to be used
+   */
+  void ShowPlaceholderText( const MarkupProcessor::StyledTextArray& stylePlaceHolderText );
+
   // Properties
 
   /**
index 74720d0..c7b03dc 100644 (file)
@@ -556,7 +556,7 @@ public:
 
   Toolkit::Control::SizePolicy mWidthPolicy :3;  ///< Stores the width policy. 3 bits covers 8 values
   Toolkit::Control::SizePolicy mHeightPolicy :3; ///< Stores the height policy. 3 bits covers 8 values
-  ControlBehaviour mFlags :4;             ///< Flags passed in from constructor. Need to increase this size when new enums are added
+  ControlBehaviour mFlags :6;             ///< Flags passed in from constructor. Need to increase this size when new enums are added
   bool mInsideRelayout:1;                 ///< Detect when were in Relayout
   bool mIsKeyboardNavigationSupported:1;  ///< Stores whether keyboard navigation is supported by the control.
   bool mIsKeyboardFocusGroup:1;           ///< Stores whether the control is a focus group.
@@ -617,6 +617,9 @@ void Control::Initialize()
     GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
   }
 
+  SetRequiresHoverEvents(mImpl->mFlags & REQUIRES_HOVER_EVENTS);
+  SetRequiresMouseWheelEvents(mImpl->mFlags & REQUIRES_MOUSE_WHEEL_EVENTS);
+
   mImpl->mInitialized = true;
 }
 
@@ -866,6 +869,11 @@ bool Control::OnTouchEvent(const TouchEvent& event)
   return false; // Do not consume
 }
 
+bool Control::OnHoverEvent(const HoverEvent& event)
+{
+  return false; // Do not consume
+}
+
 bool Control::OnKeyEvent(const KeyEvent& event)
 {
   return false; // Do not consume
index fdcc05f..d863a5d 100644 (file)
@@ -507,6 +507,11 @@ private: // From CustomActorImpl, derived classes can override these.
   virtual bool OnTouchEvent(const TouchEvent& event);
 
   /**
+   * @copydoc Dali::CustomActorImpl::OnHoverEvent(const HoverEvent&)
+   */
+  virtual bool OnHoverEvent(const HoverEvent& event);
+
+  /**
    * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
    */
   virtual bool OnKeyEvent(const KeyEvent& event);
@@ -549,7 +554,9 @@ protected: // Construction
     CONTROL_BEHAVIOUR_NONE        = 0,
     REQUIRES_TOUCH_EVENTS         = 1<<1,     ///< True if the OnTouchEvent() callback is required.
     REQUIRES_STYLE_CHANGE_SIGNALS = 1<<2,     ///< True if needs to monitor style change signals such as theme/font change
-    NO_SIZE_NEGOTIATION           = 1<<3      ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm
+    NO_SIZE_NEGOTIATION           = 1<<3,     ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm
+    REQUIRES_HOVER_EVENTS         = 1<<4,     ///< True if the OnHoverEvent() callback is required.
+    REQUIRES_MOUSE_WHEEL_EVENTS   = 1<<5      ///< True if the OnMouseWheelEvent() callback is required.
   };
 
   /**
index 4fd1edb..58fbe4d 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 11;
+const unsigned int TOOLKIT_MICRO_VERSION = 12;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 973b020..ff9a8ee 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.11
+Version:    1.0.12
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0