Merge "Add GetTextBoundingRectangle API for Text Controllers" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-editor-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/accessibility.h>
23 #include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
24 #include <dali/devel-api/adaptor-framework/input-method-context.h>
25 #include <dali/devel-api/atspi-interfaces/editable-text.h>
26 #include <dali/devel-api/atspi-interfaces/hypertext.h>
27 #include <dali/devel-api/atspi-interfaces/text.h>
28 #include <dali/public-api/animation/animation.h>
29
30 // INTERNAL INCLUDES
31 #include <dali-toolkit/devel-api/controls/control-devel.h>
32 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
33 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
34 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
35 #include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
36 #include <dali-toolkit/internal/text/controller/text-controller.h>
37 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
38 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
39 #include <dali-toolkit/internal/text/text-anchor-control-interface.h>
40 #include <dali-toolkit/internal/text/text-control-interface.h>
41 #include <dali-toolkit/internal/text/text-editable-control-interface.h>
42 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
43 #include <dali-toolkit/internal/text/text-vertical-scroller.h>
44 #include <dali-toolkit/public-api/controls/control-impl.h>
45 #include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
46
47 namespace Dali
48 {
49 namespace Toolkit
50 {
51 namespace Internal
52 {
53 /**
54  * @brief A control which renders a long text string with styles.
55  */
56 class TextEditor : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface, public Text::AnchorControlInterface
57 {
58 public:
59   /**
60    * @copydoc Dali::Toollkit::TextEditor::New()
61    * @param[in] additionalBehaviour custom behavior flags for this TextEditor. Default is CONTROL_BEHAVIOUR_DEFAULT
62    */
63   static Toolkit::TextEditor New(ControlBehaviour additionalBehaviour = ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
64
65   // Properties
66
67   /**
68    * @brief Called when a property of an object of this type is set.
69    *
70    * @param[in] object The object whose property is set.
71    * @param[in] index The property index.
72    * @param[in] value The new property value.
73    */
74   static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
75
76   /**
77    * @brief Called to retrieve a property of an object of this type.
78    *
79    * @param[in] object The object whose property is to be retrieved.
80    * @param[in] index The property index.
81    * @return The current value of the property.
82    */
83   static Property::Value GetProperty(BaseObject* object, Property::Index index);
84
85   /**
86    * @copydoc Dali::Toollkit::TextEditor::GetInputMethodContext()
87    */
88   InputMethodContext GetInputMethodContext();
89
90   /**
91    * @copydoc Dali::Toollkit::TextEditor::MaxLengthReachedSignal()
92    */
93   DevelTextEditor::MaxLengthReachedSignalType& MaxLengthReachedSignal();
94
95   /**
96    * @copydoc Dali::Toollkit::TextEditor::AnchorClickedSignal()
97    */
98   DevelTextEditor::AnchorClickedSignalType& AnchorClickedSignal();
99
100   /**
101    * @copydoc Dali::Toollkit::TextEditor::CursorPositionChangedSignal()
102    */
103   DevelTextEditor::CursorPositionChangedSignalType& CursorPositionChangedSignal();
104
105   /**
106    * @copydoc Dali::Toollkit::TextEditor::InputFilteredSignal()
107    */
108   DevelTextEditor::InputFilteredSignalType& InputFilteredSignal();
109
110   /**
111    * @copydoc Dali::Toollkit::TextEditor::SelectionChangedSignal()
112    */
113   DevelTextEditor::SelectionChangedSignalType& SelectionChangedSignal();
114
115   /**
116    * @copydoc Dali::Toollkit::TextEditor::SelectionClearedSignal()
117    */
118   DevelTextEditor::SelectionClearedSignalType& SelectionClearedSignal();
119
120   /**
121    * @copydoc Dali::Toollkit::TextEditor::SelectionStartedSignal()
122    */
123   DevelTextEditor::SelectionStartedSignalType& SelectionStartedSignal();
124
125   /**
126    * Connects a callback function with the object's signals.
127    * @param[in] object The object providing the signal.
128    * @param[in] tracker Used to disconnect the signal.
129    * @param[in] signalName The signal to connect to.
130    * @param[in] functor A newly allocated FunctorDelegate.
131    * @return True if the signal was connected.
132    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
133    */
134   static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
135
136   /**
137    * @brief Gets text controller
138    *
139    * @return The text controller
140    */
141   Text::ControllerPtr GetTextController();
142
143   /**
144    * @copydoc TextEditor::TextChangedSignal()
145    */
146   Toolkit::TextEditor::TextChangedSignalType& TextChangedSignal();
147
148   /**
149    * @copydoc TextEditor::TextChangedSignal()
150    */
151   Toolkit::TextEditor::InputStyleChangedSignalType& InputStyleChangedSignal();
152
153   /**
154    * @copydoc TextEditor::ScrollStateChangedSignal()
155    */
156   Toolkit::TextEditor::ScrollStateChangedSignalType& ScrollStateChangedSignal();
157
158 private: // From Control
159   /**
160    * @copydoc Control::OnInitialize()
161    */
162   void OnInitialize() override;
163
164   /**
165    * @copydoc Toolkit::Internal::Control::CreateAccessibleObject()
166    */
167   DevelControl::ControlAccessible* CreateAccessibleObject() override;
168
169   /**
170    * @copydoc Control::OnStyleChange()
171    */
172   void OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change) override;
173
174   /**
175    * @copydoc Control::GetNaturalSize()
176    */
177   Vector3 GetNaturalSize() override;
178
179   /**
180    * @copydoc Control::GetHeightForWidth()
181    */
182   float GetHeightForWidth(float width) override;
183
184   /**
185    * @copydoc Control::OnInitialize()
186    */
187   void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
188
189   /**
190    * @copydoc Control::OnKeyInputFocusGained()
191    */
192   void OnKeyInputFocusGained() override;
193
194   /**
195    * @copydoc Control::OnKeyInputFocusLost()
196    */
197   void OnKeyInputFocusLost() override;
198
199   /**
200    * @copydoc Control::OnAccessibilityActivated()
201    */
202   bool OnAccessibilityActivated() override;
203
204   /**
205    * @copydoc Control::OnTap()
206    */
207   void OnTap(const TapGesture& tap) override;
208
209   /**
210    * @copydoc Control::OnPan()
211    */
212   void OnPan(const PanGesture& gesture) override;
213
214   /**
215    * @copydoc Control::OnLongPress()
216    */
217   void OnLongPress(const LongPressGesture& gesture) override;
218
219   /**
220    * @copydoc Control::OnSceneConnection()
221    */
222   void OnSceneConnection(int depth) override;
223
224   /**
225    * @copydoc Control::OnPropertySet()
226    */
227   void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
228
229   /**
230    * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
231    */
232   bool OnKeyEvent(const KeyEvent& event) override;
233
234   // From ControlInterface
235
236   /**
237    * @copydoc Text::ControlInterface::RequestTextRelayout()
238    */
239   void RequestTextRelayout() override;
240
241   // From EditableControlInterface
242
243   /**
244    * @copydoc Text::EditableControlInterface::TextChanged()
245    */
246   void TextInserted(unsigned int position, unsigned int length, const std::string& content) override;
247
248   /**
249    * @copydoc Text::EditableControlInterface::TextDeleted()
250    */
251   void TextDeleted(unsigned int position, unsigned int length, const std::string& content) override;
252
253   /**
254    * @copydoc Text::EditableControlInterface::CursorPositionChanged()
255    */
256   void CursorPositionChanged(unsigned int oldPosition, unsigned int newPosition) override;
257
258   /**
259    * @copydoc Text::EditableControlInterface::TextChanged()
260    */
261   void TextChanged(bool immediate) override;
262
263   /**
264    * @copydoc Text::EditableControlInterface::MaxLengthReached()
265    */
266   void MaxLengthReached() override;
267
268   /**
269    * @copydoc Text::EditableControlInterface::InputStyleChanged()
270    */
271   void InputStyleChanged(Text::InputStyle::Mask inputStyleMask) override;
272
273   /**
274    * @copydoc Text::SelectableControlInterface::SelectionChanged()
275    */
276   void SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd) override;
277
278   /**
279    * @copydoc Text::EditableControlInterface::AddDecoration()
280    */
281   void AddDecoration(Actor& actor, Toolkit::Text::DecorationType type, bool needsClipping) override;
282
283   /**
284    * @copydoc Text::EditableControlInterface::InputFiltered()
285    */
286   void InputFiltered(Toolkit::InputFilter::Property::Type type) override;
287
288   /**
289    * @copydoc Text::EditableControlInterface::GetControlBackgroundColor()
290    */
291   void GetControlBackgroundColor(Vector4& color) const override;
292
293   // From SelectableControlInterface
294 public:
295   /**
296    * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
297    */
298   void SetTextSelectionRange(const uint32_t* start, const uint32_t* end) override;
299
300   /**
301    * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
302    */
303   Uint32Pair GetTextSelectionRange() const override;
304
305   /**
306    * @copydoc Text::SelectableControlInterface::SelectWholeText()
307    */
308   void SelectWholeText() override;
309
310   /**
311    * @copydoc Text::SelectableControlInterface::SelectNone()
312    */
313   void SelectNone() override;
314
315   /**
316    * @copydoc Text::SelectableControlInterface::SelectText()
317    */
318   void SelectText(const uint32_t start, const uint32_t end) override;
319
320   /**
321    * @copydoc Dali::Toolkit::DevelTextEditor::ScrollBy()
322    */
323   void ScrollBy(Vector2 Scroll);
324
325   /**
326    * @brief Get Horizontal scroll position of TextEditor.
327    *
328    * @return Horizontal scroll position (in pixels) of TextEditor.
329    */
330   float GetHorizontalScrollPosition();
331
332   /**
333    * @brief Get Vertical scroll position of TextEditor.
334    *
335    * @return Vertical scroll position (in pixels) of TextEditor.
336    */
337   float GetVerticalScrollPosition();
338
339   /**
340    * @brief Get the rendered size of a specific text range.
341    * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
342    * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
343    *
344    * @param[in] startIndex start index of the text requested to calculate size for.
345    * @param[in] endIndex end index(included) of the text requested to calculate size for.
346    * @return list of sizes of the reuested text.
347    */
348   Vector<Vector2> GetTextSize(const uint32_t startIndex, const uint32_t endIndex) const;
349
350   /**
351    * @brief Get the top/left rendered position of a specific text range.
352    * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
353    * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
354    *
355    * @param[in] startIndex start index of the text requested to get position to.
356    * @param[in] endIndex end index(included) of the text requested to get position to.
357    * @return list of positions of the requested text.
358    */
359   Vector<Vector2> GetTextPosition(const uint32_t startIndex, const uint32_t endIndex) const;
360
361   /**
362    * @brief Get the line bounding rectangle.
363    * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
364    *
365    * @param[in] lineIndex line index to which we want to calculate the geometry for.
366    * @return bounding rectangle.
367    */
368   Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex) const;
369
370   /**
371    * @brief Get the character bounding rectangle.
372    * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
373    *
374    * @param[in] charIndex character index to which we want to calculate the geometry for.
375    * @return bounding rectangle.
376    */
377   Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex) const;
378
379   /**
380    * @brief Get the character index.
381    * If the text is not yet rendered or the text is empty, -1 is returned.
382    *
383    * @param[in] visualX visual x position.
384    * @param[in] visualY visual y position.
385    * @return character index.
386    */
387   int GetCharacterIndexAtPosition(float visualX, float visualY) const;
388
389   /**
390    * @brief Gets the bounding box of a specific text range.
391    *
392    * @param[in] startIndex start index of the text requested to get bounding box to.
393    * @param[in] endIndex end index(included) of the text requested to get bounding box to.
394    * @return bounding box of the requested text.
395    */
396   Rect<> GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const;
397
398   /**
399    * @brief Set the @p spannedText into current textEditor
400    * the spanned text contains content (text) and  format (spans with ranges)
401    * the text is copied into text-controller and the spans are applied on ranges
402    *
403    * @param[in] spannedText the text with spans.
404    */
405   void SetSpannedText(const Text::Spanned& spannedText);
406
407   /**
408    * @copydoc Text::SelectableControlInterface::GetSelectedText()
409    */
410   string GetSelectedText() const override;
411
412   /**
413    * @copydoc Text::EditableControlInterface::IsEditable()
414    */
415   bool IsEditable() const override;
416
417   /**
418    * @copydoc Text::EditableControlInterface::SetEditable()
419    */
420   void SetEditable(bool editable) override;
421
422   /**
423    * @copydoc Text::EditableControlInterface::CopyText()
424    */
425   string CopyText() override;
426
427   /**
428    * @copydoc Text::EditableControlInterface::CutText()
429    */
430   string CutText() override;
431
432   /**
433    * @copydoc Text::EditableControlInterface::PasteText()
434    */
435   void PasteText() override;
436
437   // From AnchorControlInterface
438
439   /**
440    * @copydoc Text::AnchorControlInterface::AnchorClicked()
441    */
442   void AnchorClicked(const std::string& href) override;
443
444 private: // Implementation
445   /**
446    * @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
447    */
448   InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
449
450   /**
451    * @brief Callback when Clipboard signals an item should be pasted
452    * @param[in] clipboard handle to Clipboard Event Notifier
453    */
454   void OnClipboardTextSelected(ClipboardEventNotifier& clipboard);
455
456   /**
457    * @brief Get a Property Map for the image used for the required Handle Image
458    * @param[out] value the returned image property
459    * @param[in] handleType the type of handle
460    * @param[in] handleImageType the type of image for the given handleType
461    */
462   void GetHandleImagePropertyValue(Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType);
463
464   /**
465    * @brief Callback when keyboard is shown/hidden.
466    *
467    * @param[in] keyboardShown True if keyboard is shown.
468    */
469   void KeyboardStatusChanged(bool keyboardShown);
470
471   /**
472    * @brief update scroll bar position
473    *
474    * If text scroll is occurred, create or update scroll bar position
475    */
476   void UpdateScrollBar();
477
478   /**
479    * @brief Callback when TextEditor is touched
480    *
481    * @param[in] actor TextEditor touched
482    * @param[in] touch Touch information
483    */
484   bool OnTouched(Actor actor, const TouchEvent& touch);
485
486   /**
487    * @brief Callbacks called on idle.
488    *
489    * If there are notifications of change of input style on the queue, Toolkit::TextEditor::InputStyleChangedSignal() are emitted.
490    */
491   void OnIdleSignal();
492
493   /**
494    * @brief Emits CursorPositionChanged signal.
495    */
496   void EmitCursorPositionChangedSignal();
497
498   /**
499    * @brief Emits TextChanged signal.
500    */
501   void EmitTextChangedSignal();
502
503   /**
504    * @brief Emits SelectionChanged signal.
505    */
506   void EmitSelectionChangedSignal();
507
508   /**
509    * @brief Emits SelectionCleared signal.
510    */
511   void EmitSelectionClearedSignal();
512
513   /**
514    * @brief Emits SelectionStarted signal.
515    */
516   void EmitSelectionStartedSignal();
517
518   /**
519    * @brief set RenderActor's position with new scrollPosition
520    *
521    * Apply updated scroll position or start scroll animation if VerticalScrollAnimation is enabled
522    */
523   void ApplyScrollPosition();
524
525   /**
526    * @brief Callback function for ScrollBar indicator animation finished signal
527    *
528    * Emit ScrollBarStateChanged Signal and toggle mScrollStarted flag to false
529    */
530   void OnScrollIndicatorAnimationFinished(Animation& animation);
531
532   /**
533   * @brief Callback function for when the layout is changed.
534   * @param[in] actor The actor whose layoutDirection is changed.
535   * @param[in] type  The layoutDirection.
536   */
537   void OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type);
538
539   /**
540   * @brief Add a layer for active or cursor.
541   * @param[in] layer The actor in which to store the layer.
542   * @param[in] actor The new layer to add.
543   */
544   void AddLayer(Actor& layer, Actor& actor);
545
546   /**
547    * Construct a new TextEditor.
548    *
549    * @param[in] additionalBehaviour additional behaviour flags for this TextEditor
550    */
551   TextEditor(ControlBehaviour additionalBehaviour);
552
553   /**
554    * A reference counted object may only be deleted by calling Unreference()
555    */
556   virtual ~TextEditor();
557
558   // Undefined copy constructor and assignment operators
559   TextEditor(const TextEditor&);
560   TextEditor& operator=(const TextEditor& rhs);
561
562   /**
563    * @brief Resize actor to the given size.
564    *
565    * @param[in] actor The actor to be resized.
566    * @param[in] size Size to change.
567    */
568   void ResizeActor(Actor& actor, const Vector2& size);
569
570   /**
571    * @brief Render view, create and attach actor(s) to this text editor.
572    */
573   void RenderText(Text::Controller::UpdateTextType updateTextType);
574
575   // Connection needed to re-render text, when a text editor returns to the scene.
576   void OnSceneConnect(Dali::Actor actor);
577
578   // Needed to synchronize TextAnchor actors with Anchor objects in text's logical model
579   void OnAccessibilityStatusChanged();
580
581 private: // Data
582   // Signals
583   Toolkit::TextEditor::TextChangedSignalType                mTextChangedSignal;
584   Toolkit::TextEditor::InputStyleChangedSignalType          mInputStyleChangedSignal;
585   Toolkit::TextEditor::ScrollStateChangedSignalType         mScrollStateChangedSignal;
586   Toolkit::DevelTextEditor::MaxLengthReachedSignalType      mMaxLengthReachedSignal;
587   Toolkit::DevelTextEditor::AnchorClickedSignalType         mAnchorClickedSignal;
588   Toolkit::DevelTextEditor::InputFilteredSignalType         mInputFilteredSignal;
589   Toolkit::DevelTextEditor::CursorPositionChangedSignalType mCursorPositionChangedSignal;
590   Toolkit::DevelTextEditor::SelectionChangedSignalType      mSelectionChangedSignal;
591   Toolkit::DevelTextEditor::SelectionClearedSignalType      mSelectionClearedSignal;
592   Toolkit::DevelTextEditor::SelectionStartedSignalType      mSelectionStartedSignal;
593
594   InputMethodContext               mInputMethodContext;
595   Text::ControllerPtr              mController;
596   Text::RendererPtr                mRenderer;
597   Text::DecoratorPtr               mDecorator;
598   Text::TextVerticalScrollerPtr    mTextVerticalScroller;
599   Toolkit::Control                 mStencil;
600   Toolkit::ScrollBar               mScrollBar;
601   Dali::Animation                  mAnimation; ///< Scroll indicator Show/Hide Animation.
602   Dali::TimePeriod                 mAnimationPeriod;
603   std::vector<Actor>               mClippingDecorationActors; ///< Decoration actors which need clipping.
604   std::vector<Toolkit::TextAnchor> mAnchorActors;
605   Dali::InputMethodOptions         mInputMethodOptions;
606
607   Actor         mRenderableActor;
608   Actor         mActiveLayer;
609   Actor         mCursorLayer;
610   Actor         mBackgroundActor;
611   CallbackBase* mIdleCallback;
612
613   float mAlignmentOffset;
614   float mScrollAnimationDuration;
615   float mLineSpacing;
616   int   mRenderingBackend;
617   bool  mHasBeenStaged : 1;
618   bool  mScrollAnimationEnabled : 1;
619   bool  mScrollBarEnabled : 1;
620   bool  mScrollStarted : 1;
621   bool  mTextChanged : 1;           ///< If true, emits TextChangedSignal in next OnRelayout().
622   bool  mCursorPositionChanged : 1; ///< If true, emits CursorPositionChangedSignal at the end of OnRelayout().
623   bool  mSelectionChanged : 1;      ///< If true, emits SelectionChangedSignal at the end of OnRelayout().
624   bool  mSelectionCleared : 1;      ///< If true, emits SelectionClearedSignal at the end of OnRelayout().
625
626   //args for cursor PositionChanged event
627   unsigned int mOldPosition;
628
629   //args for selection changed event
630   uint32_t mOldSelectionStart;
631   uint32_t mOldSelectionEnd;
632
633   bool mSelectionStarted : 1; ///< If true, emits SelectionStartedSignal at the end of OnRelayout().
634
635   struct PropertyHandler;
636
637   /**
638    * @brief This structure is to connect TextEditor with Accessible functions.
639    */
640   class TextEditorAccessible : public EditableTextControlAccessible
641   {
642   public:
643     using EditableTextControlAccessible::EditableTextControlAccessible;
644
645     /**
646      * @copydoc Dali::Accessibility::Accessible::GetName()
647      */
648     std::string GetName() const override;
649
650   protected:
651     /**
652      * @copydoc Dali::Toolkit::Internal::TextControlAccessible::GetTextAnchors()
653      */
654     const std::vector<Toolkit::TextAnchor>& GetTextAnchors() const override;
655
656     /**
657      * @copydoc Dali::Toolkit::Internal::TextControlAccessible::GetTextController()
658      */
659     Toolkit::Text::ControllerPtr GetTextController() const override;
660
661     /**
662      * @copydoc Dali::Toolkit::Internal::EditableTextControlAccessible::RequestTextRelayout()
663      */
664     void RequestTextRelayout() override;
665   };
666 };
667
668 } // namespace Internal
669
670 // Helpers for public-api forwarding methods
671
672 inline Toolkit::Internal::TextEditor& GetImpl(Toolkit::TextEditor& textEditor)
673 {
674   DALI_ASSERT_ALWAYS(textEditor);
675
676   Dali::RefObject& handle = textEditor.GetImplementation();
677
678   return static_cast<Toolkit::Internal::TextEditor&>(handle);
679 }
680
681 inline const Toolkit::Internal::TextEditor& GetImpl(const Toolkit::TextEditor& textEditor)
682 {
683   DALI_ASSERT_ALWAYS(textEditor);
684
685   const Dali::RefObject& handle = textEditor.GetImplementation();
686
687   return static_cast<const Toolkit::Internal::TextEditor&>(handle);
688 }
689
690 } // namespace Toolkit
691
692 } // namespace Dali
693
694 #endif // DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H