define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / workbench / demos / Zune / mui_slider.c
blobac81428beacba054e2134b6d8b215239416adf47
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>
10 #include <dos/dos.h>
12 //#include <libraries/mui.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 <clib/alib_protos.h>
20 #include <stdio.h>
22 struct Library *MUIMasterBase;
24 #ifndef __AROS__
26 #include <mui.h>
27 #undef SysBase
29 /* On AmigaOS we build a fake library base, because it's not compiled as sharedlibrary yet */
30 #include "muimaster_intern.h"
32 int openmuimaster(void)
34 static struct MUIMasterBase_intern MUIMasterBase_instance;
35 MUIMasterBase = (struct Library*)&MUIMasterBase_instance;
37 MUIMasterBase_instance.sysbase = *((struct ExecBase **)4);
38 MUIMasterBase_instance.dosbase = OpenLibrary("dos.library",37);
39 MUIMasterBase_instance.utilitybase = OpenLibrary("utility.library",37);
40 MUIMasterBase_instance.aslbase = OpenLibrary("asl.library",37);
41 MUIMasterBase_instance.gfxbase = OpenLibrary("graphics.library",37);
42 MUIMasterBase_instance.layersbase = OpenLibrary("layers.library",37);
43 MUIMasterBase_instance.intuibase = OpenLibrary("intuition.library",37);
44 MUIMasterBase_instance.cxbase = OpenLibrary("commodities.library",37);
45 MUIMasterBase_instance.keymapbase = OpenLibrary("keymap.library",37);
46 __zune_prefs_init(&__zprefs);
48 return 1;
51 void closemuimaster(void)
55 #else
57 int openmuimaster(void)
59 if ((MUIMasterBase = OpenLibrary("muimaster.library", 0))) return 1;
60 return 0;
63 void closemuimaster(void)
65 if (MUIMasterBase) CloseLibrary(MUIMasterBase);
68 #endif
70 int main (int argc, char **argv)
72 Object *app;
73 Object *mainWin;
75 if (!openmuimaster()) return 20;
77 app = ApplicationObject,
78 SubWindow, mainWin = WindowObject,
79 MUIA_Window_Title, "Input modes",
80 WindowContents, VGroup,
81 Child, SliderObject,
82 MUIA_Numeric_Value, 50,
83 End,
84 End,
85 End,
86 End;
88 if (!app)
90 fprintf(stderr, "can't create application object.\n");
91 goto error;
94 DoMethod(mainWin, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
95 (IPTR)app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
97 set(mainWin, MUIA_Window_Open, TRUE);
98 if (!XGET(mainWin, MUIA_Window_Open))
100 MUI_DisposeObject(app);
101 fprintf(stderr, "%s : can't open main window.\n", argv[0]);
102 goto error;
106 ULONG sigs = 0;
108 while (DoMethod(app, MUIM_Application_NewInput, (IPTR)&sigs)
109 != MUIV_Application_ReturnID_Quit)
111 if (sigs)
113 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
114 if (sigs & SIGBREAKF_CTRL_C) break;
119 set(mainWin, MUIA_Window_Open, FALSE);
120 MUI_DisposeObject(app);
122 error:
123 closemuimaster();
125 return 0;