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 /**   Numeric Scroll Wheel Management (Scroll Wheel)                      */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_scroll_wheel.h"
28 
29 GX_CALLER_CHECKING_EXTERNS
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_numeric_scroll_wheel_create                    PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in numeric scroll wheel create call.*/
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    wheel                                 Scroll wheel control block    */
48 /*    name                                  Name of widget                */
49 /*    parent                                Parent widget control block   */
50 /*    start_val                             Start value of numeric range  */
51 /*    end_val                               End value of numeric range    */
52 /*    style                                 Style of widget               */
53 /*    Id                                    Application-defined ID of the */
54 /*                                            the widget                  */
55 /*    size                                  Widget size                   */
56 /*    control_block_size                    Size of the scroll wheel      */
57 /*                                            control block               */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    status                                Completion status             */
62 /*                                                                        */
63 /*  CALLS                                                                 */
64 /*                                                                        */
65 /*    _gx_numeric_scroll_wheel_create       Actual numeric scroll wheel   */
66 /*                                            create call                 */
67 /*                                                                        */
68 /*  CALLED BY                                                             */
69 /*                                                                        */
70 /*    Application Code                                                    */
71 /*                                                                        */
72 /*  RELEASE HISTORY                                                       */
73 /*                                                                        */
74 /*    DATE              NAME                      DESCRIPTION             */
75 /*                                                                        */
76 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
77 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
78 /*                                            resulting in version 6.1    */
79 /*                                                                        */
80 /**************************************************************************/
_gxe_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL * wheel,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT start_val,INT end_val,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size,UINT control_block_size)81 UINT  _gxe_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL *wheel,
82                                        GX_CONST GX_CHAR *name,
83                                        GX_WIDGET *parent,
84                                        INT start_val, INT end_val,
85                                        ULONG style, USHORT Id,
86                                        GX_CONST GX_RECTANGLE *size, UINT control_block_size)
87 {
88 UINT status;
89 
90     /* Check for appropriate caller.  */
91     GX_INIT_AND_THREADS_CALLER_CHECKING
92 
93     /* Check for invalid pointer. */
94     if ((wheel == GX_NULL) || (size == GX_NULL))
95     {
96         return GX_PTR_ERROR;
97     }
98 
99     /* Check for invalid value. */
100     if (control_block_size != sizeof(GX_NUMERIC_SCROLL_WHEEL))
101     {
102         return GX_INVALID_SIZE;
103     }
104 
105     /* Check for widget already created.  */
106     if (wheel -> gx_widget_type != 0)
107     {
108         return(GX_ALREADY_CREATED);
109     }
110 
111     status = _gx_numeric_scroll_wheel_create(wheel, name, parent, start_val, end_val, style, Id, size);
112     return status;
113 }
114 
115