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 GX_CALLER_CHECKING_EXTERNS
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gxe_pixelmap_button_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 pixelmap button create */
45 /* function. */
46 /* */
47 /* INPUT */
48 /* */
49 /* button Button control block */
50 /* name Name of button */
51 /* parent Parent widget control block */
52 /* normal_id Normal state pixelmap id */
53 /* selected_id Selected state pixelmap id */
54 /* disabled_id Disabled state pixelmap id */
55 /* style Style of checkbox */
56 /* pixelmap_button_id Application-defined ID of */
57 /* the pixelmap button */
58 /* size Button size */
59 /* button_control_block_size Size of the pixelmap button */
60 /* control block */
61 /* */
62 /* OUTPUT */
63 /* */
64 /* status Completion status */
65 /* */
66 /* CALLS */
67 /* */
68 /* _gx_pixelmap_button_create the actual function */
69 /* */
70 /* CALLED BY */
71 /* */
72 /* Application Code */
73 /* */
74 /* RELEASE HISTORY */
75 /* */
76 /* DATE NAME DESCRIPTION */
77 /* */
78 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
79 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
80 /* resulting in version 6.1 */
81 /* */
82 /**************************************************************************/
_gxe_pixelmap_button_create(GX_PIXELMAP_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID normal_id,GX_RESOURCE_ID selected_id,GX_RESOURCE_ID disabled_id,ULONG style,USHORT pixelmap_button_id,GX_CONST GX_RECTANGLE * size,UINT button_control_block_size)83 UINT _gxe_pixelmap_button_create(GX_PIXELMAP_BUTTON *button,
84 GX_CONST GX_CHAR *name,
85 GX_WIDGET *parent,
86 GX_RESOURCE_ID normal_id,
87 GX_RESOURCE_ID selected_id,
88 GX_RESOURCE_ID disabled_id,
89 ULONG style,
90 USHORT pixelmap_button_id,
91 GX_CONST GX_RECTANGLE *size,
92 UINT button_control_block_size)
93 {
94 UINT status;
95
96 /* Check for invalid caller. */
97 GX_INIT_AND_THREADS_CALLER_CHECKING
98
99 /* Check error for valid pointer. */
100 if ((button == GX_NULL) || (size == GX_NULL))
101 {
102 return(GX_PTR_ERROR);
103 }
104
105 /* Check for invalid control block size. */
106 if (button_control_block_size != sizeof(GX_PIXELMAP_BUTTON))
107 {
108 return(GX_INVALID_SIZE);
109 }
110
111 /* Check error for valid widget. */
112 if (button -> gx_widget_type != 0)
113 {
114 return(GX_ALREADY_CREATED);
115 }
116
117 status = _gx_pixelmap_button_create(button, name, parent, normal_id, selected_id, disabled_id, style, pixelmap_button_id, size);
118 return(status);
119 }
120
121