GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_generic_scroll_wheel_create.c Lines: 14 14 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
/**   Scroll Wheel Management (Generic 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_window.h"
29
#include "gx_scroll_wheel.h"
30
#include "gx_widget.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_generic_scroll_wheel_create                     PORTABLE C      */
37
/*                                                           6.1.7        */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Ting Zhu, Microsoft Corporation                                     */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function creates a generic scroll wheel selector widget.       */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    wheel                                 Scroll wheel control block    */
49
/*    name                                  Name of widget                */
50
/*    parent                                Parent widget control block   */
51
/*    total_rows                            Total rows of the scroll wheel*/
52
/*    callback                              Callback function to create a */
53
/*                                            widget row                  */
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_scroll_wheel_create               Create a scroll wheel widget  */
66
/*    _gx_widget_link                       Link a widget to its parent   */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*    GUIX Internal Code                                                  */
72
/*                                                                        */
73
/**************************************************************************/
74
75
10
UINT _gx_generic_scroll_wheel_create(GX_GENERIC_SCROLL_WHEEL *wheel,
76
                                    GX_CONST GX_CHAR *name,
77
                                    GX_WIDGET *parent,
78
                                    INT total_rows,
79
                                    VOID (*callback)(GX_GENERIC_SCROLL_WHEEL *, GX_WIDGET *, INT),
80
                                    ULONG style,
81
                                    USHORT id,
82
                                    GX_CONST GX_RECTANGLE *size)
83
{
84
85
    /* Call default widget create. */
86
10
    _gx_scroll_wheel_create((GX_SCROLL_WHEEL *)wheel, name, parent, total_rows, style, id, size);
87
88
10
    wheel -> gx_widget_type = GX_TYPE_GENERIC_SCROLL_WHEEL;
89
10
    wheel -> gx_generic_scroll_wheel_top_index = 0;
90
10
    wheel -> gx_generic_scroll_wheel_callback = callback;
91
10
    wheel -> gx_generic_scroll_wheel_child_count = 0;
92
10
    wheel -> gx_generic_scroll_wheel_visible_rows = 0;
93
10
    wheel -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_generic_scroll_wheel_event_process;
94
10
    wheel -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_generic_scroll_wheel_draw;
95
10
    wheel -> gx_scroll_wheel_scroll = (UINT(*)(GX_SCROLL_WHEEL*, GX_VALUE))_gx_generic_scroll_wheel_scroll;
96
10
    wheel -> gx_scroll_wheel_wrap_style_check = (GX_BOOL(*)(GX_SCROLL_WHEEL*))_gx_generic_scroll_wheel_wrap_style_check;
97
98
    /* Determine if a parent widget was provided.  */
99
10
    if (parent)
100
    {
101
9
        _gx_widget_link((GX_WIDGET *)parent, (GX_WIDGET *)wheel);
102
    }
103
104
10
    return GX_SUCCESS;
105
}
106