1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_IME_TEXT_INPUT_CLIENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_IME_TEXT_INPUT_CLIENT_H 18 19 #include "base/memory/ace_type.h" 20 #include "core/common/ime/text_input_action.h" 21 #include "core/common/ime/text_editing_value.h" 22 23 namespace OHOS::Ace { 24 25 class TextInputClient : public virtual AceType { 26 DECLARE_ACE_TYPE(TextInputClient, AceType); 27 28 public: 29 // Requests that this client update its editing state to the given value. 30 virtual void UpdateEditingValue( 31 const std::shared_ptr<TextEditingValue>& value, bool needFireChangeEvent = true) = 0; 32 33 // Requests that this client perform the given action. 34 virtual void PerformAction(TextInputAction action, bool forceCloseKeyboard = false) = 0; 35 36 #if defined(IOS_PLATFORM) GetInputEditingValue()37 virtual const TextEditingValue& GetInputEditingValue() const { 38 static TextEditingValue value; 39 return value; 40 }; 41 #endif UpdateInputFilterErrorText(const std::string & errorText)42 virtual void UpdateInputFilterErrorText(const std::string& errorText) {}; 43 44 // Requests that this client Y point. GetEditingBoxY()45 virtual double GetEditingBoxY() const { return 0.0; }; GetEditingBoxTopY()46 virtual double GetEditingBoxTopY() const { return 0.0; }; GetEditingBoxModel()47 virtual bool GetEditingBoxModel() const { return false; }; 48 49 }; 50 51 } // namespace OHOS::Ace 52 53 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_IME_TEXT_INPUT_CLIENT_H 54