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 FRAMEWORKS_WMSERVER_SRC_LAYOUT_HEADER_H 17 #define FRAMEWORKS_WMSERVER_SRC_LAYOUT_HEADER_H 18 19 #include <stdint.h> 20 21 struct layout { 22 double x; 23 double y; 24 double w; 25 double h; 26 }; 27 28 #ifdef __cplusplus 29 #include <cstddef> 30 #include <fstream> 31 32 namespace OHOS::WMServer { 33 struct Layout { 34 bool isZIndexSetting; 35 int32_t zIndex; 36 bool isPositionTypeSetting; 37 enum class PositionType { 38 RELATIVE, 39 STATIC, // as status bar 40 FIXED, 41 } positionType; 42 bool isPositionXTypeSetting; 43 enum class XPositionType { 44 UNSET, // unset 45 LFT, // left 46 MID, // middle 47 RGH, // right 48 } pTypeX; 49 bool isPositionYTypeSetting; 50 enum class YPositionType { 51 UNSET, // unset 52 TOP, // top 53 MID, // middle 54 BTM, // bottom 55 } pTypeY; 56 bool isLayoutSetting; 57 struct layout layout; 58 }; 59 60 std::ostream &operator <<(std::ostream &os, const struct layout &layout); 61 std::ostream &operator <<(std::ostream &os, const enum Layout::PositionType &type); 62 std::ostream &operator <<(std::ostream &os, const enum Layout::XPositionType &type); 63 std::ostream &operator <<(std::ostream &os, const enum Layout::YPositionType &type); 64 std::ostream &operator <<(std::ostream &os, const struct Layout &layout); 65 66 std::istream &operator >>(std::istream &is, struct layout &layout); 67 std::istream &operator >>(std::istream &is, enum Layout::PositionType &type); 68 std::istream &operator >>(std::istream &is, enum Layout::XPositionType &type); 69 std::istream &operator >>(std::istream &is, enum Layout::YPositionType &type); 70 std::istream &operator >>(std::istream &is, struct Layout &layout); 71 } // namespace OHOS::WMServer 72 #endif // __cplusplus 73 74 #endif // FRAMEWORKS_WMSERVER_SRC_LAYOUT_HEADER_H 75