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 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_radial_progress_bar.h"
28 
29 /* Bring in externs for caller checking code.  */
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_radial_progress_bar_create                     PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in the radial progress bar create   */
45 /*      call.                                                             */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    progress_bar                          Progress Bar control block    */
50 /*    name                                  Name of radial progress bar   */
51 /*    parent                                Pointer to parent widget      */
52 /*    info                                  Pointer to radial progress    */
53 /*                                            bar info.                   */
54 /*    style                                 Style of radial progress bar  */
55 /*    id                                    Application-defined ID of     */
56 /*                                            progress bar                */
57 /*    size                                  Dimensions of radial progress */
58 /*                                            bar                         */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _gx_radial_progress_bar_create        Actual radial progress bar    */
67 /*                                            create call                 */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
72 /*                                                                        */
73 /*  RELEASE HISTORY                                                       */
74 /*                                                                        */
75 /*    DATE              NAME                      DESCRIPTION             */
76 /*                                                                        */
77 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79 /*                                            resulting in version 6.1    */
80 /*                                                                        */
81 /**************************************************************************/
_gxe_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR * progress_bar,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RADIAL_PROGRESS_BAR_INFO * info,ULONG style,USHORT id,UINT progress_bar_control_block_size)82 UINT  _gxe_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR *progress_bar,
83                                       GX_CONST GX_CHAR *name,
84                                       GX_WIDGET *parent,
85                                       GX_RADIAL_PROGRESS_BAR_INFO *info,
86                                       ULONG style,
87                                       USHORT id,
88                                       UINT progress_bar_control_block_size)
89 {
90 UINT status;
91 
92     /* Check for invalid caller.  */
93     GX_INIT_AND_THREADS_CALLER_CHECKING
94 
95     /* Check for invalid pointer.  */
96     if ((progress_bar == GX_NULL) || (info == GX_NULL))
97     {
98         return(GX_PTR_ERROR);
99     }
100 
101     /* Check for invalid widget control block size.  */
102     if (progress_bar_control_block_size != sizeof(GX_RADIAL_PROGRESS_BAR))
103     {
104         return(GX_INVALID_SIZE);
105     }
106 
107     /* Check for widget already created.  */
108     if (progress_bar -> gx_widget_type != 0)
109     {
110         return(GX_ALREADY_CREATED);
111     }
112 
113     /* Check for invalid parent widget.  */
114     if (parent && (parent -> gx_widget_type == 0))
115     {
116         return(GX_INVALID_WIDGET);
117     }
118 
119     /* Call actual radial progress bar create function.  */
120     status = _gx_radial_progress_bar_create(progress_bar, name, parent, info, style, id);
121 
122     /* Return completion status.  */
123     return status;
124 }
125 
126