Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / dosboot / gadgets.c
blobc76149f4e350780f947ff5ed6c786f6f17d087c4
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include <proto/exec.h>
9 #include <proto/intuition.h>
10 #include <exec/memory.h>
11 #include <intuition/gadgetclass.h>
13 #include "dosboot_intern.h"
15 struct ButtonGadget *createButton
17 ULONG left, ULONG top, ULONG width, ULONG height,
18 struct Gadget *prev,
19 STRPTR name,
20 UWORD id,
21 struct DOSBootBase *DOSBootBase
24 struct TagItem tags[] =
26 {GA_Left, (IPTR)left}, /* 0 */
27 {GA_Top, (IPTR)top}, /* 1 */
28 {GA_Height, (IPTR)height}, /* 2 */
29 {GA_Width, (IPTR)width}, /* 3 */
30 {GA_Border, 0}, /* 4 */
31 {GA_SelectRender, 0}, /* 5 */
32 {GA_Previous, (IPTR)prev}, /* 6 */
33 {GA_Text, (IPTR)name}, /* 7 */
34 {GA_ID, (IPTR)id}, /* 8 */
35 {GA_Immediate, TRUE},
36 {GA_RelVerify, TRUE},
37 {TAG_DONE, 0UL}
39 struct ButtonGadget *button;
41 D(bug("[BootMenu] createButton()\n"));
43 if ((button = AllocMem(sizeof(struct ButtonGadget), MEMF_PUBLIC | MEMF_CLEAR)) != NULL)
45 if (!(prev)) tags[6].ti_Tag = TAG_IGNORE;
47 tags[4].ti_Data = (IPTR)&button->uborder2;
48 tags[5].ti_Data = (IPTR)&button->sborder2;
49 button->XY1[1] = height;
50 button->XY1[4] = width;
51 button->XY2[0] = width;
52 button->XY2[2] = width;
53 button->XY2[3] = height;
54 button->XY2[5] = height;
55 button->uborder1.FrontPen = 1;
56 button->uborder1.DrawMode = JAM1;
57 button->uborder1.Count = 3;
58 button->uborder1.XY = button->XY2;
59 button->uborder2.FrontPen = 2;
60 button->uborder2.DrawMode = JAM1;
61 button->uborder2.Count = 3;
62 button->uborder2.XY = button->XY1;
63 button->uborder2.NextBorder = &button->uborder1;
64 button->sborder1.FrontPen = 2;
65 button->sborder1.DrawMode = JAM1;
66 button->sborder1.Count = 3;
67 button->sborder1.XY = button->XY2;
68 button->sborder2.FrontPen = 1;
69 button->sborder2.DrawMode = JAM1;
70 button->sborder2.Count = 3;
71 button->sborder2.XY = button->XY1;
72 button->sborder2.NextBorder = &button->sborder1;
73 if ((button->gadget = NewObjectA(NULL, FRBUTTONCLASS, tags)) != NULL)
75 if (prev != NULL)
77 prev->NextGadget = button->gadget;
79 return button;
81 FreeMem(button, sizeof(struct ButtonGadget));
83 return NULL;
86 void freeButtonGadget(struct ButtonGadget *button, struct DOSBootBase *DOSBootBase)
88 D(bug("[BootMenu] freeButtonGadget()\n"));
89 if (button == NULL)
90 return;
91 DisposeObject(button->gadget);
92 FreeMem(button, sizeof(struct ButtonGadget));