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
41 typedef SignalV2< bool () > HandlesReleasedSignal;
44 * Signal emitted when a handle is released
46 HandlesReleasedSignal& ReleasedSignal(){ return mReleasedSignal; };
56 ~TextInputHandles() {};
59 * Create the selection handles
61 void CreateSelectionHandles(){};
64 * Un-parents the Selection Handles and resets their Image Actors
66 void DestorySelectionHandles(){};
69 * Set the Actor visibility on Selection Handle One
70 * @param[in] visibility visibility flag
72 void SetSelectionHandleOneVisibility( bool visibility ){};
75 * Set the Actor visibility on Selection Handle Two
76 * @param[in] visibility visibility flag
78 void SetSelectionHandleTwoVisibility( bool visibility ){};
81 * Attach the two selection handles to the pan gesture detector
82 * @param[in] panGestureDetector the PanGestureDetector to attach to
84 void AttachSelectionHandlesToGivenPanGesture(PanGestureDetector& panGestureDetector ){};
87 * Attach the two selection handles to the tap gesture detector
88 * @param[in] tapGestureDetector the TapGestureDetector to attach to
90 void AttachSelectionHandlesToGivenTapDetector(TapGestureDetector& tapGestureDetector ){};
93 * Attach the grab handle to the pan gesture detector
94 * @param[in] panGestureDetector the PanGestureDetector to attach to
96 void AttachGrabHandleToGivenPanGesture( PanGestureDetector& panGestureDetector ){};
99 * Get Selection handle one
100 * @return selection handle actor
102 Actor GetSelectionHandleOne() { return Actor(); };
105 * Get Selection handle two
106 * @return selection handle actor
108 Actor GetSelectionHandleTwo() { return Actor(); };
111 * Get the grab handle
112 * @return grab handle Actor
114 Actor GetGrabHandle() { return Actor(); };
117 * Create the grab handle that positions the cursor
118 * @param[in] image the image to be used.
120 void CreateGrabHandle(){};
123 * Removes and Resets GrabHandle
125 void DestoryGrabHandle(){};
128 * Set the image to be used as the cursor grab hander
129 * @pre The text input actor has been initialised.
130 * @param[in] image The image to be used.
132 void SetGrabHandleImage( Dali::Image image ){};
135 * Set the Actor visibility on the GrabHandle
136 * @param[in] visibility visibility flag
138 void SetGrabHandleVisibility( bool visibility ){};
140 /* Touch Event Callbacks */
143 * Callback on selection handle touched.
144 * Sets the image depending if handle in pressed or normal state
145 * @param[in] actor touched
146 * @param[in] touch touch event, used to determine if down or up event
148 bool OnSelectionHandleTouched(Dali::Actor actor, const TouchEvent& touch){ return true; };
153 * @brief Copy Constructor
157 TextInputHandles(const TextInputHandles& handles);
160 * @Assignment Constructor
164 TextInputHandles& operator=(const TextInputHandles& rhs);
168 ImageActor mSelectionHandleOne; // First selection handle used for selecting text to cut&paste
169 ImageActor mSelectionHandleTwo; // Second selection handle used for selecting text to cut&paste
170 Actor mHandleOneGrabArea; // Invisible actor that receives pans events for the selection handle.
171 Actor mHandleTwoGrabArea; // Invisible actor that receives pans events for the selection handle.
173 Image mSelectionHandleOneImage; // image used for selection handle one
174 Image mSelectionHandleOneImagePressed; // image used for selection handle one pressed state
175 Image mSelectionHandleTwoImage; // image used for selection handle two
176 Image mSelectionHandleTwoImagePressed; // image used for selection handle two pressed state
178 Vector3 mSelectionHandleOneOffset; // Handle One's Offset
179 Vector3 mSelectionHandleTwoOffset; // Handle Two's Offset
180 Vector3 mSelectionHandleOneCoordinatePosition; // Actual x y z position of handle
181 Vector3 mSelectionHandleTwoCoordinatePosition; // Actual x y z position of handle
182 std::size_t mSelectionHandleOneStringPosition; // Position of handle along the string of text
183 std::size_t mSelectionHandleTwoStringPosition; // Position of handle along the string of text
185 Image mGrabHandleImage; // Image to be used for grab handle
186 ImageActor mGrabHandle; // Handle used to move cursor for editing
187 Actor mGrabHandleGrabArea; // invisible actor that receives pans events for the grab handle.
189 HandlesReleasedSignal mReleasedSignal; // Signal emitted when a handle is released
191 bool mIsSelectionHandleOneFlipped:1; // Flag to know whether the handle one is flipped or not.
192 bool mIsSelectionHandleTwoFlipped:1; // Flag to know whether the handle two is flipped or not.
196 } // namespace Internal
199 } // namespace Toolkit
203 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__