7493fcc8cc6142a8b977182de0c10592a717239f
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-view / text-view-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/common/dali-vector.h>
22
23 #include <dali/public-api/actors/text-actor.h>
24 #include <dali-toolkit/public-api/controls/control-impl.h>
25 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
26 #include "text-actor-cache.h"
27 #include "text-view-processor-types.h"
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 /**
39  * TextView is a custom control for text aligning and multiline support
40  */
41 class TextView : public ControlImpl
42 {
43 public:
44
45   /**
46    * Internal exceed policy with the valid combinations.
47    */
48   enum ExceedPolicy
49   {
50     Original,             ///< Original size (even if it exceeds the witdh or the height).
51     OriginalFade,         ///< Original size if it exceeds the width but faded if it exceeds the height.
52     OriginalShrink,       ///< Shrunk if it exceeds the height.
53     SplitOriginal,        ///< Split if it exceeds the width but no action if it exceeds the height.
54     SplitFade,            ///< Split if it exceeds the width and faded if it exceeds the height.
55     SplitShrink,          ///< Split if it exceeds the width and shrunk if it exceeds the height.
56     Fade,                 ///< Faded if it exceeds any boundary.
57     FadeOriginal,         ///< Faded if it exceeds the width but no action if it exceeds the height.
58     ShrinkOriginal,       ///< Shrunk if it exceeds the width but no action if it exceeds the height.
59     ShrinkFade,           ///< Shrunk if it exceeds the width and faded if it exceeds the height.
60     Shrink,               ///< Shrunk if it exceeds any boundary.
61     EllipsizeEndOriginal, ///< Ellipsized by the end if it exceeds the width but no action if it exceeds the height.
62     EllipsizeEnd          ///< Ellipsized by the end if it exceeds the width and/or the height.
63   };
64
65   // Between two OnRelaidOut methods, several calls to InsertTextAt, RemoveTextFrom or SetText can happen.
66   // TextViewProcessorMetadata stores the type of operation. A vector stores all operations between two OnRelaidOut calls.
67
68   enum TextViewProcessorMetadataType
69   {
70     TextSet,             ///< Sets new text.
71     TextInserted,        ///< Inserts text into current text.
72     TextReplaced,        ///< Replaces some text from current text.
73     TextRemoved,         ///< Removes some text from current text.
74     NewLineHeight,       ///< Sets a new line height offset.
75     NewStyle             ///< Sets a new style to the whole text.
76   };
77
78   /**
79    * Stores info about which data structures need to be modified when the OnRelaidOut() method is called
80    */
81   struct TextViewProcessorMetadata
82   {
83     TextViewProcessorMetadata();
84
85     TextViewProcessorMetadataType    mType;               ///< Stores the type of operation.
86     std::size_t                      mPosition;           ///< Character position within the text.
87     std::size_t                      mNumberOfCharacters; ///< Number of characters to be removed/ replaced.
88     MarkupProcessor::StyledTextArray mText;               ///< The new text.
89     TextStyle::Mask                  mStyleMask;          ///< The style mask.
90   };
91
92   /**
93    * Defines which operations have to be done in the relayout process.
94    */
95   enum RelayoutOperationMask
96   {
97     NO_RELAYOUT = 0x0,                         ///< Does nothing.
98     RELAYOUT_REMOVE_TEXT_ACTORS = 0x1,         ///< Removes current text-actors from the text-view.
99     RELAYOUT_SIZE_POSITION = 0x2,              ///< Calculates size and position of the text but it doesn't calculate alignment.
100     RELAYOUT_ALIGNMENT = 0x4,                  ///< Aligns the whole text.
101     RELAYOUT_VISIBILITY = 0x8,                 ///< Calculates the visibility.
102     RELAYOUT_INITIALIZE_TEXT_ACTORS = 0x10,    ///< Initialize text-actors (create handles).
103     RELAYOUT_TEXT_ACTOR_UPDATE = 0x20,         ///< Updates text-actors (set size, position, style, ...)
104     RELAYOUT_INSERT_TO_TEXT_VIEW = 0x40,       ///< Adds the text-actors to the text-view.
105     RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST = 0x80, ///< Inserts the text-actors to the text-actor list.
106     RELAYOUT_ALL = 0xFF                        ///< Does all operations.
107   };
108
109   //////////////////////////////////////////////
110
111   /**
112    * Create a new TextView.
113    * @return A smart-pointer to the newly allocated TextView.
114    */
115   static Toolkit::TextView New();
116
117   /**
118    * @copydoc SetText( const std::string& text )
119    */
120   void SetText( const std::string& text );
121
122   /**
123    * @copydoc SetText( const StyledTextArray& text )
124    */
125   void SetText( const MarkupProcessor::StyledTextArray& text );
126
127   /**
128    * @copydoc InsertTextAt( std::size_t position, const std::string& text )
129    */
130   void InsertTextAt( std::size_t position, const std::string& text );
131
132   /**
133    * @copydoc InsertTextAt( std::size_t position, const std::string& text )
134    */
135   void InsertTextAt( std::size_t position, const MarkupProcessor::StyledTextArray& text );
136
137   /**
138    * @copydoc RemoveTextFrom( std::size_t position, std::size_t numberOfCharacters )
139    */
140   void RemoveTextFrom( std::size_t position, std::size_t numberOfCharacters );
141
142   /**
143    * @copydoc ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text )
144    */
145   void ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text );
146
147   /**
148    * @copydoc ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text )
149    */
150   void ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const MarkupProcessor::StyledTextArray& text );
151
152   /**
153    * @copydoc GetText()
154    */
155   std::string GetText() const;
156
157   /**
158    * @copydoc SetFont( const Font newFont )
159    */
160   void SetFont( const Font newFont );
161
162   /**
163    * @copydoc SetLineHeightOffset()
164    */
165   void SetLineHeightOffset( PointSize offset );
166
167   /**
168    * @copydoc GetLineHeightOffset()
169    */
170   PointSize GetLineHeightOffset() const;
171
172   /**
173    * @copydoc SetStyleToCurrentText()
174    */
175   void SetStyleToCurrentText( const TextStyle& style, TextStyle::Mask mask );
176
177   /**
178    * @copydoc SetTextAlignment( Toolkit::Alignment::Type align )
179    */
180   void SetTextAlignment( Toolkit::Alignment::Type align );
181
182   /**
183    * @copydoc GetTextAlignment()
184    */
185   Toolkit::Alignment::Type GetTextAlignment() const;
186
187   /**
188    * @copydoc SetMultilinePolicy()
189    */
190   void SetMultilinePolicy( Toolkit::TextView::MultilinePolicy policy );
191
192   /**
193    * @copydoc GetMultilinePolicy()
194    */
195   Toolkit::TextView::MultilinePolicy GetMultilinePolicy() const;
196
197   /**
198    * @copydoc SetWidthExceedPolicy()
199    */
200   void SetWidthExceedPolicy( Toolkit::TextView::ExceedPolicy policy );
201
202   /**
203    * @copydoc GetWidthExceedPolicy()
204    */
205   Toolkit::TextView::ExceedPolicy GetWidthExceedPolicy() const;
206
207   /**
208    * @copydoc SetHeightExceedPolicy()
209    */
210   void SetHeightExceedPolicy( Toolkit::TextView::ExceedPolicy policy );
211
212   /**
213    * @copydoc GetHeightExceedPolicy()
214    */
215   Toolkit::TextView::ExceedPolicy GetHeightExceedPolicy() const;
216
217   /**
218    * @copydoc SetLineJustification()
219    */
220   void SetLineJustification( Toolkit::TextView::LineJustification justification );
221
222   /**
223    * @copydoc GetLineJustification()
224    */
225   Toolkit::TextView::LineJustification GetLineJustification() const;
226
227   /**
228    * @copydoc SetFadeBoundary()
229    */
230   void SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary );
231
232   /**
233    * @copydoc GetFadeBoundary()
234    */
235   const Toolkit::TextView::FadeBoundary& GetFadeBoundary() const;
236
237   /**
238    * @copydoc SetEllipsizeText()
239    */
240   void SetEllipsizeText( const std::string& ellipsizeText );
241
242   /**
243    * @copydoc SetEllipsizeText()
244    */
245   void SetEllipsizeText( const MarkupProcessor::StyledTextArray& ellipsizeText );
246
247   /**
248    * @copydoc GetEllipsizeText()
249    */
250   std::string GetEllipsizeText() const;
251
252   /**
253    * Checks if relayout the text is needed. If it is, it relais out the text
254    * by calling DoRelayOut().
255    */
256   void GetTextLayoutInfo();
257
258   /**
259    * Calls GetTextLayoutInfo() and fills the given data structure.
260    *
261    * @see GetTextLayoutInfo()
262    */
263   void GetTextLayoutInfo( Toolkit::TextView::TextLayoutInfo& textLayoutInfo );
264
265   /**
266    * @copydoc SetSortModifier()
267    */
268   void SetSortModifier( float depthOffset );
269
270   /**
271    * @copydoc SetSnapshotModeEnabled()
272    */
273   void SetSnapshotModeEnabled( bool enable );
274
275   /**
276    * @copydoc IsSnapshotModeEnabled()
277    */
278   bool IsSnapshotModeEnabled() const;
279
280   /**
281    * @brief Sets whether markup processing should be carried out.
282    *
283    * @param[in] enable whether markup processing is carried out or not.
284    */
285   void SetMarkupProcessingEnabled( bool enable );
286
287   /**
288    * @brief Returns whether markup processing is enabled or not
289    *
290    * @return true is markup processing is enabled
291    */
292   bool IsMarkupProcessingEnabled() const;
293
294   /**
295    * @copydoc SetScrollEnabled()
296    */
297   void SetScrollEnabled( bool enable );
298
299   /**
300    * @copydoc IsScrollEnabled()
301    */
302   bool IsScrollEnabled() const;
303
304   /**
305    * @copydoc SetScrollPosition()
306    * @see DoSetScrollPosition()
307    */
308   void SetScrollPosition( const Vector2& position );
309
310   /**
311    * @copydoc GetScrollPosition()
312    */
313   const Vector2& GetScrollPosition() const;
314
315   /**
316    * @copydoc IsScrollPositionTrimmed()
317    */
318   bool IsScrollPositionTrimmed() const;
319
320   /**
321    * @copydoc ScrolledSignal()
322    */
323   Toolkit::TextView::ScrolledSignalV2& ScrolledSignal();
324
325   /**
326    * Connects a callback function with the object's signals.
327    * @param[in] object The object providing the signal.
328    * @param[in] tracker Used to disconnect the signal.
329    * @param[in] signalName The signal to connect to.
330    * @param[in] functor A newly allocated FunctorDelegate.
331    * @return True if the signal was connected.
332    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
333    */
334   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
335
336 private: // From ControlImpl
337
338   /**
339    * @copydoc Toolkit::Control::OnInitialize()
340    */
341   virtual void OnInitialize();
342
343   /**
344    * @copydoc Toolkit::Control::OnStyleChange()
345    */
346   virtual void OnStyleChange( StyleChange change );
347
348   /**
349    * @copydoc Toolkit::Control::OnControlSizeSet()
350    */
351   virtual void OnControlSizeSet( const Vector3& size );
352
353   /**
354    * @copydoc Toolkit::Control::OnRelaidOut()
355    *
356    * Removes text-actor and calls DoRelayOut()..
357    */
358   virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
359
360   /**
361    * Retrieves the text-view's natural size.
362    *
363    * @return The natural size.
364    */
365   virtual Vector3 GetNaturalSize();
366
367   /**
368    * Retrieves the text-view's \e height for a given \e width.
369    *
370    * @param[in] width The given \e width.
371    *
372    * @return The \e height for the given \e width.
373    */
374   virtual float GetHeightForWidth( float width );
375
376   /**
377    * Retrieves the text-view's \e width for a given \e height.
378    *
379    * @param[in] height The given \e height.
380    *
381    * @return The \e width for the given \e height.
382    */
383   virtual float GetWidthForHeight( float height );
384
385   /**
386    * @copydoc Dali::CustomActorImpl::OnPropertySet()
387    */
388   virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
389
390 protected:
391
392   /**
393    * Construct a new TextView.
394    */
395   TextView();
396
397   /**
398    * A reference counted object may only be deleted by calling Unreference()
399    */
400   virtual ~TextView();
401
402 private:
403
404   // Undefined
405   TextView( const TextView& );
406
407   // Undefined
408   TextView& operator=( const TextView& rhs );
409
410   /**
411    * Executes synchronously relayout operations such as set, insert, remove or replace text, or
412    * split groups of characters, etc.
413    */
414   void PerformTextViewProcessorOperations();
415
416   /**
417    * Optimizes some text-view processor operations.
418    */
419   void OptimizeTextViewProcessorOperations();
420
421   /**
422    * Synchronously relays-out all text-actors.
423    *
424    * Perform text-view-processor operations, sets the new size and position of text-actors and adds them to the text-view.
425    *
426    * @param[in] textViewSize The new text-view's size.
427    * @param[in] relayoutOperationMask Defines which operations need to be done in the relayout process.
428    */
429   void DoRelayOut( const Size& textViewSize, RelayoutOperationMask relayoutOperationMask );
430
431   /**
432    * Process Snapshot. It refresh the render-task in order to generate a new snapshot image.
433    *
434    * ProcessSnapshot is called from OnRelaidOut() only if text has been relaid out.
435    * It creates a new image buffer only if the size of the text has changed.
436    *
437    * @param[in] textViewSize The new text-view's size.
438    */
439   void ProcessSnapshot( const Size& textViewSize );
440
441   /**
442    * Aligns the offscreen rendering camera actor to cover the whole text and the resulting image actor accordingly with the text view's alignment.
443    *
444    * @param[in] textViewSize The text view's size.
445    * @param[in] offscreenSize The offscreen's frame buffer's size.
446    */
447   void AlignOffscreenCameraActor( const Size& textViewSize, const Size& offscreenSize );
448
449   /**
450    * Callback called when the render task has processed.
451    *
452    * It makes the root actor invisible.
453    *
454    * @param[in] renderTask The processed render task.
455    */
456   void RenderTaskFinished( Dali::RenderTask& renderTask );
457
458   /**
459    * Destroys offscreen rendering resources.
460    *
461    * It disconects the render task finished signal from the TextView::RenderTaskFinished() method,
462    * removes the render task from the render task list and resets the offscreen camera actor, root actor,
463    * image actor and the frame buffer.
464    */
465   void DestroyOffscreenRenderingResources();
466
467   /**
468    * Called when text-view is scrolled.
469    *
470    * Sets the new scroll position. @see DoSetScrollPosition()
471    *
472    * @param[in] actor Handle of the text-view.
473    * @param[in] gesture Data structure with the parameters of the gesture.
474    */
475   void OnTextPan( Actor actor, PanGesture gesture );
476
477   /**
478    * Ensures the text-view's boundaries are fully covered of text.
479    *
480    * i.e. if the text-view's size is 100x100 and the text's size is 150x100, the scroll position
481    * can be in the range -50,0 and 50,0.
482    */
483   void TrimScrollPosition();
484
485   /**
486    * Called from SetScrollPosition() and OnTextPan()
487    *
488    * Updates the stored scroll position ensuring the text-view is always covered with text by calling
489    * TrimScrollPosition(), calculates the difference with the previous one and emits the Toolkit::TextView::SignalScrolled() signal.
490    *
491    * @param[in] position The new scroll position.
492    */
493   void DoSetScrollPosition( const Vector2& position );
494
495   /**
496    * Combines width and height exceed policies.
497    *
498    * This method is a big switch() which combines two exceed policies into one.
499    * The aim is avoid this switch inside the relayout code.
500    *
501    * i.e.  Width policy = Split. Height policy = Original. Internally the policy is SplitOriginal.
502    */
503   void CombineExceedPolicies();
504
505   /**
506    * Retrieves the text-view's root actor which stores all text-actors.
507    * It could be the text-view itself or an actor used in the snapshot mode.
508    *
509    * @return the root actor.
510    */
511   Actor GetRootActor() const;
512
513   /**
514    * Handles SetProperty for multiline policy.
515    * @param[in] propertyValue The new property value.
516   */
517   void OnMultilinePolicyPropertySet( Property::Value propertyValue );
518
519   /**
520    * Handles SetProperty for width exceed policy.
521    * @param[in] propertyValue The new property value.
522   */
523   void OnWidthExceedPolicyPropertySet( Property::Value propertyValue );
524
525   /**
526    * Handles SetProperty for height exceed policy.
527    * @param[in] propertyValue The new property value.
528   */
529   void OnHeightExceedPolicyPropertySet( Property::Value propertyValue );
530
531   /**
532    * Handles SetProperty for line justification.
533    * @param[in] propertyValue The new property value.
534   */
535   void OnLineJustificationPropertySet( Property::Value propertyValue );
536
537   /**
538    * Handles SetProperty for fade boundary.
539    * @param[in] propertyIndex The property index.
540    * @param[in] propertyValue The new property value.
541   */
542   void OnFadeBoundaryPropertySet( Property::Index propertyIndex, Property::Value propertyValue );
543
544   /**
545    * Handles SetProperty for alignment property.
546    * @param[in] propertyIndex The property index.
547    * @param[in] propertyValue The new property value.
548   */
549   void OnAlignmentPropertySet( Property::Index propertyIndex, Property::Value propertyValue );
550
551 public:
552
553   /**
554    * The parameters which affects the layout of the text.
555    */
556   struct LayoutParameters
557   {
558     /**
559      * Default constructor.
560      */
561     LayoutParameters();
562
563     /**
564      * Constructor
565      */
566     LayoutParameters( Toolkit::TextView::MultilinePolicy     multilinePolicy,
567                       Toolkit::TextView::ExceedPolicy        widthExceedPolicy,
568                       Toolkit::TextView::ExceedPolicy        heightExceedPolicy,
569                       Toolkit::Alignment::Type               alignment,
570                       Toolkit::TextView::LineJustification   lineJustification,
571                       float                                  lineHeightOffset,
572                       const std::string&                     ellipsizeText,
573                       const bool                             markUpEnabled );
574
575     /**
576      * Copy constructor
577      */
578     LayoutParameters( const LayoutParameters& layoutParameters );
579
580     /**
581      * Assignment operator.
582      */
583     LayoutParameters& operator=( const LayoutParameters& layoutParameters );
584
585     Toolkit::TextView::MultilinePolicy   mMultilinePolicy;     ///< Stores the multiline policy.
586     TextView::ExceedPolicy               mExceedPolicy;        ///< Stores a combination of both policies;
587     Toolkit::TextView::ExceedPolicy      mWidthExceedPolicy;   ///< Stores the text width exceed policy.
588     Toolkit::TextView::ExceedPolicy      mHeightExceedPolicy;  ///< Stores the text height exceed policy.
589     Toolkit::Alignment::Type             mHorizontalAlignment; ///< Stores the horizontal alignment for the whole text.
590     Toolkit::Alignment::Type             mVerticalAlignment;   ///< Stores the vertical alignment for the whole text.
591     Toolkit::TextView::LineJustification mLineJustification;   ///< Stores the line justification.
592     float                                mLineHeightOffset;    ///< Line height offset to be addded to the font line height (measured in PointSize).
593     MarkupProcessor::StyledTextArray     mEllipsizeText;       ///< Stores the ellipsize text
594     bool                                 mMarkUpEnabled:1;     ///< Is markup string scanning enabled
595   };
596
597   /**
598    * Some parameters which affects the text view visualization.
599    */
600   struct VisualParameters
601   {
602     /**
603      * Default constructor.
604      */
605     VisualParameters();
606
607     /**
608      * Copy constructor.
609      */
610     VisualParameters( const VisualParameters& visualParameters );
611
612     /**
613      * Assignment operator.
614      */
615     VisualParameters& operator=( const VisualParameters& visualParameters );
616
617     Toolkit::TextView::FadeBoundary mFadeBoundary;            ///< Fade boundary used in fade mode.
618     float                           mSortModifier;            ///< Stores the sort modifier for all text-actors.
619     Vector2                         mCameraScrollPosition;    ///< The scroll offset.
620     bool                            mSnapshotModeEnabled:1;   ///< Whether text-view is rendered offscreen.
621     bool                            mScrollEnabled:1;         ///< Whether the text scroll is enabled.
622     bool                            mScrollPositionTrimmed:1; ///< Whether the last scroll position set was trimmed.
623   };
624
625   /**
626    * Temporary data used to calculate line justification.
627    */
628   struct LineJustificationInfo
629   {
630     TextViewProcessor::TextInfoIndices mIndices;    ///< Indices to the first character of the new line.
631     float                              mLineLength; ///< Length of the line (or portion of line).
632   };
633
634   /**
635    * The results of the relayout process.
636    */
637   struct RelayoutData
638   {
639     /**
640      * Default constructor.
641      */
642     RelayoutData();
643
644     /**
645      * Copy constructor
646      */
647     RelayoutData( const RelayoutData& relayoutData );
648
649     /**
650      * Assignment operator.
651      */
652     RelayoutData& operator=( const RelayoutData& relayoutData );
653
654     Size                                            mTextViewSize;                ///< The text-view's size used to relaid-out the text.
655     float                                           mShrinkFactor;                ///< Shrink factor used when the exceed policy contains ShrinkToFit.
656     TextViewProcessor::TextLayoutInfo               mTextLayoutInfo;              ///< Stores metrics, layout info (size, direction, type of word) and text-actor info for the whole text.
657     std::vector<int>                                mCharacterLogicalToVisualMap; ///< Reorder map that stores each character's visual (output) index according to its logical (input) index
658     std::vector<int>                                mCharacterVisualToLogicalMap; ///< Reorder map that stores each character's logical (input) index according to its visual (output) index
659     std::vector<RenderableActor>                    mGlyphActors;                 ///< Stores handles of those text-actors which are currently added to the text-view.
660     std::vector<RenderableActor>                    mEllipsizedGlyphActors;       ///< Stores handles of those text-actors which are used to ellipsize the text.
661     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
662     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
663     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
664     std::vector<LineJustificationInfo>              mLineJustificationInfo;       ///< Stores justification info per line.
665     TextActorCache                                  mTextActorCache;              ///< Stores previously created text-actors to be reused.
666   };
667
668 private:
669
670   MarkupProcessor::StyledTextArray       mCurrentStyledText;           ///< text currently displayed by the view
671   std::vector<TextViewProcessorMetadata> mTextViewProcessorOperations; ///< Stores all relayout operations which arrive between two consecutive OnRelaidOut() calls.
672
673   LayoutParameters                       mLayoutParameters;            ///< Stores some layout parameters in a struct. To be passed in layout functions.
674   VisualParameters                       mVisualParameters;            ///< Some parameters which afects text-view visualization.
675   RelayoutData                           mRelayoutData;                ///< struct with text-view's data structures used to pass all of them in one parameter.
676   RelayoutOperationMask                  mRelayoutOperations;          ///< Which relayout operations have to be done.
677
678   Layer                                  mOffscreenRootActor;          ///< Root actor for offscreen rendering.
679   ImageActor                             mOffscreenImageActor;         ///< Image actor for offscreen rendering.
680   CameraActor                            mOffscreenCameraActor;        ///< Camera actor for offscreen rendering.
681   Size                                   mCurrentOffscreenSize;        ///< Current used ofscreen size.
682   FrameBufferImage                       mFrameBufferImage;            ///< Frame buffer used for offscreen rendering.
683   RenderTask                             mRenderTask;                  ///< Used to generate an offscreen rendering.
684
685   PanGestureDetector                     mPanGestureDetector;          ///< Pan gesture for text scrolling.
686
687   /**
688    * Helper class used to prevent the modification of some members.
689    */
690   struct Lock
691   {
692     Lock( bool& lock )
693     : mLock( lock )
694     {
695       mLock = true;
696     }
697
698     ~Lock()
699     {
700       mLock = false;
701     }
702
703     bool& mLock;
704   };
705
706   bool                                            mLockPreviousSnapshotMode;      ///< Whether previous stored snapshot mode should be modified.
707   bool                                            mPreviousSnapshotModeEnabled:1; ///< Stores the previous snapshot mode value.
708   bool                                            mMarkUpEnabled:1;               ///< enable to scan for mark-up
709
710   Toolkit::TextView::ScrolledSignalV2             mScrolledSignalV2;              ///< Signal emitted when text is scrolled.
711
712   Property::Index                                 mPropertyText;                  ///< Property index for text.
713   Property::Index                                 mPropertyMultilinePolicy;       ///< Property index for multiline policy.
714   Property::Index                                 mPropertyWidthExceedPolicy;     ///< Property index for width exceed policy.
715   Property::Index                                 mPropertyHeightExceedPolicy;    ///< Property index for height exceed policy.
716   Property::Index                                 mPropertyLineJustification;     ///< Property index for line justification policy.
717   Property::Index                                 mPropertyFadeBoundaryLeft;      ///< Property index for Left fade boundary.
718   Property::Index                                 mPropertyFadeBoundaryRight;     ///< Property index for Right fade boundary.
719   Property::Index                                 mPropertyFadeBoundaryTop;       ///< Property index for Top fade boundary.
720   Property::Index                                 mPropertyFadeBoundaryBottom;    ///< Property index for Bottom fade boundary.
721   Property::Index                                 mPropertyLineHeightOffset;      ///< Property index for Line height offset.
722   Property::Index                                 mPropertyHorizontalAlignment;   ///< Property index for Horizontal alignment.
723   Property::Index                                 mPropertyVerticalAlignment;     ///< Property index for Vertical alignment.
724 };
725
726 } // namespace Internal
727
728 // Helpers for public-api forwarding methods
729
730 inline Internal::TextView& GetImpl( TextView& textView )
731 {
732   DALI_ASSERT_ALWAYS( textView );
733
734   RefObject& handle = textView.GetImplementation();
735
736   return static_cast< Internal::TextView& >( handle );
737 }
738
739 inline const Internal::TextView& GetImpl( const TextView& textView )
740 {
741   DALI_ASSERT_ALWAYS( textView );
742
743   const RefObject& handle = textView.GetImplementation();
744
745   return static_cast< const Internal::TextView& >( handle );
746 }
747
748 } // namespace Toolkit
749
750 } // namespace Dali
751
752 #endif // __DALI_TOOLKIT_INTERNAL_ITEM_VIEW_H__