r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / test / Zune / test.c
blob4c41d66554677b23688f5aa2acb3498695eee7f8
1 /*
2 Copyright © 2002, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 #define INTUITION_NO_INLINE_STDARG
10 #include <exec/types.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <string.h>
15 #include <clib/alib_protos.h>
16 #include <intuition/gadgetclass.h>
17 #include <intuition/icclass.h>
18 #include <libraries/asl.h>
19 #include <gadgets/colorwheel.h>
20 #include <proto/exec.h>
21 #include <proto/intuition.h>
22 #include <proto/dos.h>
23 #include <proto/muimaster.h>
24 #include <proto/graphics.h>
25 #include <aros/debug.h>
27 /* the following should go in a single include file which then only
28 ** constits of the public constants and members. Actually this is easiey
31 #include <libraries/mui.h>
33 struct Library *MUIMasterBase;
34 struct Library *ColorWheelBase;
36 struct list_entry
38 char *column1;
39 char *column2;
42 Object *app;
44 Object *wheel;
45 Object *r_slider;
46 Object *g_slider;
47 Object *b_slider;
48 Object *hue_gauge;
49 Object *group;
50 Object *editor_text;
51 Object *filename_string;
52 Object *save_button;
53 Object *list2;
55 Object *drawer_iconlist;
56 Object *volume_iconlist;
58 AROS_UFH0(void, repeat_function)
60 AROS_USERFUNC_INIT
62 printf("MUI_Timer\n");
64 AROS_USERFUNC_EXIT
67 AROS_UFH0(void, wheel_function)
69 AROS_USERFUNC_INIT
71 nnset(r_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Red) >> 24) & 0xff);
72 nnset(g_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Green) >> 24) & 0xff);
73 nnset(b_slider,MUIA_Numeric_Value, (XGET(wheel,WHEEL_Blue) >> 24) & 0xff);
75 AROS_USERFUNC_EXIT
78 AROS_UFH0(void, slider_function)
80 AROS_USERFUNC_INIT
82 struct ColorWheelRGB cw;
83 ULONG red = XGET(r_slider,MUIA_Numeric_Value);
84 ULONG green = XGET(g_slider,MUIA_Numeric_Value);
85 ULONG blue = XGET(b_slider,MUIA_Numeric_Value);
87 cw.cw_Red = (red<<24)|(red<<16)|(red<<8)|red;
88 cw.cw_Green = (green<<24)|(green<<16)|(green<<8)|green;
89 cw.cw_Blue = (blue<<24)|(blue<<16)|(blue<<8)|blue;
91 nnset(wheel, WHEEL_RGB, &cw);
92 set(hue_gauge, MUIA_Gauge_Current, XGET(wheel,WHEEL_Hue));
94 AROS_USERFUNC_EXIT
97 AROS_UFH0(void, objects_function)
99 AROS_USERFUNC_INIT
101 Object *new_obj = MUI_MakeObject(MUIO_Button,"Button");
102 if (new_obj)
104 DoMethod(group, MUIM_Group_InitChange);
105 DoMethod(group, OM_ADDMEMBER, new_obj);
106 DoMethod(group, MUIM_Group_ExitChange);
109 AROS_USERFUNC_EXIT
112 AROS_UFH0(void, about_function)
114 AROS_USERFUNC_INIT
116 static Object *about_wnd;
117 if (!about_wnd)
119 about_wnd = AboutmuiObject,
120 MUIA_Aboutmui_Application, app,
121 End;
124 if (about_wnd) set(about_wnd,MUIA_Window_Open,TRUE);
126 AROS_USERFUNC_EXIT
129 AROS_UFH3(void, display_function,
130 AROS_UFHA(struct Hook *, h, A0),
131 AROS_UFHA(char **, strings, A2),
132 AROS_UFHA(struct list_entry *, entry, A1))
134 AROS_USERFUNC_INIT
136 static char buf[100];
137 if (entry)
139 sprintf(buf,"%ld", (LONG) *(strings-1));
140 strings[0] = buf;
141 strings[1] = entry->column1;
142 strings[2] = entry->column2;
143 } else
145 strings[0] = "Number";
146 strings[1] = "Column 1";
147 strings[2] = "Column 2";
150 AROS_USERFUNC_EXIT
153 AROS_UFH3(void, display2_function,
154 AROS_UFHA(struct Hook *, h, A0),
155 AROS_UFHA(char **, strings, A2),
156 AROS_UFHA(struct list_entry *, entry, A1))
158 AROS_USERFUNC_INIT
160 static char buf[100];
161 if (entry)
163 sprintf(buf,"line num: %ld id: %p", (LONG) *(strings-1), entry);
164 strings[0] = buf;
165 } else
167 strings[0] = "Number";
170 AROS_USERFUNC_EXIT
173 AROS_UFH0(void, save_function)
175 AROS_USERFUNC_INIT
177 char *text = (char*)XGET(editor_text, MUIA_Text_Contents);
178 char *filename = (char*)XGET(filename_string, MUIA_String_Contents);
179 BPTR fh;
181 if (!strlen(filename)) return;
183 if ((fh = Open(filename,MODE_NEWFILE)))
185 Write(fh,text,strlen(text));
186 Close(fh);
189 AROS_USERFUNC_EXIT
192 static int id = 1;
194 AROS_UFH0(void, add_function)
196 AROS_USERFUNC_INIT
198 DoMethod(list2,MUIM_List_InsertSingle, id++, MUIV_List_Insert_Bottom);
200 AROS_USERFUNC_EXIT
203 AROS_UFH0(void, add_child_function)
205 AROS_USERFUNC_INIT
207 int act = XGET(list2,MUIA_List_Active);
209 DoMethod(list2,MUIM_List_InsertSingleAsTree, id++, act /* parent */, MUIV_List_InsertSingleAsTree_Bottom, 0);
211 AROS_USERFUNC_EXIT
214 /* IconList callbacks */
215 void volume_doubleclicked(void)
217 char buf[200];
218 struct IconList_Entry *ent = (void*)MUIV_IconList_NextSelected_Start;
219 DoMethod(volume_iconlist, MUIM_IconList_NextSelected, &ent);
220 if ((int)ent == MUIV_IconList_NextSelected_End) return;
222 strcpy(buf,ent->label);
223 strcat(buf,":");
224 set(drawer_iconlist,MUIA_IconDrawerList_Drawer,buf);
227 void drawer_doubleclicked(void)
229 struct IconList_Entry *ent = (void*)MUIV_IconList_NextSelected_Start;
231 DoMethod(drawer_iconlist, MUIM_IconList_NextSelected, &ent);
232 if ((int)ent == MUIV_IconList_NextSelected_End) return;
233 set(drawer_iconlist,MUIA_IconDrawerList_Drawer,ent->filename);
236 static IPTR create_balance_column(void)
238 return (IPTR) VGroup,
239 Child, RectangleObject, GaugeFrame, End,
240 Child, BalanceObject, End,
241 Child, RectangleObject, GaugeFrame, End,
242 Child, BalanceObject, End,
243 Child, RectangleObject, GaugeFrame, End,
244 Child, BalanceObject, End,
245 Child, RectangleObject, GaugeFrame, End,
246 Child, BalanceObject, End,
247 Child, RectangleObject, GaugeFrame, End,
248 End;
251 /* The custom class */
253 struct DropText_Data
255 ULONG times;
258 #ifdef __MAXON__
259 #undef KeymapBase
260 struct Library *KeymapBase;
261 #endif
263 #ifndef __AROS__
264 __saveds __asm IPTR dispatcher(register __a0 struct IClass *cl, register __a2 Object *obj, register __a1 Msg msg)
265 #else
266 AROS_UFH3S(IPTR, dispatcher,
267 AROS_UFHA(Class *, cl, A0),
268 AROS_UFHA(Object *, obj, A2),
269 AROS_UFHA(Msg , msg, A1))
270 #endif
272 AROS_USERFUNC_INIT
274 switch (msg->MethodID)
276 case MUIM_DragQuery: return MUIV_DragQuery_Accept;
277 case MUIM_DragDrop:
279 struct DropText_Data *data = (struct DropText_Data*)INST_DATA(cl,obj);
280 char buf[100];
281 data->times++;
282 sprintf(buf,"%ld times",data->times); /* no MUIM_SetAsString yet */
283 set(obj,MUIA_Text_Contents,buf);
287 return DoSuperMethodA(cl,obj,(Msg)msg);
289 AROS_USERFUNC_EXIT
292 struct MUI_CustomClass *CL_DropText;
294 #define DropTextObject BOOPSIOBJMACRO_START(CL_DropText->mcc_Class)
296 /* Main prog */
298 static struct Hook hook_standard;
300 AROS_UFH3(void, hook_func_standard,
301 AROS_UFHA(struct Hook *, h, A0),
302 AROS_UFHA(void *, dummy, A2),
303 AROS_UFHA(void **, funcptr, A1))
305 AROS_USERFUNC_INIT
307 void (*func) (ULONG *) = (void (*)(ULONG *)) (*funcptr);
309 if (func) func((ULONG *) funcptr + 1);
311 AROS_USERFUNC_EXIT
314 int main(void)
316 Object *wnd,*second_wnd;
317 Object *open_button;
318 Object *quit_button;
319 Object *repeat_button;
320 Object *objects_button;
321 Object *about_item, *quit_item;
322 Object *context_menu;
323 Object *popobject, *listview;
324 Object *list_add_button, *list_add_child_button, *list_remove_button, *list_clear_button;
325 Object *country_radio[2];
327 static char *pages[] = {"Groups","Colorwheel","Virtual Group","Edit","List","Gauges","Radio","Icon List","Balancing",NULL};
328 static char **radio_entries1 = pages;
329 static char *radio_entries2[] = {"Paris","Pataya","London","New-York","Reykjavik",NULL};
331 static struct list_entry entry1 = {"Testentry1","Col2: Entry1"};
332 static struct list_entry entry2 = {"Entry2","Col2: Entry2"};
333 static struct list_entry entry3 = {"Entry3","Col2: Entry3"};
334 static struct list_entry entry4 = {"Entry4","Col2: Entry4"};
335 static struct list_entry entry5 = {"Entry5","Col2: Entry5"};
336 static struct list_entry entry6 = {"Entry6","Col2: Entry6"};
338 static struct list_entry *entries[] =
339 {&entry1,&entry2,&entry3,&entry4,&entry5,&entry6,NULL};
341 struct Hook hook;
342 struct Hook hook_wheel;
343 struct Hook hook_slider;
344 struct Hook hook_objects;
345 struct Hook hook_display;
346 struct Hook hook_display2;
348 hook_standard.h_Entry = (HOOKFUNC)hook_func_standard;
350 MUIMasterBase = (struct Library*)OpenLibrary("muimaster.library",0);
352 hook.h_Entry = (HOOKFUNC)repeat_function;
353 hook_wheel.h_Entry = (HOOKFUNC)wheel_function;
354 hook_slider.h_Entry = (HOOKFUNC)slider_function;
355 hook_objects.h_Entry = (HOOKFUNC)objects_function;
356 hook_display.h_Entry = (HOOKFUNC)display_function;
357 hook_display2.h_Entry = (HOOKFUNC)display2_function;
359 context_menu = MenuitemObject,
360 MUIA_Family_Child, MenuitemObject,
361 MUIA_Menuitem_Title, "Menutest",
362 MUIA_Family_Child, about_item = MenuitemObject, MUIA_Menuitem_Title, "First Test Entry", End,
363 MUIA_Family_Child, quit_item = MenuitemObject, MUIA_Menuitem_Title, "Second Test Entry", End,
364 End,
365 End;
367 /* should check the result in a real program! */
368 CL_DropText = MUI_CreateCustomClass(NULL,MUIC_Text,NULL,sizeof(struct DropText_Data), dispatcher);
369 ColorWheelBase = OpenLibrary("gadgets/colorwheel.gadget",0);
371 app = ApplicationObject,
372 MUIA_Application_Menustrip, MenuitemObject,
373 MUIA_Family_Child, MenuitemObject,
374 MUIA_Menuitem_Title, "Project",
375 MUIA_Family_Child, about_item = MenuitemObject, MUIA_Menuitem_Title, "About...", MUIA_Menuitem_Shortcut, "?", End,
376 MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title, ~0, End,
377 MUIA_Family_Child, quit_item = MenuitemObject, MUIA_Menuitem_Title, "Quit", MUIA_Menuitem_Shortcut, "Q", End,
378 End,
379 End,
380 SubWindow, wnd = WindowObject,
381 MUIA_Window_Title, "test",
382 MUIA_Window_Activate, TRUE,
384 WindowContents, VGroup,
385 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,
386 Child, popobject = PopobjectObject,
387 MUIA_Popstring_String, MUI_MakeObject(MUIO_String, NULL, 200),
388 MUIA_Popstring_Button, PopButton(MUII_PopUp),
389 MUIA_Popobject_Object, VGroup,
390 Child, TextObject,MUIA_Text_Contents,"test",End,
391 Child, listview = ListviewObject,
392 MUIA_Listview_List, ListObject,
393 InputListFrame,
394 MUIA_List_DisplayHook, &hook_display,
395 MUIA_List_Format, ",,",
396 MUIA_List_SourceArray, entries,
397 MUIA_List_Title, TRUE,
398 End,
399 End,
400 End,
401 End,
402 Child, RegisterGroup(pages),
403 // MUIA_Background, "5:SYS:Prefs/Presets/Backdrops/StuccoBlue.pic",
404 Child, HGroup,
405 GroupFrameT("A horizontal group"),
406 Child, ColGroup(2),
407 GroupFrameT("A column group"),
408 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,
409 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,
410 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,
411 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,
412 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,
413 Child, HVSpace, //TextObject, MUIA_CycleChain, 1, ButtonFrame, MUIA_Background, MUII_ButtonBack, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Button6", MUIA_InputMode, MUIV_InputMode_RelVerify, End,
414 Child, MUI_MakeObject(MUIO_Label,"_Checkmark",0),
415 Child, MUI_MakeObject(MUIO_Checkmark,"_Checkmark"),
416 End,
417 Child, group = VGroup,
418 GroupFrameT("A vertical group"),
419 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,
420 Child, TextObject, TextFrame, MUIA_Background, MUII_MARKHALFSHINE, MUIA_CycleChain, 1, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Pattern", End,
421 Child, ColoradjustObject, End,
423 End,
424 Child, MUI_NewObject(MUIC_Popimage, TAG_DONE),
425 End,
427 Child, VGroup,
428 Child, wheel = BoopsiObject, /* MUI and Boopsi tags mixed */
429 GroupFrame,
430 MUIA_Boopsi_ClassID , "colorwheel.gadget",
431 MUIA_Boopsi_MinWidth , 30, /* boopsi objects don't know */
432 MUIA_Boopsi_MinHeight, 30, /* their sizes, so we help */
433 MUIA_Boopsi_Remember , WHEEL_Saturation, /* keep important values */
434 MUIA_Boopsi_Remember , WHEEL_Hue, /* during window resize */
435 MUIA_Boopsi_TagScreen, WHEEL_Screen, /* this magic fills in */
436 WHEEL_Screen , NULL, /* the screen pointer */
437 GA_Left , 0,
438 GA_Top , 0, /* MUI will automatically */
439 GA_Width , 0, /* fill in the correct values */
440 GA_Height , 0,
441 ICA_TARGET , ICTARGET_IDCMP, /* needed for notification */
442 WHEEL_Saturation, 0, /* start in the center */
443 MUIA_FillArea, TRUE, /* use this because it defaults to FALSE
444 for boopsi gadgets but the colorwheel
445 doesnt bother about redrawing its backgorund */
446 End,
448 Child, r_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
449 Child, g_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
450 Child, b_slider = SliderObject, MUIA_Group_Horiz, TRUE, MUIA_Numeric_Min, 0, MUIA_Numeric_Max, 255, End,
452 Child, hue_gauge = GaugeObject, GaugeFrame, MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Max, 255, MUIA_Gauge_Divide, 1<<24, MUIA_Gauge_InfoText, "Hue: %ld",End,
453 End,
455 Child, ScrollgroupObject,
456 MUIA_Scrollgroup_Contents, VGroupV,
457 VirtualFrame,
458 Child, TextObject,
459 TextFrame,
460 MUIA_Text_Contents, "Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7\nLine8\n\n\n\nLine9\nLine10\nLine11\n",
461 End,
462 Child, HGroup,
463 Child, MUI_MakeObject(MUIO_Button,"Button9"),
464 Child, MUI_MakeObject(MUIO_Button,"Button10"),
465 End,
466 End,
467 End,
468 Child, VGroup,
469 Child, editor_text = StringObject,
470 StringFrame,
471 MUIA_Text_Multiline, TRUE,
472 End,
473 Child, PopaslObject,
474 ASLFR_DoSaveMode, TRUE,
475 MUIA_Popstring_String, filename_string = MUI_MakeObject(MUIO_String, NULL, 200),
476 MUIA_Popstring_Button, PopButton(MUII_PopFile),
477 End,
478 Child, save_button = MUI_MakeObject(MUIO_Button, "Save"),
479 End,
480 Child, VGroup,
481 Child, ListviewObject,
482 MUIA_Listview_List, list2 = ListObject,
483 InputListFrame,
484 MUIA_List_DisplayHook, &hook_display2,
485 End,
486 End,
487 Child, HGroup,
488 Child, list_add_button = MUI_MakeObject(MUIO_Button,"_Add"),
489 Child, list_add_child_button = MUI_MakeObject(MUIO_Button,"_Add Child"),
490 Child, list_remove_button = MUI_MakeObject(MUIO_Button,"_Remove"),
491 Child, list_clear_button = MUI_MakeObject(MUIO_Button,"_Clear"),
492 End,
493 End,
495 /* gauges */
496 Child, HGroup,
497 Child, VGroup,
498 Child, VGroup, GroupFrame,
499 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 25, End,
500 Child, ScaleObject, End,
501 End,
502 Child, VGroup, GroupFrame,
503 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 50, End,
504 Child, ScaleObject, End,
505 End,
506 Child, VGroup, GroupFrame,
507 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Horiz, TRUE, MUIA_Gauge_Current, 75, End,
508 Child, ScaleObject, End,
509 End,
510 End,
511 Child, HGroup,
512 Child, HVSpace,
513 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 25, End,
514 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 50, End,
515 Child, GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, "%ld %%", MUIA_Gauge_Current, 75, End,
516 Child, HVSpace,
517 End,
518 End,
520 /* radios */
521 Child, HGroup,
522 Child, VGroup,
523 Child, RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries1, End,
524 Child, country_radio[0] = RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries2, MUIA_Radio_Active, 1, End,
525 End,
526 Child, HGroup,
527 Child, RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries1, End,
528 Child, country_radio[1] = RadioObject, GroupFrame, MUIA_Radio_Entries, radio_entries2, MUIA_Radio_Active, 1, End,
529 End,
530 End,
531 /* iconlist */
532 Child, HGroup,
533 Child, volume_iconlist = MUI_NewObject(MUIC_IconVolumeList, GroupFrame, TAG_DONE),
534 Child, drawer_iconlist = MUI_NewObject(MUIC_IconDrawerList, GroupFrame, MUIA_IconDrawerList_Drawer,"SYS:",TAG_DONE),
535 End,
537 Child,HGroup,
539 Child, create_balance_column(),
540 Child, BalanceObject, End,
541 Child, create_balance_column(),
542 Child, BalanceObject, End,
544 Child, create_balance_column(),
545 Child, BalanceObject, End,
547 Child, create_balance_column(),
548 Child, BalanceObject, End,
550 Child, create_balance_column(),
552 End,
553 End,
555 Child, RectangleObject,
556 MUIA_VertWeight,0, /* Seems to be not supported properly as orginal MUI doesn't allow to alter the height of the window */
557 MUIA_Rectangle_HBar, TRUE,
558 MUIA_Rectangle_BarTitle,"Enter a string",
559 End,
561 Child, StringObject,
562 StringFrame,
563 MUIA_CycleChain,1,
564 MUIA_String_AdvanceOnCR, TRUE,
565 End,
567 Child, CycleObject,
568 ButtonFrame,
569 MUIA_Cycle_Entries, pages,
570 End,
571 Child, ScrollbarObject,
572 MUIA_Group_Horiz, TRUE,
573 MUIA_Prop_Visible, 100,
574 MUIA_Prop_Entries, 300,
575 MUIA_Prop_First, 50,
576 End,
578 Child, HGroup,
579 Child, quit_button = TextObject,
580 ButtonFrame,
581 MUIA_InputMode, MUIV_InputMode_RelVerify,
582 MUIA_CycleChain, 1,
583 MUIA_Background, MUII_ButtonBack,
584 MUIA_ControlChar, 'q',
585 MUIA_Text_HiChar, 'q',
586 MUIA_Text_PreParse, "\33c",
587 MUIA_Text_Contents, "Quit",
588 End,
589 End,
590 End,
591 End,
592 SubWindow, second_wnd = WindowObject,
593 MUIA_Window_Title, "Second window",
595 WindowContents, VGroup,
596 Child, DropTextObject,
597 MUIA_Text_Contents, "Drop here",
598 MUIA_Dropable, TRUE, End,
599 End,
600 End,
601 End;
603 if (app)
605 ULONG sigs = 0;
607 DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
608 DoMethod(second_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, second_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
609 DoMethod(open_button, MUIM_Notify, MUIA_Pressed, FALSE, second_wnd, 3, MUIM_Set, MUIA_Window_Open, TRUE);
610 DoMethod(quit_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
611 DoMethod(objects_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_CallHook, &hook_objects);
612 DoMethod(repeat_button, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook);
614 DoMethod(wheel, MUIM_Notify,WHEEL_Hue , MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_wheel);
615 DoMethod(wheel, MUIM_Notify,WHEEL_Saturation, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_wheel);
616 DoMethod(r_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
617 DoMethod(g_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
618 DoMethod(b_slider, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, app, 2, MUIM_CallHook, &hook_slider);
620 DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, save_function);
622 DoMethod(quit_item, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
623 DoMethod(about_item, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, app, 3, MUIM_CallHook, &hook_standard, about_function);
625 DoMethod(listview, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE, popobject, 2, MUIM_Popstring_Close, TRUE);
627 /* The callbacks of the buttons within the list page */
628 DoMethod(list_add_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, add_function);
629 DoMethod(list_add_child_button, MUIM_Notify, MUIA_Pressed, FALSE, app, 3, MUIM_CallHook, &hook_standard, add_child_function);
630 DoMethod(list_remove_button, MUIM_Notify, MUIA_Pressed, FALSE, list2, 2, MUIM_List_Remove, MUIV_List_Remove_Active);
631 DoMethod(list_clear_button, MUIM_Notify, MUIA_Pressed, FALSE, list2, 1, MUIM_List_Clear);
633 /* radio */
634 DoMethod(country_radio[0], MUIM_Notify, MUIA_Radio_Active, MUIV_EveryTime, country_radio[1], 3, MUIM_NoNotifySet, MUIA_Radio_Active, MUIV_TriggerValue);
635 DoMethod(country_radio[1], MUIM_Notify, MUIA_Radio_Active, MUIV_EveryTime, country_radio[0], 3, MUIM_NoNotifySet, MUIA_Radio_Active, MUIV_TriggerValue);
637 /* iconlist */
638 DoMethod(volume_iconlist, MUIM_Notify, MUIA_IconList_DoubleClick, TRUE, volume_iconlist, 3, MUIM_CallHook, &hook_standard, volume_doubleclicked);
639 DoMethod(drawer_iconlist, MUIM_Notify, MUIA_IconList_DoubleClick, TRUE, drawer_iconlist, 3, MUIM_CallHook, &hook_standard, drawer_doubleclicked);
641 set(wnd,MUIA_Window_Open,TRUE);
642 set(wnd,MUIA_Window_ScreenTitle, "Zune Test application");
644 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
646 if (sigs)
648 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
649 if (sigs & SIGBREAKF_CTRL_C) break;
650 if (sigs & SIGBREAKF_CTRL_D) break;
654 MUI_DisposeObject(app);
656 if (context_menu) MUI_DisposeObject(context_menu);
657 CloseLibrary(ColorWheelBase);
658 MUI_DeleteCustomClass(CL_DropText);
660 CloseLibrary(MUIMasterBase);
661 return 0;