2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: GadTools initialization code.
8 #include <exec/libraries.h>
9 #include <exec/types.h>
11 #include <aros/symbolsets.h>
12 #include <utility/tagitem.h>
13 #include <utility/utility.h>
14 #include <intuition/classes.h>
15 #include <intuition/imageclass.h>
16 #include <proto/exec.h>
18 #include "gadtools_intern.h"
19 #include LC_LIBDEFS_FILE
22 #define INTUITIONNAME "intuition.library"
24 /****************************************************************************************/
26 static int openall(LIBBASETYPEPTR LIBBASE
)
28 if ((UtilityBase
= OpenLibrary("utility.library", 0)) != NULL
) {
29 if ((GfxBase
= OpenLibrary("graphics.library", 0)) != NULL
) {
30 if ((LayersBase
= OpenLibrary("layers.library", 0)) != NULL
) {
31 if ((IntuitionBase
= OpenLibrary("intuition.library", 0)) != NULL
) {
34 CloseLibrary(LayersBase
);
36 CloseLibrary(GfxBase
);
38 CloseLibrary(UtilityBase
);
43 static void closeall(LIBBASETYPEPTR LIBBASE
)
45 CloseLibrary(IntuitionBase
);
46 CloseLibrary(LayersBase
);
47 CloseLibrary(GfxBase
);
48 CloseLibrary(UtilityBase
);
51 static int InitRootClass(LIBBASETYPEPTR LIBBASE
)
53 return openall(LIBBASE
);
56 static int Init(LIBBASETYPEPTR LIBBASE
)
58 /* This function is single-threaded by exec by calling Forbid. */
59 InitSemaphore(&LIBBASE
->bevelsema
);
60 LIBBASE
->bevel
= NULL
;
62 /* You would return NULL here if the init failed. */
66 /****************************************************************************************/
68 Object
*makebevelobj(struct GadToolsBase_intern
*GadToolsBase
)
71 struct TagItem tags
[4];
73 tags
[0].ti_Tag
= IA_EdgesOnly
;
74 tags
[0].ti_Data
= TRUE
;
75 tags
[1].ti_Tag
= IA_Left
;
76 tags
[1].ti_Data
= 0UL;
77 tags
[2].ti_Tag
= IA_Top
;
78 tags
[2].ti_Data
= 0UL;
79 tags
[3].ti_Tag
= TAG_DONE
;
80 obj
= NewObjectA(NULL
, FRAMEICLASS
, tags
);
85 /****************************************************************************************/
87 static int Open(LIBBASETYPEPTR LIBBASE
)
90 This function is single-threaded by exec by calling Forbid.
91 If you break the Forbid() another task may enter this function
92 at the same time. Take care.
96 LIBBASE
->bevel
= (struct Image
*)makebevelobj(GadToolsBase
);
103 /****************************************************************************************/
105 static int Expunge(LIBBASETYPEPTR LIBBASE
)
108 This function is single-threaded by exec by calling Forbid.
109 If you break the Forbid() another task may enter this function
110 at the same time. Take care.
114 DisposeObject(LIBBASE
->bevel
);
115 LIBBASE
->bevel
= NULL
;
122 /****************************************************************************************/
124 DECLARESET(CLASSESINIT
);
125 ADD2SET(InitRootClass
, CLASSESINIT
, -20);
127 ADD2INITLIB(Init
, 0);
128 ADD2OPENLIB(Open
, 0);
129 ADD2EXPUNGELIB(Expunge
, 0);