GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_generic_scroll_wheel_create.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 20 20 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_scroll_wheel.h"
29
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_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 checks for errors in the generic scroll wheel create  */
45
/*    function call.                                                      */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    wheel                                 Scroll wheel control block    */
50
/*    name                                  Name of widget                */
51
/*    parent                                Parent widget control block   */
52
/*    total_rows                            Total rows of the scroll wheel*/
53
/*    callback                              Callback function to create a */
54
/*                                            widget row                  */
55
/*    style                                 Style of widget               */
56
/*    id                                    Application-defined ID of the */
57
/*                                            the widget                  */
58
/*    size                                  Widget size                   */
59
/*    control_block_size                   Size of the widget scroll      */
60
/*                                            wheel control block         */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                                Completion status             */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gxe_generic_scroll_wheel_create      Actual generic scroll wheel   */
69
/*                                            create function             */
70
/*                                                                        */
71
/*  CALLED BY                                                             */
72
/*                                                                        */
73
/*    Application Code                                                    */
74
/*                                                                        */
75
/**************************************************************************/
76
18
UINT  _gxe_generic_scroll_wheel_create(GX_GENERIC_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name,
77
                                       GX_WIDGET *parent, INT total_rows,
78
                                       VOID (*callback)(GX_GENERIC_SCROLL_WHEEL *, GX_WIDGET *, INT),
79
                                       ULONG style, USHORT id, GX_CONST GX_RECTANGLE *size,
80
                                       UINT control_block_size)
81
{
82
83
    /* Check for appropriate caller.  */
84

18
    GX_INIT_AND_THREADS_CALLER_CHECKING
85
86
    /* Check for invalid input pointers.  */
87

16
    if ((wheel == GX_NULL) || (size == GX_NULL))
88
    {
89
2
        return GX_PTR_ERROR;
90
    }
91
92
14
    if (control_block_size != sizeof(GX_GENERIC_SCROLL_WHEEL))
93
    {
94
1
        return(GX_INVALID_SIZE);
95
    }
96
97
    /* Check for id is created.  */
98
13
    if (wheel -> gx_widget_type != 0)
99
    {
100
1
        return(GX_ALREADY_CREATED);
101
    }
102
103
    /* Check for valid number of rows .  */
104
12
    if (total_rows <= 0)
105
    {
106
1
        return GX_INVALID_VALUE;
107
    }
108
109
    /* Check for invalid widget. */
110

11
    if (parent && (parent -> gx_widget_type == 0))
111
    {
112
1
        return GX_INVALID_WIDGET;
113
    }
114
115
    /* Call the actual generic scroll wheel create function.  */
116
10
    return _gx_generic_scroll_wheel_create(wheel, name, parent, total_rows, callback, style, id, size);
117
}
118