1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__
5 * Copyright (c) 2014 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/dali.h>
33 * Class to create handles and alter their visualisation.
34 * Not responsible for positioning.
37 class TextInputHandles : public ConnectionTracker
53 * Create the selection handles
55 void CreateSelectionHandles();
58 * Un-parents the Selection Handles and resets their Image Actors
60 void DestorySelectionHandles();
63 * Set the Actor visibility on Selection Handle One
64 * @param[in] visibility visibility flag
66 void SetSelectionHandleOneVisibility( bool visibility );
69 * Set the Actor visibility on Selection Handle Two
70 * @param[in] visibility visibility flag
72 void SetSelectionHandleTwoVisibility( bool visibility );
75 * Attach the two selection handles to the pan gesture detector
76 * @param[in] panGestureDetector the PanGestureDetector to attach to
78 void AttachSelectionHandlesToGivenPanGesture(PanGestureDetector& panGestureDetector );
81 * Attach the two selection handles to the tap gesture detector
82 * @param[in] tapGestureDetector the TapGestureDetector to attach to
84 void AttachSelectionHandlesToGivenTapDetector(TapGestureDetector& tapGestureDetector );
87 * Attach the grab handle to the pan gesture detector
88 * @param[in] panGestureDetector the PanGestureDetector to attach to
90 void AttachGrabHandleToGivenPanGesture( PanGestureDetector& panGestureDetector );
93 * Get Selection handle one
94 * @return selection handle actor
96 Actor GetSelectionHandleOne();
99 * Get Selection handle two
100 * @return selection handle actor
102 Actor GetSelectionHandleTwo();
105 * Get the grab handle
106 * @return grab handle Actor
108 Actor GetGrabHandle();
111 * Create the grab handle that positions the cursor
112 * @param[in] image the image to be used.
114 void CreateGrabHandle();
117 * Removes and Resets GrabHandle
119 void DestoryGrabHandle();
122 * Set the image to be used as the cursor grab hander
123 * @pre The text input actor has been initialised.
124 * @param[in] image The image to be used.
126 void SetGrabHandleImage( Dali::Image image );
129 * Set the Actor visibility on the GrabHandle
130 * @param[in] visibility visibility flag
132 void SetGrabHandleVisibility( bool visibility );
134 /* Touch Event Callbacks */
137 * Callback on selection handle touched.
138 * Sets the image depending if handle in pressed or normal state
139 * @param[in] actor touched
140 * @param[in] touch touch event, used to determine if down or up event
142 bool OnSelectionHandleTouched(Dali::Actor actor, const TouchEvent& touch);
147 * @brief Copy Constructor
151 TextInputHandles(const TextInputHandles& handles);
154 * @Assignment Constructor
158 TextInputHandles& operator=(const TextInputHandles& rhs);
162 ImageActor mSelectionHandleOne; // First selection handle used for selecting text to cut&paste
163 ImageActor mSelectionHandleTwo; // Second selection handle used for selecting text to cut&paste
164 Actor mHandleOneGrabArea; // Invisible actor that receives pans events for the selection handle.
165 Actor mHandleTwoGrabArea; // Invisible actor that receives pans events for the selection handle.
167 Image mSelectionHandleOneImage; // image used for selection handle one
168 Image mSelectionHandleOneImagePressed; // image used for selection handle one pressed state
169 Image mSelectionHandleTwoImage; // image used for selection handle two
170 Image mSelectionHandleTwoImagePressed; // image used for selection handle two pressed state
172 Vector3 mSelectionHandleOneOffset; // Handle One's Offset
173 Vector3 mSelectionHandleTwoOffset; // Handle Two's Offset
174 Vector3 mSelectionHandleOneCoordinatePosition; // Actual x y z position of handle
175 Vector3 mSelectionHandleTwoCoordinatePosition; // Actual x y z position of handle
176 std::size_t mSelectionHandleOneStringPosition; // Position of handle along the string of text
177 std::size_t mSelectionHandleTwoStringPosition; // Position of handle along the string of text
179 Image mGrabHandleImage; // Image to be used for grab handle
180 ImageActor mGrabHandle; // Handle used to move cursor for editing
181 Actor mGrabHandleGrabArea; // invisible actor that receives pans events for the grab handle.
183 bool mIsSelectionHandleOneFlipped:1; // Flag to know whether the handle one is flipped or not.
184 bool mIsSelectionHandleTwoFlipped:1; // Flag to know whether the handle two is flipped or not.
188 } // namespace Internal
191 } // namespace Toolkit
195 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__