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 #include "gx_system.h"
30 #include "gx_utility.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gx_icon_button_create PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function creates an icon button, which is a special type of */
46 /* button. */
47 /* */
48 /* INPUT */
49 /* */
50 /* button Button control block */
51 /* name Name of button */
52 /* parent Parent widget control block */
53 /* icon_id Resource ID of icon */
54 /* style Style of icon */
55 /* icon_button_id Application-definedID of icon */
56 /* size Button size */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* status Completion status */
61 /* */
62 /* CALLS */
63 /* */
64 /* _gx_button_create Create the underlying button */
65 /* _gx_widget_link Link the widget to its parent */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Application Code */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
76 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* */
79 /**************************************************************************/
_gx_icon_button_create(GX_ICON_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID icon_id,ULONG style,USHORT icon_button_id,GX_CONST GX_RECTANGLE * size)80 UINT _gx_icon_button_create(GX_ICON_BUTTON *button,
81 GX_CONST GX_CHAR *name,
82 GX_WIDGET *parent,
83 GX_RESOURCE_ID icon_id,
84 ULONG style,
85 USHORT icon_button_id,
86 GX_CONST GX_RECTANGLE *size)
87 {
88
89 /* Call the button create function. */
90 _gx_button_create((GX_BUTTON *)button, name, GX_NULL, style, icon_button_id, size);
91
92 button -> gx_widget_type = GX_TYPE_ICON_BUTTON;
93 button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_icon_button_draw;
94 button -> gx_icon_button_icon_id = icon_id;
95
96 /* Determine if a parent widget was provided. */
97 if (parent)
98 {
99 _gx_widget_link(parent, (GX_WIDGET *)button);
100 }
101
102 /* Return the error status from button create. */
103 return(GX_SUCCESS);
104 }
105
106