1 #ifndef __DALI_VIRTUAL_KEYBOARD_H__
2 #define __DALI_VIRTUAL_KEYBOARD_H__
5 * Copyright (c) 2015 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/public-api/signals/dali-signal.h>
23 #include <dali/public-api/math/rect.h>
29 * @brief This namespace is provided for application developers to be able to show and hide the on-screen keyboard.
31 * Key events are sent to the actor in focus. Focus is set through the actor Public API.
33 namespace VirtualKeyboard
38 typedef Signal< void () > VoidSignalType;
39 typedef Signal< void (bool) > StatusSignalType;
44 * @brief The direction of text.
53 * @brief The meaning of the return key.
70 * @brief Show the virtual keyboard.
72 DALI_IMPORT_API void Show();
75 * @brief Hide the virtual keyboard.
77 DALI_IMPORT_API void Hide();
80 * @brief Returns whether the virtual keyboard is visible or not.
81 * @return true if visible, false otherwise.
83 DALI_IMPORT_API bool IsVisible();
86 * @brief Set the specific return key into the virtual keyboard.
87 * @param[in] type the kind of return key types.
89 DALI_IMPORT_API void SetReturnKeyType( ReturnKeyType type );
92 * @brief Retrieve the current return key type.
93 * @return the type of retun key.
95 DALI_IMPORT_API ReturnKeyType GetReturnKeyType();
98 * @brief Enable/disable prediction (predictive text).
100 * By default prediction text is enabled.
101 * @param[in] enable true or false to enable or disable
102 * Prediction can not be changed while the keyboard is visible. It must be set in advance of showing keyboard.
104 DALI_IMPORT_API void EnablePrediction(const bool enable);
107 * @brief Returns whether prediction is enabled in the virtual keyboard
108 * @return true if predictive text enabled, false otherwise.
110 DALI_IMPORT_API bool IsPredictionEnabled();
113 * @brief Provides size and position of keyboard.
115 * Position is relative to whether keyboard is visible or not.
116 * If keyboard is not visible then position will be off the screen.
117 * If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get
118 * the values then taken down. So ideally GetSizeAndPosition() should be called after Show().
119 * @return rect which is keyboard panel x, y, width, height
121 DALI_IMPORT_API Dali::Rect<int> GetSizeAndPosition();
124 * @brief Rotates the keyboard orientation to the given angle.
126 * A value of 0 indicates the portrait orientation.
127 * Other valid values are 90, 180, 270.
128 * @param angle the angle is in degrees.
130 DALI_IMPORT_API void RotateTo(int angle);
133 * @brief Returns text direction of the keyboard's current input language.
134 * @return The direction of the text.
136 DALI_IMPORT_API TextDirection GetTextDirection();
139 * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
141 * A callback of the following type may be connected:
143 * void YourCallbackName(bool keyboardShown);
145 * If the parameter keyboardShown is true, then the keyboard has just shown, if it is false, then it
146 * has just been hidden.
147 * @return The signal to connect to.
149 DALI_IMPORT_API StatusSignalType& StatusChangedSignal();
152 * @brief Connect to this signal to be notified when the virtual keyboard is resized.
154 * A callback of the following type may be connected:
156 * void YourCallbackName();
158 * User can get changed size by using GetSizeAndPosition() in the callback
159 * @return The signal to connect to.
161 DALI_IMPORT_API VoidSignalType& ResizedSignal();
164 * @brief Connect to this signal to be notified when the virtual keyboard's language is changed.
166 * A callback of the following type may be connected:
168 * void YourCallbackName();
170 * User can get the text direction of the language by calling GetTextDirection() in the callback.
171 * @return The signal to connect to.
173 DALI_IMPORT_API VoidSignalType& LanguageChangedSignal();
175 } // namespace VirtualKeyboard
179 #endif // __DALI_VIRTUAL_KEYBOARD_H__