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 /**   Text Input Management (Single Line Text Input)                      */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_single_line_text_input.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_single_line_text_input_create                  PORTABLE C      */
38 /*                                                           6.1.3        */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the single line text input       */
46 /*    create call.                                                        */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    text_input                        Single-line text input widget     */
51 /*                                        control block                   */
52 /*    name                              Name of text input widget         */
53 /*    parent                            Pointer to parent widget          */
54 /*    input_buffer                      Pointer to text input buffer      */
55 /*    buffer_size                       Size of text input buffer         */
56 /*    style                             Style of text input widget.       */
57 /*    text_input_id                     Application-defined ID for text   */
58 /*                                        input                           */
59 /*    size                              Dimensions of text input widget   */
60 /*    text_input_control_block_size     Size of the single line text      */
61 /*                                        input control block             */
62 /*                                                                        */
63 /*  OUTPUT                                                                */
64 /*                                                                        */
65 /*    status                            Completion status                 */
66 /*                                                                        */
67 /*  CALLS                                                                 */
68 /*                                                                        */
69 /*    _gx_single_line_text_input_create                                   */
70 /*                                      Actual single line text input     */
71 /*                                        widget create call              */
72 /*                                                                        */
73 /*  CALLED BY                                                             */
74 /*                                                                        */
75 /*    Application Code                                                    */
76 /*                                                                        */
77 /*  RELEASE HISTORY                                                       */
78 /*                                                                        */
79 /*    DATE              NAME                      DESCRIPTION             */
80 /*                                                                        */
81 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
82 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
83 /*                                            resulting in version 6.1    */
84 /*  12-31-2020     Kenneth Maxwell          Modified comment(s),          */
85 /*                                            removed input buffer check, */
86 /*                                            resulting in version 6.1.3  */
87 /*                                                                        */
88 /**************************************************************************/
89 
_gxe_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT * text_input,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_CHAR * input_buffer,UINT buffer_size,UINT style,USHORT text_input_id,GX_CONST GX_RECTANGLE * size,UINT text_input_control_block_size)90 UINT  _gxe_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT *text_input,
91                                          GX_CONST GX_CHAR *name,
92                                          GX_WIDGET *parent,
93                                          GX_CHAR *input_buffer,
94                                          UINT buffer_size,
95                                          UINT style,
96                                          USHORT text_input_id,
97                                          GX_CONST GX_RECTANGLE *size,
98                                          UINT text_input_control_block_size)
99 {
100 UINT status;
101 
102     /* Check for invalid caller.  */
103     GX_INIT_AND_THREADS_CALLER_CHECKING
104 
105     /* Check for invalid input pointers.  */
106     if ((text_input == GX_NULL) || (size == GX_NULL))
107     {
108         return(GX_PTR_ERROR);
109     }
110 
111     if (text_input_control_block_size != sizeof(GX_SINGLE_LINE_TEXT_INPUT))
112     {
113         return(GX_INVALID_SIZE);
114     }
115 
116     /* Check for already created. */
117     if (text_input -> gx_widget_type != 0)
118     {
119         return(GX_ALREADY_CREATED);
120     }
121 
122     if (parent && (parent -> gx_widget_type == 0))
123     {
124         return(GX_INVALID_WIDGET);
125     }
126 
127     /* Call actual single line text input create function.  */
128     status = _gx_single_line_text_input_create(text_input, name, parent, input_buffer, buffer_size, style, text_input_id, size);
129 
130     /* Return completion status.  */
131     return(status);
132 }
133 
134