GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_single_line_text_input_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 18 18 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
/**   Text Input Management (Single Line Text Input)                      */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_single_line_text_input.h"
28
29
/* Bring in externs for caller checking code.  */
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_single_line_text_input_create                  PORTABLE C      */
37
/*                                                           6.1.3        */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function checks for errors in the single line text input       */
45
/*    create call.                                                        */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    text_input                        Single-line text input widget     */
50
/*                                        control block                   */
51
/*    name                              Name of text input widget         */
52
/*    parent                            Pointer to parent widget          */
53
/*    input_buffer                      Pointer to text input buffer      */
54
/*    buffer_size                       Size of text input buffer         */
55
/*    style                             Style of text input widget.       */
56
/*    text_input_id                     Application-defined ID for text   */
57
/*                                        input                           */
58
/*    size                              Dimensions of text input widget   */
59
/*    text_input_control_block_size     Size of the single line text      */
60
/*                                        input control block             */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                            Completion status                 */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gx_single_line_text_input_create                                   */
69
/*                                      Actual single line text input     */
70
/*                                        widget create call              */
71
/*                                                                        */
72
/*  CALLED BY                                                             */
73
/*                                                                        */
74
/*    Application Code                                                    */
75
/*                                                                        */
76
/*  RELEASE HISTORY                                                       */
77
/*                                                                        */
78
/*    DATE              NAME                      DESCRIPTION             */
79
/*                                                                        */
80
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
81
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
82
/*                                            resulting in version 6.1    */
83
/*  12-31-2020     Kenneth Maxwell          Modified comment(s),          */
84
/*                                            removed input buffer check, */
85
/*                                            resulting in version 6.1.3  */
86
/*                                                                        */
87
/**************************************************************************/
88
89
883
UINT  _gxe_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT *text_input,
90
                                         GX_CONST GX_CHAR *name,
91
                                         GX_WIDGET *parent,
92
                                         GX_CHAR *input_buffer,
93
                                         UINT buffer_size,
94
                                         UINT style,
95
                                         USHORT text_input_id,
96
                                         GX_CONST GX_RECTANGLE *size,
97
                                         UINT text_input_control_block_size)
98
{
99
UINT status;
100
101
    /* Check for invalid caller.  */
102

883
    GX_INIT_AND_THREADS_CALLER_CHECKING
103
104
    /* Check for invalid input pointers.  */
105

881
    if ((text_input == GX_NULL) || (size == GX_NULL))
106
    {
107
2
        return(GX_PTR_ERROR);
108
    }
109
110
879
    if (text_input_control_block_size != sizeof(GX_SINGLE_LINE_TEXT_INPUT))
111
    {
112
1
        return(GX_INVALID_SIZE);
113
    }
114
115
    /* Check for already created. */
116
878
    if (text_input -> gx_widget_type != 0)
117
    {
118
1
        return(GX_ALREADY_CREATED);
119
    }
120
121

877
    if (parent && (parent -> gx_widget_type == 0))
122
    {
123
1
        return(GX_INVALID_WIDGET);
124
    }
125
126
    /* Call actual single line text input create function.  */
127
876
    status = _gx_single_line_text_input_create(text_input, name, parent, input_buffer, buffer_size, style, text_input_id, size);
128
129
    /* Return completion status.  */
130
876
    return(status);
131
}
132