1 #ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
2 #define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
5 * Copyright (c) 2019 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 <dali/public-api/object/base-object.h>
25 #include <dali/devel-api/adaptor-framework/input-method-context.h>
26 #include <dali/internal/input/common/input-method-context-impl.h>
38 * @brief Satisfies input API requirements for platforms without input method context support
40 class InputMethodContextGeneric : public Dali::Internal::Adaptor::InputMethodContext
44 * @brief Creates a new InputMethodContext handle
46 * @param[in] actor The actor that uses the new InputMethodContext instance.
47 * @return InputMethodContext pointer
49 static InputMethodContextPtr New( Dali::Actor actor );
53 * @param[in] actor The actor that uses the new InputMethodContext instance.
55 explicit InputMethodContextGeneric( Dali::Actor actor );
60 * @brief Initializes member data.
62 void Initialize() override;
65 * Connect Callbacks required for InputMethodContext.
66 * If you don't connect InputMethodContext callbacks, you can't get the key events.
67 * The events are PreeditChanged, Commit and DeleteSurrounding.
69 void ConnectCallbacks() override;
72 * Disconnect Callbacks attached to input method context.
74 void DisconnectCallbacks() override;
77 * @copydoc Dali::InputMethodContext::Finalize()
79 void Finalize() override;
82 * @copydoc Dali::InputMethodContext::Activate()
84 void Activate() override;
87 * @copydoc Dali::InputMethodContext::Deactivate()
89 void Deactivate() override;
92 * @copydoc Dali::InputMethodContext::Reset()
94 void Reset() override;
97 * @copydoc Dali::InputMethodContext::GetContext()
99 ImfContext* GetContext() override;
102 * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
104 bool RestoreAfterFocusLost() const override;
107 * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
109 void SetRestoreAfterFocusLost( bool toggle ) override;
112 * @copydoc Dali::InputMethodContext::PreEditChanged()
114 void PreEditChanged( void* data, ImfContext* imfContext, void* eventInfo ) override;
117 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
119 void CommitReceived( void* data, ImfContext* imfContext, void* eventInfo ) override;
122 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
124 bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
127 * @copydoc Dali::InputMethodContext::DeleteSurrounding()
129 void DeleteSurrounding( void* data, ImfContext* imfContext, void* eventInfo ) override;
132 * @copydoc Dali::InputMethodContext::SendPrivateCommand()
134 void SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo ) override;
137 * @copydoc Dali::InputMethodContext::SendCommitContent()
139 void SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo ) override;
143 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
145 void NotifyCursorPosition() override;
148 * @copydoc Dali::InputMethodContext::SetCursorPosition()
150 void SetCursorPosition( unsigned int cursorPosition ) override;
153 * @copydoc Dali::InputMethodContext::GetCursorPosition()
155 unsigned int GetCursorPosition() const override;
158 * @copydoc Dali::InputMethodContext::SetSurroundingText()
160 void SetSurroundingText( const std::string& text ) override;
163 * @copydoc Dali::InputMethodContext::GetSurroundingText()
165 const std::string& GetSurroundingText() const override;
168 * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
170 void NotifyTextInputMultiLine( bool multiLine ) override;
173 * @copydoc Dali::InputMethodContext::GetTextDirection()
175 Dali::InputMethodContext::TextDirection GetTextDirection() override;
178 * @copydoc Dali::InputMethodContext::GetInputMethodArea()
180 Dali::Rect<int> GetInputMethodArea() override;
183 * @copydoc Dali::InputMethodContext::ApplyOptions()
185 void ApplyOptions( const InputMethodOptions& options ) override;
188 * @copydoc Dali::InputMethodContext::SetInputPanelData()
190 void SetInputPanelData( const std::string& data ) override;
193 * @copydoc Dali::InputMethodContext::GetInputPanelData()
195 void GetInputPanelData( std::string& data ) override;
198 * @copydoc Dali::InputMethodContext::GetInputPanelState()
200 Dali::InputMethodContext::State GetInputPanelState() override;
203 * @copydoc Dali::InputMethodContext::SetReturnKeyState()
205 void SetReturnKeyState( bool visible ) override;
208 * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
210 void AutoEnableInputPanel( bool enabled ) override;
213 * @copydoc Dali::InputMethodContext::ShowInputPanel()
215 void ShowInputPanel() override;
218 * @copydoc Dali::InputMethodContext::HideInputPanel()
220 void HideInputPanel() override;
223 * @copydoc Dali::InputMethodContext::GetKeyboardType()
225 Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
228 * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
230 std::string GetInputPanelLocale() override;
233 * @copydoc Dali::InputMethodContext::SetContentMIMETypes()
235 void SetContentMIMETypes( const std::string& mimeTypes ) override;
238 * @copydoc Dali::InputMethodContext::FilterEventKey()
240 bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
243 * @copydoc Dali::InputMethodContext::AllowTextPrediction()
245 void AllowTextPrediction( bool prediction ) override;
248 * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
250 bool IsTextPredictionAllowed() const override;
253 * @copydoc Dali::InputMethodContext::SetInputPanelLanguage()
255 void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override;
258 * @copydoc Dali::InputMethodContext::GetInputPanelLanguage()
260 Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override;
263 * @copydoc Dali::InputMethodContext::SetInputPanelPosition()
265 void SetInputPanelPosition( unsigned int x, unsigned int y ) override;
268 * @copydoc Dali::InputMethodContext::GetPreeditStyle()
270 void GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const override;
277 virtual ~InputMethodContextGeneric();
281 // Undefined copy constructor
282 InputMethodContextGeneric( const InputMethodContextGeneric& inputMethodContext) = delete;
284 // Undefined assignment operator
285 InputMethodContextGeneric& operator=( const InputMethodContextGeneric& inputMethodContext ) = delete;
288 } // namespace Adaptor
290 } // namespace Internal
294 #endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H