2 * Copyright (c) 2016 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 <virtual-keyboard.h>
22 #include <dali/integration-api/debug.h>
25 #include "text-input-manager.h"
38 #define TOKEN_STRING(x) #x
40 #if defined(DEBUG_ENABLED)
41 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VIRTUAL_KEYBOARD");
44 // Current DALi Virtual Keyboard devel API has no knowledge of Seats
45 // so we use the most recently 'active' seat. If Tizen ever supports two input panels
46 // at the same time, we need to modify DALi to be aware of it.
47 namespace VirtualKeyboard
50 // Functions listed in order from virtual-keyboard.h
54 TextInputManager::Get().ShowInputPanel();
59 TextInputManager::Get().HideInputPanel();
64 return TextInputManager::Get().IsInputPanelVisible();
68 void SetReturnKeyType( const InputMethod::ActionButton type )
70 TextInputManager::Get().SetReturnKeyType( type );
73 void ApplySettings( const Property::Map& settingsMap )
75 using namespace InputMethod; // Allows exclusion of namespace in TOKEN_STRING.
77 for( unsigned int i = 0, count = settingsMap.Count(); i < count; ++i )
79 std::string key = settingsMap.GetKey( i );
80 Property::Value item = settingsMap.GetValue(i);
82 if( key == TOKEN_STRING( ACTION_BUTTON ) )
84 if( item.GetType() == Property::INTEGER )
86 int value = item.Get< int >();
87 SetReturnKeyType( static_cast<InputMethod::ActionButton>(value) );
92 DALI_LOG_INFO( gLogFilter, Debug::General, "Provided Settings Key not supported\n" );
98 InputMethod::ActionButton GetReturnKeyType()
100 TextInputManager::SeatInfo& info = TextInputManager::Get().GetLastActiveSeat();
101 return info.mReturnKeyType;
104 void EnablePrediction(const bool enable)
106 // currently not part of Tizen text_input protocol
109 bool IsPredictionEnabled()
114 Dali::Rect< int > GetSizeAndPosition()
116 TextInputManager::SeatInfo& info = TextInputManager::Get().GetLastActiveSeat();
117 return info.mInputPanelDimensions;
120 void RotateTo(int angle)
122 // not part of the wayland protocol
125 Dali::VirtualKeyboard::TextDirection GetTextDirection()
127 TextInputManager::SeatInfo& info = TextInputManager::Get().GetLastActiveSeat();
128 return info.mTextDirection;
131 Dali::VirtualKeyboard::StatusSignalType& StatusChangedSignal()
133 return TextInputManager::Get().StatusChangedSignal();
136 Dali::VirtualKeyboard::VoidSignalType& ResizedSignal()
138 return TextInputManager::Get().ResizedSignal();
141 Dali::VirtualKeyboard::VoidSignalType& LanguageChangedSignal()
143 return TextInputManager::Get().LanguageChangedSignal();
146 } // namespace VirtualKeyboard
148 } // namespace Adaptor
150 } // namespace Internal