| 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 (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_window.h" | 
    
    | 28 |  |  | #include "gx_scroll_wheel.h" | 
    
    | 29 |  |  |  | 
    
    | 30 |  |  | /**************************************************************************/ | 
    
    | 31 |  |  | /*                                                                        */ | 
    
    | 32 |  |  | /*  FUNCTION                                               RELEASE        */ | 
    
    | 33 |  |  | /*                                                                        */ | 
    
    | 34 |  |  | /*    _gx_scroll_wheel_create                             PORTABLE C      */ | 
    
    | 35 |  |  | /*                                                           6.1.7        */ | 
    
    | 36 |  |  | /*  AUTHOR                                                                */ | 
    
    | 37 |  |  | /*                                                                        */ | 
    
    | 38 |  |  | /*    Kenneth Maxwell, Microsoft Corporation                              */ | 
    
    | 39 |  |  | /*                                                                        */ | 
    
    | 40 |  |  | /*  DESCRIPTION                                                           */ | 
    
    | 41 |  |  | /*                                                                        */ | 
    
    | 42 |  |  | /*    This function creates a scroll wheel selector widget.               */ | 
    
    | 43 |  |  | /*                                                                        */ | 
    
    | 44 |  |  | /*  INPUT                                                                 */ | 
    
    | 45 |  |  | /*                                                                        */ | 
    
    | 46 |  |  | /*    wheel                                 Scroll wheel control block    */ | 
    
    | 47 |  |  | /*    name                                  Name of widget                */ | 
    
    | 48 |  |  | /*    parent                                Parent widget control block   */ | 
    
    | 49 |  |  | /*    total_rows                            Total rows of the scroll wheel*/ | 
    
    | 50 |  |  | /*    style                                 Style of widget               */ | 
    
    | 51 |  |  | /*    Id                                    Application-defined ID of the */ | 
    
    | 52 |  |  | /*                                            the widget                  */ | 
    
    | 53 |  |  | /*    size                                  Widget size                   */ | 
    
    | 54 |  |  | /*                                                                        */ | 
    
    | 55 |  |  | /*  OUTPUT                                                                */ | 
    
    | 56 |  |  | /*                                                                        */ | 
    
    | 57 |  |  | /*    status                                Completion status             */ | 
    
    | 58 |  |  | /*                                                                        */ | 
    
    | 59 |  |  | /*  CALLS                                                                 */ | 
    
    | 60 |  |  | /*                                                                        */ | 
    
    | 61 |  |  | /*    _gx_window_create                     Create a window               */ | 
    
    | 62 |  |  | /*                                                                        */ | 
    
    | 63 |  |  | /*  CALLED BY                                                             */ | 
    
    | 64 |  |  | /*                                                                        */ | 
    
    | 65 |  |  | /*    Application Code                                                    */ | 
    
    | 66 |  |  | /*    GUIX Internal Code                                                  */ | 
    
    | 67 |  |  | /*                                                                        */ | 
    
    | 68 |  |  | /*  RELEASE HISTORY                                                       */ | 
    
    | 69 |  |  | /*                                                                        */ | 
    
    | 70 |  |  | /*    DATE              NAME                      DESCRIPTION             */ | 
    
    | 71 |  |  | /*                                                                        */ | 
    
    | 72 |  |  | /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */ | 
    
    | 73 |  |  | /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */ | 
    
    | 74 |  |  | /*                                            resulting in version 6.1    */ | 
    
    | 75 |  |  | /*  06-02-2021     Ting Zhu                 Modified comment(s),          */ | 
    
    | 76 |  |  | /*                                            updated with scroll wheel   */ | 
    
    | 77 |  |  | /*                                            control block change,       */ | 
    
    | 78 |  |  | /*                                            resulting in version 6.1.7  */ | 
    
    | 79 |  |  | /*                                                                        */ | 
    
    | 80 |  |  | /**************************************************************************/ | 
    
    | 81 |  |  |  | 
    
    | 82 |  | 472 | UINT _gx_scroll_wheel_create(GX_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, | 
    
    | 83 |  |  |                              GX_WIDGET *parent, INT total_rows, | 
    
    | 84 |  |  |                              ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size) | 
    
    | 85 |  |  | { | 
    
    | 86 |  |  |  | 
    
    | 87 |  |  |     GX_PARAMETER_NOT_USED(parent); | 
    
    | 88 |  |  |  | 
    
    | 89 |  | 472 |     _gx_window_create((GX_WINDOW *)wheel, name, GX_NULL, style, Id, size); | 
    
    | 90 |  |  |  | 
    
    | 91 |  | 472 |     wheel -> gx_widget_type = GX_TYPE_SCROLL_WHEEL; | 
    
    | 92 |  | 472 |     wheel -> gx_scroll_wheel_total_rows = total_rows; | 
    
    | 93 |  | 472 |     wheel -> gx_scroll_wheel_row_height = 30; | 
    
    | 94 |  |  |  | 
    
    | 95 |  | 472 |     memset(&wheel -> gx_scroll_wheel_gradient, 0, sizeof(GX_GRADIENT)); | 
    
    | 96 |  |  |  | 
    
    | 97 |  | 472 |     wheel -> gx_scroll_wheel_selected_row = 0; | 
    
    | 98 |  | 472 |     wheel -> gx_scroll_wheel_selected_yshift = 0; | 
    
    | 99 |  | 472 |     wheel -> gx_scroll_wheel_shift_error = 0; | 
    
    | 100 |  | 472 |     wheel -> gx_scroll_wheel_animation_speed = 0; | 
    
    | 101 |  | 472 |     wheel -> gx_scroll_wheel_animation_end_speed = 0; | 
    
    | 102 |  | 472 |     wheel -> gx_scroll_wheel_animation_steps = 0; | 
    
    | 103 |  | 472 |     wheel -> gx_scroll_wheel_animation_max_steps = 10; | 
    
    | 104 |  | 472 |     wheel -> gx_scroll_wheel_animation_delay = 2; | 
    
    | 105 |  | 472 |     wheel -> gx_scroll_wheel_animation_start_speed_rate = GX_FIXED_VAL_MAKE(1); | 
    
    | 106 |  | 472 |     wheel -> gx_scroll_wheel_animation_end_speed_rate = 200; | 
    
    | 107 |  | 472 |     wheel -> gx_scroll_wheel_selected_background = GX_NULL; | 
    
    | 108 |  | 472 |     wheel -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_scroll_wheel_event_process; | 
    
    | 109 |  | 472 |     wheel -> gx_scroll_wheel_scroll = _gx_scroll_wheel_scroll; | 
    
    | 110 |  | 472 |     wheel -> gx_scroll_wheel_wrap_style_check = _gx_scroll_wheel_wrap_style_check; | 
    
    | 111 |  |  |  | 
    
    | 112 |  | 472 |     return(GX_SUCCESS); | 
    
    | 113 |  |  | } | 
    
    | 114 |  |  |  |