2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/input/generic/input-method-context-impl-generic.h>
22 #include <dali/integration-api/debug.h>
25 #include <dali/integration-api/adaptor-framework/adaptor.h>
38 #if defined(DEBUG_ENABLED)
39 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
43 InputMethodContextPtr InputMethodContextGeneric::New( Dali::Actor actor )
45 InputMethodContextPtr manager;
47 if( actor && Dali::Adaptor::IsAvailable() )
49 manager = new InputMethodContextGeneric( actor );
55 void InputMethodContextGeneric::Finalize()
57 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Finalize\n" );
58 DisconnectCallbacks();
61 InputMethodContextGeneric::InputMethodContextGeneric( Dali::Actor actor )
63 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::InputMethodContextGeneric\n" );
67 InputMethodContextGeneric::~InputMethodContextGeneric()
72 void InputMethodContextGeneric::Initialize()
74 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Initialize\n" );
77 void InputMethodContextGeneric::ConnectCallbacks()
79 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ConnectCallbacks\n" );
82 void InputMethodContextGeneric::DisconnectCallbacks()
84 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::DisconnectCallbacks\n" );
87 void InputMethodContextGeneric::Activate()
89 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Activate\n" );
92 void InputMethodContextGeneric::Deactivate()
94 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Deactivate\n" );
97 void InputMethodContextGeneric::Reset()
99 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::Reset\n" );
102 ImfContext* InputMethodContextGeneric::GetContext()
104 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetContext\n" );
109 bool InputMethodContextGeneric::RestoreAfterFocusLost() const
111 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::RestoreAfterFocusLost\n" );
116 void InputMethodContextGeneric::SetRestoreAfterFocusLost( bool toggle )
118 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetRestoreAfterFocusLost\n" );
121 void InputMethodContextGeneric::PreEditChanged( void*, ImfContext* imfContext, void* event_info )
123 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::PreEditChanged\n" );
126 void InputMethodContextGeneric::CommitReceived( void*, ImfContext* imfContext, void* event_info )
128 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::CommitReceived\n" );
131 bool InputMethodContextGeneric::RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition )
133 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::RetrieveSurrounding\n" );
137 void InputMethodContextGeneric::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info )
139 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::DeleteSurrounding\n" );
142 void InputMethodContextGeneric::SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo )
144 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SendPrivateCommand\n" );
147 void InputMethodContextGeneric::SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo )
149 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SendCommitContent\n" );
152 void InputMethodContextGeneric::NotifyCursorPosition()
154 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::NotifyCursorPosition\n" );
157 void InputMethodContextGeneric::SetCursorPosition( unsigned int cursorPosition )
159 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetCursorPosition\n" );
162 unsigned int InputMethodContextGeneric::GetCursorPosition() const
164 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetCursorPosition\n" );
169 void InputMethodContextGeneric::SetSurroundingText( const std::string& text )
171 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetSurroundingText\n" );
174 const std::string& InputMethodContextGeneric::GetSurroundingText() const
176 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetSurroundingText\n" );
181 void InputMethodContextGeneric::NotifyTextInputMultiLine( bool multiLine )
183 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::NotifyTextInputMultiLine\n" );
186 Dali::InputMethodContext::TextDirection InputMethodContextGeneric::GetTextDirection()
188 Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LEFT_TO_RIGHT );
192 Rect<int> InputMethodContextGeneric::GetInputMethodArea()
194 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputMethodArea\n" );
196 int xPos, yPos, width, height;
198 width = height = xPos = yPos = 0;
199 return Rect<int>(xPos,yPos,width,height);
202 void InputMethodContextGeneric::ApplyOptions( const InputMethodOptions& options )
204 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ApplyOptions\n" );
207 void InputMethodContextGeneric::SetInputPanelData( const std::string& data )
209 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetInputPanelData\n" );
212 void InputMethodContextGeneric::GetInputPanelData( std::string& data )
214 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelData\n" );
219 Dali::InputMethodContext::State InputMethodContextGeneric::GetInputPanelState()
221 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelState\n" );
222 return Dali::InputMethodContext::DEFAULT;
225 void InputMethodContextGeneric::SetReturnKeyState( bool visible )
227 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetReturnKeyState\n" );
230 void InputMethodContextGeneric::AutoEnableInputPanel( bool enabled )
232 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::AutoEnableInputPanel\n" );
235 void InputMethodContextGeneric::ShowInputPanel()
237 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::ShowInputPanel\n" );
240 void InputMethodContextGeneric::HideInputPanel()
242 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::HideInputPanel\n" );
245 Dali::InputMethodContext::KeyboardType InputMethodContextGeneric::GetKeyboardType()
247 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetKeyboardType\n" );
249 return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
252 std::string InputMethodContextGeneric::GetInputPanelLocale()
254 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::GetInputPanelLocale\n" );
256 std::string locale = "";
260 void InputMethodContextGeneric::SetContentMIMETypes( const std::string& mimeTypes )
262 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetContentMIMETypes\n" );
265 bool InputMethodContextGeneric::FilterEventKey( const Dali::KeyEvent& keyEvent )
267 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::FilterEventKey\n" );
272 void InputMethodContextGeneric::AllowTextPrediction( bool prediction )
274 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::AllowTextPrediction\n" );
277 bool InputMethodContextGeneric::IsTextPredictionAllowed() const
279 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::IsTextPredictionAllowed\n" );
284 void InputMethodContextGeneric::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language )
286 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextGeneric::SetInputPanelLanguage\n" );
289 Dali::InputMethodContext::InputPanelLanguage InputMethodContextGeneric::GetInputPanelLanguage() const
291 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelLanguage\n" );
293 return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;
296 void InputMethodContextGeneric::SetInputPanelPosition( unsigned int x, unsigned int y )
298 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetInputPanelPosition\n" );
301 void InputMethodContextGeneric::GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const
303 DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetPreeditStyle\n" );