added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / rom / bootmenu / gadgets.c
blobdd6ef136b7f691af0443b7cfed4a9941501363f7
1 #include <proto/exec.h>
2 #include <proto/intuition.h>
3 #include <exec/memory.h>
4 #include <intuition/gadgetclass.h>
5 #define DEBUG 1
6 #include <aros/debug.h>
8 #include "gadgets.h"
9 #include "bootmenu_intern.h"
11 #undef GfxBase
12 #undef IntuitionBase
13 #define GfxBase bootmenubase->GfxBase
14 #define IntuitionBase bootmenubase->IntuitionBase
16 struct ButtonGadget *createButton
18 ULONG left, ULONG top, ULONG width, ULONG height,
19 struct Gadget *prev,
20 STRPTR name,
21 UWORD id,
22 struct BootMenuBase *bootmenubase
25 struct TagItem tags[] =
27 {GA_Left, left}, /* 0 */
28 {GA_Top, top}, /* 1 */
29 {GA_Height, height}, /* 2 */
30 {GA_Width, width}, /* 3 */
31 {GA_Border, NULL}, /* 4 */
32 {GA_SelectRender, NULL}, /* 5 */
33 {GA_Previous, (IPTR)prev}, /* 6 */
34 {GA_Text, (IPTR)name}, /* 7 */
35 {GA_ID, (IPTR)id}, /* 8 */
36 {GA_Immediate, TRUE},
37 {GA_RelVerify, TRUE},
38 {TAG_DONE, 0UL}
40 struct ButtonGadget *button;
42 button = AllocMem(sizeof(struct ButtonGadget), MEMF_PUBLIC | MEMF_CLEAR);
43 if (button)
45 tags[4].ti_Data = (IPTR)&button->uborder2;
46 tags[5].ti_Data = (IPTR)&button->sborder2;
47 button->XY1[1] = height;
48 button->XY1[4] = width;
49 button->XY2[0] = width;
50 button->XY2[2] = width;
51 button->XY2[3] = height;
52 button->XY2[5] = height;
53 button->uborder1.FrontPen = 1;
54 button->uborder1.DrawMode = JAM1;
55 button->uborder1.Count = 3;
56 button->uborder1.XY = button->XY2;
57 button->uborder2.FrontPen = 2;
58 button->uborder2.DrawMode = JAM1;
59 button->uborder2.Count = 3;
60 button->uborder2.XY = button->XY1;
61 button->uborder2.NextBorder = &button->uborder1;
62 button->sborder1.FrontPen = 2;
63 button->sborder1.DrawMode = JAM1;
64 button->sborder1.Count = 3;
65 button->sborder1.XY = button->XY2;
66 button->sborder2.FrontPen = 1;
67 button->sborder2.DrawMode = JAM1;
68 button->sborder2.Count = 3;
69 button->sborder2.XY = button->XY1;
70 button->sborder2.NextBorder = &button->sborder1;
71 button->button = NewObjectA(NULL, FRBUTTONCLASS, tags);
72 if (button->button)
74 button->gadget = prev->NextGadget;
75 button->gadget->NextGadget = NULL;
76 return button;
78 FreeMem(button, sizeof(struct ButtonGadget));
80 return NULL;
83 void freeButtonGadget(struct ButtonGadget *button, struct BootMenuBase *bootmenubase) {
85 DisposeObject(button->button);
86 FreeMem(button, sizeof(struct ButtonGadget));