1 #include <WINGs/WINGs.h>
2 #include <WINGs/WINGsP.h>
11 void closeAction(WMWidget
*self
,void *data
)
13 WMDestroyWidget(self
);
17 void drawProcedure(XEvent
*event
, void *data
)
19 WMDrawPixmap(pixmap
, W_VIEW_DRAWABLE(WMWidgetView(data
)), 30, 30);
23 int main(int argc
, char **argv
)
29 RColor one
, two
= { 0xAF, 0x0F, 0xFF, 0x33 };
35 WMInitializeApplication("DrawWin", &argc
, argv
);
36 display
= XOpenDisplay("");
37 screen
= WMCreateScreen(display
, DefaultScreen(display
));
38 win
= WMCreateWindow(screen
, "");
39 WMResizeWidget(win
, WINWIDTH
, WINHEIGHT
);
40 WMSetWindowCloseAction(win
, closeAction
, NULL
);
41 WMSetWindowTitle(win
, "Graphics");
42 color
= WMCreateRGBColor(screen
, 124<<9, 206<<8, 162<<8, False
);
43 WMSetWidgetBackgroundColor((WMWidget
*)win
, color
);
45 /* end setup main window */
47 image
= RCreateImage(100, 100, 0.8);
48 RFillImage(image
, &two
);
49 RDrawLine(image
, 50, 10, 90, 90, &one
);
50 RDrawLine(image
, 10, 90, 50, 10, &one
);
51 RDrawLine(image
, 10, 90, 90, 90, &one
);
55 pixmap
= WMCreatePixmapFromRImage(screen
, image
, 1);
56 WMCreateEventHandler(WMWidgetView(win
), ExposureMask
, drawProcedure
, win
);
59 WMScreenMainLoop(screen
);