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 /**   Text 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_text_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 text 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 /*    total_rows                          Total rows of the scroll wheel  */
51 /*    style                               Style of widget                 */
52 /*    Id                                  Application-defined ID of the   */
53 /*                                          the widget                    */
54 /*    size                                Widget size                     */
55 /*    control_block_size                  Size of the scroll wheel        */
56 /*                                          control block                 */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*    _gx_text_scroll_wheel_create          Actual text scroll wheel      */
65 /*                                            create call                 */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gxe_text_scroll_wheel_create(GX_TEXT_SCROLL_WHEEL * wheel,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT total_rows,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size,UINT control_block_size)80 UINT  _gxe_text_scroll_wheel_create(GX_TEXT_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
81                                     ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size)
82 {
83 UINT status;
84 
85     /* Check for appropriate caller.  */
86     GX_INIT_AND_THREADS_CALLER_CHECKING
87 
88     /* Check for invalid pointer. */
89     if ((wheel == GX_NULL) || (size == GX_NULL))
90     {
91         return GX_PTR_ERROR;
92     }
93 
94     /* Check for invalid control block size. */
95     if (control_block_size != sizeof(GX_TEXT_SCROLL_WHEEL))
96     {
97         return GX_INVALID_SIZE;
98     }
99 
100     /* Check for widget already created.  */
101     if (wheel -> gx_widget_type != 0)
102     {
103         return(GX_ALREADY_CREATED);
104     }
105 
106     /* Check for invalid widget. */
107     if (parent && (parent->gx_widget_type == 0))
108     {
109         return(GX_INVALID_WIDGET);
110     }
111 
112     status = _gx_text_scroll_wheel_create(wheel, name, parent, total_rows, style, Id, size);
113 
114     return status;
115 }
116 
117