GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_rich_text_view_create.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 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
/**   Rich Text View Management (Rich Text View)                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_multi_line_text_view.h"
29
#include "gx_rich_text_view.h"
30
#include "gx_widget.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_rich_text_view_create                           PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function creates a rich text view widget.                      */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    text_view                             Rich text view widget control */
49
/*                                            block                       */
50
/*    name                                  Name of the widget            */
51
/*    parent                                Pointer to parent widget      */
52
/*    text_id                               Resource ID of the text string*/
53
/*    fonts                                 Font list                     */
54
/*    style                                 Style of text view widget     */
55
/*    id                                    Application-defined ID of text*/
56
/*                                            view                        */
57
/*    size                                  Dimension of the widget       */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_multi_line_text_view_create       Create multi line text view   */
66
/*    _gx_widget_link                       Link the widget to its parent */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
249
UINT    _gx_rich_text_view_create(GX_RICH_TEXT_VIEW *text_view,
74
                                  GX_CONST GX_CHAR *name,
75
                                  GX_WIDGET *parent,
76
                                  GX_RESOURCE_ID text_id,
77
                                  GX_RICH_TEXT_FONTS *fonts,
78
                                  ULONG style,
79
                                  USHORT id,
80
                                  GX_CONST GX_RECTANGLE *size)
81
{
82
83
    /* Call the multi line text view create function.  */
84
249
    _gx_multi_line_text_view_create((GX_MULTI_LINE_TEXT_VIEW *)text_view, name, GX_NULL, text_id, style, id, size);
85
86
249
    text_view -> gx_widget_type = GX_TYPE_RICH_TEXT_VIEW;
87
249
    text_view -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_rich_text_view_draw;
88
249
    text_view -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_rich_text_view_scroll_info_get;
89
249
    text_view -> gx_rich_text_view_fonts = *fonts;
90
249
    text_view -> gx_rich_text_view_text_total_height = 0;
91
92
    /* Determine if a parent widget was provided.  */
93
249
    if (parent)
94
    {
95
248
        _gx_widget_link(parent, (GX_WIDGET *)text_view);
96
    }
97
98
    /* Return the error status from window create.  */
99
249
    return(GX_SUCCESS);
100
}
101