• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# WindowManager_NativeModule
2
3
4## Overview
5
6The WindowManager_NativeModule module provides the capabilities of managing application windows.
7
8**Since**: 12
9
10
11## Summary
12
13
14### Files
15
16| Name| Description|
17| -------- | -------- |
18| [oh_window.h](oh__window_8h.md) | Declares the window management APIs. You can use the APIs to set and obtain the properties of a window, and set its status bar style and navigation bar style.|
19| [oh_window_comm.h](oh__window__comm_8h.md) | Declares the common enums and definitions of the window manager.|
20| [oh_window_event_filter.h](oh__window__event__filter_8h.md) | Declares the APIs for a window to filter multimodal key events. When a multimodal input event passes through the window, the window can interrupt the event to prevent it from being further distributed.|
21
22
23### Structs
24
25| Name| Description|
26| -------- | -------- |
27| struct  [WindowManager_Rect](_window_manager___rect.md) | Defines a struct for the window rectangle, including the window position, width, and height.|
28| struct  [WindowManager_WindowProperties](_window_manager___window_properties.md) | Defines a struct for the window properties.|
29| struct  [WindowManager_AvoidArea](_window_manager___avoid_area.md) | Defines a struct for the avoid area.|
30
31
32### Types
33
34| Name| Description|
35| -------- | -------- |
36| typedef enum [WindowManager_ErrorCode](#windowmanager_errorcode)  [WindowManager_ErrorCode](#windowmanager_errorcode) | Defines an enum for the status codes returned by the window manager interface.|
37| typedef bool(\* [OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter)) (Input_KeyEvent \*keyEvent) | Defines a function for filtering multimodal key events.|
38| typedef bool(\* [OH_NativeWindowManager_MouseEventFilter](#oh_nativewindowmanager_mouseeventfilter)) (Input_MouseEvent \*mouseEvent) | Defines a function for filtering multimodal mouse events.|
39| typedef bool(\* [OH_NativeWindowManager_TouchEventFilter](#oh_nativewindowmanager_toucheventfilter)) (Input_TouchEvent \*touchEvent) | Defines a function for filtering multimodal touch events.|
40
41
42### Enums
43
44| Name| Description|
45| -------- | -------- |
46| [WindowManager_ErrorCode](#windowmanager_errorcode-1) {<br>OK = 0, WINDOW_MANAGER_ERRORCODE_NO_PERMISSION = 201, WINDOW_MANAGER_ERRORCODE_INVALID_PARAM = 401, WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED = 801,<br>INVAILD_WINDOW_ID = 1000, SERVICE_ERROR = 2000, WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL = 1300002, WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL = 1300003<br>} | Enumerates the status codes returned by the window manager interface.|
47| [WindowManager_AvoidAreaType](#windowmanager_avoidareatype) {<br>WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0, WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1, WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2, WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3,<br>WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4<br>} | Enumerates the avoid area types.|
48| [WindowManager_WindowType](#windowmanager_windowtype) { WINDOW_MANAGER_WINDOW_TYPE_APP = 0, WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1, WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8, WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16 } | Enumerates the window types.|
49
50
51### Functions
52
53| Name| Description|
54| -------- | -------- |
55| int32_t [OH_WindowManager_SetWindowStatusBarEnabled](#oh_windowmanager_setwindowstatusbarenabled) (int32_t windowId, bool enabled, bool enableAnimation) | Sets whether to display the status bar in a window.|
56| int32_t [OH_WindowManager_SetWindowStatusBarColor](#oh_windowmanager_setwindowstatusbarcolor) (int32_t windowId, int32_t color) | Sets the color of the status bar in a window.|
57| int32_t [OH_WindowManager_SetWindowNavigationBarEnabled](#oh_windowmanager_setwindownavigationbarenabled) (int32_t windowId, bool enabled, bool enableAnimation) | Sets whether to display the navigation bar in a window.|
58| int32_t [OH_WindowManager_GetWindowAvoidArea](#oh_windowmanager_getwindowavoidarea) (int32_t windowId, [WindowManager_AvoidAreaType](#windowmanager_avoidareatype) type, [WindowManager_AvoidArea](_window_manager___avoid_area.md) \*avoidArea) | Obtains the avoid area of a window.|
59| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_WindowManager_IsWindowShown](#oh_windowmanager_iswindowshown) (int32_t windowId, bool \*isShow) | Checks whether a window is displayed.|
60| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_WindowManager_ShowWindow](#oh_windowmanager_showwindow) (int32_t windowId) | Displays a window.|
61| int32_t [OH_WindowManager_SetWindowTouchable](#oh_windowmanager_setwindowtouchable) (int32_t windowId, bool isTouchable) | Sets whether a window is touchable.|
62| int32_t [OH_WindowManager_SetWindowFocusable](#oh_windowmanager_setwindowfocusable) (int32_t windowId, bool isFocusable) | Sets whether a window is focusable.|
63| int32_t [OH_WindowManager_SetWindowBackgroundColor](#oh_windowmanager_setwindowbackgroundcolor) (int32_t windowId, const char \*color) | Sets the background color of a window.|
64| int32_t [OH_WindowManager_SetWindowBrightness](#oh_windowmanager_setwindowbrightness) (int32_t windowId, float brightness) | Sets the screen brightness of a window.|
65| int32_t [OH_WindowManager_SetWindowKeepScreenOn](#oh_windowmanager_setwindowkeepscreenon) (int32_t windowId, bool isKeepScreenOn) | Sets whether to always keep the screen on for a window.|
66| int32_t [OH_WindowManager_SetWindowPrivacyMode](#oh_windowmanager_setwindowprivacymode) (int32_t windowId, bool isPrivacy) | Sets whether to enable privacy mode for a window.|
67| int32_t [OH_WindowManager_GetWindowProperties](#oh_windowmanager_getwindowproperties) (int32_t windowId, [WindowManager_WindowProperties](_window_manager___window_properties.md) \*windowProperties) | Obtains the properties of a window.|
68| int32_t [OH_WindowManager_Snapshot](#oh_windowmanager_snapshot) (int32_t windowId, OH_PixelmapNative \*pixelMap) | Obtains the snapshot of a window.|
69| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_RegisterKeyEventFilter](#oh_nativewindowmanager_registerkeyeventfilter) (int32_t windowId, [OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter) keyEventFilter) | Registers the function for filtering multimodal key events.|
70| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_UnregisterKeyEventFilter](#oh_nativewindowmanager_unregisterkeyeventfilter) (int32_t windowId) | Unregisters the function for filtering multimodal key events.|
71| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_RegisterMouseEventFilter](#oh_nativewindowmanager_registermouseeventfilter) (int32_t windowId, [OH_NativeWindowManager_MouseEventFilter](#oh_nativewindowmanager_mouseeventfilter) mouseEventFilter) | Registers the function for filtering multimodal mouse events.|
72| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_UnregisterMouseEventFilter](#oh_nativewindowmanager_unregistermouseeventfilter) (int32_t windowId) | Unregisters the function for filtering multimodal mouse events.|
73| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_RegisterTouchEventFilter](#oh_nativewindowmanager_registertoucheventfilter) (int32_t windowId, [OH_NativeWindowManager_TouchEventFilter](#oh_nativewindowmanager_toucheventfilter) touchEventFilter) | Registers the function for filtering multimodal touch events.|
74| [WindowManager_ErrorCode](#windowmanager_errorcode-1)  [OH_NativeWindowManager_UnregisterTouchEventFilter](#oh_nativewindowmanager_unregistertoucheventfilter) (int32_t windowId) | Unregisters the function for filtering multimodal touch events.|
75
76
77## Type Description
78
79
80### OH_NativeWindowManager_KeyEventFilter
81
82```
83typedef bool(* OH_NativeWindowManager_KeyEventFilter) (Input_KeyEvent *keyEvent)
84```
85
86**Description**
87
88Defines a function for filtering multimodal key events.
89
90**Since**: 12
91
92**Parameters**
93
94| Name| Description|
95| -------- | -------- |
96| keyEvent | Pointer to the multimodal key event. For details, see **Input_KeyEvent**. The event is defined in **oh_input_manager**.|
97
98**Returns**
99
100Returns **true** if the event will be intercepted; returns **false** otherwise.
101
102
103### OH_NativeWindowManager_MouseEventFilter
104
105```
106typedef bool(* OH_NativeWindowManager_MouseEventFilter) (Input_MouseEvent *mouseEvent)
107```
108
109**Description**
110
111Defines a function for filtering multimodal mouse events.
112
113**Since**: 15
114
115**Parameters**
116
117| Name| Description|
118| -------- | -------- |
119| mouseEvent | Pointer to the multimodal mouse event. For details, see **Input_MouseEvent**. The event is defined in **oh_input_manager**.|
120
121**Returns**
122
123Returns **true** if the event will be intercepted; returns **false** otherwise.
124
125
126### OH_NativeWindowManager_TouchEventFilter
127
128```
129typedef bool(* OH_NativeWindowManager_TouchEventFilter) (Input_TouchEvent *touchEvent)
130```
131
132**Description**
133
134Defines a function for filtering multimodal touch events.
135
136**Since**: 15
137
138**Parameters**
139
140| Name| Description|
141| -------- | -------- |
142| touchEvent | Pointer to the multimodal touch event. For details, see **Input_TouchEvent**. The event is defined in **oh_input_manager**.|
143
144**Returns**
145
146Returns **true** if the event will be intercepted; returns **false** otherwise.
147
148
149### WindowManager_ErrorCode
150
151```
152typedef enum WindowManager_ErrorCode WindowManager_ErrorCode
153```
154
155**Description**
156
157Defines an enum for the status codes returned by the window manager interface.
158
159**Since**: 12
160
161
162## Enum Description
163
164
165### WindowManager_AvoidAreaType
166
167```
168enum WindowManager_AvoidAreaType
169```
170
171**Description**
172
173Enumerates the avoid area types.
174
175**Since**: 15
176
177| Value| Description|
178| -------- | -------- |
179| WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM | System avoid area.|
180| WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT | Cutout.|
181| WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE | System gesture area.|
182| WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD | Keyboard area.|
183| WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR | Navigation bar area.|
184
185
186### WindowManager_ErrorCode
187
188```
189enum WindowManager_ErrorCode
190```
191
192**Description**
193
194Enumerates the status codes returned by the window manager interface.
195
196**Since**: 12
197
198| Value| Description|
199| -------- | -------- |
200| OK | Operation successful.|
201| WINDOW_MANAGER_ERRORCODE_NO_PERMISSION<sup>15+</sup> | No permission.|
202| WINDOW_MANAGER_ERRORCODE_INVALID_PARAM<sup>15+</sup> | Invalid parameter.|
203| WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED<sup>15+</sup> | Not supported by the device.|
204| INVAILD_WINDOW_ID | Invalid window ID.|
205| SERVICE_ERROR | Service error.|
206| WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL<sup>15+</sup> | Abnormal window status.|
207| WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL<sup>15+</sup> | Abnormal window manager service.|
208
209
210### WindowManager_WindowType
211
212```
213enum WindowManager_WindowType
214```
215
216**Description**
217
218Enumerates the window types.
219
220**Since**: 15
221
222| Value| Description|
223| -------- | -------- |
224| WINDOW_MANAGER_WINDOW_TYPE_APP | Child window.|
225| WINDOW_MANAGER_WINDOW_TYPE_MAIN | Main window.|
226| WINDOW_MANAGER_WINDOW_TYPE_FLOAT | Floating window.|
227| WINDOW_MANAGER_WINDOW_TYPE_DIALOG | Modal window.|
228
229
230## Function Description
231
232
233### OH_NativeWindowManager_RegisterKeyEventFilter()
234
235```
236WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter (int32_t windowId, OH_NativeWindowManager_KeyEventFilter keyEventFilter )
237```
238
239**Description**
240
241Registers the function for filtering multimodal key events.
242
243**Since**: 12
244
245**Parameters**
246
247| Name| Description|
248| -------- | -------- |
249| windowId | ID of the window for which the function is registered.|
250| keyEventFilter | Function to register.|
251
252**Returns**
253
254Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
255
256
257### OH_NativeWindowManager_RegisterMouseEventFilter()
258
259```
260WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter (int32_t windowId, OH_NativeWindowManager_MouseEventFilter mouseEventFilter )
261```
262
263**Description**
264
265Registers the function for filtering multimodal mouse events.
266
267**Since**: 15
268
269**Parameters**
270
271| Name| Description|
272| -------- | -------- |
273| windowId | ID of the window for which the function is registered.|
274| mouseEventFilter | Function to register.|
275
276**Returns**
277
278Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
279
280
281### OH_NativeWindowManager_RegisterTouchEventFilter()
282
283```
284WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter (int32_t windowId, OH_NativeWindowManager_TouchEventFilter touchEventFilter )
285```
286
287**Description**
288
289Registers the function for filtering multimodal touch events.
290
291**Since**: 15
292
293**Parameters**
294
295| Name| Description|
296| -------- | -------- |
297| windowId | ID of the window for which the function is registered.|
298| touchEventFilter | Function to register.|
299
300**Returns**
301
302Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
303
304
305### OH_NativeWindowManager_UnregisterKeyEventFilter()
306
307```
308WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter (int32_t windowId)
309```
310
311**Description**
312
313Unregisters the function for filtering multimodal key events.
314
315**Since**: 12
316
317**Parameters**
318
319| Name| Description|
320| -------- | -------- |
321| windowId | ID of the window for which the function is unregistered.|
322
323**Returns**
324
325Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
326
327
328### OH_NativeWindowManager_UnregisterMouseEventFilter()
329
330```
331WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter (int32_t windowId)
332```
333
334**Description**
335
336Unregisters the function for filtering multimodal mouse events.
337
338**Since**: 15
339
340**Parameters**
341
342| Name| Description|
343| -------- | -------- |
344| windowId | ID of the window for which the function is unregistered.|
345
346**Returns**
347
348Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
349
350
351### OH_NativeWindowManager_UnregisterTouchEventFilter()
352
353```
354WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter (int32_t windowId)
355```
356
357**Description**
358
359Unregisters the function for filtering multimodal touch events.
360
361**Since**: 15
362
363**Parameters**
364
365| Name| Description|
366| -------- | -------- |
367| windowId | ID of the window for which the function is unregistered.|
368
369**Returns**
370
371Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
372
373
374### OH_WindowManager_GetWindowAvoidArea()
375
376```
377int32_t OH_WindowManager_GetWindowAvoidArea (int32_t windowId, WindowManager_AvoidAreaType type, WindowManager_AvoidArea * avoidArea )
378```
379
380**Description**
381
382Obtains the avoid area of a window.
383
384**Since**: 15
385
386**Parameters**
387
388| Name| Description|
389| -------- | -------- |
390| windowId | Window ID. The default value is **0**. The value is an integer.|
391| type | Type of the avoid area.|
392| avoidArea | Pointer to the avoid area.|
393
394**Returns**
395
396Returns one of the following result codes:
397
398**OK**: This code is returned if the function is successfully called, and the pointer to the avoid area is returned.
399
400**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
401
402**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
403
404**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
405
406
407### OH_WindowManager_GetWindowProperties()
408
409```
410int32_t OH_WindowManager_GetWindowProperties (int32_t windowId, WindowManager_WindowProperties * windowProperties )
411```
412
413**Description**
414
415Obtains the properties of a window.
416
417**Since**: 15
418
419**Parameters**
420
421| Name| Description|
422| -------- | -------- |
423| windowId | Window ID. The default value is **0**. The value is an integer.|
424| windowProperties | Pointer to the properties.|
425
426**Returns**
427
428Returns one of the following result codes:
429
430**OK**: This code is returned if the function is successfully called, and the pointer to the window properties is returned.
431
432**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
433
434**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
435
436**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
437
438
439### OH_WindowManager_IsWindowShown()
440
441```
442WindowManager_ErrorCode OH_WindowManager_IsWindowShown (int32_t windowId, bool * isShow )
443```
444
445**Description**
446
447Checks whether a window is displayed.
448
449**Since**: 15
450
451**Parameters**
452
453| Name| Description|
454| -------- | -------- |
455| windowId | Window ID. The default value is **0**. The value is an integer.|
456| isShow | Pointer to the check result. The value **true** means that the window is displayed, and **false** means the opposite.|
457
458**Returns**
459
460Returns one of the following result codes:
461
462**OK**: This code is returned if the function is successfully called.
463
464**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
465
466**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
467
468
469### OH_WindowManager_SetWindowBackgroundColor()
470
471```
472int32_t OH_WindowManager_SetWindowBackgroundColor (int32_t windowId, const char * color )
473```
474
475**Description**
476
477Sets the background color of a window.
478
479**Since**: 15
480
481**Parameters**
482
483| Name| Description|
484| -------- | -------- |
485| windowId | Window ID. The default value is **0**. The value is an integer.|
486| color | Pointer to the background color. The value is a string in hexadecimal RGB or ARGB color format.|
487
488**Returns**
489
490Returns one of the following result codes:
491
492**OK**: This code is returned if the function is successfully called.
493
494**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
495
496**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
497
498
499### OH_WindowManager_SetWindowBrightness()
500
501```
502int32_t OH_WindowManager_SetWindowBrightness (int32_t windowId, float brightness )
503```
504
505**Description**
506
507Sets the screen brightness of a window.
508
509**Since**: 15
510
511**Parameters**
512
513| Name| Description|
514| -------- | -------- |
515| windowId | Window ID. The default value is **0**. The value is an integer.|
516| brightness | Screen brightness. The value is a floating point number in the range [0.0, 1.0] or set to **-1.0**, where **1.0** indicates the brightest, and **-1.0** is the default brightness.|
517
518**Returns**
519
520Returns one of the following result codes:
521
522**OK**: This code is returned if the function is successfully called.
523
524**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
525
526**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
527
528**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
529
530
531### OH_WindowManager_SetWindowFocusable()
532
533```
534int32_t OH_WindowManager_SetWindowFocusable (int32_t windowId, bool isFocusable )
535```
536
537**Description**
538
539Sets whether a window is focusable.
540
541**Since**: 15
542
543**Parameters**
544
545| Name| Description|
546| -------- | -------- |
547| windowId | Window ID. The default value is **0**. The value is an integer.|
548| isFocusable | Whether the window is focusable. The value **true** means that the window is focusable, and **false** means the opposite.|
549
550**Returns**
551
552Returns one of the following result codes:
553
554**OK**: This code is returned if the function is successfully called.
555
556**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
557
558**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
559
560**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
561
562
563### OH_WindowManager_SetWindowKeepScreenOn()
564
565```
566int32_t OH_WindowManager_SetWindowKeepScreenOn (int32_t windowId, bool isKeepScreenOn )
567```
568
569**Description**
570
571Sets whether to always keep the screen on for a window.
572
573**Since**: 15
574
575**Parameters**
576
577| Name| Description|
578| -------- | -------- |
579| windowId | Window ID. The default value is **0**. The value is an integer.|
580| isKeepScreenOn | Whether to always keep the screen on. The value **true** means to always keep the screen on, and the value **false** indicates the opposite.|
581
582**Returns**
583
584Returns one of the following result codes:
585
586**OK**: This code is returned if the function is successfully called.
587
588**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
589
590**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
591
592**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
593
594
595### OH_WindowManager_SetWindowNavigationBarEnabled()
596
597```
598int32_t OH_WindowManager_SetWindowNavigationBarEnabled (int32_t windowId, bool enabled, bool enableAnimation )
599```
600
601**Description**
602
603Sets whether to display the navigation bar in a window.
604
605**Since**: 15
606
607**Parameters**
608
609| Name| Description|
610| -------- | -------- |
611| windowId | Window ID. The default value is **0**. The value is an integer.|
612| enabled | Whether to display the navigation bar. The value **true** means to display the navigation bar, and **false** means the opposite.|
613| enableAnimation | Whether to enable the show/hide animation of the navigation bar. The value **true** means to enable the show/hide animation of the navigation bar, and **false** means the opposite.|
614
615**Returns**
616
617Returns one of the following result codes:
618
619**OK**: This code is returned if the function is successfully called.
620
621**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
622
623**WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED**: This code is returned if the feature is not supported by the device.
624
625**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
626
627**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
628
629
630### OH_WindowManager_SetWindowPrivacyMode()
631
632```
633int32_t OH_WindowManager_SetWindowPrivacyMode (int32_t windowId, bool isPrivacy )
634```
635
636**Description**
637
638Sets whether to enable privacy mode for a window.
639
640**Since**: 15
641
642**Parameters**
643
644| Name| Description|
645| -------- | -------- |
646| windowId | Window ID. The default value is **0**. The value is an integer.|
647| isPrivacy | Whether to enable privacy mode. The value **true** means to enable privacy mode, and **false** means the opposite.|
648
649**Required permissions**: ohos.permission.PRIVACY_WINDOW
650
651**Returns**
652
653Returns one of the following result codes:
654
655**OK**: This code is returned if the function is successfully called.
656
657**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
658
659**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
660
661**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
662
663**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
664
665**WINDOW_MANAGER_ERRORCODE_NO_PERMISSION**: This code is returned if the permission verification fails.
666
667
668### OH_WindowManager_SetWindowStatusBarColor()
669
670```
671int32_t OH_WindowManager_SetWindowStatusBarColor (int32_t windowId, int32_t color )
672```
673
674**Description**
675
676Sets the color of the status bar in a window.
677
678**Since**: 15
679
680**Parameters**
681
682| Name| Description|
683| -------- | -------- |
684| windowId | Window ID. The default value is **0**. The value is an integer.|
685| color | Color to set, in the ARGB format.|
686
687**Returns**
688
689Returns one of the following result codes:
690
691**OK**: This code is returned if the function is successfully called.
692
693**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
694
695**WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED**: This code is returned if the feature is not supported by the device.
696
697**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
698
699**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
700
701
702### OH_WindowManager_SetWindowStatusBarEnabled()
703
704```
705int32_t OH_WindowManager_SetWindowStatusBarEnabled (int32_t windowId, bool enabled, bool enableAnimation )
706```
707
708**Description**
709
710Sets whether to display the status bar in a window.
711
712**Since**: 15
713
714**Parameters**
715
716| Name| Description|
717| -------- | -------- |
718| windowId | Window ID. The default value is **0**. The value is an integer.|
719| enabled | Whether to display the status bar. The value **true** means to display the status bar, and **false** means the opposite.|
720| enableAnimation | Whether to enable the show/hide animation of the status bar. The value **true** means to enable the show/hide animation of the status bar, and **false** means the opposite.|
721
722**Returns**
723
724Returns one of the following result codes:
725
726**OK**: This code is returned if the function is successfully called.
727
728**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
729
730**WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED**: This code is returned if the feature is not supported by the device.
731
732**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
733
734**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
735
736
737### OH_WindowManager_SetWindowTouchable()
738
739```
740int32_t OH_WindowManager_SetWindowTouchable (int32_t windowId, bool isTouchable )
741```
742
743**Description**
744
745Sets whether a window is touchable.
746
747**Since**: 15
748
749**Parameters**
750
751| Name| Description|
752| -------- | -------- |
753| windowId | Window ID. The default value is **0**. The value is an integer.|
754| isTouchable | Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
755
756**Returns**
757
758Returns one of the following result codes:
759
760**OK**: This code is returned if the function is successfully called.
761
762**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
763
764**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
765
766**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
767
768
769### OH_WindowManager_ShowWindow()
770
771```
772WindowManager_ErrorCode OH_WindowManager_ShowWindow (int32_t windowId)
773```
774
775**Description**
776
777Displays a window.
778
779**Since**: 15
780
781**Parameters**
782
783| Name| Description|
784| -------- | -------- |
785| windowId | Window ID. The default value is **0**. The value is an integer.|
786
787**Returns**
788
789Returns one of the following result codes:
790
791**OK**: This code is returned if the function is successfully called.
792
793**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
794
795**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
796
797**WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL**: This code is returned if the window manager service is abnormal.
798
799
800### OH_WindowManager_Snapshot()
801
802```
803int32_t OH_WindowManager_Snapshot (int32_t windowId, OH_PixelmapNative * pixelMap )
804```
805
806**Description**
807
808Obtains the snapshot of a window.
809
810**Since**: 15
811
812**Parameters**
813
814| Name| Description|
815| -------- | -------- |
816| windowId | Window ID. The default value is **0**. The value is an integer. If the window ID is invalid or the window has been destroyed, you cannot obtain the window screenshot. To successfully obtain a screenshot, a valid window ID is required. You can obtain a valid window ID by calling the ArkTS API **getWindowProperties** on the window object.|
817| pixelMap | Pointer to the snapshot.|
818
819**Returns**
820
821Returns one of the following result codes:
822
823**OK**: This code is returned if the function is successfully called, and the pointer to the pixelMap is returned.
824
825**WINDOW_MANAGER_ERRORCODE_INVALID_PARAM**: This code is returned if a parameter is incorrect.
826
827**WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL**: This code is returned if the window status is abnormal.
828