GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_slider_create.c Lines: 12 12 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
/**   Slider Management (Slider)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_slider.h"
28
29
/* Bring in externs for caller checking code.  */
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_slider_create                                  PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function checks for errors in the slider create call.          */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    slider                                Slider control block          */
49
/*    name                                  Name of prompt                */
50
/*    parent                                Parent widget control block   */
51
/*    tick_count                            Number of slider ticks        */
52
/*    slider_info                           Pointer to slider info        */
53
/*    style                                 Style of slider               */
54
/*    slider_id                             Application-defined ID of     */
55
/*                                            slider                      */
56
/*    size                                  Dimensions of slider          */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    status                                Completion status             */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    _gx_slider_create                     Actual slider create call     */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/*  RELEASE HISTORY                                                       */
71
/*                                                                        */
72
/*    DATE              NAME                      DESCRIPTION             */
73
/*                                                                        */
74
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76
/*                                            resulting in version 6.1    */
77
/*                                                                        */
78
/**************************************************************************/
79
3704
UINT  _gxe_slider_create(GX_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT tick_count,
80
                         GX_SLIDER_INFO *slider_info, ULONG style, USHORT slider_id,
81
                         GX_CONST GX_RECTANGLE *size, UINT slider_control_block_size)
82
{
83
UINT status;
84
85
    /* Check for invalid caller.  */
86

3704
    GX_INIT_AND_THREADS_CALLER_CHECKING
87
88
    /* Check for invalid pointer.  */
89

3702
    if ((slider == GX_NULL) || (size == GX_NULL) || (slider_info == GX_NULL))
90
    {
91
3
        return(GX_PTR_ERROR);
92
    }
93
94
    /* Check for invalid control block size. */
95
3699
    if (slider_control_block_size != sizeof(GX_SLIDER))
96
    {
97
1
        return(GX_INVALID_SIZE);
98
    }
99
100
    /* Check for widget already created.  */
101
3698
    if (slider -> gx_widget_type != 0)
102
    {
103
1
        return(GX_ALREADY_CREATED);
104
    }
105
106
    /* Check for invalid widget.  */
107

3697
    if (parent && (parent -> gx_widget_type == 0))
108
    {
109
1
        return(GX_INVALID_WIDGET);
110
    }
111
112
    /* Call actual slider create function.  */
113
3696
    status = _gx_slider_create(slider, name, parent, tick_count, slider_info, style, slider_id, size);
114
115
    /* Return completion status.  */
116
3696
    return status;
117
}
118