- fixed bug with windows shrinking to very small sizes when Unmaximize was
[wmaker-crm.git] / WINGs / Tests / wmquery.c
blob22be0bbc0437f03ddf28af7426b87a7e2d683500
2 /*
3 * Author: Len Trigg <trigg@cs.waikato.ac.nz>
4 */
7 #include <WINGs/WINGs.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <stdlib.h>
13 #include "logo.xpm"
18 void
19 wAbort()
21 exit(1);
24 char *ProgName;
26 void
27 usage(void)
29 fprintf(stderr,
30 "usage:\n"
31 "\t%s [-options]\n"
32 "\n"
33 "options:\n"
34 " -i <str>\tInitial entry contents (default none)\n"
35 " -p <str>\tPrompt message (default none)\n"
36 " -t <str>\tQuery window title (default none)\n"
37 "\n"
38 "information:\n"
39 "\t%s pops up a WindowMaker style input panel.\n"
40 "\n"
41 "version:\n"
42 "\t%s\n"
43 ,ProgName,ProgName,__DATE__
45 exit(0);
48 int
49 main(int argc, char **argv)
51 Display *dpy = XOpenDisplay("");
52 WMScreen *scr;
53 WMPixmap *pixmap;
54 char *title = NULL;
55 char *prompt = NULL;
56 char *initial = NULL;
57 char *result = NULL;
58 int ch;
59 extern char *optarg;
60 extern int optind;
62 WMInitializeApplication("WMQuery", &argc, argv);
64 ProgName = argv[0];
66 if (!dpy) {
67 puts("could not open display");
68 exit(1);
71 while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
72 switch(ch)
74 case 'i':
75 initial = optarg;
76 break;
77 case 'p':
78 prompt = optarg;
79 break;
80 case 't':
81 title = optarg;
82 break;
83 default:
84 usage();
87 for(; optind <argc; optind++)
88 usage();
91 scr = WMCreateSimpleApplicationScreen(dpy);
93 pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
95 WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
97 if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
98 printf("%s\n", result);
99 else
100 printf("\n");
101 return 0;