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 /* Include necessary system files.  */
24 
25 #include "gx_api.h"
26 #include "gx_widget.h"
27 
28 /* Bring in externs for caller checking code.  */
29 GX_CALLER_CHECKING_EXTERNS
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_widget_string_get                              PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in widget_string_get call.          */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    widget                                called widget control block   */
48 /*    string_id                             String 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_widget_string_get                 Actual widget string get      */
59 /*                                            call                        */
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)
_gxe_widget_string_get(GX_WIDGET * widget,GX_RESOURCE_ID resource_id,GX_CONST GX_CHAR ** return_string)75 UINT  _gxe_widget_string_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_CONST GX_CHAR **return_string)
76 {
77 UINT status;
78 
79     /* Check for appropriate caller.  */
80     GX_INIT_AND_THREADS_CALLER_CHECKING
81 
82     /* Check for invalid pointer.  */
83     if (return_string == GX_NULL || widget == GX_NULL)
84     {
85         return(GX_PTR_ERROR);
86     }
87 
88     /* Check for invalid widget.*/
89     if (widget -> gx_widget_type == 0)
90     {
91         return(GX_INVALID_WIDGET);
92     }
93 
94     /* Call actual system pixelmap get.  */
95     status = _gx_widget_string_get(widget, resource_id, return_string);
96 
97     /* Return status.  */
98     return(status);
99 }
100 #endif
101 
102 /**************************************************************************/
103 /*                                                                        */
104 /*  FUNCTION                                               RELEASE        */
105 /*                                                                        */
106 /*    _gxe_widget_string_get_ext                          PORTABLE C      */
107 /*                                                           6.1          */
108 /*  AUTHOR                                                                */
109 /*                                                                        */
110 /*    Kenneth Maxwell, Microsoft Corporation                              */
111 /*                                                                        */
112 /*  DESCRIPTION                                                           */
113 /*                                                                        */
114 /*    This function checks for errors in widget_string_get_ext call.      */
115 /*                                                                        */
116 /*  INPUT                                                                 */
117 /*                                                                        */
118 /*    widget                                called widget control block   */
119 /*    string_id                             String 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_widget_string_get_ext             Actual widget string get      */
130 /*                                            call                        */
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 /**************************************************************************/
_gxe_widget_string_get_ext(GX_WIDGET * widget,GX_RESOURCE_ID string_id,GX_STRING * return_string)145 UINT    _gxe_widget_string_get_ext(GX_WIDGET *widget, GX_RESOURCE_ID string_id, GX_STRING *return_string)
146 {
147 UINT status;
148 
149     /* Check for appropriate caller.  */
150     GX_INIT_AND_THREADS_CALLER_CHECKING
151 
152     /* Check for invalid pointer.  */
153     if (return_string == GX_NULL || widget == GX_NULL)
154     {
155         return(GX_PTR_ERROR);
156     }
157 
158     /* Check for invalid widget.*/
159     if (widget -> gx_widget_type == 0)
160     {
161         return(GX_INVALID_WIDGET);
162     }
163 
164     /* Call actual system pixelmap get.  */
165     status = _gx_widget_string_get_ext(widget, string_id, return_string);
166 
167     /* Return status.  */
168     return(status);
169 }
170 
171