[dali_1.9.0] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / generic / input-method-context-impl-generic.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/input/generic/input-method-context-impl-generic.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/integration-api/adaptor-framework/adaptor.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 namespace
37 {
38 #if defined(DEBUG_ENABLED)
39 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
40 #endif
41 }
42
43 InputMethodContextPtr InputMethodContextGeneric::New( Dali::Actor actor )
44 {
45   InputMethodContextPtr manager;
46
47   if( actor && Dali::Adaptor::IsAvailable() )
48   {
49     manager = new InputMethodContextGeneric( actor );
50   }
51
52   return manager;
53 }
54
55 void InputMethodContextGeneric::Finalize()
56 {
57   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Finalize\n" );
58   DisconnectCallbacks();
59 }
60
61 InputMethodContextGeneric::InputMethodContextGeneric( Dali::Actor actor )
62 {
63   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::InputMethodContextGeneric\n" );
64   Initialize();
65 }
66
67 InputMethodContextGeneric::~InputMethodContextGeneric()
68 {
69   Finalize();
70 }
71
72 void InputMethodContextGeneric::Initialize()
73 {
74   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Initialize\n" );
75 }
76
77 void InputMethodContextGeneric::ConnectCallbacks()
78 {
79   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ConnectCallbacks\n" );
80 }
81
82 void InputMethodContextGeneric::DisconnectCallbacks()
83 {
84   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::DisconnectCallbacks\n" );
85 }
86
87 void InputMethodContextGeneric::Activate()
88 {
89   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Activate\n" );
90 }
91
92 void InputMethodContextGeneric::Deactivate()
93 {
94   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Deactivate\n" );
95 }
96
97 void InputMethodContextGeneric::Reset()
98 {
99   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Reset\n" );
100 }
101
102 ImfContext* InputMethodContextGeneric::GetContext()
103 {
104   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetContext\n" );
105
106   return nullptr;
107 }
108
109 bool InputMethodContextGeneric::RestoreAfterFocusLost() const
110 {
111   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::RestoreAfterFocusLost\n" );
112
113   return false;
114 }
115
116 void InputMethodContextGeneric::SetRestoreAfterFocusLost( bool toggle )
117 {
118   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetRestoreAfterFocusLost\n" );
119 }
120
121 void InputMethodContextGeneric::PreEditChanged( void*, ImfContext* imfContext, void* event_info )
122 {
123   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::PreEditChanged\n" );
124 }
125
126 void InputMethodContextGeneric::CommitReceived( void*, ImfContext* imfContext, void* event_info )
127 {
128   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::CommitReceived\n" );
129 }
130
131 bool InputMethodContextGeneric::RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition )
132 {
133   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::RetrieveSurrounding\n" );
134   return false;
135 }
136
137 void InputMethodContextGeneric::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info )
138 {
139   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::DeleteSurrounding\n" );
140 }
141
142 void InputMethodContextGeneric::SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo )
143 {
144   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SendPrivateCommand\n" );
145 }
146
147 void InputMethodContextGeneric::SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo )
148 {
149   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SendCommitContent\n" );
150 }
151
152 void InputMethodContextGeneric::NotifyCursorPosition()
153 {
154   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::NotifyCursorPosition\n" );
155 }
156
157 void InputMethodContextGeneric::SetCursorPosition( unsigned int cursorPosition )
158 {
159   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetCursorPosition\n" );
160 }
161
162 unsigned int InputMethodContextGeneric::GetCursorPosition() const
163 {
164   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetCursorPosition\n" );
165
166   return 0;
167 }
168
169 void InputMethodContextGeneric::SetSurroundingText( const std::string& text )
170 {
171   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetSurroundingText\n" );
172 }
173
174 const std::string& InputMethodContextGeneric::GetSurroundingText() const
175 {
176   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetSurroundingText\n" );
177
178   return "";
179 }
180
181 void InputMethodContextGeneric::NotifyTextInputMultiLine( bool multiLine )
182 {
183   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::NotifyTextInputMultiLine\n" );
184 }
185
186 Dali::InputMethodContext::TextDirection InputMethodContextGeneric::GetTextDirection()
187 {
188   Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LeftToRight );
189   return direction;
190 }
191
192 Rect<int> InputMethodContextGeneric::GetInputMethodArea()
193 {
194   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputMethodArea\n" );
195
196   int xPos, yPos, width, height;
197
198   width = height = xPos = yPos = 0;
199   return Rect<int>(xPos,yPos,width,height);
200 }
201
202 void InputMethodContextGeneric::ApplyOptions( const InputMethodOptions& options )
203 {
204   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ApplyOptions\n" );
205 }
206
207 void InputMethodContextGeneric::SetInputPanelData( const std::string& data )
208 {
209   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetInputPanelData\n" );
210 }
211
212 void InputMethodContextGeneric::GetInputPanelData( std::string& data )
213 {
214   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelData\n" );
215
216   data.assign( "" );
217 }
218
219 Dali::InputMethodContext::State InputMethodContextGeneric::GetInputPanelState()
220 {
221   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelState\n" );
222   return Dali::InputMethodContext::DEFAULT;
223 }
224
225 void InputMethodContextGeneric::SetReturnKeyState( bool visible )
226 {
227   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetReturnKeyState\n" );
228 }
229
230 void InputMethodContextGeneric::AutoEnableInputPanel( bool enabled )
231 {
232   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::AutoEnableInputPanel\n" );
233 }
234
235 void InputMethodContextGeneric::ShowInputPanel()
236 {
237   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ShowInputPanel\n" );
238 }
239
240 void InputMethodContextGeneric::HideInputPanel()
241 {
242   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::HideInputPanel\n" );
243 }
244
245 Dali::InputMethodContext::KeyboardType InputMethodContextGeneric::GetKeyboardType()
246 {
247   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetKeyboardType\n" );
248
249   return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
250 }
251
252 std::string InputMethodContextGeneric::GetInputPanelLocale()
253 {
254   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelLocale\n" );
255
256   std::string locale = "";
257   return locale;
258 }
259
260 void InputMethodContextGeneric::SetContentMIMETypes( const std::string& mimeTypes )
261 {
262   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetContentMIMETypes\n" );
263 }
264
265 bool InputMethodContextGeneric::FilterEventKey( const Dali::KeyEvent& keyEvent )
266 {
267   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::FilterEventKey\n" );
268
269   return false;
270 }
271
272 void InputMethodContextGeneric::AllowTextPrediction( bool prediction )
273 {
274   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::AllowTextPrediction\n" );
275 }
276
277 bool InputMethodContextGeneric::IsTextPredictionAllowed() const
278 {
279   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::IsTextPredictionAllowed\n" );
280
281   return false;
282 }
283
284 void InputMethodContextGeneric::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language )
285 {
286   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetInputPanelLanguage\n" );
287 }
288
289 Dali::InputMethodContext::InputPanelLanguage InputMethodContextGeneric::GetInputPanelLanguage() const
290 {
291   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelLanguage\n" );
292
293   return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;
294 }
295
296 void InputMethodContextGeneric::SetInputPanelPosition( unsigned int x, unsigned int y )
297 {
298   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetInputPanelPosition\n" );
299 }
300
301 void InputMethodContextGeneric::GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs) const
302 {
303   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetPreeditStyle\n" );
304   // Do Nothing
305 }
306
307 } // Adaptor
308
309 } // Internal
310
311 } // Dali