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 /**   Button Management (checkbox)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_button.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_checkbox_create                                PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the checkbox create function     */
46 /*    call.                                                               */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    checkbox                              Checkbox control block        */
51 /*    name                                  Name of checkbox              */
52 /*    parent                                Parent widget control block   */
53 /*    text_id                               text resource id              */
54 /*    style                                 Style of checkbox             */
55 /*    checkbox_id                           Application-defined ID of     */
56 /*                                          checkbox                      */
57 /*    size                                  Checkbox size                 */
58 /*    checkbox_control_block_size           Size of the checkbox control  */
59 /*                                            block                       */
60 /*                                                                        */
61 /*  OUTPUT                                                                */
62 /*                                                                        */
63 /*    status                                Completion status             */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*    _gx_checkbox_create                   Actual checkbox create call   */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
72 /*                                                                        */
73 /*  RELEASE HISTORY                                                       */
74 /*                                                                        */
75 /*    DATE              NAME                      DESCRIPTION             */
76 /*                                                                        */
77 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79 /*                                            resulting in version 6.1    */
80 /*                                                                        */
81 /**************************************************************************/
_gxe_checkbox_create(GX_CHECKBOX * checkbox,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT checkbox_id,GX_CONST GX_RECTANGLE * size,UINT checkbox_control_block_size)82 UINT  _gxe_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83                            GX_RESOURCE_ID text_id, ULONG style, USHORT checkbox_id,
84                            GX_CONST GX_RECTANGLE *size, UINT checkbox_control_block_size)
85 {
86 UINT status;
87 
88     /* Check for appropriate caller.  */
89     GX_INIT_AND_THREADS_CALLER_CHECKING
90 
91     /* Check for the invalid input pointers.  */
92     if ((checkbox == GX_NULL) || (size == GX_NULL))
93     {
94         return(GX_PTR_ERROR);
95     }
96 
97     if (checkbox_control_block_size != sizeof(GX_CHECKBOX))
98     {
99         return(GX_INVALID_SIZE);
100     }
101 
102     /* Check for the checkbox is already created.  */
103     if (checkbox -> gx_widget_type != 0)
104     {
105         return(GX_ALREADY_CREATED);
106     }
107 
108     /* Call the actual checkbox create funtion.  */
109     status = _gx_checkbox_create(checkbox, name, parent, text_id, style, checkbox_id, size);
110 
111     /* Return completion status.  */
112     return status;
113 }
114 
115