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 (radio_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
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_radio_button_create PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This service creates a radio button widget. */
45 /* */
46 /* INPUT */
47 /* */
48 /* button Button control block */
49 /* name Name of button */
50 /* parent Parent widget control block */
51 /* text_id text resource id */
52 /* style Style of button */
53 /* radio_button_id Application-defined ID of */
54 /* radio button */
55 /* size Button size */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _gx_text_button_create Create text button */
64 /* _gx_widget_link Link the widget to its parent */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
75 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* */
78 /**************************************************************************/
_gx_radio_button_create(GX_RADIO_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT radio_btton_id,GX_CONST GX_RECTANGLE * size)79 UINT _gx_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
80 GX_RESOURCE_ID text_id, ULONG style, USHORT radio_btton_id,
81 GX_CONST GX_RECTANGLE *size)
82 {
83
84 style |= GX_STYLE_BUTTON_RADIO;
85
86 /* Call the button create function. */
87 _gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, radio_btton_id, size);
88
89 /* Populate the rest of button control block - overriding as necessary. */
90 button -> gx_widget_type = GX_TYPE_RADIO_BUTTON;
91 button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_radio_button_draw;
92 button -> gx_radio_button_on_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID;
93 button -> gx_radio_button_off_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID;
94 button -> gx_radio_button_on_disabled_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID;
95 button -> gx_radio_button_off_disabled_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID;
96
97 /* Determine if a parent widget was provided. */
98 if (parent)
99 {
100 _gx_widget_link(parent, (GX_WIDGET *)button);
101 }
102
103 /* Return the status from button create. */
104 return(GX_SUCCESS);
105 }
106
107