GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_pixelmap_prompt_create.c Lines: 13 13 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 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
/**   Prompt Management (Prompt)                                          */
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_prompt.h"
29
#include "gx_pixelmap_prompt.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_pixelmap_prompt_create                          PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function creates a pixelmap prompt, which is a special type of */
45
/*    widget.                                                             */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    prompt                                Prompt control block          */
50
/*    name                                  Name of prompt                */
51
/*    parent                                Parent widget control block   */
52
/*    text_id                               Resource string id            */
53
/*    fill_id                               pixelmap id for fill area     */
54
/*    style                                 Style of checkbox             */
55
/*    pixelmap_prompt_id                    Application-defined ID of     */
56
/*                                            pixelmap prompt             */
57
/*    size                                  Prompt size                   */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_prompt_create                     Create the underlying prompt  */
66
/*    _gx_widget_link                       Link the widget to its parent */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/*  RELEASE HISTORY                                                       */
73
/*                                                                        */
74
/*    DATE              NAME                      DESCRIPTION             */
75
/*                                                                        */
76
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
77
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
78
/*                                            resulting in version 6.1    */
79
/*                                                                        */
80
/**************************************************************************/
81
13768
UINT  _gx_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt,
82
                                 GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83
                                 GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
84
                                 ULONG style, USHORT pixelmap_prompt_id,
85
                                 GX_CONST GX_RECTANGLE *size)
86
87
{
88
89
    /* Call the base prompt create function.  */
90
13768
    _gx_prompt_create((GX_PROMPT *)prompt, name, GX_NULL, text_id, style, pixelmap_prompt_id, size);
91
92
    /* Populate the rest of prompt control block - overriding as necessary.  */
93
13768
    prompt -> gx_widget_type = GX_TYPE_PIXELMAP_PROMPT;
94
13768
    prompt -> gx_normal_fill_pixelmap_id = fill_id;
95
13768
    prompt -> gx_normal_left_pixelmap_id = 0;
96
13768
    prompt -> gx_normal_right_pixelmap_id = 0;
97
98
13768
    prompt -> gx_selected_fill_pixelmap_id = 0;
99
13768
    prompt -> gx_selected_left_pixelmap_id = 0;
100
13768
    prompt -> gx_selected_right_pixelmap_id = 0;
101
102
13768
    prompt -> gx_widget_draw_function =  (VOID (*)(GX_WIDGET *))_gx_pixelmap_prompt_draw;
103
104
    /* Determine if a parent widget was provided.  */
105
13768
    if (parent)
106
    {
107
1915
        _gx_widget_link(parent, (GX_WIDGET *)prompt);
108
    }
109
110
    /* Return the status from prompt create.  */
111
13768
    return(GX_SUCCESS);
112
}
113