1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Widget Management (Widget)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_system.h"
29 #include "gx_widget.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_widget_border_style_set                         PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function sets the border style flags of the widget.            */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    widget                                Widget control block          */
49 /*    Style                                 Border style for widget       */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*                                                                        */
56 /*  CALLED BY                                                             */
57 /*                                                                        */
58 /*    Application Code                                                    */
59 /*                                                                        */
60 /*  RELEASE HISTORY                                                       */
61 /*                                                                        */
62 /*    DATE              NAME                      DESCRIPTION             */
63 /*                                                                        */
64 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
65 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
66 /*                                            resulting in version 6.1    */
67 /*                                                                        */
68 /**************************************************************************/
_gx_widget_border_style_set(GX_WIDGET * widget,ULONG Style)69 UINT  _gx_widget_border_style_set(GX_WIDGET *widget, ULONG Style)
70 {
71 GX_WINDOW *win = (GX_WINDOW *)widget;
72 GX_VALUE   border_width;
73 GX_EVENT   my_event;
74 ULONG      old_style = widget -> gx_widget_style;
75 
76     /* Set the widget's border style.  */
77 
78     widget -> gx_widget_style &= ~GX_STYLE_BORDER_MASK;
79     Style &= GX_STYLE_BORDER_MASK;
80     widget -> gx_widget_style |= Style;
81 
82     if (widget -> gx_widget_type >= GX_TYPE_WINDOW)
83     {
84         /* Pick up border width.  */
85         _gx_widget_border_width_get(widget, &border_width);
86 
87         /* Get window client.  */
88         _gx_widget_client_get(widget, border_width, &win -> gx_window_client);
89     }
90 
91     memset(&my_event, 0, sizeof(GX_EVENT));
92     my_event.gx_event_payload.gx_event_ulongdata = old_style;
93     my_event.gx_event_type = GX_EVENT_STYLE_CHANGED;
94     my_event.gx_event_target = widget;
95     _gx_system_event_fold(&my_event);
96     return(GX_SUCCESS);
97 }
98 
99