GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_numeric_prompt_create.c Lines: 7 7 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
/**   Numeric 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_numeric_prompt.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_numeric_prompt_create                           PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function creates a numeric prompt, which is a special type of  */
45
/*    widget.                                                             */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    prompt                                Numeric prompt control block  */
50
/*    name                                  Name of numeric prompt        */
51
/*    parent                                Parent widget control block   */
52
/*    text_id                               Resource string id            */
53
/*    style                                 Style of numeric prompt       */
54
/*    prompt_id                             Application-defined ID of     */
55
/*                                            Numeric prompt.             */
56
/*    size                                  Numeric prompt size           */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    status                                Completion status             */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    _gx_prompt_create                     Create a prompt               */
65
/*    _gx_widget_link                       Link a widget to its parent   */
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
1691
UINT  _gx_numeric_prompt_create(GX_NUMERIC_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
81
    GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id, GX_CONST GX_RECTANGLE *size)
82
{
83
84
    /* Call the prompt create function.  */
85
1691
    _gx_prompt_create((GX_PROMPT *)prompt, name, GX_NULL, text_id, style, prompt_id, size);
86
87
    /* Populate the rest of numeric prompt control block - overriding as necessary.  */
88
1691
    prompt -> gx_widget_type = GX_TYPE_NUMERIC_PROMPT;
89
1691
    prompt -> gx_numeric_prompt_format_function = _gx_numeric_prompt_format;
90
91
    /* Determine if a parent widget was provided.  */
92
1691
    if (parent)
93
    {
94
1690
        _gx_widget_link(parent, (GX_WIDGET *)prompt);
95
    }
96
97
1691
    return(GX_SUCCESS);
98
}
99