1 #ifndef DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H
2 #define DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <Ecore_IMF.h>
25 #include <dali/public-api/object/base-object.h>
28 #include <dali/devel-api/adaptor-framework/imf-manager.h>
29 #include <dali/internal/input/common/imf-manager-impl.h>
42 class DALI_IMPORT_API ImfManagerX : public Dali::Internal::Adaptor::ImfManager
47 * Check whether the ImfManager is available.
48 * @return true if available, false otherwise
50 static bool IsAvailable();
53 * Get the IMF manager instance, it creates the instance if it has not already been created.
54 * Internally, a check should be made using IsAvailable() before this is called as we do not want
55 * to create an instance if not needed by applications.
58 static Dali::ImfManager Get();
62 * @param[in] ecoreXwin, The window is created by application.
64 explicit ImfManagerX( Ecore_X_Window ecoreXwin );
67 * Connect Callbacks required for IMF.
68 * If you don't connect imf callbacks, you can't get the key events.
69 * The events are PreeditChanged, Commit and DeleteSurrounding.
71 void ConnectCallbacks() override;
74 * Disconnect Callbacks attached to imf context.
76 void DisconnectCallbacks() override;
79 * @copydoc Dali::ImfManager::Activate()
81 void Activate() override;
84 * @copydoc Dali::ImfManager::Deactivate()
86 void Deactivate() override;
89 * @copydoc Dali::ImfManager::Reset()
91 void Reset() override;
94 * @copydoc Dali::ImfManager::GetContext()
96 ImfContext* GetContext() override;
99 * @copydoc Dali::ImfManager::RestoreAfterFocusLost()
101 bool RestoreAfterFocusLost() const override;
104 * @copydoc Dali::ImfManager::SetRestoreAfterFocusLost()
106 void SetRestoreAfterFocusLost( bool toggle ) override;
109 * @copydoc Dali::ImfManager::PreEditChanged()
111 void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
114 * @copydoc Dali::ImfManager::NotifyCursorPosition()
116 void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
119 * @copydoc Dali::ImfManager::NotifyCursorPosition()
121 bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
124 * @copydoc Dali::ImfManager::DeleteSurrounding()
126 void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info );
129 void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override
137 * @copydoc Dali::ImfManager::NotifyCursorPosition()
139 void NotifyCursorPosition() override;
142 * @copydoc Dali::ImfManager::SetCursorPosition()
144 void SetCursorPosition( unsigned int cursorPosition ) override;
147 * @copydoc Dali::ImfManager::GetCursorPosition()
149 unsigned int GetCursorPosition() const override;
152 * @copydoc Dali::ImfManager::SetSurroundingText()
154 void SetSurroundingText( const std::string& text ) override;
157 * @copydoc Dali::ImfManager::GetSurroundingText()
159 const std::string& GetSurroundingText() const override;
162 * @copydoc Dali::ImfManager::NotifyTextInputMultiLine()
164 void NotifyTextInputMultiLine( bool multiLine ) override;
167 * @copydoc Dali::ImfManager::GetTextDirection()
169 Dali::ImfManager::TextDirection GetTextDirection() override;
172 * @copydoc Dali::ImfManager::GetInputMethodArea()
174 Dali::Rect<int> GetInputMethodArea() override;
177 * @copydoc Dali::ImfManager::ApplyOptions()
179 void ApplyOptions( const InputMethodOptions& options ) override;
182 * @copydoc Dali::ImfManager::SetInputPanelData()
184 void SetInputPanelData( const std::string& data ) override;
187 * @copydoc Dali::ImfManager::GetInputPanelData()
189 void GetInputPanelData( std::string& data ) override;
192 * @copydoc Dali::ImfManager::GetInputPanelState()
194 Dali::ImfManager::State GetInputPanelState() override;
197 * @copydoc Dali::ImfManager::SetReturnKeyState()
199 void SetReturnKeyState( bool visible ) override;
202 * @copydoc Dali::ImfManager::AutoEnableInputPanel()
204 void AutoEnableInputPanel( bool enabled ) override;
207 * @copydoc Dali::ImfManager::ShowInputPanel()
209 void ShowInputPanel() override;
212 * @copydoc Dali::ImfManager::HideInputPanel()
214 void HideInputPanel() override;
217 * @copydoc Dali::ImfManager::GetKeyboardType()
219 Dali::ImfManager::KeyboardType GetKeyboardType() override;
222 * @copydoc Dali::ImfManager::GetInputPanelLocale()
224 std::string GetInputPanelLocale() override;
231 ~ImfManagerX() override;
235 * Context created the first time and kept until deleted.
236 * @param[in] ecoreXwin, The window is created by application.
238 void CreateContext( Ecore_X_Window ecoreXwin );
241 * @copydoc Dali::ImfManager::DeleteContext()
243 void DeleteContext();
247 ImfManagerX( const ImfManagerX& );
248 ImfManagerX& operator=( ImfManagerX& ) = delete;
251 Ecore_IMF_Context* mIMFContext;
252 int mIMFCursorPosition;
253 std::string mSurroundingText;
255 bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
256 bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
257 InputMethodOptions mOptions;
261 } // namespace Adaptor
263 } // namespace Internal
267 #endif // DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H