Change to the linux kernel coding style
[wmaker-crm.git] / WINGs / Examples / colorpick.c
1
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <WINGs/WINGs.h>
5
6 void showSelectedColor(void *self, void *cdata)
7 {
8 WMColorPanel *panel = (WMColorPanel *) self;
9
10 printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
11 }
12
13 int main(int argc, char **argv)
14 {
15 Display *dpy;
16 WMScreen *scr;
17
18 WMInitializeApplication("wmcolorpick", &argc, argv);
19
20 dpy = XOpenDisplay("");
21 if (!dpy) {
22 printf("could not open display\n");
23 exit(1);
24 }
25
26 scr = WMCreateScreen(dpy, DefaultScreen(dpy));
27
28 {
29 WMColorPanel *panel = WMGetColorPanel(scr);
30
31 WMSetColorPanelAction(panel, showSelectedColor, NULL);
32
33 WMShowColorPanel(panel);
34 }
35
36 WMScreenMainLoop(scr);
37
38 return 0;
39 }