1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
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 |
|
|
/**************************************************************************/ |
71 |
|
5346 |
UINT _gx_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, |
72 |
|
|
GX_RESOURCE_ID text_id, ULONG style, USHORT radio_btton_id, |
73 |
|
|
GX_CONST GX_RECTANGLE *size) |
74 |
|
|
{ |
75 |
|
|
|
76 |
|
5346 |
style |= GX_STYLE_BUTTON_RADIO; |
77 |
|
|
|
78 |
|
|
/* Call the button create function. */ |
79 |
|
5346 |
_gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, radio_btton_id, size); |
80 |
|
|
|
81 |
|
|
/* Populate the rest of button control block - overriding as necessary. */ |
82 |
|
5346 |
button -> gx_widget_type = GX_TYPE_RADIO_BUTTON; |
83 |
|
5346 |
button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_radio_button_draw; |
84 |
|
5346 |
button -> gx_radio_button_on_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID; |
85 |
|
5346 |
button -> gx_radio_button_off_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID; |
86 |
|
5346 |
button -> gx_radio_button_on_disabled_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID; |
87 |
|
5346 |
button -> gx_radio_button_off_disabled_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID; |
88 |
|
|
|
89 |
|
|
/* Determine if a parent widget was provided. */ |
90 |
✓✓ |
5346 |
if (parent) |
91 |
|
|
{ |
92 |
|
5345 |
_gx_widget_link(parent, (GX_WIDGET *)button); |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
/* Return the status from button create. */ |
96 |
|
5346 |
return(GX_SUCCESS); |
97 |
|
|
} |
98 |
|
|
|