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 /**************************************************************************/
30 /*                                                                        */
31 /*  FUNCTION                                               RELEASE        */
32 /*                                                                        */
33 /*    _gxe_text_scroll_wheel_callback_set                 PORTABLE C      */
34 /*                                                           6.1          */
35 /*  AUTHOR                                                                */
36 /*                                                                        */
37 /*    Kenneth Maxwell, Microsoft Corporation                              */
38 /*                                                                        */
39 /*  DESCRIPTION                                                           */
40 /*                                                                        */
41 /*    This function checks for errors in the scroll wheel callback set    */
42 /*    function call.                                                      */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    widget                                Widget control block          */
47 /*    callback                              pointer to event process      */
48 /*                                            function                    */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _gx_text_scroll_wheel_callback_set    Actual wheel event process    */
57 /*                                            set function                */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    GUIX Application                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
68 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
72 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_text_scroll_wheel_callback_set(GX_TEXT_SCROLL_WHEEL * widget,GX_CONST GX_CHAR * (* callback)(GX_TEXT_SCROLL_WHEEL *,INT))73 UINT _gxe_text_scroll_wheel_callback_set(GX_TEXT_SCROLL_WHEEL *widget, GX_CONST GX_CHAR *(*callback)(GX_TEXT_SCROLL_WHEEL *, INT))
74 {
75 UINT status;
76 
77     /* Check for invalid input pointers.  */
78     if ((widget == GX_NULL) || (callback == GX_NULL))
79     {
80         return(GX_PTR_ERROR);
81     }
82 
83     /* Check for invalid widget. */
84     if (widget -> gx_widget_type == 0)
85     {
86         return(GX_INVALID_WIDGET);
87     }
88 
89     /* Call actual widget event process set function.  */
90     status = _gx_text_scroll_wheel_callback_set(widget, callback);
91 
92     /* Return completion status.  */
93     return(status);
94 }
95 #endif
96 
97 /**************************************************************************/
98 /*                                                                        */
99 /*  FUNCTION                                               RELEASE        */
100 /*                                                                        */
101 /*    _gxe_text_scroll_wheel_callback_set_ext             PORTABLE C      */
102 /*                                                           6.1          */
103 /*  AUTHOR                                                                */
104 /*                                                                        */
105 /*    Kenneth Maxwell, Microsoft Corporation                              */
106 /*                                                                        */
107 /*  DESCRIPTION                                                           */
108 /*                                                                        */
109 /*    This function checks for errors in the scroll wheel callback set    */
110 /*    function call.                                                      */
111 /*                                                                        */
112 /*  INPUT                                                                 */
113 /*                                                                        */
114 /*    widget                                Widget control block          */
115 /*    callback                              pointer to event process      */
116 /*                                            function                    */
117 /*                                                                        */
118 /*  OUTPUT                                                                */
119 /*                                                                        */
120 /*    status                                Completion status             */
121 /*                                                                        */
122 /*  CALLS                                                                 */
123 /*                                                                        */
124 /*    _gx_text_scroll_wheel_callback_set_ext                              */
125 /*                                          Actual wheel event process    */
126 /*                                            set function                */
127 /*                                                                        */
128 /*  CALLED BY                                                             */
129 /*                                                                        */
130 /*    GUIX Application                                                    */
131 /*                                                                        */
132 /*  RELEASE HISTORY                                                       */
133 /*                                                                        */
134 /*    DATE              NAME                      DESCRIPTION             */
135 /*                                                                        */
136 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
137 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
138 /*                                            resulting in version 6.1    */
139 /*                                                                        */
140 /**************************************************************************/
_gxe_text_scroll_wheel_callback_set_ext(GX_TEXT_SCROLL_WHEEL * widget,UINT (* callback)(GX_TEXT_SCROLL_WHEEL *,INT,GX_STRING *))141 UINT _gxe_text_scroll_wheel_callback_set_ext(GX_TEXT_SCROLL_WHEEL *widget, UINT (*callback)(GX_TEXT_SCROLL_WHEEL *, INT, GX_STRING *))
142 {
143 UINT status;
144 
145     /* Check for invalid input pointers.  */
146     if ((widget == GX_NULL) || (callback == GX_NULL))
147     {
148         return(GX_PTR_ERROR);
149     }
150 
151     /* Check for invalid widget. */
152     if (widget -> gx_widget_type == 0)
153     {
154         return(GX_INVALID_WIDGET);
155     }
156 
157     /* Call actual widget event process set function.  */
158     status = _gx_text_scroll_wheel_callback_set_ext(widget, callback);
159 
160     /* Return completion status.  */
161     return(status);
162 }
163 
164