GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_menu_create.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 14 14 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
/**   Menu Management (Menu)                                              */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_menu.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_menu_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 menu create function call.       */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    menu                                  Pointer to the menu control   */
50
/*                                            block                       */
51
/*    name                                  Name of the menu              */
52
/*    parent                                Parent menu control block     */
53
/*    text_id                               Resource string id            */
54
/*    fill_id                               Pixelmap id for fill area     */
55
/*    style                                 Style of the widget           */
56
/*    menu_id                               Application-defined ID of     */
57
/*                                          the menu menu                 */
58
/*    size                                  Menu size                     */
59
/*    control_block_size                    Control block size            */
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*    _gx_menu_create                       Actual menu create call       */
68
/*                                                                        */
69
/*  CALLED BY                                                             */
70
/*                                                                        */
71
/*    Application Code                                                    */
72
/*                                                                        */
73
/**************************************************************************/
74
11858
UINT  _gxe_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
75
                       GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
76
                       ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size)
77
{
78
UINT status;
79
80
    /* Check for appropriate caller.  */
81

11858
    GX_INIT_AND_THREADS_CALLER_CHECKING
82
83
    /* Check for invalid input pointers.  */
84

11856
    if ((!menu) || (!size))
85
    {
86
2
        return(GX_PTR_ERROR);
87
    }
88
89
    /* Check for widget already created.  */
90
11854
    if (menu -> gx_widget_type != 0)
91
    {
92
1
        return(GX_ALREADY_CREATED);
93
    }
94
95
    /* Check for invalid control block size. */
96
11853
    if (control_block_size != sizeof(GX_MENU))
97
    {
98
1
        return(GX_INVALID_SIZE);
99
    }
100
101
    /* Call actual menu create function. */
102
11852
    status = _gx_menu_create(menu, name, parent, text_id, fill_id, style, menu_id, size);
103
104
11852
    return(status);
105
}
106