1 #ifndef DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_WIN_H
\r
2 #define DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_WIN_H
\r
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
21 // EXTERNAL INCLUDES
\r
22 //#include <Ecore_IMF.h>
\r
23 //#include <Ecore_X.h>
\r
25 #include <dali/public-api/object/base-object.h>
\r
27 // INTERNAL INCLUDES
\r
28 #include <dali/devel-api/adaptor-framework/input-method-context.h>
\r
29 #include <dali/internal/input/common/input-method-context-impl.h>
\r
31 typedef unsigned int Ecore_X_Window;
\r
36 class RenderSurface;
\r
44 class InputMethodContextWin : public Dali::Internal::Adaptor::InputMethodContext
\r
48 * @brief Creates a new InputMethodContext handle
\r
50 * @return InputMethodContext pointer
\r
52 static InputMethodContextPtr New();
\r
56 * @param[in] ecoreXwin, The window is created by application.
\r
58 explicit InputMethodContextWin( Ecore_X_Window ecoreXwin );
\r
63 * @brief Initializes member data.
\r
65 void Initialize() override;
\r
68 * Connect Callbacks required for InputMethodContext.
\r
69 * If you don't connect InputMethodContext callbacks, you can't get the key events.
\r
70 * The events are PreeditChanged, Commit and DeleteSurrounding.
\r
72 void ConnectCallbacks() override;
\r
75 * Disconnect Callbacks attached to input method context.
\r
77 void DisconnectCallbacks() override;
\r
80 * @copydoc Dali::InputMethodContext::Finalize()
\r
82 void Finalize() override;
\r
85 * @copydoc Dali::InputMethodContext::Activate()
\r
87 void Activate() override;
\r
90 * @copydoc Dali::InputMethodContext::Deactivate()
\r
92 void Deactivate() override;
\r
95 * @copydoc Dali::InputMethodContext::Reset()
\r
97 void Reset() override;
\r
100 * @copydoc Dali::InputMethodContext::GetContext()
\r
102 ImfContext* GetContext() override;
\r
105 * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
\r
107 bool RestoreAfterFocusLost() const override;
\r
110 * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
\r
112 void SetRestoreAfterFocusLost( bool toggle ) override;
\r
115 * @copydoc Dali::InputMethodContext::PreEditChanged()
\r
117 void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
\r
120 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
122 void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
\r
125 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
127 bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
\r
130 * @copydoc Dali::InputMethodContext::DeleteSurrounding()
\r
132 void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) override;
\r
135 * @copydoc Dali::InputMethodContext::SendPrivateCommand()
\r
137 void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override
\r
142 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
144 void NotifyCursorPosition() override;
\r
147 * @copydoc Dali::InputMethodContext::SetCursorPosition()
\r
149 void SetCursorPosition( unsigned int cursorPosition ) override;
\r
152 * @copydoc Dali::InputMethodContext::GetCursorPosition()
\r
154 unsigned int GetCursorPosition() const override;
\r
157 * @copydoc Dali::InputMethodContext::SetSurroundingText()
\r
159 void SetSurroundingText( const std::string& text ) override;
\r
162 * @copydoc Dali::InputMethodContext::GetSurroundingText()
\r
164 const std::string& GetSurroundingText() const override;
\r
167 * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
\r
169 void NotifyTextInputMultiLine( bool multiLine ) override;
\r
172 * @copydoc Dali::InputMethodContext::GetTextDirection()
\r
174 Dali::InputMethodContext::TextDirection GetTextDirection() override;
\r
177 * @copydoc Dali::InputMethodContext::GetInputMethodArea()
\r
179 Dali::Rect<int> GetInputMethodArea() override;
\r
182 * @copydoc Dali::InputMethodContext::ApplyOptions()
\r
184 void ApplyOptions( const InputMethodOptions& options ) override;
\r
187 * @copydoc Dali::InputMethodContext::SetInputPanelData()
\r
189 void SetInputPanelData( const std::string& data ) override;
\r
192 * @copydoc Dali::InputMethodContext::GetInputPanelData()
\r
194 void GetInputPanelData( std::string& data ) override;
\r
197 * @copydoc Dali::InputMethodContext::GetInputPanelState()
\r
199 Dali::InputMethodContext::State GetInputPanelState() override;
\r
202 * @copydoc Dali::InputMethodContext::SetReturnKeyState()
\r
204 void SetReturnKeyState( bool visible ) override;
\r
207 * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
\r
209 void AutoEnableInputPanel( bool enabled ) override;
\r
212 * @copydoc Dali::InputMethodContext::ShowInputPanel()
\r
214 void ShowInputPanel() override;
\r
217 * @copydoc Dali::InputMethodContext::HideInputPanel()
\r
219 void HideInputPanel() override;
\r
222 * @copydoc Dali::InputMethodContext::GetKeyboardType()
\r
224 Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
\r
227 * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
\r
229 std::string GetInputPanelLocale() override;
\r
232 * @copydoc Dali::InputMethodContext::FilterEventKey()
\r
234 bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
\r
238 * Context created the first time and kept until deleted.
\r
239 * @param[in] ecoreXwin, The window is created by application.
\r
241 void CreateContext( Ecore_X_Window ecoreXwin );
\r
244 * @copydoc Dali::InputMethodContext::DeleteContext()
\r
246 void DeleteContext();
\r
251 * @brief Process event key down, whether filter a key to isf.
\r
253 * @param[in] keyEvent The event key to be handled.
\r
254 * @return Whether the event key is handled.
\r
256 bool ProcessEventKeyDown( const KeyEvent& keyEvent );
\r
259 * @brief Process event key up, whether filter a key to isf.
\r
261 * @param[in] keyEvent The event key to be handled.
\r
262 * @return Whether the event key is handled.
\r
264 bool ProcessEventKeyUp( const KeyEvent& keyEvent );
\r
267 //* Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
\r
268 //* This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
\r
269 //* @param[in] ecoreModifier the Ecore_Event_Modifier input.
\r
270 //* @return the Ecore_IMF_Keyboard_Modifiers output.
\r
272 //Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier );
\r
275 // * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
\r
276 // * @param[in] modifier the Ecore_Event_Modifier input.
\r
277 // * @return the Ecore_IMF_Keyboard_Locks output.
\r
279 //Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier );
\r
286 virtual ~InputMethodContextWin();
\r
290 // Undefined copy constructor
\r
291 InputMethodContextWin( const InputMethodContextWin& inputMethodContext) = delete;
\r
293 // Undefined assignment operator
\r
294 InputMethodContextWin& operator=( const InputMethodContextWin& inputMethodContext ) = delete;
\r
297 //Ecore_IMF_Context* mIMFContext;
\r
298 Ecore_X_Window mEcoreXwin;
\r
299 int mIMFCursorPosition;
\r
300 std::string mSurroundingText;
\r
302 bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
\r
303 bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
\r
304 InputMethodOptions mOptions;
\r
307 } // namespace Adaptor
\r
309 } // namespace Internal
\r
311 } // namespace Dali
\r
313 #endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_X_H
\r