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 /**   Progress Bar Management (Radial Progress Bar)                       */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 /* Include necessary system files.  */
24 
25 #include "gx_api.h"
26 #include "gx_system.h"
27 #include "gx_widget.h"
28 #include "gx_radial_progress_bar.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_radial_progress_bar_info_set                    PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function reset the information structure of a radial progress  */
44 /*      bar                                                               */
45 /*                                                                        */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    bar                                   Radial proress bar control    */
50 /*                                            block                       */
51 /*    info                                  Radial progess bar info block */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _gx_radial_progrss_bar_size_update    Update the size of the        */
60 /*                                            progress bar                */
61 /*    _gx_system_dirty_mark                 Mark the widget as dirty      */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Application Code                                                    */
66 /*    GUIX Internal Code                                                  */
67 /*                                                                        */
68 /*  RELEASE HISTORY                                                       */
69 /*                                                                        */
70 /*    DATE              NAME                      DESCRIPTION             */
71 /*                                                                        */
72 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74 /*                                            resulting in version 6.1    */
75 /*                                                                        */
76 /**************************************************************************/
_gx_radial_progress_bar_info_set(GX_RADIAL_PROGRESS_BAR * bar,GX_RADIAL_PROGRESS_BAR_INFO * info)77 UINT _gx_radial_progress_bar_info_set(GX_RADIAL_PROGRESS_BAR *bar, GX_RADIAL_PROGRESS_BAR_INFO *info)
78 {
79 
80     /* Copy the new info.  */
81     bar -> gx_radial_progress_bar_info = *info;
82 
83     if (info -> gx_radial_progress_bar_info_anchor_val < 0)
84     {
85         bar -> gx_radial_progress_bar_info.gx_radial_progress_bar_info_anchor_val = 0;
86     }
87     else if (info -> gx_radial_progress_bar_info_anchor_val > 360)
88     {
89         bar -> gx_radial_progress_bar_info.gx_radial_progress_bar_info_anchor_val = 360;
90     }
91 
92     /* Calculate radial progress bar.  */
93     _gx_radial_progress_bar_size_update(bar);
94 
95     if (bar -> gx_widget_status & GX_STATUS_VISIBLE)
96     {
97         /* Mark the widget area as dirty.  */
98         _gx_system_dirty_mark((GX_WIDGET *)bar);
99     }
100 
101     return(GX_SUCCESS);
102 }
103 
104