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 <dali/public-api/object/base-object.h>
\r
24 // INTERNAL INCLUDES
\r
25 #include <dali/devel-api/adaptor-framework/input-method-context.h>
\r
26 #include <dali/internal/input/common/input-method-context-impl.h>
\r
27 #include <dali/internal/window-system/windows/platform-implement-win.h>
\r
32 class RenderSurface;
\r
40 class InputMethodContextWin : public Dali::Internal::Adaptor::InputMethodContext
\r
44 * @brief Creates a new InputMethodContext handle
\r
46 * @return InputMethodContext pointer
\r
48 static InputMethodContextPtr New();
\r
52 * @param[in] win32Window, The window is created by application.
\r
54 explicit InputMethodContextWin( WinWindowHandle win32Window );
\r
59 * @brief Initializes member data.
\r
61 void Initialize() override;
\r
64 * Connect Callbacks required for InputMethodContext.
\r
65 * If you don't connect InputMethodContext callbacks, you can't get the key events.
\r
66 * The events are PreeditChanged, Commit and DeleteSurrounding.
\r
68 void ConnectCallbacks() override;
\r
71 * Disconnect Callbacks attached to input method context.
\r
73 void DisconnectCallbacks() override;
\r
76 * @copydoc Dali::InputMethodContext::Finalize()
\r
78 void Finalize() override;
\r
81 * @copydoc Dali::InputMethodContext::Activate()
\r
83 void Activate() override;
\r
86 * @copydoc Dali::InputMethodContext::Deactivate()
\r
88 void Deactivate() override;
\r
91 * @copydoc Dali::InputMethodContext::Reset()
\r
93 void Reset() override;
\r
96 * @copydoc Dali::InputMethodContext::GetContext()
\r
98 ImfContext* GetContext() override;
\r
101 * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
\r
103 bool RestoreAfterFocusLost() const override;
\r
106 * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
\r
108 void SetRestoreAfterFocusLost( bool toggle ) override;
\r
111 * @copydoc Dali::InputMethodContext::PreEditChanged()
\r
113 void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
\r
116 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
118 void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
\r
121 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
123 bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
\r
126 * @copydoc Dali::InputMethodContext::DeleteSurrounding()
\r
128 void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) override;
\r
131 * @copydoc Dali::InputMethodContext::SendPrivateCommand()
\r
133 void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override
\r
138 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
140 void NotifyCursorPosition() override;
\r
143 * @copydoc Dali::InputMethodContext::SetCursorPosition()
\r
145 void SetCursorPosition( unsigned int cursorPosition ) override;
\r
148 * @copydoc Dali::InputMethodContext::GetCursorPosition()
\r
150 unsigned int GetCursorPosition() const override;
\r
153 * @copydoc Dali::InputMethodContext::SetSurroundingText()
\r
155 void SetSurroundingText( const std::string& text ) override;
\r
158 * @copydoc Dali::InputMethodContext::GetSurroundingText()
\r
160 const std::string& GetSurroundingText() const override;
\r
163 * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
\r
165 void NotifyTextInputMultiLine( bool multiLine ) override;
\r
168 * @copydoc Dali::InputMethodContext::GetTextDirection()
\r
170 Dali::InputMethodContext::TextDirection GetTextDirection() override;
\r
173 * @copydoc Dali::InputMethodContext::GetInputMethodArea()
\r
175 Dali::Rect<int> GetInputMethodArea() override;
\r
178 * @copydoc Dali::InputMethodContext::ApplyOptions()
\r
180 void ApplyOptions( const InputMethodOptions& options ) override;
\r
183 * @copydoc Dali::InputMethodContext::SetInputPanelData()
\r
185 void SetInputPanelData( const std::string& data ) override;
\r
188 * @copydoc Dali::InputMethodContext::GetInputPanelData()
\r
190 void GetInputPanelData( std::string& data ) override;
\r
193 * @copydoc Dali::InputMethodContext::GetInputPanelState()
\r
195 Dali::InputMethodContext::State GetInputPanelState() override;
\r
198 * @copydoc Dali::InputMethodContext::SetReturnKeyState()
\r
200 void SetReturnKeyState( bool visible ) override;
\r
203 * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
\r
205 void AutoEnableInputPanel( bool enabled ) override;
\r
208 * @copydoc Dali::InputMethodContext::ShowInputPanel()
\r
210 void ShowInputPanel() override;
\r
213 * @copydoc Dali::InputMethodContext::HideInputPanel()
\r
215 void HideInputPanel() override;
\r
218 * @copydoc Dali::InputMethodContext::GetKeyboardType()
\r
220 Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
\r
223 * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
\r
225 std::string GetInputPanelLocale() override;
\r
228 * @copydoc Dali::InputMethodContext::FilterEventKey()
\r
230 bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
\r
233 * @copydoc Dali::InputMethodContext::SetInputPanelLanguage()
\r
235 void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override;
\r
238 * @copydoc Dali::InputMethodContext::GetInputPanelLanguage()
\r
240 Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override;
\r
244 * Context created the first time and kept until deleted.
\r
245 * @param[in] win32Window, The window is created by application.
\r
247 void CreateContext( WinWindowHandle win32Window );
\r
250 * @copydoc Dali::InputMethodContext::DeleteContext()
\r
252 void DeleteContext();
\r
257 * @brief Process event key down, whether filter a key to isf.
\r
259 * @param[in] keyEvent The event key to be handled.
\r
260 * @return Whether the event key is handled.
\r
262 bool ProcessEventKeyDown( const KeyEvent& keyEvent );
\r
265 * @brief Process event key up, whether filter a key to isf.
\r
267 * @param[in] keyEvent The event key to be handled.
\r
268 * @return Whether the event key is handled.
\r
270 bool ProcessEventKeyUp( const KeyEvent& keyEvent );
\r
277 virtual ~InputMethodContextWin();
\r
281 // Undefined copy constructor
\r
282 InputMethodContextWin( const InputMethodContextWin& inputMethodContext) = delete;
\r
284 // Undefined assignment operator
\r
285 InputMethodContextWin& operator=( const InputMethodContextWin& inputMethodContext ) = delete;
\r
288 WinWindowHandle mWin32Window;
\r
289 int mIMFCursorPosition;
\r
290 std::string mSurroundingText;
\r
292 bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
\r
293 bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
\r
294 InputMethodOptions mOptions;
\r
297 } // namespace Adaptor
\r
299 } // namespace Internal
\r
301 } // namespace Dali
\r
303 #endif // DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_WIN_H
\r