Remove useless iteration when debug mode
[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   /**
108    * @brief Called by Controller::Impl when a select range event is received.
109    *
110    * @param controllerImpl A reference to Controller::Impl
111    * @param event The event
112    */
113   static void OnSelectRangeEvent(Controller::Impl& controllerImpl, const Event& event);
114
115 private:
116   /**
117    * @brief Called by OnHandleEvent when we are in the Pressed state.
118    *
119    * @param impl A reference to Controller::Impl
120    * @param event The event
121    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
122    */
123   static void OnHandlePressed(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
124
125   /**
126    * @brief Called by OnHandleEvent when we are in the Released state.
127    *
128    * @param impl A reference to Controller::Impl
129    * @param event The event
130    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
131    * @param handleStopScrolling Whether we should handle stop scrolling or not
132    */
133   static void OnHandleReleased(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled, const bool handleStopScrolling);
134
135   /**
136    * @brief Called by OnHandleEvent when we are in the Scrolling state.
137    *
138    * @param impl A reference to Controller::Impl
139    * @param event The event
140    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
141    */
142   static void OnHandleScrolling(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
143 };
144
145 } // namespace Text
146
147 } // namespace Toolkit
148
149 } // namespace Dali
150
151 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_H