grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / muimaster / test.c
blobb52271b259574c75a33faec917d8a0142f568d1d
1 /*
2 Copyright © 2002, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 #include <stdio.h>
9 #include <string.h>
11 #include <clib/alib_protos.h>
12 #include <intuition/gadgetclass.h>
13 #include <intuition/icclass.h>
14 #include <gadgets/colorwheel.h>
15 #include <libraries/asl.h>
16 #include <proto/exec.h>
17 #include <proto/intuition.h>
18 #include <proto/dos.h>
20 /* define this if this should be compiled with mui */
21 #ifdef COMPILE_WITH_MUI
23 #include <libraries/mui.h>
24 #include <proto/muimaster.h>
26 typedef unsigned long IPTR;
28 #else
30 /* the following should go in a single include file which then only
31 ** constits of the public constants and members. Actually this is easiey
34 #include "mui.h"
36 /* muimaster.library is not yet a library */
37 #include "muimaster_intern.h"
39 struct MUIMasterBase_intern MUIMasterBase_instance;
41 #endif
43 struct Library *MUIMasterBase;
44 struct Library *ColorWheelBase;
46 struct list_entry
48 char *column1;
49 char *column2;
52 Object *app;
54 Object *wheel;
55 Object *r_slider;
56 Object *g_slider;
57 Object *b_slider;
58 Object *hue_gauge;
59 Object *group;
60 Object *editor_text;
61 Object *filename_string;
62 Object *save_button;
63 Object *list2;
65 Object *drawer_iconlist;
66 Object *volume_iconlist;
68 __saveds void repeat_function(void)
70 printf("MUI_Timer\n");
73 __saveds void wheel_function(void)
75 nnset(r_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Red) >> 24) & 0xff);
76 nnset(g_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Green) >> 24) & 0xff);
77 nnset(b_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Blue) >> 24) & 0xff);
78 set(hue_gauge, MUIA_Gauge_Current, XGET(wheel,WHEEL_Hue));
81 __saveds void slider_function(void)
83 struct ColorWheelRGB cw;
84 ULONG red = XGET(r_slider,MUIA_Numeric_Value);
85 ULONG green = XGET(g_slider,MUIA_Numeric_Value);
86 ULONG blue = XGET(b_slider,MUIA_Numeric_Value);
88 cw.cw_Red = (red<<24)|(red<<16)|(red<<8)|red;
89 cw.cw_Green = (green<<24)|(green<<16)|(green<<8)|green;
90 cw.cw_Blue = (blue<<24)|(blue<<16)|(blue<<8)|blue;
92 nnset(wheel, WHEEL_RGB, &cw);
93 set(hue_gauge, MUIA_Gauge_Current, XGET(wheel,WHEEL_Hue));
96 __saveds void objects_function(void)
98 Object *new_obj = MUI_MakeObject(MUIO_Button,"Button");
99 if (new_obj)
101 DoMethod(group, MUIM_Group_InitChange);
102 DoMethod(group, OM_ADDMEMBER, new_obj);
103 DoMethod(group, MUIM_Group_ExitChange);
107 void about_function(void)
109 // MUI_Request(app,NULL,0,"Test", "*Ok|Cancel", "This is a test application of Zune, an OpenSource MUI clone",NULL);
111 static Object *about_wnd;
112 if (!about_wnd)
114 about_wnd = AboutmuiObject,
115 MUIA_Aboutmui_Application, app,
116 End;
119 if (about_wnd) set(about_wnd,MUIA_Window_Open,TRUE);
122 __saveds __asm void display_function(register __a0 struct Hook *h, register __a2 char **strings, register __a1 struct list_entry *entry)
124 static char buf[100];
125 if (entry)
127 sprintf(buf,"%ld",*(strings-1));
128 strings[0] = buf;
129 strings[1] = entry->column1;
130 strings[2] = entry->column2;
131 } else
133 strings[0] = "Number";
134 strings[1] = "Column 1";
135 strings[2] = "Column 2";
139 __saveds __asm void display2_function(register __a0 struct Hook *h, register __a2 char **strings, register __a1 struct list_entry *entry)
141 static char buf[100];
142 if (entry)
144 sprintf(buf,"line num: %ld id: %ld",*(strings-1),entry);
145 strings[0] = buf;
146 } else
148 strings[0] = "Number";
152 void save_function(void)
154 char *text = (char*)XGET(editor_text, MUIA_Text_Contents);
155 char *filename = (char*)XGET(filename_string, MUIA_String_Contents);
156 BPTR fh;
158 if (!strlen(filename)) return;
160 if ((fh = Open(filename,MODE_NEWFILE)))
162 Write(fh,text,strlen(text));
163 Close(fh);
167 static int id = 1;
169 void add_function(void)
171 DoMethod(list2,MUIM_List_InsertSingle, id++, MUIV_List_Insert_Bottom);
174 void add_child_function(void)
176 int act = XGET(list2,MUIA_List_Active);
178 #ifndef COMPILE_WITH_MUI
179 DoMethod(list2,MUIM_List_InsertSingleAsTree, id++, act /* parent */, MUIV_List_InsertSingleAsTree_Bottom, 0);
180 #endif
183 /* IconList callbacks */
184 void volume_doubleclicked(void)
186 #ifndef COMPILE_WITH_MUI
187 char buf[200];
188 struct IconList_Entry *ent = (void*)MUIV_IconList_NextSelected_Start;
189 DoMethod(volume_iconlist, MUIM_IconList_NextSelected, &ent);
190 if ((int)ent == MUIV_IconList_NextSelected_End) return;
192 strcpy(buf,ent->label);
193 strcat(buf,":");
194 set(drawer_iconlist,MUIA_IconDrawerList_Drawer,buf);
195 #endif
198 void drawer_doubleclicked(void)
200 #ifndef COMPILE_WITH_MUI
201 static char buf[1024];
202 struct IconList_Entry *ent = (void*)MUIV_IconList_NextSelected_Start;
204 DoMethod(drawer_iconlist, MUIM_IconList_NextSelected, &ent);
205 if ((int)ent == MUIV_IconList_NextSelected_End) return;
206 set(drawer_iconlist,MUIA_IconDrawerList_Drawer,ent->filename);
207 #endif
210 /* The custom class */
212 struct DropText_Data
214 ULONG times;
217 #ifdef __MAXON__
218 #undef KeymapBase
219 struct Library *KeymapBase;
220 #endif
222 #ifndef __AROS__
223 __saveds __asm IPTR dispatcher(register __a0 struct IClass *cl, register __a2 Object *obj, register __a1 Msg msg)
224 #else
225 AROS_UFH3S(IPTR, dispatcher,
226 AROS_UFHA(Class *, cl, A0),
227 AROS_UFHA(Object *, obj, A2),
228 AROS_UFHA(Msg , msg, A1))
229 #endif
231 switch (msg->MethodID)
233 case MUIM_DragQuery: return MUIV_DragQuery_Accept;
234 case MUIM_DragDrop:
236 struct DropText_Data *data = (struct DropText_Data*)INST_DATA(cl,obj);
237 char buf[100];
238 data->times++;
239 sprintf(buf,"%ld times",data->times); /* no MUIM_SetAsString yet */
240 set(obj,MUIA_Text_Contents,buf);
243 return DoSuperMethodA(cl,obj,(Msg)msg);
246 struct MUI_CustomClass *CL_DropText;
248 #ifdef __MAXON__
249 #define DropTextObject TextObject
250 #else
251 #define DropTextObject (Object*)NewObject(CL_DropText->mcc_Class, NULL
252 #endif
254 /* Main prog */
256 static struct Hook hook_standard;
258 __saveds static __asm void hook_func_standard(register __a0 struct Hook *h, register __a1 ULONG * funcptr)
260 void (*func) (ULONG *) = (void (*)(ULONG *)) (*funcptr);
261 // putreg(REG_A4,(long)h->h_Data);
263 if (func)
264 func(funcptr + 1);
266 void main(void)
268 Object *wnd,*second_wnd;
269 Object *open_button;
270 Object *quit_button;
271 Object *repeat_button;
272 Object *objects_button;
273 Object *about_item, *quit_item;
274 Object *context_menu;
275 Object *popobject, *listview;
276 Object *list_add_button, *list_add_child_button, *list_remove_button, *list_clear_button;
277 Object *country_radio[2];
278 Object *prop;
280 static char *pages[] = {"Groups","Colorwheel","Virtual Group","Edit","List","Gauges","Radio","IconList",NULL};
281 static char **radio_entries1 = pages;
282 static char *radio_entries2[] = {"Paris","Pataya","London","New-York","Reykjavik",NULL};
284 static struct list_entry entry1 = {"Testentry1","Col2: Entry1"};
285 static struct list_entry entry2 = {"Entry2","Col2: Entry2"};
286 static struct list_entry entry3 = {"Entry3","Col2: Entry3"};
287 static struct list_entry entry4 = {"Entry4","Col2: Entry4"};
288 static struct list_entry entry5 = {"Entry5","Col2: Entry5"};
289 static struct list_entry entry6 = {"Entry6","Col2: Entry6"};
291 static struct list_entry *entries[] =
292 {&entry1,&entry2,&entry3,&entry4,&entry5,&entry6,NULL};
294 struct Hook hook;
295 struct Hook hook_wheel;
296 struct Hook hook_slider;
297 struct Hook hook_objects;
298 struct Hook hook_display;
299 struct Hook hook_display2;
301 hook_standard.h_Entry = (HOOKFUNC)hook_func_standard;
302 // hook_standard.h_Data = (void*)getreg(REG_A4);
304 #ifndef COMPILE_WITH_MUI
305 MUIMasterBase = (struct Library*)&MUIMasterBase_instance;
307 MUIMasterBase_instance.sysbase = *((struct ExecBase **)4);
308 MUIMasterBase_instance.dosbase = (APTR)OpenLibrary("dos.library",37);
309 MUIMasterBase_instance.utilitybase = (APTR)OpenLibrary("utility.library",37);
310 MUIMasterBase_instance.aslbase = OpenLibrary("asl.library",37);
311 MUIMasterBase_instance.gfxbase = (APTR)OpenLibrary("graphics.library",37);
312 MUIMasterBase_instance.layersbase = OpenLibrary("layers.library",37);
313 MUIMasterBase_instance.intuibase = (APTR)OpenLibrary("intuition.library",37);
314 MUIMasterBase_instance.cxbase = OpenLibrary("commodities.library",37);
315 MUIMasterBase_instance.keymapbase = OpenLibrary("keymap.library",37);
316 MUIMasterBase_instance.gadtoolsbase = OpenLibrary("gadtools.library",37);
317 MUIMasterBase_instance.iffparsebase = OpenLibrary("iffparse.library",37);
318 MUIMasterBase_instance.diskfontbase = OpenLibrary("diskfont.library",37);
319 MUIMasterBase_instance.iconbase = OpenLibrary("icon.library",44);
320 MUIMasterBase_instance.cybergfxbase = OpenLibrary("cybergraphics.library", 0);
321 InitSemaphore(&MUIMasterBase_instance.ZuneSemaphore);
323 #ifdef __MAXON__
324 KeymapBase = MUIMasterBase_instance.keymapbase;
325 #endif
326 #else
327 MUIMasterBase = (struct Library*)OpenLibrary("muimaster.library",0);
328 #endif
330 hook.h_Entry = (HOOKFUNC)repeat_function;
331 hook_wheel.h_Entry = (HOOKFUNC)wheel_function;
332 hook_slider.h_Entry = (HOOKFUNC)slider_function;
333 hook_objects.h_Entry = (HOOKFUNC)objects_function;
334 hook_display.h_Entry = (HOOKFUNC)display_function;
335 hook_display2.h_Entry = (HOOKFUNC)display2_function;
337 context_menu = MenustripObject,
338 MUIA_Family_Child, MenuObject,
339 MUIA_Menu_Title, "Menutest",
340 MUIA_Family_Child, about_item = MenuitemObject, MUIA_Menuitem_Title, "First Test Entry", End,
341 MUIA_Family_Child, quit_item = MenuitemObject, MUIA_Menuitem_Title, "Second Test Entry", End,
342 End,
343 End;
345 /* should check the result in a real program! */
346 CL_DropText = MUI_CreateCustomClass(NULL,MUIC_Text,NULL,sizeof(struct DropText_Data), dispatcher);
347 ColorWheelBase = OpenLibrary("gadgets/colorwheel.gadget",0);
349 app = ApplicationObject,
350 MUIA_Application_Menustrip, MenustripObject,
351 MUIA_Family_Child, MenuObject,
352 MUIA_Menu_Title, "Project",
353 MUIA_Family_Child, about_item = MenuitemObject, MUIA_Menuitem_Title, "About...", MUIA_Menuitem_Shortcut, "?", End,
354 MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title, ~0, End,
355 MUIA_Family_Child, quit_item = MenuitemObject, MUIA_Menuitem_Title, "Quit", MUIA_Menuitem_Shortcut, "Q", End,
356 End,
357 End,
358 SubWindow, wnd = WindowObject,
359 MUIA_Window_Title, "test",
360 MUIA_Window_Activate, TRUE,
362 MUIA_Window_UseRightBorderScroller, TRUE,
364 WindowContents, VGroup,
365 Child, TextObject, MUIA_Background, "2:cfffffff,cfffffff,10000000", TextFrame, MUIA_Text_Contents, "\33cHello World!!\nThis is a text object\n\33lLeft \33bbold\33n\n\33rRight",End,
366 Child, popobject = PopobjectObject,
367 MUIA_Popstring_String, MUI_MakeObject(MUIO_String, NULL, 200),
368 MUIA_Popstring_Button, PopButton(MUII_PopUp),
369 MUIA_Popobject_Object, VGroup,
370 Child, TextObject,MUIA_Text_Contents,"test",End,
371 Child, listview = ListviewObject,
372 MUIA_Listview_List, ListObject,
373 InputListFrame,
374 MUIA_List_DisplayHook, &hook_display,
375 MUIA_List_Format, ",,",
376 MUIA_List_SourceArray, entries,
377 MUIA_List_Title, TRUE,
378 End,
379 End,
380 End,
381 End,
382 Child, RegisterObject,
383 MUIA_Register_Titles, pages,
384 MUIA_Register_Columns, 3,
386 // MUIA_Background, "5:SYS:Prefs/Presets/Backdrops/StuccoBlue.pic",
387 Child, HGroup,
388 GroupFrameT("A horizontal group"),
389 Child, ColGroup(2),
390 GroupFrameT("A column group"),
391 Child, repeat_button = TextObject, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Repeat", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
392 Child, TextObject, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Drag Me", MUIA_Draggable, TRUE, MUIA_InputMode, MUIV_InputMode_RelVerify, End,
393 Child, open_button = TextObject, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Open Window", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
394 Child, TextObject, MUIA_ContextMenu, context_menu, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Press Right", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
395 Child, objects_button = TextObject, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Add Objects", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
396 Child, TextObject, MUIA_Disabled, 1, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Button6", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
397 Child, MUI_MakeObject(MUIO_Label,"_Checkmark",0),
398 Child, MUI_MakeObject(MUIO_Checkmark,"_Checkmark"),
399 End,
400 Child, group = VGroup,
401 GroupFrameT("A vertical group"),
402 Child, DropTextObject, MUIA_Dropable, TRUE, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Drop Here", MUIA_Dropable, TRUE, MUIA_InputMode, MUIV_InputMode_RelVerify, End,
403 Child, TextObject, TextFrame, MUIA_Background, MUII_MARKHALFSHINE, MUIA_CycleChain, 1, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Pattern", End,
404 End,
405 Child, MUI_NewObject(MUIC_Popimage, TAG_DONE),
406 End,
408 Child, VGroup,
409 Child, wheel = BoopsiObject, /* MUI and Boopsi tags mixed */
410 GroupFrame,
411 MUIA_Boopsi_ClassID , "colorwheel.gadget",
412 MUIA_Boopsi_MinWidth , 30, /* boopsi objects don't know */
413 MUIA_Boopsi_MinHeight, 30, /* their sizes, so we help */
414 MUIA_Boopsi_Remember , WHEEL_Saturation, /* keep important values */
415 MUIA_Boopsi_Remember , WHEEL_Hue, /* during window resize */
416 MUIA_Boopsi_TagScreen, WHEEL_Screen, /* this magic fills in */
417 WHEEL_Screen , NULL, /* the screen pointer */
418 GA_Left , 0,
419 GA_Top , 0, /* MUI will automatically */
420 GA_Width , 0, /* fill in the correct values */
421 GA_Height , 0,
422 ICA_TARGET , ICTARGET_IDCMP, /* needed for notification */
423 WHEEL_Saturation, 0, /* start in the center */
424 MUIA_FillArea, TRUE, /* use this because it defaults to FALSE
425 for boopsi gadgets but the colorwheel
426 doesnt bother about redrawing its backgorund */
427 End,
429 Child, r_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
430 Child, g_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
431 Child, b_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
433 Child, hue_gauge = GaugeObject, MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Max, 255, MUIA_Gauge_Divide, 1<<24, MUIA_Gauge_InfoText, "Hue: %ld",End,
434 End,
436 #if 0
437 Child, ScrollgroupObject,
438     MUIA_Scrollgroup_Contents, HGroupV,
439 Child, VGroup,
440     Child, TextObject,
441 TextFrame,
442 MUIA_Text_Contents,
443 "Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7\nLine8\n\n\n\nLine9\nLine10\nLine11\n",
444 End,
445     Child, HGroup,
446 Child, MUI_MakeObject(MUIO_Button,"Button9"),
447 Child, MUI_MakeObject(MUIO_Button,"Button10"),
448 Child, MUI_MakeObject(MUIO_Button,"Button11"),
449 Child, MUI_MakeObject(MUIO_Button,"Button12"),
450 Child, MUI_MakeObject(MUIO_Button,"Button13"),
451 End,
452     End,
453 Child, VGroup,
454     Child, SimpleButton("blabla"),
455     Child, SimpleButton("blabla"),
456     Child, SimpleButton("blabla"),
457     Child, SimpleButton("blabla"),
458     Child, SimpleButton("blabla"),
459     Child, SimpleButton("blabla"),
460     End,
462 Child, ScrollgroupObject, MUIA_Scrollgroup_Contents, VGroupV,
463     GroupFrameT("virtvir"),
464     Child, SimpleButton("eins"),
465     Child, SimpleButton("zwei"),
466     Child, SimpleButton("drei"),
467     Child, SimpleButton("vier"),
468     Child, SimpleButton("eins"),
469     Child, SimpleButton("zwei"),
470     Child, SimpleButton("drei"),
471     Child, SimpleButton("vier"),
472     Child, SimpleButton("eins"),
473     Child, SimpleButton("zwei"),
474     Child, SimpleButton("drei"),
475     Child, SimpleButton("vier"),
476     Child, SimpleButton("eins"),
477     Child, SimpleButton("zwei"),
478     Child, SimpleButton("drei"),
479     Child, SimpleButton("vier"),
480     End,
481 End,
482 End,
483     End,
484 #else
486 Child, ScrollgroupObject,
487 MUIA_Scrollgroup_Contents, HGroupV,
488 VirtualFrame,
489 Child, TextObject,
490 TextFrame,
491 MUIA_Text_Contents, "Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7\nLine8\n\n\n\nLine9\nLine10\nLine11\n",
492 End,
493 Child, HGroup,
494 Child, MUI_MakeObject(MUIO_Button,"Button9"),
495 Child, MUI_MakeObject(MUIO_Button,"Button10"),
496 End,
497 Child, HGroup,
498 Child, MUI_MakeObject(MUIO_Button,"Button9"),
499 Child, MUI_MakeObject(MUIO_Button,"Button10"),
500 End,
501 Child, HGroup,
502 Child, MUI_MakeObject(MUIO_Button,"Button9"),
503 Child, MUI_MakeObject(MUIO_Button,"Button10"),
504 End,
505 End,
506 End,
507 Child, VGroup,
508 Child, editor_text = TextObject,
509 StringFrame,
510 #ifndef COMPILE_WITH_MUI
511 #if 0
512 MUIA_Text_Editable, TRUE,
513 MUIA_Text_Multiline, TRUE,
514 #endif
515 #endif
516 End,
517 Child, PopaslObject,
518 ASLFR_DoSaveMode, TRUE,
519 MUIA_Popstring_String, filename_string = MUI_MakeObject(MUIO_String, NULL, 200),
520 MUIA_Popstring_Button, PopButton(MUII_PopFile),
521 End,
522 Child, save_button = MUI_MakeObject(MUIO_Button, "Save"),
523 End,
524 Child, VGroup,
525 Child, ListviewObject,
526 MUIA_Listview_List, list2 = ListObject,
527 InputListFrame,
528 MUIA_List_DisplayHook, &hook_display2,
529 End,
530 End,
531 Child, HGroup,
532 Child, list_add_button = MUI_MakeObject(MUIO_Button,"_Add"),
533 Child, list_add_child_button = MUI_MakeObject(MUIO_Button,"_Add Child"),
534 Child, list_remove_button = MUI_MakeObject(MUIO_Button,"_Remove"),
535 Child, list_clear_button = MUI_MakeObject(MUIO_Button,"_Clear"),
536 End,
537 End,
539 /* gauges */
540 Child, HGroup,
541 Child, VGroup,
542 Child, VGroup, GroupFrame,
543 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 25, End,
544 Child, ScaleObject, End,
545 End,
546 Child, VGroup, GroupFrame,
547 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 50, End,
548 Child, ScaleObject, End,
549 End,
550 Child, VGroup, GroupFrame,
551 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 75, End,
552 Child, ScaleObject, End,
553 End,
554 End,
555 Child, HGroup,
556 Child, HVSpace,
557 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 25, End,
558 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 50, End,
559 Child, GaugeObject, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 75, End,
560 Child, HVSpace,
561 End,
562 End,
563 /* radios */
564 Child, HGroup,
565 Child, VGroup,
566 Child, RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries1, End,
567 Child, country_radio[0] = RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries2, MUIA_Radio_Active, 1, End,
568 End,
569 Child, HGroup,
570 Child, RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries1, End,
571 Child, country_radio[1] = RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries2, MUIA_Radio_Active, 1, End,
572 End,
573 End,
575 /* iconlist */
576 #ifndef COMPILE_WITH_MUI
578 Child, HGroup,
579 Child, volume_iconlist = MUI_NewObject(MUIC_IconVolumeList, GroupFrame, TAG_DONE),
580 Child, drawer_iconlist = MUI_NewObject(MUIC_IconDrawerList, GroupFrame, MUIA_IconDrawerList_Drawer,"SYS:",TAG_DONE),
581 End,
582 #else
583 Child, HGroup,
584 TAG_IGNORE,volume_iconlist = drawer_iconlist = NULL,
585 Child, HVSpace,
586 End,
587 #endif
589 End,
591 #endif
592 Child, RectangleObject,
593 MUIA_VertWeight,0, /* Seems to be not supported properly as orginal MUI doesn't allow to alter the height of the window */
594 MUIA_Rectangle_HBar, TRUE,
595 MUIA_Rectangle_BarTitle,"Enter an integer",
596 End,
598 Child, CycleObject,
599 ButtonFrame,
600 MUIA_Cycle_Entries, pages,
601 End,
603 Child, StringObject,
604 StringFrame,
605 MUIA_CycleChain,1,
606 MUIA_String_AdvanceOnCR, TRUE,
607 MUIA_String_Accept, "0123456789",
608 End,
610 Child, prop = ScrollbarObject,
611 MUIA_Group_Horiz, TRUE,
612 MUIA_Prop_Visible, 100,
613 MUIA_Prop_Entries, 300,
614 MUIA_Prop_First, 50,
615 MUIA_Prop_UseWinBorder, MUIV_Prop_UseWinBorder_Right,
616 End,
618 Child, HGroup,
619 Child, quit_button = TextObject,
620 ButtonFrame,
621 MUIA_InputMode, MUIV_InputMode_RelVerify,
622 MUIA_CycleChain, 1,
623 MUIA_Background, MUII_ButtonBack,
624 MUIA_ControlChar, 'q',
625 MUIA_Text_HiChar, 'q',
626 MUIA_Text_PreParse, "\33c",
627 MUIA_Text_Contents, "Quit",
628 End,
629 End,
630 End,
631 End,
632 SubWindow, second_wnd = WindowObject,
633 MUIA_Window_Title, "Second window",
635 WindowContents, VGroup,
636 Child, DropTextObject, MUIA_Text_Contents, "Drop here", MUIA_Dropable, TRUE, End,
637 End,
638 End,
639 End;
641 if (app)
643 ULONG sigs = 0;
645 DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
646 DoMethod(second_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, second_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
647 DoMethod(open_button, MUIM_Notify, MUIA_Pressed, FALSE, second_wnd, 3, MUIM_Set, MUIA_Window_Open, TRUE);
648 DoMethod(quit_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
649 DoMethod(objects_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_CallHook, &hook_objects);
650 DoMethod(repeat_button, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook);
651 DoMethod(prop, MUIM_Notify, MUIA_Prop_First, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook);
653 DoMethod(wheel, MUIM_Notify,WHEEL_Hue , MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_wheel);
654 DoMethod(wheel, MUIM_Notify,WHEEL_Saturation, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_wheel);
655 DoMethod(r_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
656 DoMethod(g_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
657 DoMethod(b_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
659 DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, save_function);
661 DoMethod(quit_item, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
662 DoMethod(about_item, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, app, 3, MUIM_CallHook, &hook_standard, about_function);
664 DoMethod(listview, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE, popobject, 2, MUIM_Popstring_Close, TRUE);
666 /* The callbacks of the buttons within the list page */
667 DoMethod(list_add_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, add_function);
668 DoMethod(list_add_child_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, add_child_function);
669 DoMethod(list_remove_button, MUIM_Notify, MUIA_Pressed, FALSE, list2, 2, MUIM_List_Remove, MUIV_List_Remove_Active);
670 DoMethod(list_clear_button, MUIM_Notify, MUIA_Pressed, FALSE, list2, 1, MUIM_List_Clear);
672 /* radio */
673 DoMethod(country_radio[0], MUIM_Notify, MUIA_Radio_Active, MUIV_EveryTime, country_radio[1], 3, MUIM_NoNotifySet, MUIA_Radio_Active, MUIV_TriggerValue);
674 DoMethod(country_radio[1], MUIM_Notify, MUIA_Radio_Active, MUIV_EveryTime, country_radio[0], 3, MUIM_NoNotifySet, MUIA_Radio_Active, MUIV_TriggerValue);
676 /* iconlist */
677 #ifndef COMPILE_WITH_MUI
678 DoMethod(volume_iconlist, MUIM_Notify, MUIA_IconList_DoubleClick, TRUE, volume_iconlist, 3, MUIM_CallHook, &hook_standard, volume_doubleclicked);
679 DoMethod(drawer_iconlist, MUIM_Notify, MUIA_IconList_DoubleClick, TRUE, drawer_iconlist, 3, MUIM_CallHook, &hook_standard, drawer_doubleclicked);
680 #endif
682 set(wnd,MUIA_Window_Open,TRUE);
684 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
686 if (sigs)
688 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
689 if (sigs & SIGBREAKF_CTRL_C) break;
690 if (sigs & SIGBREAKF_CTRL_D) break;
694 MUI_DisposeObject(app);
696 if (context_menu) MUI_DisposeObject(context_menu);
697 CloseLibrary(ColorWheelBase);
698 MUI_DeleteCustomClass(CL_DropText);
700 #ifdef COMPILE_WITH_MUI
701 CloseLibrary(MUIMasterBase);
702 #endif
705 // ---- old test -------
707 #if 0
708 __asm __saveds void hook_function(register __a1 int *pval)
710 printf("get notification of the userdata: %ld\n",*pval);
713 void main(void)
715 struct Hook hook;
716 Object *notify;
718 MUIMasterBase = (struct Library*)&MUIMasterBase_instance;
720 MUIMasterBase_instance.sysbase = *((struct ExecBase **)4);
721 MUIMasterBase_instance.utilitybase = OpenLibrary("utility.library",37);
723 printf("Creating object\n");
724 notify = MUI_NewObjectA(MUIC_Notify, NULL);
726 if (notify)
728 LONG ud;
729 printf("Object created at 0x%lx. Now setting MUIA_UserData to 10\n",notify);
730 set(notify, MUIA_UserData, 10);
731 get(notify, MUIA_UserData, &ud);
732 printf("UserData is now %ld\n",ud);
734 printf("Create a notify for the MUIA_UserData tag\n");
735 hook.h_Entry = (HOOKFUNC)hook_function;
736 DoMethod(notify, MUIM_Notify, MUIA_UserData, MUIV_EveryTime, notify, 3, MUIM_CallHook, &hook, MUIV_TriggerValue);
737 printf("Setting User Data to 20\n");
738 set(notify, MUIA_UserData, 20);
739 printf("Done. Now disposing object\n");
741 MUI_DisposeObject(notify);
745 #endif