(Text Controller Impl) Moved event handling related methods into a separate struct
[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 Called by Controller::Impl when a cursor key event is received.
40    *
41    * @param controllerImpl A reference to Controller::Impl
42    * @param event The event
43    */
44   static void OnCursorKeyEvent(Controller::Impl& controllerImpl, const Event& event);
45
46   /**
47    * @brief Called by Controller::Impl when a tap event is received.
48    *
49    * @param controllerImpl A reference to Controller::Impl
50    * @param event The event
51    */
52   static void OnTapEvent(Controller::Impl& controllerImpl, const Event& event);
53
54   /**
55    * @brief Called by Controller::Impl when a pan event is received.
56    *
57    * @param controllerImpl A reference to Controller::Impl
58    * @param event The event
59    */
60   static void OnPanEvent(Controller::Impl& controllerImpl, const Event& event);
61
62   /**
63    * @brief Called by Controller::Impl when a long press event is received.
64    *
65    * @param controllerImpl A reference to Controller::Impl
66    * @param event The event
67    */
68   static void OnLongPressEvent(Controller::Impl& controllerImpl, const Event& event);
69
70   /**
71    * @brief Called by Controller::Impl when a handle event is received.
72    *
73    * @param controllerImpl A reference to Controller::Impl
74    * @param event The event
75    */
76   static void OnHandleEvent(Controller::Impl& controllerImpl, const Event& event);
77
78   /**
79    * @brief Called by Controller::Impl when a select event is received.
80    *
81    * @param controllerImpl A reference to Controller::Impl
82    * @param event The event
83    */
84   static void OnSelectEvent(Controller::Impl& controllerImpl, const Event& event );
85
86   /**
87    * @brief Called by Controller::Impl when a select all event is received.
88    *
89    * @param controllerImpl A reference to Controller::Impl
90    * @param event The event
91    */
92   static void OnSelectAllEvent(Controller::Impl& controllerImpl);
93
94   /**
95    * @brief Called by Controller::Impl when a select none event is received.
96    *
97    * @param controllerImpl A reference to Controller::Impl
98    * @param event The event
99    */
100   static void OnSelectNoneEvent(Controller::Impl& controllerImpl);
101
102 private:
103
104   /**
105    * @brief Called by OnHandleEvent when we are in the Pressed state.
106    *
107    * @param impl A reference to Controller::Impl
108    * @param event The event
109    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
110    */
111   static void OnHandlePressed(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
112
113   /**
114    * @brief Called by OnHandleEvent when we are in the Released state.
115    *
116    * @param impl A reference to Controller::Impl
117    * @param event The event
118    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
119    * @param handleStopScrolling Whether we should handle stop scrolling or not
120    */
121   static void OnHandleReleased(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled, const bool handleStopScrolling);
122
123   /**
124    * @brief Called by OnHandleEvent when we are in the Scrolling state.
125    *
126    * @param impl A reference to Controller::Impl
127    * @param event The event
128    * @param isSmoothHandlePanEnabled Whether smooth handle pan is enabled
129    */
130   static void OnHandleScrolling(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled);
131 };
132
133 } // namespace Text
134
135 } // namespace Toolkit
136
137 } // namespace Dali
138
139 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_H