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