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 OH_NATIVE_DISPLAY_INFO_H
17#define OH_NATIVE_DISPLAY_INFO_H
18
19/**
20 * @addtogroup OH_DisplayInfo
21 * @{
22 *
23 * @brief Defines the data structures for the C APIs of the display module.
24 *
25 * @syscap SystemCapability.WindowManager.WindowManager.Core
26 * @since 12
27 * @version 1.0
28 */
29
30/**
31 * @file oh_display_info.h
32 *
33 * @brief Defines the data structures for the C APIs of the display module.
34 *
35 * @kit ArkUI
36 * @library libnative_display_manager.so
37 * @syscap SystemCapability.WindowManager.WindowManager.Core
38 * @since 12
39 * @version 1.0
40 */
41
42#include "stdint.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 * @brief Enumerates rotations.
50 *
51 * @since 12
52 * @version 1.0
53 */
54typedef enum {
55    /** device rotation 0 degree */
56    DISPLAY_MANAGER_ROTATION_0,
57
58    /** device rotation 90 degrees */
59    DISPLAY_MANAGER_ROTATION_90,
60
61    /** device rotation 180 degrees */
62    DISPLAY_MANAGER_ROTATION_180,
63
64    /** device rotation 270 degree */
65    DISPLAY_MANAGER_ROTATION_270,
66} NativeDisplayManager_Rotation;
67
68/**
69 * @brief Enumerates orientations.
70 *
71 * @since 12
72 * @version 1.0
73 */
74typedef enum {
75    /** device portrait show */
76    DISPLAY_MANAGER_PORTRAIT = 0,
77
78    /** device landscape show */
79    DISPLAY_MANAGER_LANDSCAPE = 1,
80
81    /** device portrait inverted show */
82    DISPLAY_MANAGER_PORTRAIT_INVERTED = 2,
83
84    /** device landscape inverted show */
85    DISPLAY_MANAGER_LANDSCAPE_INVERTED = 3,
86
87    /** device unknow show */
88    DISPLAY_MANAGER_UNKNOWN,
89} NativeDisplayManager_Orientation;
90
91/**
92 * @brief Enumerates the result types of the display manager interface.
93 *
94 * @since 12
95 * @version 1.0
96 */
97typedef enum {
98    /** @error Operation is successful */
99    DISPLAY_MANAGER_OK = 0,
100
101    /** @error Operation no permission */
102    DISPLAY_MANAGER_ERROR_NO_PERMISSION = 201,
103
104    /** @error Operation not system app */
105    DISPLAY_MANAGER_ERROR_NOT_SYSTEM_APP = 202,
106
107    /** @error Operation invalid param */
108    DISPLAY_MANAGER_ERROR_INVALID_PARAM = 401,
109
110    /** @error Operation device not supported */
111    DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED = 801,
112
113    /** @error Operation screen invalid */
114    DISPLAY_MANAGER_ERROR_INVALID_SCREEN = 1400001,
115
116    /** @error Operation invalid call */
117    DISPLAY_MANAGER_ERROR_INVALID_CALL = 1400002,
118
119    /** @error Operation system abnormal */
120    DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL = 1400003,
121} NativeDisplayManager_ErrorCode;
122
123/**
124 * @brief Enumerates the fold display mode.
125 *
126 * @since 12
127 * @version 1.0
128 */
129typedef enum {
130    /** display mode unknown */
131    DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN = 0,
132
133    /** display mode full */
134    DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL = 1,
135
136    /** display mode main */
137    DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN = 2,
138
139    /** display mode sub */
140    DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB = 3,
141
142    /** display mode coordination */
143    DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION = 4,
144} NativeDisplayManager_FoldDisplayMode;
145
146/**
147 * @brief Defines the display rect data structure.
148 *
149 * @since 12
150 * @version 1.0
151 */
152typedef struct {
153    /* rect left */
154    int32_t left;
155    /* rect top */
156    int32_t top;
157    /* rect width */
158    uint32_t width;
159    /* rect height */
160    uint32_t height;
161} NativeDisplayManager_Rect;
162
163/**
164 * @brief Defines the display waterfallDisplayAreaRects data structure.
165 *
166 * @since 12
167 * @version 1.0
168 */
169typedef struct {
170    /* waterfall left rect */
171    NativeDisplayManager_Rect left;
172
173    /* waterfall top rect */
174    NativeDisplayManager_Rect top;
175
176    /* waterfall right rect */
177    NativeDisplayManager_Rect right;
178
179    /* waterfall bottom rect */
180    NativeDisplayManager_Rect bottom;
181} NativeDisplayManager_WaterfallDisplayAreaRects;
182
183/**
184 * @brief Defines the display cutout info data structure.
185 *
186 * @since 12
187 * @version 1.0
188 */
189typedef struct {
190    /* boundingRects length */
191    int32_t boundingRectsLength;
192
193    /* boundingRects info pointer */
194    NativeDisplayManager_Rect *boundingRects;
195
196    /* waterfallDisplayAreaRects info */
197    NativeDisplayManager_WaterfallDisplayAreaRects waterfallDisplayAreaRects;
198} NativeDisplayManager_CutoutInfo;
199
200#ifdef __cplusplus
201}
202#endif
203/** @} */
204#endif // OH_NATIVE_DISPLAY_INFO_H