DALi signals refactor to remove V2 naming
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-impl.h
index d723d8d..ac82fc8 100644 (file)
@@ -1,30 +1,35 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_H__
 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_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/public-api/common/dali-vector.h>
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/images/glyph-image.h>
+#include <dali/public-api/render-tasks/render-task.h>
 
-#include <dali/public-api/actors/text-actor.h>
+// INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
-#include "text-actor-cache.h"
-#include "text-view-processor-types.h"
+#include <dali-toolkit/internal/controls/text-view/text-actor-cache.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
 
 namespace Dali
 {
@@ -38,14 +43,14 @@ namespace Internal
 /**
  * TextView is a custom control for text aligning and multiline support
  */
-class TextView : public ControlImpl
+class TextView : public Control
 {
 public:
 
   // Properties
   enum
   {
-    TEXTVIEW_PROPERTY_START_INDEX = ControlImpl::CONTROL_PROPERTY_END_INDEX + 1,
+    TEXTVIEW_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
     TEXTVIEW_PROPERTY_END_INDEX = TEXTVIEW_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
   };
 
@@ -92,7 +97,7 @@ public:
 
     TextViewProcessorMetadataType    mType;               ///< Stores the type of operation.
     std::size_t                      mPosition;           ///< Character position within the text.
-    std::size_t                      mNumberOfCharacters; ///< Number of characters to be removed/ replaced.
+    std::size_t                      mNumberOfCharacters; ///< Number of characters to be removed/replaced.
     MarkupProcessor::StyledTextArray mText;               ///< The new text.
     TextStyle::Mask                  mStyleMask;          ///< The style mask.
   };
@@ -110,7 +115,6 @@ public:
     RELAYOUT_INITIALIZE_TEXT_ACTORS = 0x10,    ///< Initialize text-actors (create handles).
     RELAYOUT_TEXT_ACTOR_UPDATE = 0x20,         ///< Updates text-actors (set size, position, style, ...)
     RELAYOUT_INSERT_TO_TEXT_VIEW = 0x40,       ///< Adds the text-actors to the text-view.
-    RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST = 0x80, ///< Inserts the text-actors to the text-actor list.
     RELAYOUT_ALL = 0xFF                        ///< Does all operations.
   };
 
@@ -163,11 +167,6 @@ public:
   std::string GetText() const;
 
   /**
-   * @copydoc SetFont( const Font newFont )
-   */
-  void SetFont( const Font newFont );
-
-  /**
    * @copydoc SetLineHeightOffset()
    */
   void SetLineHeightOffset( PointSize offset );
@@ -253,6 +252,11 @@ public:
   void SetEllipsizeText( const MarkupProcessor::StyledTextArray& ellipsizeText );
 
   /**
+   * @copydoc SetEllipsizeText()
+   */
+  void SetEllipsizeText( const Text& ellipsizeText, const Vector<TextStyle*>& ellipsizeStyles );
+
+  /**
    * @copydoc GetEllipsizeText()
    */
   std::string GetEllipsizeText() const;
@@ -328,7 +332,7 @@ public:
   /**
    * @copydoc ScrolledSignal()
    */
-  Toolkit::TextView::ScrolledSignalV2& ScrolledSignal();
+  Toolkit::TextView::ScrolledSignalType& ScrolledSignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -360,7 +364,7 @@ public:
   static Property::Value GetProperty( BaseObject* object, Property::Index index );
 
 
-private: // From ControlImpl
+private: // From Control
 
   /**
    * @copydoc Toolkit::Control::OnInitialize()
@@ -368,9 +372,9 @@ private: // From ControlImpl
   virtual void OnInitialize();
 
   /**
-   * @copydoc Toolkit::Control::OnStyleChange()
+   * @copydoc Toolkit::Control::OnFontChange( )
    */
-  virtual void OnStyleChange( StyleChange change );
+  virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );
 
   /**
    * @copydoc Toolkit::Control::OnControlSizeSet()
@@ -430,8 +434,7 @@ private:
   TextView& operator=( const TextView& rhs );
 
   /**
-   * Executes synchronously relayout operations such as set, insert, remove or replace text, or
-   * split groups of characters, etc.
+   * Executes synchronously relayout operations such as set, insert, remove or replace text, etc.
    */
   void PerformTextViewProcessorOperations();
 
