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 /**   Circular Gauge Management (Circular Gauge)                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_circular_gauge.h"
28 
29 GX_CALLER_CHECKING_EXTERNS
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_circular_gauge_create                          PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks errors in circular gauge create call.          */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    circular_gauge                        Circular gauge control block  */
48 /*    name                                  Name of the widget            */
49 /*    parent                                Parent widget control block   */
50 /*    circular_gauge_info                   Pointer to circular gauge info*/
51 /*    style                                 Style of circular gauge       */
52 /*    circular_gauge_id                     Application-defined ID of     */
53 /*                                            circular gauge              */
54 /*    size                                  Dimensions of circular gauge  */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_circular_gauge_create             Actual circular gauge create. */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    Application 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 /**************************************************************************/
_gxe_circular_gauge_create(GX_CIRCULAR_GAUGE * circular_gauge,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_CIRCULAR_GAUGE_INFO * circular_gauge_info,GX_RESOURCE_ID background,ULONG style,USHORT circular_gauge_id,GX_VALUE xpos,GX_VALUE ypos,UINT checkbox_control_block_size)77 UINT  _gxe_circular_gauge_create(GX_CIRCULAR_GAUGE *circular_gauge,
78                                  GX_CONST GX_CHAR *name,
79                                  GX_WIDGET *parent,
80                                  GX_CIRCULAR_GAUGE_INFO *circular_gauge_info,
81                                  GX_RESOURCE_ID background,
82                                  ULONG style,
83                                  USHORT circular_gauge_id,
84                                  GX_VALUE xpos, GX_VALUE ypos, UINT checkbox_control_block_size)
85 {
86 UINT status;
87 
88     /* Check for appropriate caller.  */
89     GX_INIT_AND_THREADS_CALLER_CHECKING
90 
91     /* Check for invalid input pointers.  */
92     if ((circular_gauge == GX_NULL) || (circular_gauge_info == GX_NULL))
93     {
94         return(GX_PTR_ERROR);
95     }
96 
97     if (checkbox_control_block_size != sizeof(GX_CIRCULAR_GAUGE))
98     {
99         return(GX_INVALID_SIZE);
100     }
101 
102     /* Check for widget already created.  */
103     if (circular_gauge -> gx_widget_type != 0)
104     {
105         return(GX_ALREADY_CREATED);
106     }
107 
108     /* Call the actual gauge create function.  */
109     status = _gx_circular_gauge_create(circular_gauge, name, parent,
110                                        circular_gauge_info, background,
111                                        style, circular_gauge_id, xpos, ypos);
112 
113     return status;
114 }
115 
116