1 #ifndef DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/internal/text/input-style.h>
23 #include <dali-toolkit/public-api/controls/text-controls/input-filter-properties.h>
34 * @brief An interface that the Text::Controller uses to notify about text changes and add decoration to the text control.
36 class EditableControlInterface
40 * @brief Virtual destructor.
42 virtual ~EditableControlInterface()
47 * @brief Called to signal that text has been inserted.
49 virtual void TextInserted(unsigned int position, unsigned int length, const std::string& content) = 0;
52 * @brief Called to signal that text has been deleted.
54 virtual void TextDeleted(unsigned int position, unsigned int length, const std::string& content) = 0;
57 * @brief Called to signal that caret (cursor position) has been moved.
59 virtual void CursorPositionChanged(unsigned int oldPosition, unsigned int newPosition) = 0;
62 * @brief Called to signal that text has been inserted or deleted.
64 * @param[in] immediate If true, it immediately emits the signal, if false, only emits once the signal when OnRelayout() is called next time.
66 virtual void TextChanged(bool immediate) = 0;
69 * @brief Called when the number of characters to be inserted exceeds the maximum limit
71 virtual void MaxLengthReached() = 0;
74 * @brief Called to signal that input style has been changed.
76 * @param[in] inputStyleMask Mask with the bits of the input style that has changed.
78 virtual void InputStyleChanged(InputStyle::Mask inputStyleMask) = 0;
81 * @brief Called when the character to be inserted is filtered by the input filter.
83 * @param[in] type The filter type is ACCEPTED or REJECTED.
85 virtual void InputFiltered(Toolkit::InputFilter::Property::Type type) = 0;
88 * @brief Add a decoration.
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.
94 virtual void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) = 0;
97 * @brief Gets the color of the control.
99 * @param[out] The color of the control.
101 virtual void GetControlBackgroundColor(Vector4& color) const = 0;
104 * @brief Editable status (on/off).
106 * @return true if it can be edit, else false.
108 virtual bool IsEditable() const = 0;
111 * @brief Change the editable status (on/off) .
113 * @param[in] editable The editable status.
115 virtual void SetEditable(bool editable) = 0;
118 * @brief Called to copy the selected text.
119 * @return The copied text.
121 virtual string CopyText() = 0;
124 * @brief Called to cut the selected text.
125 * @return The cut text.
127 virtual string CutText() = 0;
130 * @brief Called to paste the most recent clipboard text item into the control.
132 virtual void PasteText() = 0;
137 } // namespace Toolkit
141 #endif // DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H