1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_EVENT_HANDLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_EVENT_HANDLER_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/devel-api/adaptor-framework/input-method-context.h>
23 #include <dali/public-api/events/gesture-enumerations.h>
24 #include <dali/public-api/events/key-event.h>
25 #include <dali/public-api/math/vector2.h>
28 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
29 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
30 #include <dali-toolkit/internal/text/text-controller.h>
38 struct Controller::EventHandler
40 /// @copydoc Text::Controller::KeyboardFocusGainEvent
41 /// @param[in] controller A reference to the controller class
42 static void KeyboardFocusGainEvent(Controller& controller);
44 /// @copydoc Text::Controller::KeyboardFocusLostEvent
45 /// @param[in] controller A reference to the controller class
46 static void KeyboardFocusLostEvent(Controller& controller);
48 /// @copydoc Text::Controller::KeyEvent
49 /// @param[in] controller A reference to the controller class
50 static bool KeyEvent(Controller& controller, const Dali::KeyEvent& keyEvent);
52 /// @copydoc Text::Controller::AnchorEvent
53 /// @param[in] controller A reference to the controller class
54 static void AnchorEvent(Controller& controller, float x, float y);
56 /// @copydoc Text::Controller::TapEvent
57 /// @param[in] controller A reference to the controller class
58 static void TapEvent(Controller& controller, unsigned int tapCount, float x, float y);
60 /// @copydoc Text::Controller::PanEvent
61 /// @param[in] controller A reference to the controller class
62 static void PanEvent(Controller& controller, GestureState state, const Vector2& displacement);
64 /// @copydoc Text::Controller::LongPressEvent
65 /// @param[in] controller A reference to the controller class
66 static void LongPressEvent(Controller& controller, GestureState state, float x, float y);
68 /// @copydoc Text::Controller::SelectEvent
69 /// @param[in] controller A reference to the controller class
70 static void SelectEvent(Controller& controller, float x, float y, SelectionType selectType);
73 * @brief Creates a selection event with a selection index.
75 * It could be called from the SelectText().
76 * The start and end parameters are passed through the event.
78 * @param[in] controller A reference to the controller class
79 * @param[in] start The start selection position.
80 * @param[in] end The end selection position.
81 * @param[in] selection type like the range.
83 static void SelectEvent(Controller& controller, const uint32_t start, const uint32_t end, SelectionType selectType);
86 * @brief Process queued events which modify the model.
87 * @param[in] controller A reference to the controller class
89 static void ProcessModifyEvents(Controller& controller);
92 * @brief Used to process an event queued from SetText()
93 * @param[in] controller A reference to the controller class
95 static void TextReplacedEvent(Controller& controller);
98 * @brief Used to process an event queued from key events etc.
99 * @param[in] controller A reference to the controller class
101 static void TextInsertedEvent(Controller& controller);
104 * @brief Used to process an event queued from backspace key etc.
105 * @param[in] controller A reference to the controller class
107 static void TextDeletedEvent(Controller& controller);
110 * @brief Helper to KeyEvent() to handle the backspace or delete key case.
112 * @param[in] controller A reference to the controller class
113 * @param[in] keyCode The keycode for the key pressed
114 * @return True if a character was deleted.
116 static bool DeleteEvent(Controller& controller, int keyCode);
118 static InputMethodContext::CallbackData OnInputMethodContextEvent(Controller& controller,
119 InputMethodContext& inputMethodContext,
120 const InputMethodContext::EventData& inputMethodContextEvent);
122 static void PasteClipboardItemEvent(Controller& controller);
123 static void DecorationEvent(Controller& controller, HandleType handleType, HandleState state, float x, float y);
124 static void TextPopupButtonTouched(Controller& controller, Dali::Toolkit::TextSelectionPopup::Buttons button);
129 } // namespace Toolkit
133 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_EVENT_HANDLER_H