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