[dali_1.9.1] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / generic / input-method-context-impl-generic.h
1 #ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
2 #define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
3
4 /*
5  * Copyright (c) 2019 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/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/input-method-context.h>
26 #include <dali/internal/input/common/input-method-context-impl.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 /**
38  * @brief Satisfies input API requirements for platforms without input method context support
39  */
40 class InputMethodContextGeneric : public Dali::Internal::Adaptor::InputMethodContext
41 {
42 public:
43   /**
44    * @brief Creates a new InputMethodContext handle
45    *
46    * @param[in] actor The actor that uses the new InputMethodContext instance.
47    * @return InputMethodContext pointer
48    */
49   static InputMethodContextPtr New( Dali::Actor actor );
50
51   /**
52    * Constructor
53    * @param[in] actor The actor that uses the new InputMethodContext instance.
54    */
55   explicit InputMethodContextGeneric( Dali::Actor actor );
56
57 public:
58
59   /**
60    * @brief Initializes member data.
61    */
62   void Initialize() override;
63
64   /**
65    * Connect Callbacks required for InputMethodContext.
66    * If you don't connect InputMethodContext callbacks, you can't get the key events.
67    * The events are PreeditChanged, Commit and DeleteSurrounding.
68    */
69   void ConnectCallbacks() override;
70
71   /**
72    * Disconnect Callbacks attached to input method context.
73    */
74   void DisconnectCallbacks() override;
75
76   /**
77    * @copydoc Dali::InputMethodContext::Finalize()
78    */
79   void Finalize() override;
80
81   /**
82    * @copydoc Dali::InputMethodContext::Activate()
83    */
84   void Activate() override;
85
86   /**
87    * @copydoc Dali::InputMethodContext::Deactivate()
88    */
89   void Deactivate() override;
90
91   /**
92    * @copydoc Dali::InputMethodContext::Reset()
93    */
94   void Reset() override;
95
96   /**
97    * @copydoc Dali::InputMethodContext::GetContext()
98    */
99   ImfContext* GetContext() override;
100
101   /**
102    * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
103    */
104   bool RestoreAfterFocusLost() const override;
105
106   /**
107    * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
108    */
109   void SetRestoreAfterFocusLost( bool toggle ) override;
110
111   /**
112    * @copydoc Dali::InputMethodContext::PreEditChanged()
113    */
114   void PreEditChanged( void* data, ImfContext* imfContext, void* eventInfo ) override;
115
116   /**
117    * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
118    */
119   void CommitReceived( void* data, ImfContext* imfContext, void* eventInfo ) override;
120
121   /**
122    * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
123    */
124   bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
125
126   /**
127    * @copydoc Dali::InputMethodContext::DeleteSurrounding()
128    */
129   void DeleteSurrounding( void* data, ImfContext* imfContext, void* eventInfo ) override;
130
131   /**
132    * @copydoc Dali::InputMethodContext::SendPrivateCommand()
133    */
134   void SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo ) override;
135
136   /**
137    * @copydoc Dali::InputMethodContext::SendCommitContent()
138    */
139   void SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo ) override;
140
141   // Cursor related
142   /**
143    * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
144    */
145   void NotifyCursorPosition() override;
146
147   /**
148    * @copydoc Dali::InputMethodContext::SetCursorPosition()
149    */
150   void SetCursorPosition( unsigned int cursorPosition ) override;
151
152   /**
153    * @copydoc Dali::InputMethodContext::GetCursorPosition()
154    */
155   unsigned int GetCursorPosition() const override;
156
157   /**
158    * @copydoc Dali::InputMethodContext::SetSurroundingText()
159    */
160   void SetSurroundingText( const std::string& text ) override;
161
162   /**
163    * @copydoc Dali::InputMethodContext::GetSurroundingText()
164    */
165   const std::string& GetSurroundingText() const override;
166
167   /**
168   * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
169   */
170   void NotifyTextInputMultiLine( bool multiLine ) override;
171
172   /**
173   * @copydoc Dali::InputMethodContext::GetTextDirection()
174   */
175   Dali::InputMethodContext::TextDirection GetTextDirection() override;
176
177   /**
178   * @copydoc Dali::InputMethodContext::GetInputMethodArea()
179   */
180   Dali::Rect<int> GetInputMethodArea() override;
181
182   /**
183   * @copydoc Dali::InputMethodContext::ApplyOptions()
184   */
185   void ApplyOptions( const InputMethodOptions& options ) override;
186
187   /**
188    * @copydoc Dali::InputMethodContext::SetInputPanelData()
189    */
190   void SetInputPanelData( const std::string& data ) override;
191
192   /**
193    * @copydoc Dali::InputMethodContext::GetInputPanelData()
194    */
195   void GetInputPanelData( std::string& data ) override;
196
197   /**
198    * @copydoc Dali::InputMethodContext::GetInputPanelState()
199    */
200   Dali::InputMethodContext::State GetInputPanelState() override;
201
202   /**
203    * @copydoc Dali::InputMethodContext::SetReturnKeyState()
204    */
205   void SetReturnKeyState( bool visible ) override;
206
207   /**
208    * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
209    */
210   void AutoEnableInputPanel( bool enabled ) override;
211
212   /**
213    * @copydoc Dali::InputMethodContext::ShowInputPanel()
214    */
215   void ShowInputPanel() override;
216
217   /**
218    * @copydoc Dali::InputMethodContext::HideInputPanel()
219    */
220   void HideInputPanel() override;
221
222   /**
223    * @copydoc Dali::InputMethodContext::GetKeyboardType()
224    */
225   Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
226
227   /**
228    * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
229    */
230   std::string GetInputPanelLocale() override;
231
232   /**
233    * @copydoc Dali::InputMethodContext::SetContentMIMETypes()
234    */
235   void SetContentMIMETypes( const std::string& mimeTypes ) override;
236
237   /**
238    * @copydoc Dali::InputMethodContext::FilterEventKey()
239    */
240   bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
241
242   /**
243    * @copydoc Dali::InputMethodContext::AllowTextPrediction()
244    */
245   void AllowTextPrediction( bool prediction ) override;
246
247   /**
248    * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
249    */
250   bool IsTextPredictionAllowed() const override;
251
252   /**
253    * @copydoc Dali::InputMethodContext::SetInputPanelLanguage()
254    */
255   void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override;
256
257   /**
258    * @copydoc Dali::InputMethodContext::GetInputPanelLanguage()
259    */
260   Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override;
261
262   /**
263    * @copydoc Dali::InputMethodContext::SetInputPanelPosition()
264    */
265   void SetInputPanelPosition( unsigned int x, unsigned int y ) override;
266
267   /**
268    * @copydoc Dali::InputMethodContext::GetPreeditStyle()
269    */
270   void GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const override;
271
272 public:
273
274   /**
275    * Destructor.
276    */
277   virtual ~InputMethodContextGeneric();
278
279 private:
280
281   // Undefined copy constructor
282   InputMethodContextGeneric( const InputMethodContextGeneric& inputMethodContext) = delete;
283
284   // Undefined assignment operator
285   InputMethodContextGeneric& operator=( const InputMethodContextGeneric& inputMethodContext ) = delete;
286 };
287
288 } // namespace Adaptor
289
290 } // namespace Internal
291
292 } // namespace Dali
293
294 #endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H