1 /* 2 * Copyright (c) 2024 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 INPUTMETHOD_IMF_PANEL_COMMON_H 17 #define INPUTMETHOD_IMF_PANEL_COMMON_H 18 19 #include <cstdint> 20 21 #include "wm_common.h" 22 23 namespace OHOS { 24 namespace MiscServices { 25 struct WindowSize { 26 uint32_t width = 0; 27 uint32_t height = 0; 28 }; 29 30 struct LayoutParams { 31 Rosen::Rect landscapeRect{ 0, 0, 0, 0 }; 32 Rosen::Rect portraitRect{ 0, 0, 0, 0 }; 33 }; 34 35 struct HotArea { 36 std::vector<Rosen::Rect> keyboardHotArea; 37 std::vector<Rosen::Rect> panelHotArea; ToStringHotArea38 static std::string ToString(const std::vector<Rosen::Rect> &areas) 39 { 40 std::string areasStr = "["; 41 for (const auto area : areas) { 42 areasStr.append(area.ToString()); 43 } 44 areasStr.append("]"); 45 return areasStr; 46 } 47 }; 48 49 struct HotAreas { 50 HotArea landscape; 51 HotArea portrait; 52 bool isSet{ false }; 53 }; 54 55 struct EnhancedLayoutParam { 56 Rosen::Rect rect{ 0, 0, 0, 0 }; 57 int32_t avoidY{ 0 }; 58 uint32_t avoidHeight{ 0 }; ToStringEnhancedLayoutParam59 inline std::string ToString() const 60 { 61 std::stringstream ss; 62 ss << "rect" << rect.ToString() << " avoidY " << avoidY << " avoidHeight " << avoidHeight; 63 return ss.str(); 64 } 65 }; 66 67 struct EnhancedLayoutParams { 68 bool isFullScreen{ false }; 69 EnhancedLayoutParam portrait; 70 EnhancedLayoutParam landscape; 71 }; 72 73 struct DisplaySize { 74 WindowSize portrait; 75 WindowSize landscape; 76 }; 77 78 struct PanelAdjustInfo { 79 int32_t top{ 0 }; 80 int32_t left{ 0 }; 81 int32_t right{ 0 }; 82 int32_t bottom{ 0 }; 83 bool operator==(const PanelAdjustInfo &panelAdjust) const 84 { 85 return (top == panelAdjust.top && left == panelAdjust.left && right == panelAdjust.right 86 && bottom == panelAdjust.bottom); 87 } 88 }; 89 90 struct FullPanelAdjustInfo { 91 PanelAdjustInfo portrait; 92 PanelAdjustInfo landscape; 93 }; 94 } // namespace MiscServices 95 } // namespace OHOS 96 #endif //INPUTMETHOD_IMF_PANEL_COMMON_H 97