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 Input Managment (Multi Line Text Input) */
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_input.h"
29 #include "gx_utility.h"
30
31 GX_CALLER_CHECKING_EXTERNS
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gxe_multi_line_text_input_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 input text */
45 /* set function call. */
46 /* */
47 /* */
48 /* INPUT */
49 /* */
50 /* input Pointer to multi line text */
51 /* input 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_input_set Actual multi line text input */
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_input_text_set(GX_MULTI_LINE_TEXT_INPUT * input,GX_CONST GX_CHAR * text)77 UINT _gxe_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text)
78 {
79 UINT status;
80
81 /* Check for invalid caller. */
82 GX_INIT_AND_THREADS_CALLER_CHECKING
83
84 if (!input)
85 {
86 return(GX_PTR_ERROR);
87 }
88
89 status = _gx_multi_line_text_input_text_set(input, text);
90
91 return(status);
92 }
93 #endif
94
95 /**************************************************************************/
96 /* */
97 /* FUNCTION RELEASE */
98 /* */
99 /* _gxe_multi_line_text_input_text_set_ext PORTABLE C */
100 /* 6.1 */
101 /* AUTHOR */
102 /* */
103 /* Kenneth Maxwell, Microsoft Corporation */
104 /* */
105 /* DESCRIPTION */
106 /* */
107 /* This function checks for errors in the multi line text input text */
108 /* set ext function call. */
109 /* */
110 /* */
111 /* INPUT */
112 /* */
113 /* input Pointer to multi line text */
114 /* input control block */
115 /* text GX_STRING type text string */
116 /* */
117 /* OUTPUT */
118 /* */
119 /* status Completion status */
120 /* */
121 /* CALLS */
122 /* */
123 /* _gx_multi_line_text_input_text_set_ext */
124 /* Actual multi line text input */
125 /* text set 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_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT * input,GX_CONST GX_STRING * text)140 UINT _gxe_multi_line_text_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text)
141 {
142 UINT status;
143 UINT text_length = 0;
144
145 /* Check for invalid caller. */
146 GX_INIT_AND_THREADS_CALLER_CHECKING
147
148 if (!input)
149 {
150 return(GX_PTR_ERROR);
151 }
152
153 if (text)
154 {
155 if (text -> gx_string_ptr)
156 {
157 /* Calculate string length. */
158 status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
159
160 if (status != GX_SUCCESS)
161 {
162 return status;
163 }
164 }
165
166 /* Validate string length. */
167 if (text_length != text -> gx_string_length)
168 {
169 return GX_INVALID_STRING_LENGTH;
170 }
171 }
172
173 status = _gx_multi_line_text_input_text_set_ext(input, text);
174
175 return(status);
176 }
177
178