GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_window_create.c Lines: 12 12 100.0 %
Date: 2026-03-06 19:21:09 Branches: 18 18 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Window Management (Window)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_window.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_window_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 window create function call. */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    window                                Pointer to window control     */
50
/*                                           block                        */
51
/*    name                                  Logical name of window        */
52
/*    parent                                Pointer to parent window      */
53
/*    style                                 Window Style                  */
54
/*    window_id                             Application-defined ID of the */
55
/*                                            window                      */
56
/*    size                                  Size of the window            */
57
/*    window_control_block_size             Size of the window control    */
58
/*                                            block                       */
59
/*                                                                        */
60
/*  OUTPUT                                                                */
61
/*                                                                        */
62
/*    status                                Completion status             */
63
/*                                                                        */
64
/*  CALLS                                                                 */
65
/*                                                                        */
66
/*    _gx_window_create                     Actual window create function */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
11727
UINT  _gxe_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
74
                         ULONG style, USHORT window_id, GX_CONST GX_RECTANGLE *size,
75
                         UINT window_control_block_size)
76
{
77
UINT status;
78
79
    /* Check for appropriate caller.  */
80

11727
    GX_INIT_AND_THREADS_CALLER_CHECKING
81
82
    /* Check for invalid input pointers.  */
83

11725
    if ((window == GX_NULL) || (size == GX_NULL))
84
    {
85
2
        return(GX_PTR_ERROR);
86
    }
87
88
    /* Check for widget already created.  */
89
11723
    if (window -> gx_widget_type != 0)
90
    {
91
5
        return(GX_ALREADY_CREATED);
92
    }
93
94
    /* Check for invalid widget control block size. */
95
11718
    if (window_control_block_size != sizeof(GX_WINDOW))
96
    {
97
1
        return(GX_INVALID_SIZE);
98
    }
99
100
    /* Check for invalid parent widget. */
101

11717
    if (parent && (parent -> gx_widget_type == 0))
102
    {
103
1
        return(GX_INVALID_WIDGET);
104
    }
105
106
    /* Call actual window create function.  */
107
11716
    status = _gx_window_create(window, name, parent, style, window_id, size);
108
109
    /* Return completion status.  */
110
11716
    return(status);
111
}
112