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 /**   Scroll Wheel Management (Generic 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_widget.h"
28 #include "gx_scroll_wheel.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_generic_scroll_wheel_event_process              PORTABLE C      */
35 /*                                                           6.1.7        */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Ting Zhu, Microsoft Corporation                                     */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This service processes an event for the generic scroll wheel.       */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    wheel                                 Scroll wheel control block    */
47 /*    event_ptr                             Pointer to event to process   */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    status                                Completion status             */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _gx_generic_scroll_wheel_children_position                          */
56 /*                                          Position the children for     */
57 /*                                            the scroll wheel children   */
58 /*    _gx_scroll_wheel_event_process        Process events for the        */
59 /*                                            scroll wheel widget         */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  06-02-2021        Ting Zhu              Initial Version 6.1.7         */
70 /*                                                                        */
71 /**************************************************************************/
_gx_generic_scroll_wheel_event_process(GX_GENERIC_SCROLL_WHEEL * wheel,GX_EVENT * event_ptr)72 UINT  _gx_generic_scroll_wheel_event_process(GX_GENERIC_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr)
73 {
74 UINT status;
75 
76     switch (event_ptr -> gx_event_type)
77     {
78     case GX_EVENT_SHOW:
79 
80         /* Show the children before attempting to position them, because child
81            widgets do not know their size until shown.  */
82 
83         status = _gx_scroll_wheel_event_process((GX_SCROLL_WHEEL *)wheel, event_ptr);
84 
85         /* Position the child widgets.  */
86         if (!wheel -> gx_generic_scroll_wheel_child_count)
87         {
88             _gx_generic_scroll_wheel_children_position(wheel);
89         }
90         break;
91 
92     default:
93         status = _gx_scroll_wheel_event_process((GX_SCROLL_WHEEL *)wheel, event_ptr);
94         break;
95     }
96 
97     return status;
98 }
99 
100