GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_window_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
/**   Window Management (Window)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_window.h"
28
29
/* Bring in externs for caller checking code.  */
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_window_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 window create function call. */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    window                                Pointer to window control     */
49
/*                                           block                        */
50
/*    name                                  Logical name of window        */
51
/*    parent                                Pointer to parent window      */
52
/*    style                                 Window Style                  */
53
/*    window_id                             Application-defined ID of the */
54
/*                                            window                      */
55
/*    size                                  Size of the window            */
56
/*    window_control_block_size             Size of the window control    */
57
/*                                            block                       */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_window_create                     Actual window create function */
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
11727
UINT  _gxe_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
81
                         ULONG style, USHORT window_id, GX_CONST GX_RECTANGLE *size,
82
                         UINT window_control_block_size)
83
{
84
UINT status;
85
86
    /* Check for appropriate caller.  */
87

11727
    GX_INIT_AND_THREADS_CALLER_CHECKING
88
89
    /* Check for invalid input pointers.  */
90

11725
    if ((window == GX_NULL) || (size == GX_NULL))
91
    {
92
2
        return(GX_PTR_ERROR);
93
    }
94
95
    /* Check for widget already created.  */
96
11723
    if (window -> gx_widget_type != 0)
97
    {
98
3
        return(GX_ALREADY_CREATED);
99
    }
100
101
    /* Check for invalid widget control block size. */
102
11720
    if (window_control_block_size != sizeof(GX_WINDOW))
103
    {
104
1
        return(GX_INVALID_SIZE);
105
    }
106
107
    /* Check for invalid parent widget. */
108

11719
    if (parent && (parent -> gx_widget_type == 0))
109
    {
110
1
        return(GX_INVALID_WIDGET);
111
    }
112
113
    /* Call actual window create function.  */
114
11718
    status = _gx_window_create(window, name, parent, style, window_id, size);
115
116
    /* Return completion status.  */
117
11718
    return(status);
118
}
119