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
42 typedef SignalV2< bool () > HandlesReleasedSignal;
45 * Signal emitted when a handle is released
47 HandlesReleasedSignal& ReleasedSignal(){ return mReleasedSignal; };
57 ~TextInputHandles() {};
60 * Create the selection handles
62 void CreateSelectionHandles(){};
65 * Un-parents the Selection Handles and resets their Image Actors
67 void DestorySelectionHandles(){};
70 * Set the Actor visibility on Selection Handle One
71 * @param[in] visibility visibility flag
73 void SetSelectionHandleOneVisibility( bool visibility ){};
76 * Set the Actor visibility on Selection Handle Two
77 * @param[in] visibility visibility flag
79 void SetSelectionHandleTwoVisibility( bool visibility ){};
82 * Attach the two selection handles to the pan gesture detector
83 * @param[in] panGestureDetector the PanGestureDetector to attach to
85 void AttachSelectionHandlesToGivenPanGesture(PanGestureDetector& panGestureDetector ){};
88 * Attach the two selection handles to the tap gesture detector
89 * @param[in] tapGestureDetector the TapGestureDetector to attach to
91 void AttachSelectionHandlesToGivenTapDetector(TapGestureDetector& tapGestureDetector ){};
94 * Attach the grab handle to the pan gesture detector
95 * @param[in] panGestureDetector the PanGestureDetector to attach to
97 void AttachGrabHandleToGivenPanGesture( PanGestureDetector& panGestureDetector ){};
100 * Get Selection handle one
101 * @return selection handle actor
103 Actor GetSelectionHandleOne() { return Actor(); };
106 * Get Selection handle two
107 * @return selection handle actor
109 Actor GetSelectionHandleTwo() { return Actor(); };
112 * Get the grab handle
113 * @return grab handle Actor
115 Actor GetGrabHandle() { return Actor(); };
118 * Create the grab handle that positions the cursor
119 * @param[in] image the image to be used.
121 void CreateGrabHandle(){};
124 * Removes and Resets GrabHandle
126 void DestoryGrabHandle(){};
129 * Set the image to be used as the cursor grab hander
130 * @pre The text input actor has been initialised.
131 * @param[in] image The image to be used.
133 void SetGrabHandleImage( Dali::Image image ){};
136 * Set the Actor visibility on the GrabHandle
137 * @param[in] visibility visibility flag
139 void SetGrabHandleVisibility( bool visibility ){};
141 /* Touch Event Callbacks */
144 * Callback on selection handle touched.
145 * Sets the image depending if handle in pressed or normal state
146 * @param[in] actor touched
147 * @param[in] touch touch event, used to determine if down or up event
149 bool OnSelectionHandleTouched(Dali::Actor actor, const TouchEvent& touch){ return true; };
154 * @brief Copy Constructor
158 TextInputHandles(const TextInputHandles& handles);
161 * @Assignment Constructor
165 TextInputHandles& operator=(const TextInputHandles& rhs);
169 ImageActor mSelectionHandleOne; // First selection handle used for selecting text to cut&paste
170 ImageActor mSelectionHandleTwo; // Second selection handle used for selecting text to cut&paste
171 Actor mHandleOneGrabArea; // Invisible actor that receives pans events for the selection handle.
172 Actor mHandleTwoGrabArea; // Invisible actor that receives pans events for the selection handle.
174 Image mSelectionHandleOneImage; // image used for selection handle one
175 Image mSelectionHandleOneImagePressed; // image used for selection handle one pressed state
176 Image mSelectionHandleTwoImage; // image used for selection handle two
177 Image mSelectionHandleTwoImagePressed; // image used for selection handle two pressed state
179 Vector3 mSelectionHandleOneOffset; // Handle One's Offset
180 Vector3 mSelectionHandleTwoOffset; // Handle Two's Offset
181 Vector3 mSelectionHandleOneCoordinatePosition; // Actual x y z position of handle
182 Vector3 mSelectionHandleTwoCoordinatePosition; // Actual x y z position of handle
183 std::size_t mSelectionHandleOneStringPosition; // Position of handle along the string of text
184 std::size_t mSelectionHandleTwoStringPosition; // Position of handle along the string of text
186 Image mGrabHandleImage; // Image to be used for grab handle
187 ImageActor mGrabHandle; // Handle used to move cursor for editing
188 Actor mGrabHandleGrabArea; // invisible actor that receives pans events for the grab handle.
190 HandlesReleasedSignal mReleasedSignal; // Signal emitted when a handle is released
192 bool mIsSelectionHandleOneFlipped:1; // Flag to know whether the handle one is flipped or not.
193 bool mIsSelectionHandleTwoFlipped:1; // Flag to know whether the handle two is flipped or not.
197 } // namespace Internal
200 } // namespace Toolkit
204 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_HANDLES_H__