GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_icon_button_create.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 14 14 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
/**   Button Management (Button)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_widget.h"
28
#include "gx_button.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_icon_button_create                             PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function checks for errors in the icon button create function. */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    button                                Button control block          */
50
/*    name                                  Name of button                */
51
/*    parent                                Parent widget control block   */
52
/*    icon_id                               Resource ID of icon           */
53
/*    style                                 Style of icon                 */
54
/*    icon_button_id                        Application-definedID of icon */
55
/*    size                                  Button size                   */
56
/*    buton_control_block_size              Size of the button control    */
57
/*                                            block                       */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_icon_button_create                Actual icon button create call*/
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    Application Code                                                    */
70
/*                                                                        */
71
/*  RELEASE HISTORY                                                       */
72
/*                                                                        */
73
/*    DATE              NAME                      DESCRIPTION             */
74
/*                                                                        */
75
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77
/*                                            resulting in version 6.1    */
78
/*                                                                        */
79
/**************************************************************************/
80
2939
UINT  _gxe_icon_button_create(GX_ICON_BUTTON *button,
81
                              GX_CONST GX_CHAR *name,
82
                              GX_WIDGET *parent,
83
                              GX_RESOURCE_ID icon_id,
84
                              ULONG style,
85
                              USHORT icon_button_id,
86
                              GX_CONST GX_RECTANGLE *size,
87
                              UINT button_control_block_size)
88
{
89
UINT status;
90
91
    /* Check for appropriate caller.  */
92

2939
    GX_INIT_AND_THREADS_CALLER_CHECKING
93
94
    /* Check for invalid input pointers.  */
95

2937
    if ((button == GX_NULL) || (size == GX_NULL))
96
    {
97
2
        return(GX_PTR_ERROR);
98
    }
99
100
2935
    if (button_control_block_size != sizeof(GX_ICON_BUTTON))
101
    {
102
1
        return(GX_INVALID_SIZE);
103
    }
104
105
    /* Check for widget already created.  */
106
2934
    if (button -> gx_widget_type != 0)
107
    {
108
1
        return(GX_ALREADY_CREATED);
109
    }
110
111
    /* Call the actual icon button create function.  */
112
2933
    status = _gx_icon_button_create(button, name, parent, icon_id, style, icon_button_id, size);
113
114
    /* Return completion status.  */
115
2933
    return status;
116
}
117