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 (Button) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 #include "gx_button.h"
29
30 /* Bring in externs for caller checking code. */
31 GX_CALLER_CHECKING_EXTERNS
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gxe_button_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 button create function call. */
46 /* */
47 /* INPUT */
48 /* */
49 /* button Pointer to button control */
50 /* block */
51 /* name Logical name of button */
52 /* parent Pointer to parent widget */
53 /* of button */
54 /* style Button stuyle */
55 /* button_id Application-defined ID of */
56 /* the button */
57 /* size Size of the button */
58
59 /* */
60 /* OUTPUT */
61 /* */
62 /* status Completion status */
63 /* */
64 /* CALLS */
65 /* */
66 /* _gx_button_create Actual button create function */
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_button_create(GX_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT button_id,GX_CONST GX_RECTANGLE * size,UINT button_control_block_size)81 UINT _gxe_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, ULONG style,
82 USHORT button_id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size)
83 {
84 UINT status;
85
86 /* Check for appropriate caller. */
87 GX_INIT_AND_THREADS_CALLER_CHECKING
88
89 /* Check for invalid input pointers. */
90 if ((button == GX_NULL) || (size == GX_NULL))
91 {
92 return(GX_PTR_ERROR);
93 }
94
95 /* Check for invalid widget control block size. */
96 if (button_control_block_size != sizeof(GX_BUTTON))
97 {
98 return(GX_INVALID_SIZE);
99 }
100
101 /* Check for widget already created. */
102 if (button -> gx_widget_type != 0)
103 {
104 return(GX_ALREADY_CREATED);
105 }
106
107 /* Call the actual button create function. */
108 status = _gx_button_create(button, name, parent, style, button_id, size);
109
110 /* Return completion status. */
111 return status;
112 }
113
114