[comp.windows.x] Drawables

jstravis@athena.mit.edu (John S. Travis) (10/24/89)

Widgets and Pixmaps and other stuff are often reffered to as drawables.
I have a program that calls various functions to write on a widget. I
now would also like to write to a Pixmap. Must i recopy my various 
functions and set the parameter as Pixmap or is there Drawable declaration
that covers both. Writing this i realize it's a silly question, but
can i get around this. Send the Pixmap cast a Widget--this seems like
ity could never work, but i'm an amteur so tell me if it would. Example 
simple function below, thanks.

john travis
jstravis@athena.mit.edu

     Widget  w;
     GC      gc;
     int   x,y,x2,y2;
{
  Display   *dpy =XtDisplay(w);
  Window    win = XtWindow(w);

  check_points(&x,&y,&x2,&y2);
  XFillArc(dpy,win,gc,x,y,x2-x,y2-y,0,64 * 360);
}

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (10/27/89)

> Widgets and Pixmaps and other stuff are often reffered (sic) to as drawables.

Close, but no cigar.  A drawable is a window or a pixmap.  A widget is something
completely different.  Give your function example, you will have to write a
new function that draws into a pixmap.  Since you pass a widget which is
very different than a pixmap.  

You may be able to define your functions to take a widget and a drawable, and
make your life easier, but without knowing the structure of your application I
cannot be much more specific.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213

swick@ATHENA.MIT.EDU (Ralph R. Swick) (11/02/89)

> I have a program that calls various functions to write on a widget. I
> now would also like to write to a Pixmap.

If you were careful, you could write a widget class whose
realize procedure created a pixmap instead of a window.  You'd
never want to try to have a parent manage one of these widgets
(unless it had special knowledge), but you could probably
get along just fine with such a widget wrapper around a pixmap.