@@ -494,7 +497,7 @@ private:
    * @param[in] actor Handle of the text-view.
    * @param[in] gesture Data structure with the parameters of the gesture.
    */
-  void OnTextPan( Actor actor, PanGesture gesture );
+  void OnTextPan( Actor actor, const PanGesture& gesture );
 
   /**
    * Ensures the text-view's boundaries are fully covered of text.
@@ -533,6 +536,11 @@ private:
   Actor GetRootActor() const;
 
   /**
+   * Creates the ellipsize text layout.
+   */
+  void CreateEllipsizeLayout();
+
+  /**
    * Handle SetProperty for markup processing.
    * @param[in] propertyValue The new property value.
    */
@@ -600,6 +608,11 @@ public:
     LayoutParameters();
 
     /**
+     * Default destructor.
+     */
+    ~LayoutParameters();
+
+    /**
      * Constructor
      */
     LayoutParameters( Toolkit::TextView::MultilinePolicy     multilinePolicy,
@@ -608,8 +621,7 @@ public:
                       Toolkit::Alignment::Type               alignment,
                       Toolkit::TextView::LineJustification   lineJustification,
                       float                                  lineHeightOffset,
-                      const std::string&                     ellipsizeText,
-                      const bool                             markUpEnabled );
+                      bool                                   markUpEnabled );
 
     /**
      * Copy constructor
@@ -622,15 +634,14 @@ public:
     LayoutParameters& operator=( const LayoutParameters& layoutParameters );
 
     Toolkit::TextView::MultilinePolicy   mMultilinePolicy;     ///< Stores the multiline policy.
-    TextView::ExceedPolicy               mExceedPolicy;        ///< Stores a combination of both policies;
+    TextView::ExceedPolicy               mExceedPolicy;        ///< Stores a combination of both policies.
     Toolkit::TextView::ExceedPolicy      mWidthExceedPolicy;   ///< Stores the text width exceed policy.
     Toolkit::TextView::ExceedPolicy      mHeightExceedPolicy;  ///< Stores the text height exceed policy.
     Toolkit::Alignment::Type             mHorizontalAlignment; ///< Stores the horizontal alignment for the whole text.
     Toolkit::Alignment::Type             mVerticalAlignment;   ///< Stores the vertical alignment for the whole text.
     Toolkit::TextView::LineJustification mLineJustification;   ///< Stores the line justification.
     float                                mLineHeightOffset;    ///< Line height offset to be addded to the font line height (measured in PointSize).
-    MarkupProcessor::StyledTextArray     mEllipsizeText;       ///< Stores the ellipsize text
-    bool                                 mMarkUpEnabled:1;     ///< Is markup string scanning enabled
+    bool                                 mMarkUpEnabled:1;     ///< Is markup string scanning enabled.
   };
 
   /**
@@ -662,15 +673,6 @@ public:
   };
 
   /**
-   * Temporary data used to calculate line justification.
-   */
-  struct LineJustificationInfo
-  {
-    TextViewProcessor::TextInfoIndices mIndices;    ///< Indices to the first character of the new line.
-    float                              mLineLength; ///< Length of the line (or portion of line).
-  };
-
-  /**
    * The results of the relayout process.
    */
   struct RelayoutData
@@ -700,7 +702,6 @@ public:
     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
-    std::vector<LineJustificationInfo>              mLineJustificationInfo;       ///< Stores justification info per line.
     TextActorCache                                  mTextActorCache;              ///< Stores previously created text-actors to be reused.
   };
 
@@ -746,7 +747,7 @@ private:
   bool                                            mPreviousSnapshotModeEnabled:1; ///< Stores the previous snapshot mode value.
   bool                                            mMarkUpEnabled:1;               ///< enable to scan for mark-up
 
-  Toolkit::TextView::ScrolledSignalV2             mScrolledSignalV2;              ///< Signal emitted when text is scrolled.
+  Toolkit::TextView::ScrolledSignalType             mScrolledSignal;              ///< Signal emitted when text is scrolled.
 };
 
 } // namespace Internal