fix cursor visible issue
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-editable-control-interface.h
1 #ifndef DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
3
4 /*
5  * Copyright (c) 2021 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/text/input-style.h>
23 #include <dali-toolkit/public-api/controls/text-controls/input-filter-properties.h>
24
25 namespace Dali
26 {
27 class Actor;
28
29 namespace Toolkit
30 {
31 namespace Text
32 {
33 /**
34  * @brief An interface that the Text::Controller uses to notify about text changes and add decoration to the text control.
35  */
36 class EditableControlInterface
37 {
38 public:
39   /**
40    * @brief Virtual destructor.
41    */
42   virtual ~EditableControlInterface()
43   {
44   }
45
46   /**
47    * @brief Called to signal that text has been inserted.
48    */
49   virtual void TextInserted(unsigned int position, unsigned int length, const std::string& content) = 0;
50
51   /**
52    * @brief Called to signal that text has been deleted.
53    */
54   virtual void TextDeleted(unsigned int position, unsigned int length, const std::string& content) = 0;
55
56   /**
57    * @brief Called to signal that caret (cursor position) has been moved.
58    */
59   virtual void CursorPositionChanged(unsigned int oldPosition, unsigned int newPosition) = 0;
60
61   /**
62    * @brief Called to signal that text has been inserted or deleted.
63    *
64    * @param[in] immediate If true, it immediately emits the signal, if false, only emits once the signal when OnRelayout() is called next time.
65    */
66   virtual void TextChanged(bool immediate) = 0;
67
68   /**
69    * @brief Called when the number of characters to be inserted exceeds the maximum limit
70    */
71   virtual void MaxLengthReached() = 0;
72
73   /**
74    * @brief Called to signal that input style has been changed.
75    *
76    * @param[in] inputStyleMask Mask with the bits of the input style that has changed.
77    */
78   virtual void InputStyleChanged(InputStyle::Mask inputStyleMask) = 0;
79
80   /**
81    * @brief Called when the character to be inserted is filtered by the input filter.
82    *
83    * @param[in] type The filter type is ACCEPTED or REJECTED.
84    */
85   virtual void InputFiltered(Toolkit::InputFilter::Property::Type type) = 0;
86
87   /**
88    * @brief Add a decoration.
89    *
90    * @param[in] decoration The actor displaying a decoration.
91    * @param[in] type Whether this decoration is a layer or not, which layer it is.
92    * @param[in] needsClipping Whether the actor needs clipping.
93    */
94   virtual void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) = 0;
95
96   /**
97    * @brief Gets the color of the control.
98    *
99    * @param[out] The color of the control.
100    */
101   virtual void GetControlBackgroundColor(Vector4& color) const = 0;
102
103   /**
104    * @brief Editable status (on/off).
105    *
106    * @return true if it can be edit, else false.
107    */
108   virtual bool IsEditable() const = 0;
109
110   /**
111    * @brief Change the editable status (on/off) .
112    *
113    * @param[in] editable The editable status.
114    */
115   virtual void SetEditable(bool editable) = 0;
116
117   /**
118    * @brief Called to copy the selected text.
119    * @return The copied text.
120    */
121   virtual string CopyText() = 0;
122
123   /**
124    * @brief Called to cut the selected text.
125    * @return The cut text.
126    */
127   virtual string CutText() = 0;
128
129   /**
130    * @brief Called to paste the most recent clipboard text item into the control.
131    */
132   virtual void PasteText() = 0;
133 };
134
135 } // namespace Text
136
137 } // namespace Toolkit
138
139 } // namespace Dali
140
141 #endif // DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H