1 #ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
2 #define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
5 * Copyright (c) 2021 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>
35 * @brief Satisfies input API requirements for platforms without input method context support
37 class InputMethodContextGeneric : public Dali::Internal::Adaptor::InputMethodContext
41 * @brief Creates a new InputMethodContext handle
43 * @param[in] actor The actor that uses the new InputMethodContext instance.
44 * @return InputMethodContext pointer
46 static InputMethodContextPtr New(Dali::Actor actor);
50 * @param[in] actor The actor that uses the new InputMethodContext instance.
52 explicit InputMethodContextGeneric(Dali::Actor actor);
56 * @brief Initializes member data.
58 void Initialize() override;
61 * Connect Callbacks required for InputMethodContext.
62 * If you don't connect InputMethodContext callbacks, you can't get the key events.
63 * The events are PreeditChanged, Commit and DeleteSurrounding.
65 void ConnectCallbacks() override;
68 * Disconnect Callbacks attached to input method context.
70 void DisconnectCallbacks() override;
73 * @copydoc Dali::InputMethodContext::Finalize()
75 void Finalize() override;
78 * @copydoc Dali::InputMethodContext::Activate()
80 void Activate() override;
83 * @copydoc Dali::InputMethodContext::Deactivate()
85 void Deactivate() override;
88 * @copydoc Dali::InputMethodContext::Reset()
90 void Reset() override;
93 * @copydoc Dali::InputMethodContext::GetContext()
95 ImfContext* GetContext() override;
98 * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
100 bool RestoreAfterFocusLost() const override;
103 * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
105 void SetRestoreAfterFocusLost(bool toggle) override;
108 * @copydoc Dali::InputMethodContext::PreEditChanged()
110 void PreEditChanged(void* data, ImfContext* imfContext, void* eventInfo) override;
113 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
115 void CommitReceived(void* data, ImfContext* imfContext, void* eventInfo) override;
118 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
120 bool RetrieveSurrounding(void* data, ImfContext* imfContext, char** text, int* cursorPosition) override;
123 * @copydoc Dali::InputMethodContext::DeleteSurrounding()
125 void DeleteSurrounding(void* data, ImfContext* imfContext, void* eventInfo) override;
128 * @copydoc Dali::InputMethodContext::SendPrivateCommand()
130 void SendPrivateCommand(void* data, ImfContext* imfContext, void* eventInfo) override;
133 * @copydoc Dali::InputMethodContext::SendCommitContent()
135 void SendCommitContent(void* data, ImfContext* imfContext, void* eventInfo) override;
139 * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
141 void NotifyCursorPosition() override;
144 * @copydoc Dali::InputMethodContext::SetCursorPosition()
146 void SetCursorPosition(unsigned int cursorPosition) override;
149 * @copydoc Dali::InputMethodContext::GetCursorPosition()
151 unsigned int GetCursorPosition() const override;
154 * @copydoc Dali::InputMethodContext::SetSurroundingText()
156 void SetSurroundingText(const std::string& text) override;
159 * @copydoc Dali::InputMethodContext::GetSurroundingText()
161 const std::string& GetSurroundingText() const override;
164 * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
166 void NotifyTextInputMultiLine(bool multiLine) override;
169 * @copydoc Dali::InputMethodContext::GetTextDirection()
171 Dali::InputMethodContext::TextDirection GetTextDirection() override;
174 * @copydoc Dali::InputMethodContext::GetInputMethodArea()
176 Dali::Rect<int> GetInputMethodArea() override;
179 * @copydoc Dali::InputMethodContext::ApplyOptions()
181 void ApplyOptions(const InputMethodOptions& options) override;
184 * @copydoc Dali::InputMethodContext::SetInputPanelData()
186 void SetInputPanelData(const std::string& data) override;
189 * @copydoc Dali::InputMethodContext::GetInputPanelData()
191 void GetInputPanelData(std::string& data) override;
194 * @copydoc Dali::InputMethodContext::GetInputPanelState()
196 Dali::InputMethodContext::State GetInputPanelState() override;
199 * @copydoc Dali::InputMethodContext::SetReturnKeyState()
201 void SetReturnKeyState(bool visible) override;
204 * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
206 void AutoEnableInputPanel(bool enabled) override;
209 * @copydoc Dali::InputMethodContext::ShowInputPanel()
211 void ShowInputPanel() override;
214 * @copydoc Dali::InputMethodContext::HideInputPanel()
216 void HideInputPanel() override;
219 * @copydoc Dali::InputMethodContext::GetKeyboardType()
221 Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
224 * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
226 std::string GetInputPanelLocale() override;
229 * @copydoc Dali::InputMethodContext::SetContentMIMETypes()
231 void SetContentMIMETypes(const std::string& mimeTypes) override;
234 * @copydoc Dali::InputMethodContext::FilterEventKey()
236 bool FilterEventKey(const Dali::KeyEvent& keyEvent) override;
239 * @copydoc Dali::InputMethodContext::AllowTextPrediction()
241 void AllowTextPrediction(bool prediction) override;
244 * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
246 bool IsTextPredictionAllowed() const override;
249 * @copydoc Dali::InputMethodContext::SetInputPanelLanguage()
251 void SetInputPanelLanguage(Dali::InputMethodContext::InputPanelLanguage language) override;
254 * @copydoc Dali::InputMethodContext::GetInputPanelLanguage()
256 Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override;
259 * @copydoc Dali::InputMethodContext::SetInputPanelPosition()
261 void SetInputPanelPosition(unsigned int x, unsigned int y) override;
264 * @copydoc Dali::InputMethodContext::GetPreeditStyle()
266 void GetPreeditStyle(Dali::InputMethodContext::PreEditAttributeDataContainer& attrs) const override;
272 virtual ~InputMethodContextGeneric();
275 // Undefined copy constructor
276 InputMethodContextGeneric(const InputMethodContextGeneric& inputMethodContext) = delete;
278 // Undefined assignment operator
279 InputMethodContextGeneric& operator=(const InputMethodContextGeneric& inputMethodContext) = delete;
282 } // namespace Adaptor
284 } // namespace Internal
288 #endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H