Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: Amy.Moore@corp.sun.COM (Amy) Newsgroups: comp.windows.x Subject: Re: Motif DrawingArea to OL Intrinsics? Message-ID: <9106101720.AA08434@slotown.Corp.Sun.COM> Date: 10 Jun 91 17:20:34 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 72 >> >>I'm porting an application from Motif to the Open Look Intrinsics. >>In the Motif program, I used a drawingArea widget to give me input >>and expose events. However, under Open Look, I do not see an >>analogous widget. There seems to be no widget whose purpose is to >>give an input/drawing basis. You should be using the Stub widget (strange name, I know). THis widget provides hooks to the various widget methods such as Expose. It is very easy to use, all you do is create the Stub the size you want and then set the XtNexpose resource to be the routine which will do the rendering....see code below. Hope this helps, Regards, Amy Moore aim@sun.com -------------------------------------------------------------------- #include #include #include #include /************************************************************************* * exposeHandler: routine called on Exposure events on the Canvas(Stub). ************************************************************************/ void exposeHandler(w, xevent, region) Widget w; XEvent *xevent; Region region; { Display *display; static GC gc; XGCValues gc_values; Window paint_win; display = XtDisplay(w); paint_win = XtWindow(w); /* All xlib drawing routines would go here....*/ } /**********************************************************************/ main(argc, argv) int argc; char **argv; { Widget toplevel, canvas; Arg arg; toplevel = OlInitialize(argv[0], "Test", NULL, 0, &argc, argv); /* * Create canvas (Stub) and set its expose Method */ canvas = XtVaCreateManagedWidget("canvas", stubWidgetClass, toplevel, XtNexpose, (XtArgVal)exposeHandler, XtNwidth, 100, XtNheight, 100, NULL); XtRealizeWidget(toplevel); XtMainLoop(); } /*******************************END EXAMPLE***************************/