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_pixelmap_button_create PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function creates a pixelmap 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 |
|
|
/* normal_id Normal state pixelmap id */ |
54 |
|
|
/* selected_id Selected state pixelmap id */ |
55 |
|
|
/* disabled_id Disabled state pixelmap id */ |
56 |
|
|
/* style Style of button */ |
57 |
|
|
/* pixelmap_button_id Application-defined ID of */ |
58 |
|
|
/* the pixelmap button */ |
59 |
|
|
/* size Button size */ |
60 |
|
|
/* */ |
61 |
|
|
/* OUTPUT */ |
62 |
|
|
/* */ |
63 |
|
|
/* status Completion status */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLS */ |
66 |
|
|
/* */ |
67 |
|
|
/* _gx_button_create Create the underlying button */ |
68 |
|
|
/* _gx_pixelmap_transparent_detect Detect whether or not a */ |
69 |
|
|
/* pixelmap is transparent */ |
70 |
|
|
/* _gx_widget_status_add Set the widget status flag */ |
71 |
|
|
/* _gx_widget_link Link the widget to its parent */ |
72 |
|
|
/* */ |
73 |
|
|
/* CALLED BY */ |
74 |
|
|
/* */ |
75 |
|
|
/* Application Code */ |
76 |
|
|
/* */ |
77 |
|
|
/* RELEASE HISTORY */ |
78 |
|
|
/* */ |
79 |
|
|
/* DATE NAME DESCRIPTION */ |
80 |
|
|
/* */ |
81 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
82 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
83 |
|
|
/* resulting in version 6.1 */ |
84 |
|
|
/* */ |
85 |
|
|
/**************************************************************************/ |
86 |
|
1079 |
UINT _gx_pixelmap_button_create(GX_PIXELMAP_BUTTON *button, |
87 |
|
|
GX_CONST GX_CHAR *name, |
88 |
|
|
GX_WIDGET *parent, |
89 |
|
|
GX_RESOURCE_ID normal_id, |
90 |
|
|
GX_RESOURCE_ID selected_id, |
91 |
|
|
GX_RESOURCE_ID disabled_id, |
92 |
|
|
ULONG style, |
93 |
|
|
USHORT pixelmap_button_id, |
94 |
|
|
GX_CONST GX_RECTANGLE *size) |
95 |
|
|
{ |
96 |
|
|
/* Call the button create function. */ |
97 |
|
1079 |
_gx_button_create((GX_BUTTON *)button, name, GX_NULL, style, pixelmap_button_id, size); |
98 |
|
|
|
99 |
|
1079 |
button -> gx_widget_type = GX_TYPE_PIXELMAP_BUTTON; |
100 |
|
1079 |
button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_pixelmap_button_draw; |
101 |
|
1079 |
button -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_pixelmap_button_event_process; |
102 |
|
1079 |
button -> gx_pixelmap_button_normal_id = normal_id; |
103 |
|
1079 |
button -> gx_pixelmap_button_selected_id = selected_id; |
104 |
|
1079 |
button -> gx_pixelmap_button_disabled_id = disabled_id; |
105 |
|
|
|
106 |
|
|
/* Determine if a parent widget was provided. */ |
107 |
✓✓ |
1079 |
if (parent) |
108 |
|
|
{ |
109 |
|
1078 |
_gx_widget_link(parent, (GX_WIDGET *)button); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
1079 |
return(GX_SUCCESS); |
113 |
|
|
} |
114 |
|
|
|