Squashed commit of 'x11-hostlib' branch
[tangerine.git] / workbench / demos / fontreq.c
blobf08a56f4ba4d237f01536846fa818d8b2ac9017b
3 #include <exec/types.h>
4 #include <exec/libraries.h>
5 #include <graphics/displayinfo.h>
6 #include <libraries/asl.h>
7 #ifndef __AROS__
8 #include <clib/exec_protos.h>
9 #include <clib/asl_protos.h>
10 #else
11 #include <proto/exec.h>
12 #include <proto/asl.h>
13 #endif
14 #include <stdio.h>
16 #ifdef LATTICE
17 int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
18 void chkabort(void) { return; } /* really */
19 #endif
21 #define MYLEFTEDGE 0
22 #define MYTOPEDGE 0
23 #define MYWIDTH 320
24 #define MYHEIGHT 400
26 struct Library *AslBase = NULL;
28 struct TextAttr mytextattr =
30 "arial.font", 13, 0, 0
33 struct TagItem fotags1[] =
35 {ASLFO_TextAttr, (IPTR)&mytextattr},
36 {ASLFO_TitleText , (IPTR)"ASL Font requester" },
37 {ASLFO_DoDrawMode, TRUE},
38 {ASLFO_DoStyle, TRUE},
39 {TAG_DONE }
42 static void showrequester(char *msg, struct TagItem *tags)
44 struct FontRequester *freq;
46 printf("\n%s:\n",msg ? msg : "");
48 if ((freq = (struct FontRequester *)AllocAslRequest(ASL_FontRequest, tags)))
50 if (AslRequest(freq, NULL))
52 printf("\n-------------------------------------------------------\n\n");
53 printf("FontName = %s\n", freq->fo_TAttr.tta_Name);
54 printf("FontSize = %d\n", freq->fo_TAttr.tta_YSize);
55 printf("FontStyle = %d\n", freq->fo_TAttr.tta_Style);
56 printf("FontFlags = %d\n", freq->fo_TAttr.tta_Flags);
57 printf("DrawMode = %d\n", freq->fo_DrawMode);
59 } else printf("\nRequester was aborted\n");
60 FreeAslRequest(freq);
62 else printf("Could not alloc FontRequester\n");
65 int main(int argc, char **argv)
67 if ((AslBase = OpenLibrary("asl.library", 37L)))
69 showrequester("Default requester with no tags", NULL);
70 showrequester(NULL, fotags1);
72 CloseLibrary(AslBase);
73 } else {
74 puts("Could not open asl.library!\n");
76 return 0;