GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_menu_text_draw.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
/**   Menu Management (Menu)                                              */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_menu.h"
29
#include "gx_widget.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_menu_text_draw                                  PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function draws the text of a menu widget.                      */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    menu                                  Pointer to menu control block */
48
/*                                                                        */
49
/*  OUTPUT                                                                */
50
/*                                                                        */
51
/*    None                                                                */
52
/*                                                                        */
53
/*  CALLS                                                                 */
54
/*                                                                        */
55
/*    _gx_widget_text_draw                  Draw text to a widget         */
56
/*                                                                        */
57
/*  CALLED BY                                                             */
58
/*                                                                        */
59
/*    Application Code                                                    */
60
/*    GUIX Internal Code                                                  */
61
/*                                                                        */
62
/**************************************************************************/
63
3948
VOID  _gx_menu_text_draw(GX_MENU *menu)
64
{
65
3948
GX_WIDGET     *widget = (GX_WIDGET *)menu;
66
GX_RESOURCE_ID color;
67
GX_STRING      pText;
68
69
    /* Draw text.  */
70
71
3948
    if ((widget -> gx_widget_style & GX_STYLE_DRAW_SELECTED) &&
72
57
        (menu -> gx_prompt_selected_text_color != 0))
73
    {
74
56
        color = menu -> gx_prompt_selected_text_color;
75
    }
76
    else
77
    {
78
3892
        color = menu -> gx_prompt_normal_text_color;
79
    }
80
81
3948
    memset((GX_STRING *)&pText, 0, sizeof(GX_STRING));
82
3948
    menu -> gx_prompt_text_get_function((GX_PROMPT *)menu, &pText);
83
84
3948
    if (pText.gx_string_ptr)
85
    {
86
3933
        _gx_widget_text_draw_ext((GX_WIDGET *)menu, color,
87
3933
                                 menu -> gx_prompt_font_id,
88
                                 &pText,
89
3933
                                 menu -> gx_menu_text_x_offset,
90
3933
                                 menu -> gx_menu_text_y_offset);
91
    }
92
3948
}
93