Added missing properties.
[tangerine.git] / workbench / demos / easyreq.c
blob9fc08e47f824f29a089b9a50795ba73ececc1c93
1 #include <intuition/intuition.h>
2 #include <proto/exec.h>
3 #include <proto/dos.h>
4 #include <proto/intuition.h>
5 #include <proto/alib.h>
7 #include <stdio.h>
9 struct IntuitionBase *IntuitionBase;
11 static struct EasyStruct es;
13 int main(void)
15 struct Window *req;
17 LONG result, counter = 0;
19 if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",39)))
22 es.es_StructSize = sizeof(es);
23 es.es_Flags = 0;
25 es.es_Title = "First Requester";
26 es.es_TextFormat = "I'm a very nice requester :)";
27 es.es_GadgetFormat = "Yep!";
29 EasyRequestArgs(0, &es, 0, 0);
31 es.es_Title = "Second Requester";
32 es.es_TextFormat = "This requester should have\ntwo text lines!";
33 es.es_GadgetFormat = "Ok|Cancel";
35 result = EasyRequestArgs(0, &es, 0, 0);
36 puts((result == 1) ? "You clicked on \"OK\"." : "You clicked on \"Cancel\".");
38 es.es_Title = "Third Requester";
39 es.es_TextFormat = "One\nTwo\nThree\nFour\n\nTest Test";
40 es.es_GadgetFormat = "10|20|30|40|50|60|70|80|90|100";
42 result = EasyRequestArgs(0, &es, 0, 0);
43 printf("Result %ld\n",result);
45 es.es_Title = "Fourth Requester";
46 es.es_TextFormat = "Requester Text with args:\n\nArg 1: %ld Arg 2: %ld Arg 3: %ld\nStringarg: %s";
47 es.es_GadgetFormat = "Coooool";
49 EasyRequest(0, &es, 0, 10, 20, 30, (IPTR)"I'm the string");
51 es.es_Title = "Fifth Requester";
52 es.es_TextFormat = "Requester Text with text and gadget args:\n\nArg 1: %ld Arg 2: %ld Arg 3: %ld\nStringarg: %s";
53 es.es_GadgetFormat = "Coooool %ld|Holy %s";
55 EasyRequest(0, &es, 0, 10, 20, 30, (IPTR)"I'm the string", 7777, "crap");
57 es.es_Title = "Sixth Requester";
58 es.es_TextFormat = "I'm an asynchronous Requester.\nWatch shell output while\nrequester is open!";
59 es.es_GadgetFormat = "Incredible|Great|Not bad";
61 req = BuildEasyRequestArgs(0, &es, 0, 0);
62 if (req && (req != (struct Window *)1))
66 Delay(20);
67 result = SysReqHandler(req, 0, FALSE);
68 printf("*** Async Counter: %ld ***\n",++counter);
70 } while (result == -2);
72 printf("You clicked on \"%s\"\n",(result == 1) ? "Incredible" : (result == 2) ? "Great" : "Not bad");
74 FreeSysRequest(req);
76 CloseLibrary((struct Library *)IntuitionBase);
78 else
80 fprintf(stderr, "Could not open intuition.library V39 or greater.\n");
81 return 10;
84 return 0;