GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_multi_line_text_button_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 4 4 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 Button Management (Button)                                     */
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_button.h"
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_multi_line_text_button_create                   PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This function creates a multi-line text button, which is a special  */
43
/*    type of button (widget).                                            */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    button                                Button control block          */
48
/*    name                                  Name of button                */
49
/*    parent                                Parent widget control block   */
50
/*    text_id                               text resource id              */
51
/*    style                                 Style of button               */
52
/*    size                                  Button size                   */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    memset                                Set control block to zero     */
61
/*    _gx_button_create                     Create the underlying button  */
62
/*    _gx_widget_link                       Link the button to its parent */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*                                                                        */
76
/**************************************************************************/
77
364
UINT  _gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
78
                                        GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
79
                                        GX_CONST GX_RECTANGLE *size)
80
{
81
82
INT  line_index;
83
84
    /* Call the prompt create function.  */
85
364
    _gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, Id, size);
86
87
    /* Populate the rest of button control block - overriding as necessary.  */
88
364
    button -> gx_widget_type =                     GX_TYPE_MULTI_LINE_TEXT_BUTTON;
89
364
    button -> gx_widget_draw_function =            (VOID (*)(GX_WIDGET *))_gx_multi_line_text_button_draw;
90
364
    button -> gx_widget_event_process_function =   (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_multi_line_text_button_event_process;
91
364
    button -> gx_multi_line_text_button_line_count = 0;
92
93
1820
    for (line_index = 0; line_index < GX_MULTI_LINE_TEXT_BUTTON_MAX_LINES; line_index++)
94
    {
95
1456
        button -> gx_multi_line_text_button_lines[line_index].gx_string_ptr = GX_NULL;
96
1456
        button -> gx_multi_line_text_button_lines[line_index].gx_string_length = 0;
97
    }
98
99
    /* Determine if a parent widget was provided.  */
100
364
    if (parent)
101
    {
102
363
        _gx_widget_link(parent, (GX_WIDGET *)button);
103
    }
104
105
    /* Return the status from button create.  */
106
364
    return(GX_SUCCESS);
107
}
108