grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / demos / Zune / mui_notify1.c
blobaa52194074f6970fb68de5e9b471756ac19ccdaa
1 /*
2 Copyright © 1999, David Le Corfec.
3 Copyright © 2002, The AROS Development Team.
4 All rights reserved.
6 $Id$
7 */
9 #include <exec/types.h>
11 //#include <libraries/mui.h>
12 #include <clib/alib_protos.h>
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
16 #ifdef __AROS__
17 #include <libraries/mui.h>
18 #endif
19 #include <stdio.h>
21 struct Library *MUIMasterBase;
23 #ifndef __AROS__
25 #include <mui.h>
26 #undef SysBase
28 /* On AmigaOS we build a fake library base, because it's not compiled as sharedlibrary yet */
29 #include "muimaster_intern.h"
31 int openmuimaster(void)
33 static struct MUIMasterBase_intern MUIMasterBase_instance;
34 MUIMasterBase = (struct Library*)&MUIMasterBase_instance;
36 MUIMasterBase_instance.sysbase = *((struct ExecBase **)4);
37 MUIMasterBase_instance.dosbase = OpenLibrary("dos.library",37);
38 MUIMasterBase_instance.utilitybase = OpenLibrary("utility.library",37);
39 MUIMasterBase_instance.aslbase = OpenLibrary("asl.library",37);
40 MUIMasterBase_instance.gfxbase = OpenLibrary("graphics.library",37);
41 MUIMasterBase_instance.layersbase = OpenLibrary("layers.library",37);
42 MUIMasterBase_instance.intuibase = OpenLibrary("intuition.library",37);
43 MUIMasterBase_instance.cxbase = OpenLibrary("commodities.library",37);
44 MUIMasterBase_instance.keymapbase = OpenLibrary("keymap.library",37);
45 __zune_prefs_init(&__zprefs);
47 return 1;
50 void closemuimaster(void)
54 #else
56 int openmuimaster(void)
58 if ((MUIMasterBase = OpenLibrary("muimaster.library", 0))) return 1;
59 return 0;
62 void closemuimaster(void)
64 if (MUIMasterBase) CloseLibrary(MUIMasterBase);
67 #endif
69 int main (void)
71 Object *obj;
72 ULONG val = 0;
74 if (!openmuimaster()) return 20;
76 obj = MUI_NewObjectA(MUIC_Notify, NULL);
77 printf("new Notify object = %p\n", obj);
78 if (obj != NULL)
80 set(obj, MUIA_UserData, 21);
81 get(obj, MUIA_UserData, &val);
82 printf("object UserData = %ld (should be 21)\n", (long)val);
84 DoMethod(obj, MUIM_Notify, MUIA_UserData, MUIV_EveryTime, MUIV_Notify_Self,
85 3, MUIM_Set, MUIA_ObjectID, 19);
86 printf("MUIM_Notify OK\n");
88 set(obj, MUIA_ObjectID, 12);
89 get(obj, MUIA_ObjectID, &val);
90 printf("id = %ld (should be 12)\n", (long)val);
92 set(obj, MUIA_UserData, 22);
93 get(obj, MUIA_ObjectID, &val);
94 printf("id = %ld (should be 19) after notification\n", (long)val);
96 set(obj, MUIA_ObjectID, 14);
97 set(obj, MUIA_UserData, 22);
98 get(obj, MUIA_ObjectID, &val);
99 printf("id = %ld (should be 14) after notification\n", (long)val);
101 MUI_DisposeObject(obj);
104 closemuimaster();
106 return 0;