GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_generic_scroll_wheel_create.c Lines: 13 13 100.0 %
Date: 2024-12-05 08:52:37 Branches: 20 20 100.0 %

Line Branch Exec Source
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
/**   Scroll Wheel Management (Generic 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
29
GX_CALLER_CHECKING_EXTERNS
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gxe_generic_scroll_wheel_create                    PORTABLE C      */
36
/*                                                           6.1.7        */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Ting Zhu, Microsoft Corporation                                     */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function checks for errors in the generic scroll wheel create  */
44
/*    function call.                                                      */
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
/*    control_block_size                   Size of the widget scroll      */
59
/*                                            wheel control block         */
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*    _gxe_generic_scroll_wheel_create      Actual generic scroll wheel   */
68
/*                                            create function             */
69
/*                                                                        */
70
/*  CALLED BY                                                             */
71
/*                                                                        */
72
/*    Application Code                                                    */
73
/*                                                                        */
74
/*  RELEASE HISTORY                                                       */
75
/*                                                                        */
76
/*    DATE              NAME                      DESCRIPTION             */
77
/*                                                                        */
78
/*  06-02-2021     Ting Zhu                 Initial Version 6.1.7         */
79
/*                                                                        */
80
/**************************************************************************/
81
18
UINT  _gxe_generic_scroll_wheel_create(GX_GENERIC_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name,
82
                                       GX_WIDGET *parent, INT total_rows,
83
                                       VOID (*callback)(GX_GENERIC_SCROLL_WHEEL *, GX_WIDGET *, INT),
84
                                       ULONG style, USHORT id, GX_CONST GX_RECTANGLE *size,
85
                                       UINT control_block_size)
86
{
87
88
    /* Check for appropriate caller.  */
89

18
    GX_INIT_AND_THREADS_CALLER_CHECKING
90
91
    /* Check for invalid input pointers.  */
92

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

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