GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_string_scroll_wheel_string_id_list_set.c Lines: 16 16 100.0 %
Date: 2026-03-06 19:21:09 Branches: 10 10 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   String Scroll Wheel Management (Scroll Wheel)                       */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_scroll_wheel.h"
29
#include "gx_system.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_string_scroll_wheel_string_id_list_set          PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function assigns a string id list for the string scroll wheel. */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    wheel                                 Scroll wheel control block    */
48
/*    string_id_list                        String id list to be set      */
49
/*    id_count                              The number of string ids      */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_system_memory_free                Application defined memory    */
58
/*                                            free function               */
59
/*    _gx_scroll_wheel_total_rows_set       Set scroll wheel total rows   */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    Application Code                                                    */
64
/*                                                                        */
65
/**************************************************************************/
66
190
UINT _gx_string_scroll_wheel_string_id_list_set(GX_STRING_SCROLL_WHEEL *wheel,
67
                                                GX_CONST GX_RESOURCE_ID *string_id_list,
68
                                                INT id_count)
69
{
70
UINT status;
71
72
190
    if (wheel -> gx_widget_style & GX_STYLE_TEXT_COPY)
73
    {
74
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
75
28
        if (wheel -> gx_string_scroll_wheel_string_list_deprecated)
76
        {
77
2
            if (_gx_system_memory_free == GX_NULL)
78
            {
79
1
                return GX_SYSTEM_MEMORY_ERROR;
80
            }
81
82
1
            _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list_deprecated);
83
        }
84
#endif
85
86
27
        if (wheel -> gx_string_scroll_wheel_string_list)
87
        {
88
2
            if (_gx_system_memory_free == GX_NULL)
89
            {
90
1
                return GX_SYSTEM_MEMORY_ERROR;
91
            }
92
93
1
            _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list);
94
        }
95
    }
96
97
188
    wheel -> gx_string_scroll_wheel_string_id_list = string_id_list;
98
188
    wheel -> gx_string_scroll_wheel_string_list = GX_NULL;
99
188
    wheel -> gx_string_scroll_wheel_string_list_buffer_size = 0;
100
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
101
188
    wheel -> gx_string_scroll_wheel_string_list_deprecated = GX_NULL;
102
#endif
103
104
#ifdef GX_DYNAMIC_BIDI_TEXT_SUPPORT
105
    _gx_text_scroll_wheel_dynamic_bidi_text_delete((GX_TEXT_SCROLL_WHEEL *)wheel);
106
#endif  // GX_DYNAMIC_BIDI_TEXT_SUPPORT
107
108
188
    status = _gx_scroll_wheel_total_rows_set((GX_SCROLL_WHEEL *)wheel, id_count);
109
110
188
    return status;
111
}
112