1 #include <WINGs/WINGs.h>
2 #include <WINGs/WINGsP.h>
11 void closeAction(WMWidget
*self
,void *data
){
12 WMDestroyWidget(self
);
16 void drawProcedure(XEvent
*event
, void *data
){
17 WMDrawPixmap(pixmap
, W_VIEW_DRAWABLE(WMWidgetView(data
)),30,30);XFlush(display
);
21 int main (int argc
, char **argv
){
26 RColor one
, two
={0xaf, 0x0f,0xff,0x33};
33 WMInitializeApplication("DrawWin", &argc
, argv
);
34 display
= XOpenDisplay("");
35 screen
= WMCreateScreen(display
, DefaultScreen(display
));
36 win
= WMCreateWindow(screen
, "");
37 WMResizeWidget(win
, WINWIDTH
, WINHEIGHT
);
38 WMSetWindowCloseAction(win
, closeAction
, NULL
);
39 WMSetWindowTitle(win
,"Graphics");
40 color
= WMCreateRGBColor(screen
,124<<9,206<<8,162<<8, False
);
41 WMSetWidgetBackgroundColor((WMWidget
*)win
, color
);
42 /* end setup main window */
45 image
=RCreateImage( 100,100,.8);
46 RFillImage(image
, &two
);
47 RDrawLine(image
, 50,10,90,90,&one
);
48 RDrawLine(image
, 10,90,50,10,&one
);
49 RDrawLine(image
, 10,90,90,90,&one
);
53 pixmap
=WMCreatePixmapFromRImage(screen
, image
,1);
54 WMCreateEventHandler(WMWidgetView(win
), ExposureMask
,drawProcedure
,win
);
57 WMScreenMainLoop(screen
);