2 Copyright © 1999, David Le Corfec.
3 Copyright © 2002-2003, The AROS Development Team.
9 #define MUIMASTER_NO_INLINE_STDARG
11 #include <exec/types.h>
14 //#include <libraries/mui.h>
15 #include <proto/exec.h>
16 #include <proto/intuition.h>
17 #include <proto/muimaster.h>
19 #include <libraries/mui.h>
22 #include <clib/alib_protos.h>
24 #include <aros/debug.h>
26 struct Library
*MUIMasterBase
;
28 #define _U(s) ((IPTR)(s))
32 #include <mui.h> /* Should be somewhen libraries/mui.h */
35 /* On AmigaOS we build a fake library base, because it's not compiled as sharedlibrary yet */
36 #include "muimaster_intern.h"
38 int openmuimaster(void)
40 static struct MUIMasterBase_intern MUIMasterBase_instance
;
41 MUIMasterBase
= (struct Library
*)&MUIMasterBase_instance
;
43 MUIMasterBase_instance
.sysbase
= *((struct ExecBase
**)4);
44 MUIMasterBase_instance
.dosbase
= OpenLibrary("dos.library",37);
45 MUIMasterBase_instance
.utilitybase
= OpenLibrary("utility.library",37);
46 MUIMasterBase_instance
.aslbase
= OpenLibrary("asl.library",37);
47 MUIMasterBase_instance
.gfxbase
= OpenLibrary("graphics.library",37);
48 MUIMasterBase_instance
.layersbase
= OpenLibrary("layers.library",37);
49 MUIMasterBase_instance
.intuibase
= OpenLibrary("intuition.library",37);
50 MUIMasterBase_instance
.cxbase
= OpenLibrary("commodities.library",37);
51 MUIMasterBase_instance
.keymapbase
= OpenLibrary("keymap.library",37);
52 __zune_prefs_init(&__zprefs
);
57 void closemuimaster(void)
63 int openmuimaster(void)
65 if ((MUIMasterBase
= OpenLibrary("muimaster.library", 0))) return 1;
69 void closemuimaster(void)
71 if (MUIMasterBase
) CloseLibrary(MUIMasterBase
);
76 Object
*SimpleChainedButton (STRPTR label
)
80 obj
= MUI_MakeObject(MUIO_Button
,label
);
81 set(obj
, MUIA_CycleChain
, TRUE
);
85 Object
*ChainedCheckmark (STRPTR label
)
89 obj
= MUI_MakeObject(MUIO_Checkmark
, _U(label
));
90 set(obj
, MUIA_CycleChain
, TRUE
);
94 int main (int argc
, char **argv
)
102 if (!(openmuimaster())) return 20;
104 app
= ApplicationObject
,
105 SubWindow
, mainWin
= WindowObject
,
106 MUIA_Window_Title
, (IPTR
)"Input modes",
107 WindowContents
, VGroup
,
108 Child
, MUI_MakeObject(MUIO_BarTitle
, (IPTR
)_U("MUIV_InputMode_RelVerify")),
109 Child
, SimpleChainedButton("Hello world, \33u\33iyo\n"
110 "\33l\33iHello \33bworld\33n, yo\n"
111 "\33iHello world, yo\n"
112 "_Hello \33uwo\0331r\33bl\33n\33ud\33n, \33iyo\n"
113 "\33cI \33ilove MUI\n"
114 "HelloH \33b\33ihello\33nH"),
115 Child
, MUI_MakeObject(MUIO_BarTitle
, (IPTR
)_U("MUIV_InputMode_Toggle")),
118 MUIA_Frame
, MUIV_Frame_Group
,
119 MUIA_FrameTitle
, (IPTR
)"The quick brown fox jumps over the lazy dog",
120 MUIA_Background
, MUII_GroupBack
,
121 Child
, ChainedCheckmark("My first checkmark"),
123 Child
, MUI_MakeObject(MUIO_BarTitle
, (IPTR
)_U("MUIV_InputMode_Immediate")),
125 MUIA_Frame
, MUIV_Frame_Group
,
126 MUIA_FrameTitle
, (IPTR
)"Radio",
128 Child
, radio1
= RectangleObject
,
129 MUIA_CycleChain
, TRUE
,
130 MUIA_ControlChar
, 'i',
131 MUIA_InputMode
, MUIV_InputMode_Immediate
,
132 MUIA_Background
, MUII_ButtonBack
,
133 MUIA_Frame
, MUIV_Frame_Button
,
135 Child
, radio2
= RectangleObject
,
136 MUIA_CycleChain
, TRUE
,
137 MUIA_ControlChar
, 'o',
138 MUIA_InputMode
, MUIV_InputMode_Immediate
,
139 MUIA_Background
, MUII_ButtonBack
,
140 MUIA_Frame
, MUIV_Frame_Button
,
149 kprintf("can't create application object.\n");
154 kprintf("*** MUIM_Notify on MUIA_Window_CloseRequest...\n");
155 DoMethod(mainWin
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
156 _U(app
), 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
158 kprintf("*** set up radio1...\n");
159 set(radio1
, MUIA_Selected
, TRUE
);
160 DoMethod(radio1
, MUIM_Notify
, MUIA_Selected
, TRUE
,
161 _U(radio2
), 3, MUIM_Set
, MUIA_Selected
, FALSE
);
162 DoMethod(radio2
, MUIM_Notify
, MUIA_Selected
, TRUE
,
163 _U(radio1
), 3, MUIM_Set
, MUIA_Selected
, FALSE
);
166 * Open window and ALWAYS check.
168 kprintf("*** open window...\n");
169 set(mainWin
, MUIA_Window_Open
, TRUE
);
170 if (!XGET(mainWin
, MUIA_Window_Open
))
172 MUI_DisposeObject(app
);
173 kprintf("%s : can't open main window.\n", argv
[0]);
181 kprintf("*** main loop...\n");
182 while (DoMethod(app
, MUIM_Application_NewInput
, _U(&sigs
))
183 != MUIV_Application_ReturnID_Quit
)
187 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
188 if (sigs
& SIGBREAKF_CTRL_C
) break;
193 kprintf("*** close window...\n");
194 set(mainWin
, MUIA_Window_Open
, FALSE
);
195 kprintf("*** dispose app...\n");
196 MUI_DisposeObject(app
);