GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_text_id_draw.c Lines: 5 5 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
/**   Widget Management (Widget)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_context.h"
28
#include "gx_widget.h"
29
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_widget_text_id_draw                             PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function draws text over a widget given a text id.             */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    widget                                Widget control block          */
48
/*    tColor                                Text Color                    */
49
/*    fColor                                Text fill color               */
50
/*    font_id                               Font Id                       */
51
/*    text_id                               Text Id                       */
52
/*    x_offset                              Drawing position adjustment   */
53
/*    y_offset                              Drawing position adjustment   */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _gx_context_string_get                Retrieve the text string      */
62
/*    _gx_widget_text_draw                  Draw text on canvas           */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    GUIX Internal 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
2
VOID  _gx_widget_text_id_draw(GX_WIDGET *widget, UINT tColor,
78
                              UINT font_id, UINT text_id,
79
                              INT x_offset, INT y_offset)
80
{
81
GX_STRING string;
82
83
    /* Get string.  */
84
2
    _gx_context_string_get_ext(text_id, &string);
85
86
2
    if (string.gx_string_ptr)
87
    {
88
        /* Draw text.  */
89
1
        _gx_widget_text_draw_ext(widget, tColor, font_id, &string,
90
                                 x_offset, y_offset);
91
    }
92
2
}
93