Changes for omnipresent icons in clip (menu entries redone).
[wmaker-crm.git] / WINGs / wmquery.c
blobcfea64c22bcc3ccfc167410fa4278debace0f2bd
2 /*
3 * Author: Len Trigg <trigg@cs.waikato.ac.nz>
4 */
7 #include "WINGs.h"
9 #include <unistd.h>
10 #include <stdio.h>
12 #include "logo.xpm"
17 void
18 wAbort()
20 exit(1);
23 char *ProgName;
25 void usage(void)
27 fprintf(stderr,
28 "usage:\n"
29 "\t%s [-options]\n"
30 "\n"
31 "options:\n"
32 " -i <str>\tInitial entry contents (default none)\n"
33 " -p <str>\tPrompt message (default none)\n"
34 " -t <str>\tQuery window title (default none)\n"
35 "\n"
36 "information:\n"
37 "\t%s pops up a WindowMaker style input panel.\n"
38 "\n"
39 "version:\n"
40 "\t%s\n"
41 ,ProgName,ProgName,__DATE__
43 exit(0);
46 int main(int argc, char **argv)
48 Display *dpy = XOpenDisplay("");
49 WMScreen *scr;
50 WMPixmap *pixmap;
51 char *title = NULL;
52 char *prompt = NULL;
53 char *initial = NULL;
54 char *result = NULL;
55 int ch;
56 extern char *optarg;
57 extern int optind;
59 WMInitializeApplication("WMQuery", &argc, argv);
61 ProgName = argv[0];
63 if (!dpy) {
64 puts("could not open display");
65 exit(1);
68 while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
69 switch(ch)
71 case 'i':
72 initial = optarg;
73 break;
74 case 'p':
75 prompt = optarg;
76 break;
77 case 't':
78 title = optarg;
79 break;
80 default:
81 usage();
84 for(; optind <argc; optind++)
85 usage();
88 scr = WMCreateSimpleApplicationScreen(dpy);
90 pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
92 WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
94 if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
95 printf("%s\n", result);
96 else
97 printf("\n");
98 return 0;