grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / gadtools / createcontext.c
blobfa52bfdc7e6ea144b7e5ad749a209b70030fd67f
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <proto/intuition.h>
10 #include <exec/memory.h>
11 #include <intuition/classusr.h>
12 #include <utility/tagitem.h>
13 #include <libraries/gadtools.h>
14 #include "gadtools_intern.h"
16 /*********************************************************************
18 NAME */
19 #include <proto/gadtools.h>
20 #include <intuition/intuition.h>
22 AROS_LH1(struct Gadget *, CreateContext,
24 /* SYNOPSIS */
25 AROS_LHA(struct Gadget **, glistpointer, A0),
27 /* LOCATION */
28 struct Library *, GadToolsBase, 19, GadTools)
30 /* FUNCTION
31 Creates a virtual first gadget to which all following gadgets must be
32 linked.
34 INPUTS
35 glistpointer - pointer to a pointer to the virtual gadget. Use the
36 gadget pointer as NewWindow->FirstGadget or in
37 AddGList(). The gadget pointer must be initialized
38 to NULL before CreateContext() is called.
40 RESULT
41 A point to the first gadget or NULL, if there was an error.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 HISTORY
55 ***************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct GT_ContextGadget *rc;
61 DEBUG_CREATECONTEXT(dprintf("CreateContext: glistptr 0x%lx\n", glistpointer));
63 rc = (struct GT_ContextGadget *)AllocMem(sizeof(struct GT_ContextGadget), MEMF_PUBLIC | MEMF_CLEAR);
64 if (rc)
66 rc->magic = CONTEXT_MAGIC;
67 rc->magic2 = CONTEXT_MAGIC2;
68 rc->gad.Flags = GFLG_GADGHNONE | GFLG_DISABLED;
69 rc->gad.GadgetType = GTYP_GADTOOLS;
72 *glistpointer = (struct Gadget *)rc;
74 DEBUG_CREATECONTEXT(dprintf("CreateContext: return 0x%lx\n", rc));
76 return (struct Gadget *)rc;
78 AROS_LIBFUNC_EXIT
79 } /* CreateContext */