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* eventInfo ) override;
\r
116 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
118 void CommitReceived( void* data, ImfContext* imfContext, void* eventInfo ) 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* eventInfo ) override;
\r
131 * @copydoc Dali::InputMethodContext::SendPrivateCommand()
\r
133 void SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo ) override
\r
137 * @copydoc Dali::InputMethodContext::SendCommitContent()
\r
139 void SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo ) override
\r
144 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
\r
146 void NotifyCursorPosition() override;
\r
149 * @copydoc Dali::InputMethodContext::SetCursorPosition()
\r
151 void SetCursorPosition( unsigned int cursorPosition ) override;
\r
154 * @copydoc Dali::InputMethodContext::GetCursorPosition()
\r
156 unsigned int GetCursorPosition() const override;
\r
159 * @copydoc Dali::InputMethodContext::SetSurroundingText()
\r
161 void SetSurroundingText( const std::string& text ) override;
\r
164 * @copydoc Dali::InputMethodContext::GetSurroundingText()
\r
166 const std::string& GetSurroundingText() const override;
\r
169 * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
\r
171 void NotifyTextInputMultiLine( bool multiLine ) override;
\r
174 * @copydoc Dali::InputMethodContext::GetTextDirection()
\r
176 Dali::InputMethodContext::TextDirection GetTextDirection() override;
\r
179 * @copydoc Dali::InputMethodContext::GetInputMethodArea()
\r
181 Dali::Rect<int> GetInputMethodArea() override;
\r
184 * @copydoc Dali::InputMethodContext::ApplyOptions()
\r
186 void ApplyOptions( const InputMethodOptions& options ) override;
\r
189 * @copydoc Dali::InputMethodContext::SetInputPanelData()
\r
191 void SetInputPanelData( const std::string& data ) override;
\r
194 * @copydoc Dali::InputMethodContext::GetInputPanelData()
\r
196 void GetInputPanelData( std::string& data ) override;
\r
199 * @copydoc Dali::InputMethodContext::GetInputPanelState()
\r
201 Dali::InputMethodContext::State GetInputPanelState() override;
\r
204 * @copydoc Dali::InputMethodContext::SetReturnKeyState()
\r
206 void SetReturnKeyState( bool visible ) override;
\r
209 * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
\r
211 void AutoEnableInputPanel( bool enabled ) override;
\r
214 * @copydoc Dali::InputMethodContext::ShowInputPanel()
\r
216 void ShowInputPanel() override;
\r
219 * @copydoc Dali::InputMethodContext::HideInputPanel()
\r
221 void HideInputPanel() override;
\r
224 * @copydoc Dali::InputMethodContext::GetKeyboardType()
\r
226 Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
\r
229 * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
\r
231 std::string GetInputPanelLocale() override;
\r
234 * @copydoc Dali::InputMethodContext::SetContentMIMETypes()
\r
236 void SetContentMIMETypes( const std::string& mimeTypes ) override;
\r
239 * @copydoc Dali::InputMethodContext::FilterEventKey()
\r
241 bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
\r
244 * @copydoc Dali::InputMethodContext::SetInputPanelLanguage()
\r
246 void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override;
\r
249 * @copydoc Dali::InputMethodContext::GetInputPanelLanguage()
\r
251 Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override;
\r
255 * Context created the first time and kept until deleted.
\r
256 * @param[in] win32Window, The window is created by application.
\r
258 void CreateContext( WinWindowHandle win32Window );
\r
261 * @copydoc Dali::InputMethodContext::DeleteContext()
\r
263 void DeleteContext();
\r
268 * @brief Process event key down, whether filter a key to isf.
\r
270 * @param[in] keyEvent The event key to be handled.
\r
271 * @return Whether the event key is handled.
\r
273 bool ProcessEventKeyDown( const KeyEvent& keyEvent );
\r
276 * @brief Process event key up, whether filter a key to isf.
\r
278 * @param[in] keyEvent The event key to be handled.
\r
279 * @return Whether the event key is handled.
\r
281 bool ProcessEventKeyUp( const KeyEvent& keyEvent );
\r
288 virtual ~InputMethodContextWin();
\r
292 // Undefined copy constructor
\r
293 InputMethodContextWin( const InputMethodContextWin& inputMethodContext) = delete;
\r
295 // Undefined assignment operator
\r
296 InputMethodContextWin& operator=( const InputMethodContextWin& inputMethodContext ) = delete;
\r
299 WinWindowHandle mWin32Window;
\r
300 int mIMFCursorPosition;
\r
301 std::string mSurroundingText;
\r
303 bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
\r
304 bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
\r
305 InputMethodOptions mOptions;
\r
308 } // namespace Adaptor
\r
310 } // namespace Internal
\r
312 } // namespace Dali
\r
314 #endif // DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_WIN_H
\r