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 /**   Dispaly Management (Dispaly)                                        */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_display.h"
28 #include "gx_system.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_display_theme_install                           PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This service installs themes to the specified display.              */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    display                               Display control block         */
47 /*    theme_table                           Theme table to be installed   */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    status                                Completion status             */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _gx_display_canvas_dirty              Mark all root windows as dirty*/
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Application Code                                                    */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
66 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
67 /*                                            resulting in version 6.1    */
68 /*                                                                        */
69 /**************************************************************************/
_gx_display_theme_install(GX_DISPLAY * display,GX_CONST GX_THEME * theme_ptr)70 UINT  _gx_display_theme_install(GX_DISPLAY *display, GX_CONST GX_THEME *theme_ptr)
71 {
72     /* Install color table.  */
73     _gx_display_color_table_set(display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
74 
75     /* install the color palette if required.  */
76     if (display->gx_display_driver_palette_set &&
77         theme_ptr->theme_palette != NULL)
78     {
79         display->gx_display_driver_palette_set(display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
80     }
81 
82     /* install font table.  */
83     _gx_display_font_table_set(display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
84 
85     /* install pixelmap table.  */
86     _gx_display_pixelmap_table_set(display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
87 
88     _gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *)&theme_ptr->theme_vertical_scrollbar_appearance);
89     _gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *)&theme_ptr->theme_horizontal_scrollbar_appearance);
90 
91     /* mark all visible canvases as dirty when there is a resource change */
92     _gx_display_canvas_dirty(display);
93 
94     /* Return success.  */
95     return(GX_SUCCESS);
96 }
97 
98