Register nameservers dynamically instead of writing them to disk. It is
[AROS.git] / rom / dosboot / gadgets.c
blobbd407027ca0f28eb71b16c403bf6b5644fc6e86a
1 #include <aros/debug.h>
3 #include <proto/exec.h>
4 #include <proto/intuition.h>
5 #include <exec/memory.h>
6 #include <intuition/gadgetclass.h>
8 #include "dosboot_intern.h"
10 struct ButtonGadget *createButton
12 ULONG left, ULONG top, ULONG width, ULONG height,
13 struct Gadget *prev,
14 STRPTR name,
15 UWORD id,
16 struct DOSBootBase *DOSBootBase
19 struct TagItem tags[] =
21 {GA_Left, (IPTR)left}, /* 0 */
22 {GA_Top, (IPTR)top}, /* 1 */
23 {GA_Height, (IPTR)height}, /* 2 */
24 {GA_Width, (IPTR)width}, /* 3 */
25 {GA_Border, 0}, /* 4 */
26 {GA_SelectRender, 0}, /* 5 */
27 {GA_Previous, (IPTR)prev}, /* 6 */
28 {GA_Text, (IPTR)name}, /* 7 */
29 {GA_ID, (IPTR)id}, /* 8 */
30 {GA_Immediate, TRUE},
31 {GA_RelVerify, TRUE},
32 {TAG_DONE, 0UL}
34 struct ButtonGadget *button;
36 D(bug("[BootMenu] createButton()\n"));
38 if ((button = AllocMem(sizeof(struct ButtonGadget), MEMF_PUBLIC | MEMF_CLEAR)) != NULL)
40 if (!(prev)) tags[6].ti_Tag = TAG_IGNORE;
42 tags[4].ti_Data = (IPTR)&button->uborder2;
43 tags[5].ti_Data = (IPTR)&button->sborder2;
44 button->XY1[1] = height;
45 button->XY1[4] = width;
46 button->XY2[0] = width;
47 button->XY2[2] = width;
48 button->XY2[3] = height;
49 button->XY2[5] = height;
50 button->uborder1.FrontPen = 1;
51 button->uborder1.DrawMode = JAM1;
52 button->uborder1.Count = 3;
53 button->uborder1.XY = button->XY2;
54 button->uborder2.FrontPen = 2;
55 button->uborder2.DrawMode = JAM1;
56 button->uborder2.Count = 3;
57 button->uborder2.XY = button->XY1;
58 button->uborder2.NextBorder = &button->uborder1;
59 button->sborder1.FrontPen = 2;
60 button->sborder1.DrawMode = JAM1;
61 button->sborder1.Count = 3;
62 button->sborder1.XY = button->XY2;
63 button->sborder2.FrontPen = 1;
64 button->sborder2.DrawMode = JAM1;
65 button->sborder2.Count = 3;
66 button->sborder2.XY = button->XY1;
67 button->sborder2.NextBorder = &button->sborder1;
68 if ((button->gadget = NewObjectA(NULL, FRBUTTONCLASS, tags)) != NULL)
70 if (prev != NULL)
72 prev->NextGadget = button->gadget;
74 return button;
76 FreeMem(button, sizeof(struct ButtonGadget));
78 return NULL;
81 void freeButtonGadget(struct ButtonGadget *button, struct DOSBootBase *DOSBootBase)
83 D(bug("[BootMenu] freeButtonGadget()\n"));
84 if (button == NULL)
85 return;
86 DisposeObject(button->gadget);
87 FreeMem(button, sizeof(struct ButtonGadget));