1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Widget Management (Widget)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_display.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_widget_string_get                              PORTABLE C       */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION (deprecated)                                              */
42 /*                                                                        */
43 /*    This service gets the string associated with the supplied           */
44 /*      resource ID.                                                      */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    widget                                Called widget control block   */
49 /*    string_id                             Pixelmap resource ID          */
50 /*    return_string                         Pointer to string             */
51 /*                                            destination pointer         */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _gx_display_string_get                Retrieve string from display  */
60 /*                                            function                    */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
75 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gx_widget_string_get(GX_WIDGET * widget,GX_RESOURCE_ID resource_id,GX_CONST GX_CHAR ** return_string)76 UINT  _gx_widget_string_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_CONST GX_CHAR **return_string)
77 {
78 UINT        status = GX_INVALID_CANVAS;
79 
80 GX_CANVAS  *canvas;
81 GX_DISPLAY *display;
82 
83     if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
84     {
85         _gx_widget_canvas_get(widget, &canvas);
86 
87         if (canvas)
88         {
89             display = canvas -> gx_canvas_display;
90             status = _gx_display_string_get(display, resource_id, return_string);
91         }
92     }
93     else
94     {
95         *return_string = GX_NULL;
96     }
97     return status;
98 }
99 #endif
100 
101 /**************************************************************************/
102 /*                                                                        */
103 /*  FUNCTION                                               RELEASE        */
104 /*                                                                        */
105 /*    _gx_widget_string_get_ext                          PORTABLE C       */
106 /*                                                           6.1          */
107 /*  AUTHOR                                                                */
108 /*                                                                        */
109 /*    Kenneth Maxwell, Microsoft Corporation                              */
110 /*                                                                        */
111 /*  DESCRIPTION                                                           */
112 /*                                                                        */
113 /*    This service gets the string associated with the supplied           */
114 /*      resource ID.                                                      */
115 /*                                                                        */
116 /*  INPUT                                                                 */
117 /*                                                                        */
118 /*    widget                                Called widget control block   */
119 /*    string_id                             Pixelmap resource ID          */
120 /*    return_string                         Pointer to string             */
121 /*                                            destination pointer         */
122 /*                                                                        */
123 /*  OUTPUT                                                                */
124 /*                                                                        */
125 /*    status                                Completion status             */
126 /*                                                                        */
127 /*  CALLS                                                                 */
128 /*                                                                        */
129 /*    _gx_display_string_get                Retrieve string from display  */
130 /*                                            function                    */
131 /*                                                                        */
132 /*  CALLED BY                                                             */
133 /*                                                                        */
134 /*    Application Code                                                    */
135 /*                                                                        */
136 /*  RELEASE HISTORY                                                       */
137 /*                                                                        */
138 /*    DATE              NAME                      DESCRIPTION             */
139 /*                                                                        */
140 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
141 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
142 /*                                            resulting in version 6.1    */
143 /*                                                                        */
144 /**************************************************************************/
_gx_widget_string_get_ext(GX_WIDGET * widget,GX_RESOURCE_ID resource_id,GX_STRING * return_string)145 UINT  _gx_widget_string_get_ext(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_STRING *return_string)
146 {
147 UINT        status = GX_INVALID_CANVAS;
148 
149 GX_CANVAS  *canvas;
150 GX_DISPLAY *display;
151 
152     if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
153     {
154         _gx_widget_canvas_get(widget, &canvas);
155 
156         if (canvas)
157         {
158             display = canvas -> gx_canvas_display;
159             status = _gx_display_string_get_ext(display, resource_id, return_string);
160         }
161     }
162     else
163     {
164         return_string -> gx_string_ptr = GX_NULL;
165         return_string -> gx_string_length = 0;
166     }
167     return status;
168 }
169 
170