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