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] needsClipping Whether the actor needs clipping.
93 virtual void AddDecoration(Actor& actor, bool needsClipping) = 0;
96 * @brief Gets the color of the control.
98 * @param[out] The color of the control.
100 virtual void GetControlBackgroundColor(Vector4& color) const = 0;
103 * @brief Editable status (on/off).
105 * @return true if it can be edit, else false.
107 virtual bool IsEditable() const = 0;
110 * @brief Change the editable status (on/off) .
112 * @param[in] editable The editable status.
114 virtual void SetEditable(bool editable) = 0;
117 * @brief Called to copy the selected text.
118 * @return The copied text.
120 virtual string CopyText() = 0;
123 * @brief Called to cut the selected text.
124 * @return The cut text.
126 virtual string CutText() = 0;
129 * @brief Called to paste the most recent clipboard text item into the control.
131 virtual void PasteText() = 0;
136 } // namespace Toolkit
140 #endif // DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H