1 #ifndef DALI_VIRTUAL_KEYBOARD_H
2 #define DALI_VIRTUAL_KEYBOARD_H
5 * Copyright (c) 2020 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/math/rect.h>
23 #include <dali/public-api/object/property-map.h>
24 #include <dali/public-api/signals/dali-signal.h>
27 #include <dali/public-api/adaptor-framework/input-method.h>
32 * @brief This namespace is provided for application developers to be able to show and hide the on-screen keyboard.
34 * Key events are sent to the actor in focus. Focus is set through the actor Public API.
36 namespace VirtualKeyboard
40 typedef Signal<void()> VoidSignalType;
41 typedef Signal<void(bool)> StatusSignalType;
42 typedef Signal<void(int)> KeyboardResizedSignalType;
43 typedef Signal<void(int)> LanguageChangedSignalType;
48 * @brief The direction of text.
57 * @brief The meaning of the return key.
74 * @brief Show the virtual keyboard.
76 DALI_ADAPTOR_API void Show();
79 * @brief Hide the virtual keyboard.
81 DALI_ADAPTOR_API void Hide();
84 * @brief Returns whether the virtual keyboard is visible or not.
85 * @return true if visible, false otherwise.
87 DALI_ADAPTOR_API bool IsVisible();
90 * @brief Set one or more of the Input Method Settings
91 * @param[in] settingsMap Map of Settings to be applied.
93 DALI_ADAPTOR_API void ApplySettings(const Property::Map& settingsMap);
96 * @brief Set the specific return key into the virtual keyboard.
97 * @param[in] type the kind of return key types.
99 DALI_ADAPTOR_API void SetReturnKeyType(const InputMethod::ButtonAction::Type type);
102 * @brief Retrieve the current return key type.
103 * @return the type of retun key.
105 DALI_ADAPTOR_API InputMethod::ButtonAction::Type GetReturnKeyType();
108 * @brief Enable/disable prediction (predictive text).
110 * By default prediction text is enabled.
111 * @param[in] enable true or false to enable or disable
112 * Prediction can not be changed while the keyboard is visible. It must be set in advance of showing keyboard.
114 DALI_ADAPTOR_API void EnablePrediction(const bool enable);
117 * @brief Returns whether prediction is enabled in the virtual keyboard
118 * @return true if predictive text enabled, false otherwise.
120 DALI_ADAPTOR_API bool IsPredictionEnabled();
123 * @brief Provides size and position of keyboard.
125 * Position is relative to whether keyboard is visible or not.
126 * If keyboard is not visible then position will be off the screen.
127 * If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get
128 * the values then taken down. So ideally GetSizeAndPosition() should be called after Show().
129 * @return rect which is keyboard panel x, y, width, height
131 DALI_ADAPTOR_API Dali::Rect<int> GetSizeAndPosition();
134 * @brief Rotates the keyboard orientation to the given angle.
136 * A value of 0 indicates the portrait orientation.
137 * Other valid values are 90, 180, 270.
138 * @param angle the angle is in degrees.
140 DALI_ADAPTOR_API void RotateTo(int angle);
143 * @brief Returns text direction of the keyboard's current input language.
144 * @return The direction of the text.
146 DALI_ADAPTOR_API TextDirection GetTextDirection();
148 } // namespace VirtualKeyboard
152 #endif // DALI_VIRTUAL_KEYBOARD_H