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