GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_string_get.c Lines: 19 19 100.0 %
Date: 2024-12-05 08:52:37 Branches: 8 8 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_widget.h"
28
#include "gx_display.h"
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_widget_string_get                              PORTABLE C       */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION (deprecated)                                              */
41
/*                                                                        */
42
/*    This service gets the string associated with the supplied           */
43
/*      resource ID.                                                      */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    widget                                Called widget control block   */
48
/*    string_id                             Pixelmap resource ID          */
49
/*    return_string                         Pointer to string             */
50
/*                                            destination pointer         */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_display_string_get                Retrieve string from display  */
59
/*                                            function                    */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    Application Code                                                    */
64
/*                                                                        */
65
/*  RELEASE HISTORY                                                       */
66
/*                                                                        */
67
/*    DATE              NAME                      DESCRIPTION             */
68
/*                                                                        */
69
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71
/*                                            resulting in version 6.1    */
72
/*                                                                        */
73
/**************************************************************************/
74
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
75
6
UINT  _gx_widget_string_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_CONST GX_CHAR **return_string)
76
{
77
6
UINT        status = GX_INVALID_CANVAS;
78
79
GX_CANVAS  *canvas;
80
GX_DISPLAY *display;
81
82
6
    if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
83
    {
84
3
        _gx_widget_canvas_get(widget, &canvas);
85
86
3
        if (canvas)
87
        {
88
1
            display = canvas -> gx_canvas_display;
89
1
            status = _gx_display_string_get(display, resource_id, return_string);
90
        }
91
    }
92
    else
93
    {
94
3
        *return_string = GX_NULL;
95
    }
96
6
    return status;
97
}
98
#endif
99
100
/**************************************************************************/
101
/*                                                                        */
102
/*  FUNCTION                                               RELEASE        */
103
/*                                                                        */
104
/*    _gx_widget_string_get_ext                          PORTABLE C       */
105
/*                                                           6.1          */
106
/*  AUTHOR                                                                */
107
/*                                                                        */
108
/*    Kenneth Maxwell, Microsoft Corporation                              */
109
/*                                                                        */
110
/*  DESCRIPTION                                                           */
111
/*                                                                        */
112
/*    This service gets the string associated with the supplied           */
113
/*      resource ID.                                                      */
114
/*                                                                        */
115
/*  INPUT                                                                 */
116
/*                                                                        */
117
/*    widget                                Called widget control block   */
118
/*    string_id                             Pixelmap resource ID          */
119
/*    return_string                         Pointer to string             */
120
/*                                            destination pointer         */
121
/*                                                                        */
122
/*  OUTPUT                                                                */
123
/*                                                                        */
124
/*    status                                Completion status             */
125
/*                                                                        */
126
/*  CALLS                                                                 */
127
/*                                                                        */
128
/*    _gx_display_string_get                Retrieve string from display  */
129
/*                                            function                    */
130
/*                                                                        */
131
/*  CALLED BY                                                             */
132
/*                                                                        */
133
/*    Application Code                                                    */
134
/*                                                                        */
135
/*  RELEASE HISTORY                                                       */
136
/*                                                                        */
137
/*    DATE              NAME                      DESCRIPTION             */
138
/*                                                                        */
139
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
140
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
141
/*                                            resulting in version 6.1    */
142
/*                                                                        */
143
/**************************************************************************/
144
790223
UINT  _gx_widget_string_get_ext(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_STRING *return_string)
145
{
146
790223
UINT        status = GX_INVALID_CANVAS;
147
148
GX_CANVAS  *canvas;
149
GX_DISPLAY *display;
150
151
790223
    if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
152
    {
153
790217
        _gx_widget_canvas_get(widget, &canvas);
154
155
790217
        if (canvas)
156
        {
157
790216
            display = canvas -> gx_canvas_display;
158
790216
            status = _gx_display_string_get_ext(display, resource_id, return_string);
159
        }
160
    }
161
    else
162
    {
163
6
        return_string -> gx_string_ptr = GX_NULL;
164
6
        return_string -> gx_string_length = 0;
165
    }
166
790223
    return status;
167
}
168