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