1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Window Management (Window)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 #include "gx_window.h"
29 #include "gx_system.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_window_wallpaper_set                            PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This service sets the wallpaper for the specified window.           */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    window                                Pointer to window             */
49 /*    wallpaper_id                          Resource ID of wallpaper      */
50 /*    tile                                  Wallpaper is tiled if GX_TRUE,*/
51 /*                                          otherwise wallpaper is not    */
52 /*                                          tiled                         */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    status                                Completion status             */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _gx_system_dirty_mark                 Mark this text as dirty       */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    GUIX Internal Code                                                  */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
_gx_window_wallpaper_set(GX_WINDOW * window,GX_RESOURCE_ID wallpaper_id,GX_BOOL tile)75 UINT _gx_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX_BOOL tile)
76 {
77     /* assign the resource id */
78     window -> gx_window_wallpaper = wallpaper_id;
79 
80     /* check for centered or tiled */
81     if (tile)
82     {
83         window -> gx_widget_style |= GX_STYLE_TILE_WALLPAPER;
84     }
85     else
86     {
87         window -> gx_widget_style &= (ULONG)(~GX_STYLE_TILE_WALLPAPER);
88     }
89 
90     /* if I am already visible then I need to mark as dirty */
91     if (window -> gx_widget_status & GX_STATUS_VISIBLE)
92     {
93         _gx_system_dirty_mark((GX_WIDGET *)window);
94     }
95 
96     return(GX_SUCCESS);
97 }
98 
99