2 #include <aros/debug.h>
4 #include <proto/exec.h>
5 #include <proto/intuition.h>
6 #include <exec/memory.h>
7 #include <intuition/gadgetclass.h>
10 #include "bootmenu_intern.h"
12 struct ButtonGadget
*createButton
14 ULONG left
, ULONG top
, ULONG width
, ULONG height
,
18 struct BootMenuBase
*BootMenuBase
21 struct TagItem tags
[] =
23 {GA_Left
, (IPTR
)left
}, /* 0 */
24 {GA_Top
, (IPTR
)top
}, /* 1 */
25 {GA_Height
, (IPTR
)height
}, /* 2 */
26 {GA_Width
, (IPTR
)width
}, /* 3 */
27 {GA_Border
, NULL
}, /* 4 */
28 {GA_SelectRender
, NULL
}, /* 5 */
29 {GA_Previous
, (IPTR
)prev
}, /* 6 */
30 {GA_Text
, (IPTR
)name
}, /* 7 */
31 {GA_ID
, (IPTR
)id
}, /* 8 */
36 struct ButtonGadget
*button
;
38 D(bug("[BootMenu] createButton()\n"));
40 if ((button
= AllocMem(sizeof(struct ButtonGadget
), MEMF_PUBLIC
| MEMF_CLEAR
)) != NULL
)
42 if (!(prev
)) tags
[6].ti_Tag
= TAG_IGNORE
;
44 tags
[4].ti_Data
= (IPTR
)&button
->uborder2
;
45 tags
[5].ti_Data
= (IPTR
)&button
->sborder2
;
46 button
->XY1
[1] = height
;
47 button
->XY1
[4] = width
;
48 button
->XY2
[0] = width
;
49 button
->XY2
[2] = width
;
50 button
->XY2
[3] = height
;
51 button
->XY2
[5] = height
;
52 button
->uborder1
.FrontPen
= 1;
53 button
->uborder1
.DrawMode
= JAM1
;
54 button
->uborder1
.Count
= 3;
55 button
->uborder1
.XY
= button
->XY2
;
56 button
->uborder2
.FrontPen
= 2;
57 button
->uborder2
.DrawMode
= JAM1
;
58 button
->uborder2
.Count
= 3;
59 button
->uborder2
.XY
= button
->XY1
;
60 button
->uborder2
.NextBorder
= &button
->uborder1
;
61 button
->sborder1
.FrontPen
= 2;
62 button
->sborder1
.DrawMode
= JAM1
;
63 button
->sborder1
.Count
= 3;
64 button
->sborder1
.XY
= button
->XY2
;
65 button
->sborder2
.FrontPen
= 1;
66 button
->sborder2
.DrawMode
= JAM1
;
67 button
->sborder2
.Count
= 3;
68 button
->sborder2
.XY
= button
->XY1
;
69 button
->sborder2
.NextBorder
= &button
->sborder1
;
70 if ((button
->gadget
= NewObjectA(NULL
, FRBUTTONCLASS
, tags
)) != NULL
)
74 prev
->NextGadget
= button
->gadget
;
78 FreeMem(button
, sizeof(struct ButtonGadget
));
83 void freeButtonGadget(struct ButtonGadget
*button
, struct BootMenuBase
*BootMenuBase
)
85 D(bug("[BootMenu] freeButtonGadget()\n"));
87 DisposeObject(button
->gadget
);
88 FreeMem(button
, sizeof(struct ButtonGadget
));