GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_string_scroll_wheel_create.c Lines: 16 16 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 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_widget.h"
29
#include "gx_scroll_wheel.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_string_scroll_wheel_create                      PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION (Deprecated)                                              */
42
/*                                                                        */
43
/*    This function creates a string scroll wheel selector widget.        */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    wheel                                 Scroll wheel control block    */
48
/*    name                                  Name of widget                */
49
/*    parent                                Parent widget control block   */
50
/*    total_rows                            Total rows of the scroll wheel*/
51
/*    string_list                           String list for display       */
52
/*    callback                              Callback for retrieved row    */
53
/*                                            string                      */
54
/*    style                                 Style of widget               */
55
/*    Id                                    Application-defined ID of the */
56
/*                                            the widget                  */
57
/*    size                                  Widget size                   */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_text_scroll_wheel_create          Create a text scroll wheel    */
66
/*    _gx_widget_link                       Link a widget to parent       */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
74
4
UINT  _gx_string_scroll_wheel_create(GX_STRING_SCROLL_WHEEL *wheel,
75
                                     GX_CONST GX_CHAR *name,
76
                                     GX_WIDGET *parent, INT total_rows,
77
                                     GX_CONST GX_CHAR **string_list,
78
                                     ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size)
79
{
80
UINT status;
81
82
4
    status = _gx_string_scroll_wheel_create_ext(wheel, name, parent, total_rows, GX_NULL, style, Id, size);
83
84
4
    wheel -> gx_string_scroll_wheel_string_list_deprecated = string_list;
85
86
    /* Return successful status.  */
87
4
    return(status);
88
}
89
#endif
90
91
92
/**************************************************************************/
93
/*                                                                        */
94
/*  FUNCTION                                               RELEASE        */
95
/*                                                                        */
96
/*    _gx_string_scroll_wheel_create_ext                  PORTABLE C      */
97
/*                                                           6.1          */
98
/*  AUTHOR                                                                */
99
/*                                                                        */
100
/*    Kenneth Maxwell, Microsoft Corporation                              */
101
/*                                                                        */
102
/*  DESCRIPTION                                                           */
103
/*                                                                        */
104
/*    This function creates a string scroll wheel selector widget.        */
105
/*                                                                        */
106
/*  INPUT                                                                 */
107
/*                                                                        */
108
/*    wheel                                 Scroll wheel control block    */
109
/*    name                                  Name of widget                */
110
/*    parent                                Parent widget control block   */
111
/*    total_rows                            Total rows of the scroll wheel*/
112
/*    string_list                           String list for display       */
113
/*    callback                              Callback for retrieved row    */
114
/*                                            string                      */
115
/*    style                                 Style of widget               */
116
/*    Id                                    Application-defined ID of the */
117
/*                                            the widget                  */
118
/*    size                                  Widget size                   */
119
/*                                                                        */
120
/*  OUTPUT                                                                */
121
/*                                                                        */
122
/*    status                                Completion status             */
123
/*                                                                        */
124
/*  CALLS                                                                 */
125
/*                                                                        */
126
/*    _gx_text_scroll_wheel_create          Create a text scroll wheel    */
127
/*    _gx_widget_link                       Link a widget to parent       */
128
/*                                                                        */
129
/*  CALLED BY                                                             */
130
/*                                                                        */
131
/*    Application Code                                                    */
132
/*                                                                        */
133
/**************************************************************************/
134
194
UINT _gx_string_scroll_wheel_create_ext(GX_STRING_SCROLL_WHEEL *wheel,
135
                                        GX_CONST GX_CHAR *name,
136
                                        GX_WIDGET *parent, INT total_rows,
137
                                        GX_CONST GX_STRING *string_list,
138
                                        ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size)
139
{
140
141
    /* Call text scroll wheel create. */
142
194
    _gx_text_scroll_wheel_create((GX_TEXT_SCROLL_WHEEL *)wheel, name, GX_NULL, total_rows, style, Id, size);
143
144
194
    wheel -> gx_widget_type = GX_TYPE_STRING_SCROLL_WHEEL;
145
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
146
194
    wheel -> gx_string_scroll_wheel_string_list_deprecated = GX_NULL;
147
#endif
148
194
    wheel -> gx_string_scroll_wheel_string_list = string_list;
149
194
    wheel -> gx_string_scroll_wheel_string_list_buffer_size = 0;
150
194
    wheel -> gx_string_scroll_wheel_string_id_list = GX_NULL;
151
194
    wheel -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_string_scroll_wheel_event_process;
152
194
    wheel -> gx_text_scroll_wheel_text_get = (UINT (*)(GX_TEXT_SCROLL_WHEEL *, INT, GX_STRING *))_gx_string_scroll_wheel_text_get;
153
154
    /* Determine if a parent widget was provided.  */
155
194
    if (parent)
156
    {
157
187
        _gx_widget_link(parent, (GX_WIDGET *)wheel);
158
    }
159
160
    /* Return successful status.  */
161
194
    return(GX_SUCCESS);
162
}
163