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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
32 * Class to create handles and alter their visualisation.
33 * Not responsible for positioning.
36 class TextInputHandles : public ConnectionTracker
52 * Create the selection handles
54 void CreateSelectionHandles();
57 * Un-parents the Selection Handles and resets their Image Actors
59 void DestorySelectionHandles();
62 * Set the Actor visibility on Selection Handle One
63 * @param[in] visibility visibility flag
65 void SetSelectionHandleOneVisibility( bool visibility );
68 * Set the Actor visibility on Selection Handle Two
69 * @param[in] visibility visibility flag
71 void SetSelectionHandleTwoVisibility( bool visibility );
74 * Attach the two selection handles to the pan gesture detector
75 * @param[in] panGestureDetector the PanGestureDetector to attach to
77 void AttachSelectionHandlesToGivenPanGesture(PanGestureDetector& panGestureDetector );
80 * Attach the two selection handles to the tap gesture detector
81 * @param[in] tapGestureDetector the TapGestureDetector to attach to
83 void AttachSelectionHandlesToGivenTapDetector(TapGestureDetector& tapGestureDetector );
86 * Attach the grab handle to the pan gesture detector
87 * @param[in] panGestureDetector the PanGestureDetector to attach to
89 void AttachGrabHandleToGivenPanGesture( PanGestureDetector& panGestureDetector );
92 * Get Selection handle one
93 * @return selection handle actor
95 Actor GetSelectionHandleOne();
98 * Get Selection handle two
99 * @return selection handle actor
101 Actor GetSelectionHandleTwo();
104 * Get the grab handle
105 * @return grab handle Actor
107 Actor GetGrabHandle();
110 * Create the grab handle that positions the cursor
111 * @param[in] image the image to be used.
113 void CreateGrabHandle();
116 * Removes and Resets GrabHandle
118 void DestoryGrabHandle();
121 * Set the image to be used as the cursor grab hander
122 * @pre The text input actor has been initialised.
123 * @param[in] image The image to be used.
125 void SetGrabHandleImage( Dali::Image image );
128 * Set the Actor visibility on the GrabHandle
129 * @param[in] visibility visibility flag
131 void SetGrabHandleVisibility( bool visibility );
133 /* Touch Event Callbacks */
136 * Callback on selection handle touched.
137 * Sets the image depending if handle in pressed or normal state
138 * @param[in] actor touched
139 * @param[in] touch touch event, used to determine if down or up event
141 bool OnSelectionHandleTouched(Dali::Actor actor, const TouchEvent& touch);
146 * @brief Copy Constructor
150 TextInputHandles(const TextInputHandles& handles);
153 * @Assignment Constructor
157 TextInputHandles& operator=(const TextInputHandles& rhs);
161 ImageActor mSelectionHandleOne; // First selection handle used for selecting text to cut&paste
162 ImageActor mSelectionHandleTwo; // Second selection handle used for selecting text to cut&paste
163 Actor mHandleOneGrabArea; // Invisible actor that receives pans events for the selection handle.
164 Actor mHandleTwoGrabArea; // Invisible actor that receives pans events for the selection handle.
166 Image mSelectionHandleOneImage; // image used for selection handle one
167 Image mSelectionHandleOneImagePressed; // image used for selection handle one pressed state
168 Image mSelectionHandleTwoImage; // image used for selection handle two
169 Image mSelectionHandleTwoImagePressed; // image used for selection handle two pressed state
171 Vector3 mSelectionHandleOneOffset; // Handle One's Offset
172 Vector3 mSelectionHandleTwoOffset; // Handle Two's Offset
173 Vector3 mSelectionHandleOneCoordinatePosition; // Actual x y z position of handle
174 Vector3 mSelectionHandleTwoCoordinatePosition; // Actual x y z position of handle
175 std::size_t mSelectionHandleOneStringPosition; // Position of handle along the string of text
176 std::size_t mSelectionHandleTwoStringPosition; // Position of handle along the string of text
178 Image mGrabHandleImage; // Image to be used for grab handle
179 ImageActor mGrabHandle; // Handle used to move cursor for editing
180 Actor mGrabHandleGrabArea; // invisible actor that receives pans events for the grab handle.
182 bool mIsSelectionHandleOneFlipped:1; // Flag to know whether the handle one is flipped or not.
183 bool mIsSelectionHandleTwoFlipped:1; // Flag to know whether the handle two is flipped or not.
187 } // namespace Internal
190 } // namespace Toolkit
194 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__