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 /**   Radial Slider Management (Slider)                                   */
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_slider.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_slider_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 slider create         */
45 /*    function call.                                                      */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    slider                                Radial slider control block   */
50 /*    name                                  Name of radial slider         */
51 /*    parent                                Parent widget control block   */
52 /*    info                                  Pointer to radial slider info */
53 /*    style                                 Style of prompt               */
54 /*    slider_id                             Application-defined ID of     */
55 /*                                            radial slider               */
56 /*    size                                  Widget size                   */
57 /*    control_block_size                    Size of the radial slider     */
58 /*                                            control block               */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _gx_radial_slider_create              Actual radial slider create   */
67 /*                                            function                    */
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_slider_create(GX_RADIAL_SLIDER * slider,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RADIAL_SLIDER_INFO * info,ULONG style,USHORT slider_id,GX_CONST GX_RECTANGLE * size,UINT control_block_size)82 UINT _gxe_radial_slider_create(GX_RADIAL_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83                                GX_RADIAL_SLIDER_INFO *info, ULONG style, USHORT slider_id,
84                                GX_CONST GX_RECTANGLE *size, UINT 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 ((slider == GX_NULL) || (size == GX_NULL) || (info == GX_NULL))
93     {
94         return(GX_PTR_ERROR);
95     }
96 
97     /* Check for widget already created.  */
98     if (slider -> gx_widget_type != 0)
99     {
100         return(GX_ALREADY_CREATED);
101     }
102 
103     /* Check for invalid widget control block size. */
104     if (control_block_size != sizeof(GX_RADIAL_SLIDER))
105     {
106         return(GX_INVALID_SIZE);
107     }
108 
109     /* Check for invalid parent widget. */
110     if (parent && (parent -> gx_widget_type == 0))
111     {
112         return(GX_INVALID_WIDGET);
113     }
114 
115     /* Call actual radial slider create function.  */
116     status = _gx_radial_slider_create(slider, name, parent, info, style, slider_id, size);
117 
118     /* Return completion status.  */
119     return(status);
120 }
121 
122