e1e9dbbd02e88b0263f865c30f7dc2c5226394fe
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl-event-handler.h
1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_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/text-controller-impl.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Text
29 {
30 /**
31  * Contains all the event handling methods for Text::Controller::Impl
32  */
33 struct ControllerImplEventHandler
34 {
35   /**
36    * @brief Processes input events
37    *
38    * @param[in] impl A reference to Controller::Impl
39    * @return True if the decorator has been updated
40    */
41   static bool ProcessInputEvents(Controller::Impl& impl);
42
43   /**
44    * @brief Called by Controller::Impl when a cursor key event is received.
45    *
46    * @param controllerImpl A reference to Controller::Impl
47    * @param event The event
48    */
49   static void OnCursorKeyEvent(Controller::Impl& controllerImpl, const Event& event);
50
51   /**
52    * @brief Called by Controller::Impl when a tap event is received.
53    *
54    * @param controllerImpl A reference to Controller::Impl
55    * @param event The event
56    */
57   static void OnTapEvent(Controller::Impl& controllerImpl, const Event& event);
58
59   /**
60    * @brief Called by Controller::Impl when a pan event is received.
61    *
62    * @param controllerImpl A reference to Controller::Impl
63    * @param event The event
64    */
65   static void OnPanEvent(Controller::Impl& controllerImpl, const Event& event);
66
67   /**
68    * @brief Called by Controller::Impl when a long press event is received.
69    *
70    * @param controllerImpl A reference to Controller::Impl
71    * @param event The event
72    */
73   static void OnLongPressEvent(Controller::Impl& controllerImpl, const Event& event);
74
75   /**
76    * @brief Called by Controller::Impl when a handle event is received.
77    *
78    * @param controllerImpl A reference to Controller::Impl
79    * @param event The event
80    */
81   static void OnHandleEvent(Controller::Impl& controllerImpl, const Event& event);
82
83   /**
84    * @brief Called by Controller::Impl when a select event is received.
85    *
86    * @param controllerImpl A reference to Controller::Impl
87    * @param event The event
88    */
89   static void OnSelectEvent(Controller::Impl& controllerImpl, const Event& event);
90
91   /**
92    * @brief Called by Controller::Impl when a select all event is received.
93    *
94    * @param controllerImpl A reference to Controller::Impl
95    * @param event The event
96    */
97   static void OnSelectAllEvent(Controller::Impl& controllerImpl);
98
99   /**
100    * @brief Called by Controller::Impl when a select none event is received.
101    *
102    * @param controllerImpl A reference to Controller::Impl
103    * @param event The event
104    */
105   static void OnSelectNoneEvent(Controller::Impl& controllerImpl);
106
107 private:
108   /**
109    * @brief Called by OnHandleEvent when we are in the Pressed state.
110    *
111    * @param impl A reference to Controller::Impl
112    * @param event The event
113    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
114    */
115   static void OnHandlePressed(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
116
117   /**
118    * @brief Called by OnHandleEvent when we are in the Released state.
119    *
120    * @param impl A reference to Controller::Impl
121    * @param event The event
122    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
123    * @param handleStopScrolling Whether we should handle stop scrolling or not
124    */
125   static void OnHandleReleased(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled, const bool handleStopScrolling);
126
127   /**
128    * @brief Called by OnHandleEvent when we are in the Scrolling state.
129    *
130    * @param impl A reference to Controller::Impl
131    * @param event The event
132    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
133    */
134   static void OnHandleScrolling(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
135 };
136
137 } // namespace Text
138
139 } // namespace Toolkit
140
141 } // namespace Dali
142
143 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_H