TextInput PopUp supports scrolling if buttons do not fit in visible area.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-input / text-input-impl.h
index 1712d2e..9eb5ee6 100644 (file)
@@ -1,21 +1,22 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_H__
 #define __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * Copyright (c) 2014 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/public-api/controls/control-impl.h>
@@ -46,6 +47,13 @@ class TextInput : public Control
 {
 public:
 
+  // Properties
+  enum
+  {
+    TEXTINPUT_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+    TEXTINPUT_PROPERTY_END_INDEX = TEXTINPUT_PROPERTY_START_INDEX + 512 ///< Reserving property indices
+  };
+
   /**
    * Create a new TextInput
    * @return instrusive ptr to a TextInput
@@ -130,6 +138,11 @@ public:
   Toolkit::TextInput::StyleChangedSignalV2& StyleChangedSignal();
 
   /**
+   * @copydoc Toolkit::TextInput::TextModifiedSignal()
+   */
+  Toolkit::TextInput::TextModifiedSignalType& TextModifiedSignal();
+
+  /**
    * @copydoc Toolkit::TextInput::MaxInputCharactersReachedSignal()
    */
   Toolkit::TextInput::MaxInputCharactersReachedSignalV2& MaxInputCharactersReachedSignal();
@@ -372,6 +385,22 @@ public:
    */
   std::size_t GetNumberOfCharacters() const;
 
+  /**
+   * Styling
+   */
+
+  /**
+   * Set the diffuse color for the highlight
+   * @param[in] color color to use
+   */
+  void SetMaterialDiffuseColor( const Vector4& color );
+
+  /**
+   * Get the diffuse color used by the highlight
+   * @return color
+   */
+  const Vector4& GetMaterialDiffuseColor() const;
+
 private:
 
   /**
@@ -1026,15 +1055,9 @@ public:  // Public to allow internal testing.
   void ClearPopup();
 
   /**
-   * Adds a popup option.
-   * @note Creates popup frame if not already created.
-   * @param[in] name The unique name for this option.
-   * @param[in] caption The caption (label) for this option
-   * @param[in] icon the image icon to be displayed for this option
-   * @param[in] finalOption Flag to indicate that this is the final option.
-   * (set to true on the last option you add)
+   * Adds Popup options which have been enabled.
    */
-  void AddPopupOption(const std::string& name, const std::string& caption, const Image icon, bool finalOption = false);
+  void AddPopupOptions();
 
   /**
    * Sets popup position
@@ -1310,12 +1333,35 @@ public:  // Public to allow internal testing.
    */
   void GetTextLayoutInfo();
 
+  // Properties
+
+  /**
+   * Called when a property of an object of this type is set.
+   * @param[in] object The object whose property is set.
+   * @param[in] index The property index.
+   * @param[in] value The new property value.
+   */
+  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+  /**
+   * Called to retrieve a property of an object of this type.
+   * @param[in] object The object whose property is to be retrieved.
+   * @param[in] index The property index.
+   * @return The current value of the property.
+   */
+  static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+
   /**
    * Emits the style changed signal.
    */
   void EmitStyleChangedSignal();
 
   /**
+   * Emit signal when text is modified.
+   */
+  void EmitTextModified();
+
+  /**
    * Emits max input characters reached signal.
    */
   void EmitMaxInputCharactersReachedSignal();
@@ -1408,6 +1454,9 @@ private:
 
   Clipboard mClipboard;                  ///< Handle to clipboard
 
+  // Styling
+  Vector4           mMaterialColor;      // Color of the highlight
+
   bool mOverrideAutomaticAlignment:1;    ///< Whether to override the alignment automatically set by the text content (e.g. european LTR or arabic RTL)
   bool mCursorRTLEnabled:1;              ///< Enable state of Alternate RTL Cursor (need to keep track of this as it's not always enabled)
   bool mClosestCursorPositionEOL:1;      ///< closest cursor position is end of line.
@@ -1445,6 +1494,7 @@ private:
   Toolkit::TextInput::InputSignalV2                      mInputStartedSignalV2;              ///< Signal emitted when input starts
   Toolkit::TextInput::InputSignalV2                      mInputFinishedSignalV2;             ///< Signal emitted when input ends
   Toolkit::TextInput::StyleChangedSignalV2               mStyleChangedSignalV2;              ///< Signal emitted when style changes.
+  Toolkit::TextInput::TextModifiedSignalType             mTextModifiedSignal;                ///< Signal emitted when text modified.
   Toolkit::TextInput::MaxInputCharactersReachedSignalV2  mMaxInputCharactersReachedSignalV2; ///< Signal emitted when max input characters is reached.
   Toolkit::TextInput::InputSignalV2                      mCutAndPasteToolBarDisplayedV2;     ///< Signal emitted when toolbar displayed
   Toolkit::TextInput::InputTextExceedBoundariesSignalV2  mInputTextExceedBoundariesSignalV2; ///< Signal emitted when input text exceeds the boundaries of the text-input.