GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_icon_create.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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
/**   Prompt Management (Prompt)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_widget.h"
29
#include "gx_utility.h"
30
#include "gx_prompt.h"
31
#include "gx_system.h"
32
#include "gx_icon.h"
33
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gx_icon_create                                     PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This function creates a bitmap prompt, which is a special type of   */
48
/*    widget.                                                             */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    icon                                  Pointer to icon control block */
53
/*    name                                  Logical name of icon widget   */
54
/*    parent                                Pointer to the parent widget  */
55
/*    pixelmap_id                           Resource ID of pixelmap       */
56
/*    style                                 Style of icon                 */
57
/*    icon_id                               Application-definedID of icon */
58
/*    x                                     Starting x-coordinate position*/
59
/*    y                                     Starting y-coordinate position*/
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*    _gx_utility_rectangle_define          Define the icon area          */
68
/*    _gx_widget_create                     Create the underlying widget  */
69
/*    _gx_widget_status_add                 Set widget status             */
70
/*    _gx_widget_link                       Link the widget to its parent */
71
/*                                                                        */
72
/*  CALLED BY                                                             */
73
/*                                                                        */
74
/*    Application Code                                                    */
75
/*                                                                        */
76
/**************************************************************************/
77
7217
UINT  _gx_icon_create(GX_ICON *icon, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
78
                      GX_RESOURCE_ID pixelmap_id, ULONG style, USHORT icon_id,
79
                      GX_VALUE x, GX_VALUE y)
80
{
81
82
GX_RECTANGLE size;
83
84
7217
    _gx_utility_rectangle_define(&size, x, y, (GX_VALUE)(x + 1), (GX_VALUE)(y + 1));
85
86
    /* Call the base prompt create function.  */
87
7217
    _gx_widget_create((GX_WIDGET *)icon, name, GX_NULL, style, icon_id, &size);
88
89
    /* Populate the rest of icon control block - overriding as necessary.  */
90
7217
    icon -> gx_widget_type = GX_TYPE_ICON;
91
7217
    icon -> gx_icon_normal_pixelmap = pixelmap_id;
92
7217
    icon -> gx_icon_selected_pixelmap = 0;
93
7217
    icon -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_icon_event_process;
94
7217
    icon -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_icon_draw;
95
96
7217
    if (icon_id > 0)
97
    {
98
872
        _gx_widget_status_add((GX_WIDGET *)icon, GX_STATUS_SELECTABLE);
99
    }
100
101
    /* Determine if a parent widget was provided.  */
102
7217
    if (parent)
103
    {
104
6766
        _gx_widget_link(parent, (GX_WIDGET *)icon);
105
    }
106
107
7217
    return(GX_SUCCESS);
108
}