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  | 
     | 
     | 
    /**   String 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  | 
     | 
     | 
    #include "gx_system.h"  | 
    
    
    29  | 
     | 
     | 
     | 
    
    
    30  | 
     | 
     | 
    /**************************************************************************/  | 
    
    
    31  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    32  | 
     | 
     | 
    /*  FUNCTION                                               RELEASE        */  | 
    
    
    33  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    34  | 
     | 
     | 
    /*    _gx_string_scroll_wheel_string_id_list_set          PORTABLE C      */  | 
    
    
    35  | 
     | 
     | 
    /*                                                           6.1          */  | 
    
    
    36  | 
     | 
     | 
    /*  AUTHOR                                                                */  | 
    
    
    37  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    38  | 
     | 
     | 
    /*    Kenneth Maxwell, Microsoft Corporation                              */  | 
    
    
    39  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    40  | 
     | 
     | 
    /*  DESCRIPTION                                                           */  | 
    
    
    41  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    42  | 
     | 
     | 
    /*    This function assigns a string id list for the string scroll wheel. */  | 
    
    
    43  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    44  | 
     | 
     | 
    /*  INPUT                                                                 */  | 
    
    
    45  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    46  | 
     | 
     | 
    /*    wheel                                 Scroll wheel control block    */  | 
    
    
    47  | 
     | 
     | 
    /*    string_id_list                        String id list to be set      */  | 
    
    
    48  | 
     | 
     | 
    /*    id_count                              The number of string ids      */  | 
    
    
    49  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    50  | 
     | 
     | 
    /*  OUTPUT                                                                */  | 
    
    
    51  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    52  | 
     | 
     | 
    /*    status                                Completion status             */  | 
    
    
    53  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    54  | 
     | 
     | 
    /*  CALLS                                                                 */  | 
    
    
    55  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    56  | 
     | 
     | 
    /*    _gx_system_memory_free                Application defined memory    */  | 
    
    
    57  | 
     | 
     | 
    /*                                            free function               */  | 
    
    
    58  | 
     | 
     | 
    /*    _gx_scroll_wheel_total_rows_set       Set scroll wheel total rows   */  | 
    
    
    59  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    60  | 
     | 
     | 
    /*  CALLED BY                                                             */  | 
    
    
    61  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    62  | 
     | 
     | 
    /*    Application Code                                                    */  | 
    
    
    63  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    64  | 
     | 
     | 
    /*  RELEASE HISTORY                                                       */  | 
    
    
    65  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    66  | 
     | 
     | 
    /*    DATE              NAME                      DESCRIPTION             */  | 
    
    
    67  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    68  | 
     | 
     | 
    /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */  | 
    
    
    69  | 
     | 
     | 
    /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */  | 
    
    
    70  | 
     | 
     | 
    /*                                            added logic to delete       */  | 
    
    
    71  | 
     | 
     | 
    /*                                            dynamic bidi text,          */  | 
    
    
    72  | 
     | 
     | 
    /*                                            resulting in version 6.1    */  | 
    
    
    73  | 
     | 
     | 
    /*                                                                        */  | 
    
    
    74  | 
     | 
     | 
    /**************************************************************************/  | 
    
    
    75  | 
     | 
    190  | 
    UINT _gx_string_scroll_wheel_string_id_list_set(GX_STRING_SCROLL_WHEEL *wheel,  | 
    
    
    76  | 
     | 
     | 
                                                    GX_CONST GX_RESOURCE_ID *string_id_list,  | 
    
    
    77  | 
     | 
     | 
                                                    INT id_count)  | 
    
    
    78  | 
     | 
     | 
    { | 
    
    
    79  | 
     | 
     | 
    UINT status;  | 
    
    
    80  | 
     | 
     | 
     | 
    
    
    81  | 
    ✓✓ | 
    190  | 
        if (wheel -> gx_widget_style & GX_STYLE_TEXT_COPY)  | 
    
    
    82  | 
     | 
     | 
        { | 
    
    
    83  | 
     | 
     | 
    #if defined(GX_ENABLE_DEPRECATED_STRING_API)  | 
    
    
    84  | 
    ✓✓ | 
    28  | 
            if (wheel -> gx_string_scroll_wheel_string_list_deprecated)  | 
    
    
    85  | 
     | 
     | 
            { | 
    
    
    86  | 
    ✓✓ | 
    2  | 
                if (_gx_system_memory_free == GX_NULL)  | 
    
    
    87  | 
     | 
     | 
                { | 
    
    
    88  | 
     | 
    1  | 
                    return GX_SYSTEM_MEMORY_ERROR;  | 
    
    
    89  | 
     | 
     | 
                }  | 
    
    
    90  | 
     | 
     | 
     | 
    
    
    91  | 
     | 
    1  | 
                _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list_deprecated);  | 
    
    
    92  | 
     | 
     | 
            }  | 
    
    
    93  | 
     | 
     | 
    #endif  | 
    
    
    94  | 
     | 
     | 
     | 
    
    
    95  | 
    ✓✓ | 
    27  | 
            if (wheel -> gx_string_scroll_wheel_string_list)  | 
    
    
    96  | 
     | 
     | 
            { | 
    
    
    97  | 
    ✓✓ | 
    2  | 
                if (_gx_system_memory_free == GX_NULL)  | 
    
    
    98  | 
     | 
     | 
                { | 
    
    
    99  | 
     | 
    1  | 
                    return GX_SYSTEM_MEMORY_ERROR;  | 
    
    
    100  | 
     | 
     | 
                }  | 
    
    
    101  | 
     | 
     | 
     | 
    
    
    102  | 
     | 
    1  | 
                _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list);  | 
    
    
    103  | 
     | 
     | 
            }  | 
    
    
    104  | 
     | 
     | 
        }  | 
    
    
    105  | 
     | 
     | 
     | 
    
    
    106  | 
     | 
    188  | 
        wheel -> gx_string_scroll_wheel_string_id_list = string_id_list;  | 
    
    
    107  | 
     | 
    188  | 
        wheel -> gx_string_scroll_wheel_string_list = GX_NULL;  | 
    
    
    108  | 
     | 
    188  | 
        wheel -> gx_string_scroll_wheel_string_list_buffer_size = 0;  | 
    
    
    109  | 
     | 
     | 
    #if defined(GX_ENABLE_DEPRECATED_STRING_API)  | 
    
    
    110  | 
     | 
    188  | 
        wheel -> gx_string_scroll_wheel_string_list_deprecated = GX_NULL;  | 
    
    
    111  | 
     | 
     | 
    #endif  | 
    
    
    112  | 
     | 
     | 
     | 
    
    
    113  | 
     | 
     | 
    #ifdef GX_DYNAMIC_BIDI_TEXT_SUPPORT  | 
    
    
    114  | 
     | 
     | 
        _gx_text_scroll_wheel_dynamic_bidi_text_delete((GX_TEXT_SCROLL_WHEEL *)wheel);  | 
    
    
    115  | 
     | 
     | 
    #endif  // GX_DYNAMIC_BIDI_TEXT_SUPPORT  | 
    
    
    116  | 
     | 
     | 
     | 
    
    
    117  | 
     | 
    188  | 
        status = _gx_scroll_wheel_total_rows_set((GX_SCROLL_WHEEL *)wheel, id_count);  | 
    
    
    118  | 
     | 
     | 
     | 
    
    
    119  | 
     | 
    188  | 
        return status;  | 
    
    
    120  | 
     | 
     | 
    }  | 
    
    
    121  | 
     | 
     | 
     |