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 /** Multi Line Text View Managment (Multi Line Text View) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_multi_line_text_view.h"
29 #include "gx_utility.h"
30
31 GX_CALLER_CHECKING_EXTERNS
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gxe_multi_line_text_view_text_set PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors in the multi line text view text */
45 /* set function call. */
46 /* */
47 /* */
48 /* INPUT */
49 /* */
50 /* view Pointer to multi line text */
51 /* view control block */
52 /* text Null-terminated text string */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _gx_multi_line_text_view_text_set Actual multi line text view */
61 /* text set fucntion */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
76 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW * view,GX_CONST GX_CHAR * text)77 UINT _gxe_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW *view,
78 GX_CONST GX_CHAR *text)
79 {
80 UINT status;
81
82 /* Check for invalid caller. */
83 GX_INIT_AND_THREADS_CALLER_CHECKING
84
85 if (!view)
86 {
87 return(GX_PTR_ERROR);
88 }
89
90 status = _gx_multi_line_text_view_text_set(view, text);
91
92 return(status);
93 }
94 #endif
95
96 /**************************************************************************/
97 /* */
98 /* FUNCTION RELEASE */
99 /* */
100 /* _gxe_multi_line_text_view_text_set_ext PORTABLE C */
101 /* 6.1 */
102 /* AUTHOR */
103 /* */
104 /* Kenneth Maxwell, Microsoft Corporation */
105 /* */
106 /* DESCRIPTION */
107 /* */
108 /* This function checks for errors in the multi line text view text */
109 /* set ext function call. */
110 /* */
111 /* */
112 /* INPUT */
113 /* */
114 /* view Pointer to multi line text */
115 /* view control block */
116 /* text Null-terminated text string */
117 /* */
118 /* OUTPUT */
119 /* */
120 /* status Completion status */
121 /* */
122 /* CALLS */
123 /* */
124 /* _gx_multi_line_text_view_text_set_ext Actual multi line text view */
125 /* text set ext fucntion */
126 /* */
127 /* CALLED BY */
128 /* */
129 /* Application Code */
130 /* */
131 /* RELEASE HISTORY */
132 /* */
133 /* DATE NAME DESCRIPTION */
134 /* */
135 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
136 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
137 /* resulting in version 6.1 */
138 /* */
139 /**************************************************************************/
_gxe_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW * view,GX_CONST GX_STRING * text)140 UINT _gxe_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW *view,
141 GX_CONST GX_STRING *text)
142 {
143 UINT status = GX_SUCCESS;
144 UINT text_length = 0;
145
146 /* Check for invalid caller. */
147 GX_INIT_AND_THREADS_CALLER_CHECKING
148
149 if (!view)
150 {
151 return(GX_PTR_ERROR);
152 }
153
154 if (text)
155 {
156 if (text -> gx_string_ptr)
157 {
158 /* Calculate string length. */
159 status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
160
161 if (status != GX_SUCCESS)
162 {
163 return status;
164 }
165 }
166
167 /* Validate string length. */
168 if (text_length != text -> gx_string_length)
169 {
170 return GX_INVALID_STRING_LENGTH;
171 }
172 }
173
174 status = _gx_multi_line_text_view_text_set_ext(view, text);
175
176 return(status);
177 }
178
179