[4.0] Add DALI_IMPORT_API for reference
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / virtual-keyboard.h
1 #ifndef __DALI_VIRTUAL_KEYBOARD_H__
2 #define __DALI_VIRTUAL_KEYBOARD_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/signals/dali-signal.h>
23 #include <dali/public-api/object/property-map.h>
24 #include <dali/public-api/math/rect.h>
25
26 // INTERNAL INCLUDES
27 #ifdef DALI_ADAPTOR_COMPILATION  // full path doesn't exist until adaptor is installed so we have to use relative
28 // @todo Make dali-adaptor code folder structure mirror the folder structure installed to dali-env
29 #include "input-method.h"
30 #else
31 #include <dali/public-api/adaptor-framework/input-method.h>
32 #endif
33
34 namespace Dali
35 {
36
37 /**
38  * @brief This namespace is provided for application developers to be able to show and hide the on-screen keyboard.
39  *
40  * Key events are sent to the actor in focus. Focus is set through the actor Public API.
41  */
42 namespace VirtualKeyboard
43 {
44
45 // Types
46
47 typedef Signal< void () > VoidSignalType;
48 typedef Signal< void (bool) > StatusSignalType;
49
50 // Enumerations
51
52 /**
53  * @brief The direction of text.
54  */
55 enum TextDirection
56 {
57   LeftToRight,
58   RightToLeft,
59 };
60
61 /**
62  * @brief The meaning of the return key.
63  */
64 enum ReturnKeyType
65 {
66   DEFAULT,
67   DONE,
68   GO,
69   JOIN,
70   LOGIN,
71   NEXT,
72   SEARCH,
73   SEND,
74   SIGNIN
75 };
76
77 // Functions
78 /**
79  * @brief Show the virtual keyboard.
80  */
81 DALI_IMPORT_API void Show();
82
83 /**
84  * @brief Hide the virtual keyboard.
85  */
86 DALI_IMPORT_API void Hide();
87
88 /**
89  * @brief Returns whether the virtual keyboard is visible or not.
90  * @return true if visible, false otherwise.
91  */
92 DALI_IMPORT_API bool IsVisible();
93
94 /**
95  * @brief Set one or more of the Input Method Settings
96  * @param[in] settingsMap Map of Settings to be applied.
97  */
98 DALI_IMPORT_API void ApplySettings( const Property::Map& settingsMap );
99
100 /**
101  * @brief Set the specific return key into the virtual keyboard.
102  * @param[in] type the kind of return key types.
103  */
104 DALI_IMPORT_API void SetReturnKeyType( const InputMethod::ActionButton type );
105
106 /**
107  * @brief Retrieve the current return key type.
108  * @return the type of retun key.
109  */
110 DALI_IMPORT_API InputMethod::ActionButton GetReturnKeyType();
111
112 /**
113  * @brief Enable/disable prediction (predictive text).
114  *
115  * By default prediction text is enabled.
116  * @param[in] enable true or false to enable or disable
117  * Prediction can not be changed while the keyboard is visible. It must be set in advance of showing keyboard.
118  */
119 DALI_IMPORT_API void EnablePrediction(const bool enable);
120
121 /**
122  * @brief Returns whether prediction is enabled in the virtual keyboard
123  * @return true if predictive text enabled, false otherwise.
124  */
125 DALI_IMPORT_API bool IsPredictionEnabled();
126
127 /**
128  * @brief Provides size and position of keyboard.
129  *
130  * Position is relative to whether keyboard is visible or not.
131  * If keyboard is not visible then position will be off the screen.
132  * If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get
133  * the values then taken down.  So ideally GetSizeAndPosition() should be called after Show().
134  * @return rect which is keyboard panel x, y, width, height
135  */
136 DALI_IMPORT_API Dali::Rect<int> GetSizeAndPosition();
137
138 /**
139  * @brief Rotates the keyboard orientation to the given angle.
140  *
141  * A value of 0 indicates the portrait orientation.
142  * Other valid values are 90, 180, 270.
143  * @param angle the angle is in degrees.
144  */
145 DALI_IMPORT_API void RotateTo(int angle);
146
147 /**
148  * @brief Returns text direction of the keyboard's current input language.
149  * @return The direction of the text.
150  */
151 DALI_IMPORT_API TextDirection GetTextDirection();
152
153 /**
154  * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
155  *
156  * A callback of the following type may be connected:
157  * @code
158  *   void YourCallbackName(bool keyboardShown);
159  * @endcode
160  * If the parameter keyboardShown is true, then the keyboard has just shown, if it is false, then it
161  * has just been hidden.
162  * @return The signal to connect to.
163  */
164 DALI_IMPORT_API StatusSignalType& StatusChangedSignal();
165
166 /**
167  * @brief Connect to this signal to be notified when the virtual keyboard is resized.
168  *
169  * A callback of the following type may be connected:
170  * @code
171  *   void YourCallbackName();
172  * @endcode
173  * User can get changed size by using GetSizeAndPosition() in the callback
174  * @return The signal to connect to.
175  */
176 DALI_IMPORT_API VoidSignalType& ResizedSignal();
177
178 /**
179  * @brief Connect to this signal to be notified when the virtual keyboard's language is changed.
180  *
181  * A callback of the following type may be connected:
182  * @code
183  *   void YourCallbackName();
184  * @endcode
185  * User can get the text direction of the language by calling GetTextDirection() in the callback.
186  * @return The signal to connect to.
187  */
188 DALI_IMPORT_API VoidSignalType& LanguageChangedSignal();
189
190 } // namespace VirtualKeyboard
191
192 } // namespace Dali
193
194 #endif // __DALI_VIRTUAL_KEYBOARD_H__