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 (checkbox) */ |
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_checkbox_create PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function creates a checkbox, which is a special type of */ |
45 |
|
|
/* button (widget). */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* checkbox Checkbox control block */ |
50 |
|
|
/* name Name of checkbox */ |
51 |
|
|
/* parent Parent widget control block */ |
52 |
|
|
/* text_id Text resource id */ |
53 |
|
|
/* style Style of checkbox */ |
54 |
|
|
/* checkbox_id Checkbox id */ |
55 |
|
|
/* size Checkbox size */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* status Completion status */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_text_button_create Create the underlying button */ |
64 |
|
|
/* _gx_widget_link Link the widget to its parent */ |
65 |
|
|
/* */ |
66 |
|
|
/* CALLED BY */ |
67 |
|
|
/* */ |
68 |
|
|
/* Application Code */ |
69 |
|
|
/* */ |
70 |
|
|
/**************************************************************************/ |
71 |
|
3968 |
UINT _gx_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent, |
72 |
|
|
GX_RESOURCE_ID text_id, ULONG style, USHORT checkbox_id, |
73 |
|
|
GX_CONST GX_RECTANGLE *size) |
74 |
|
|
{ |
75 |
|
|
|
76 |
|
3968 |
style |= GX_STYLE_BUTTON_TOGGLE; |
77 |
|
|
|
78 |
|
|
/* Call the prompt create function. */ |
79 |
|
3968 |
_gx_text_button_create((GX_TEXT_BUTTON *)checkbox, name, GX_NULL, text_id, style, checkbox_id, size); |
80 |
|
|
|
81 |
|
|
/* Populate the rest of button control block - overriding as necessary. */ |
82 |
|
3968 |
checkbox -> gx_widget_type = GX_TYPE_CHECKBOX; |
83 |
|
3968 |
checkbox -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_checkbox_draw; |
84 |
|
3968 |
checkbox -> gx_button_select_handler = (VOID (*)(GX_WIDGET *))(void (*)(void))_gx_checkbox_select; |
85 |
|
3968 |
checkbox -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_checkbox_event_process; |
86 |
|
3968 |
checkbox -> gx_checkbox_checked_pixelmap_id = GX_PIXELMAP_CHECKBOX_ON_ID; |
87 |
|
3968 |
checkbox -> gx_checkbox_unchecked_pixelmap_id = GX_PIXELMAP_CHECKBOX_OFF_ID; |
88 |
|
|
|
89 |
|
|
/* Determine if a parent widget was provided. */ |
90 |
✓✓ |
3968 |
if (parent) |
91 |
|
|
{ |
92 |
|
3967 |
_gx_widget_link(parent, (GX_WIDGET *)checkbox); |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
/* Return the status from button create. */ |
96 |
|
3968 |
return(GX_SUCCESS); |
97 |
|
|
} |
98 |
|
|
|