Change to the linux kernel coding style
[wmaker-crm.git] / WINGs / Examples / colorpick.c
Commit [+]AuthorDateLineData
95897acc kojima2004-08-24 19:27:45 +00001
2#include <stdlib.h>
3#include <stdio.h>
4#include <WINGs/WINGs.h>
5
95897acc kojima2004-08-24 19:27:45 +00006void showSelectedColor(void *self, void *cdata)
7{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +02008 WMColorPanel *panel = (WMColorPanel *) self;
6830b057 dan2004-10-12 21:28:27 +00009
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020010 printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
95897acc kojima2004-08-24 19:27:45 +000011}
12
95897acc kojima2004-08-24 19:27:45 +000013int main(int argc, char **argv)
14{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020015 Display *dpy;
16 WMScreen *scr;
6830b057 dan2004-10-12 21:28:27 +000017
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020018 WMInitializeApplication("wmcolorpick", &argc, argv);
95897acc kojima2004-08-24 19:27:45 +000019
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020020 dpy = XOpenDisplay("");
21 if (!dpy) {
22 printf("could not open display\n");
23 exit(1);
24 }
6830b057 dan2004-10-12 21:28:27 +000025
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020026 scr = WMCreateScreen(dpy, DefaultScreen(dpy));
95897acc kojima2004-08-24 19:27:45 +000027
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020028 {
29 WMColorPanel *panel = WMGetColorPanel(scr);
6830b057 dan2004-10-12 21:28:27 +000030
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020031 WMSetColorPanelAction(panel, showSelectedColor, NULL);
6830b057 dan2004-10-12 21:28:27 +000032
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020033 WMShowColorPanel(panel);
34 }
6830b057 dan2004-10-12 21:28:27 +000035
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020036 WMScreenMainLoop(scr);
6830b057 dan2004-10-12 21:28:27 +000037
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020038 return 0;
95897acc kojima2004-08-24 19:27:45 +000039}