GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_progress_bar_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 18 18 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
/**   Progress Bar Management (Progress Bar)                              */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_progress_bar.h"
28
29
/* Bring in externs for caller checking code.  */
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_progress_bar_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 progress bar create call.    */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    progress_bar                          Progress Bar control block    */
49
/*    name                                  Name of prompt                */
50
/*    parent                                Parent widget control block   */
51
/*    progress_bar_info                     Pointer to progress bar info  */
52
/*    style                                 Style of progress bar         */
53
/*    progress_bar_id                       Application-defined ID of     */
54
/*                                            progress bar                */
55
/*    size                                  Dimensions of progress bar    */
56
/*                                                                        */
57
/*  OUTPUT                                                                */
58
/*                                                                        */
59
/*    status                                Completion status             */
60
/*                                                                        */
61
/*  CALLS                                                                 */
62
/*                                                                        */
63
/*    _gx_progress_bar_create               Actual progress bar create    */
64
/*                                             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
559
UINT  _gxe_progress_bar_create(GX_PROGRESS_BAR *progress_bar, GX_CONST GX_CHAR *name,
80
                               GX_WIDGET *parent,
81
                               GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
82
                               USHORT progress_bar_id,
83
                               GX_CONST GX_RECTANGLE *size,
84
                               UINT progress_bar_control_block_size)
85
{
86
UINT status;
87
88
    /* Check for invalid caller.  */
89

559
    GX_INIT_AND_THREADS_CALLER_CHECKING
90
91
    /* Check for invalid pointer.  */
92

557
    if ((progress_bar == GX_NULL) || (size == GX_NULL))
93
    {
94
2
        return(GX_PTR_ERROR);
95
    }
96
97
    /* Check for invalid widget control block size.  */
98
555
    if (progress_bar_control_block_size != sizeof(GX_PROGRESS_BAR))
99
    {
100
1
        return(GX_INVALID_SIZE);
101
    }
102
103
    /* Check for widget already created.  */
104
554
    if (progress_bar -> gx_widget_type != 0)
105
    {
106
1
        return(GX_ALREADY_CREATED);
107
    }
108
109
    /* Check for invalid parent widget.  */
110

553
    if (parent && (parent -> gx_widget_type == 0))
111
    {
112
1
        return(GX_INVALID_WIDGET);
113
    }
114
115
    /* Call actual progress bar create function.  */
116
552
    status = _gx_progress_bar_create(progress_bar, name, parent, progress_bar_info, style, progress_bar_id, size);
117
118
    /* Return completion status.  */
119
552
    return status;
120
}
121