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 /**   Widget Management (Widget)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_widget.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_widget_border_style_set                         PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function sets the border style flags of the widget.            */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    widget                                Widget control block          */
48 /*    Style                                 Border style for widget       */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*                                                                        */
55 /*  CALLED BY                                                             */
56 /*                                                                        */
57 /*    Application Code                                                    */
58 /*                                                                        */
59 /*  RELEASE HISTORY                                                       */
60 /*                                                                        */
61 /*    DATE              NAME                      DESCRIPTION             */
62 /*                                                                        */
63 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
64 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
65 /*                                            resulting in version 6.1    */
66 /*                                                                        */
67 /**************************************************************************/
_gx_widget_border_style_set(GX_WIDGET * widget,ULONG Style)68 UINT  _gx_widget_border_style_set(GX_WIDGET *widget, ULONG Style)
69 {
70 GX_WINDOW *win = (GX_WINDOW *)widget;
71 GX_VALUE   border_width;
72 GX_EVENT   my_event;
73 ULONG      old_style = widget -> gx_widget_style;
74 
75     /* Set the widget's border style.  */
76 
77     widget -> gx_widget_style &= ~GX_STYLE_BORDER_MASK;
78     Style &= GX_STYLE_BORDER_MASK;
79     widget -> gx_widget_style |= Style;
80 
81     if (widget -> gx_widget_type >= GX_TYPE_WINDOW)
82     {
83         /* Pick up border width.  */
84         _gx_widget_border_width_get(widget, &border_width);
85 
86         /* Get window client.  */
87         _gx_widget_client_get(widget, border_width, &win -> gx_window_client);
88     }
89 
90     memset(&my_event, 0, sizeof(GX_EVENT));
91     my_event.gx_event_payload.gx_event_ulongdata = old_style;
92     my_event.gx_event_type = GX_EVENT_STYLE_CHANGED;
93     my_event.gx_event_target = widget;
94     _gx_system_event_fold(&my_event);
95     return(GX_SUCCESS);
96 }
97 
98