Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / tutorial / examples / muizunesupport.h
blob51df0c63ca5ccd56b5bd3a450425d17a5292c464
1 /*
2 Copyright © 2003, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 #ifndef _ZUNE_MUISUPPORT_H
9 #define _ZUNE_MUISUPPORT_H
11 #include <string.h>
13 #include <exec/memory.h>
15 #include <libraries/asl.h>
16 #include <libraries/mui.h>
17 #include <prefs/prefhdr.h>
19 #include <clib/alib_protos.h>
20 #include <proto/exec.h>
21 #include <proto/dos.h>
22 #include <proto/intuition.h>
23 #include <proto/utility.h>
24 #include <proto/iffparse.h>
26 #ifdef __AROS__
27 #include <proto/muimaster.h>
28 #endif
30 Object *MakeLabel(STRPTR str);
31 LONG xget(Object * obj, ULONG attr);
33 #define getstring(obj) (char *) xget(obj, MUIA_String_Contents)
35 #define SimpleText(text) TextObject, MUIA_Text_Contents, (IPTR) text, End
38 struct Library *MUIMasterBase;
41 #ifndef __AROS__
43 /* On AmigaOS we build a fake library base, because it's not compiled as sharedlibrary yet */
44 #include "muimaster_intern.h"
46 int open_muimaster(void)
48 static struct MUIMasterBase_intern MUIMasterBase_instance;
49 MUIMasterBase = (struct Library*)&MUIMasterBase_instance;
51 MUIMasterBase_instance.sysbase = *((struct ExecBase **)4);
52 MUIMasterBase_instance.dosbase = (void *)OpenLibrary("dos.library", 37);
53 MUIMasterBase_instance.utilitybase = (void *)OpenLibrary("utility.library", 37);
54 MUIMasterBase_instance.aslbase = OpenLibrary("asl.library", 37);
55 MUIMasterBase_instance.gfxbase = (void *)OpenLibrary("graphics.library", 37);
56 MUIMasterBase_instance.layersbase = OpenLibrary("layers.library", 37);
57 MUIMasterBase_instance.intuibase = (void *)OpenLibrary("intuition.library", 37);
58 MUIMasterBase_instance.cxbase = OpenLibrary("commodities.library",37);
59 MUIMasterBase_instance.keymapbase = OpenLibrary("keymap.library", 37);
60 MUIMasterBase_instance.gadtoolsbase = OpenLibrary("gadtools.library", 37);
61 MUIMasterBase_instance.iffparsebase = OpenLibrary("iffparse.library", 37);
62 MUIMasterBase_instance.diskfontbase = OpenLibrary("diskfont.library", 37);
63 __zune_prefs_init(&__zprefs);
64 InitSemaphore(&MUIMB(MUIMasterBase)->ZuneSemaphore);
65 return 1;
68 void close_muimaster(void)
72 #else
74 int open_muimaster(void)
76 if ((MUIMasterBase = OpenLibrary("muimaster.library", 0))) return 1;
77 return 0;
80 void close_muimaster(void)
82 if (MUIMasterBase) CloseLibrary(MUIMasterBase);
85 #endif
88 /****************************************************************
89 Open needed libraries
90 *****************************************************************/
91 int open_libs(void)
93 if (open_muimaster())
95 return 1;
98 return 0;
101 /****************************************************************
102 Close opened libraries
103 *****************************************************************/
104 void close_libs(void)
106 close_muimaster();
110 /****************************************************************
111 Create a simple label
112 *****************************************************************/
113 Object *MakeLabel(STRPTR str)
115 return (MUI_MakeObject(MUIO_Label, str, 0));
119 /****************************************************************
120 Easy getting an attributes value
121 *****************************************************************/
122 LONG xget(Object * obj, ULONG attr)
124 LONG x = 0;
125 get(obj, attr, &x);
126 return x;
130 #endif /* _ZUNE_MUISUPPORT_H */