[comp.windows.x] Novice question

mart@ele.tue.nl (Mart van Stiphout) (09/06/89)

Hi,
I just started experimenting with the x toolkit to
see if its usefull for a new apllication I'm
intending to write. What puzzles me is the following:

How can I get an ordinary window into the widget
hierarchy? Ordinary means: a window in which I can draw
using the Xlib primitives. Can anyone give me some advice
(or maybe even an example program).

Thanks in advance,


Mart van Stiphout
mart@euteal.uucp or mart@euteal.ele.tue.nl or mcvax!hp4nl!eutrc3!euteal!mart

Erik.Hardy@SEI.CMU.EDU (09/07/89)

From: mcsun!hp4nl!eutrc3!euteal!mart@uunet uu net  (Mart van Stiphout)

>Hi,
>I just started experimenting with the x toolkit to
>see if its usefull for a new apllication I'm
>intending to write. What puzzles me is the following:

>How can I get an ordinary window into the widget
>hierarchy? Ordinary means: a window in which I can draw
>using the Xlib primitives. Can anyone give me some advice
>(or maybe even an example program).

We have a canvas widget and several modules for drawing graphics (lines,
circles, etc.), so that you can do what you want under Xt instead of Xlib.
These are experimental and haven't been fully tested, but we know that lines
work and the others were built the same way.

If anyone is interested, send me mail and I'll send it out.

>Thanks in advance,

>Mart van Stiphout
>mart@euteal.uucp or mart@euteal.ele.tue.nl or mcvax!hp4nl!eutrc3!euteal!mart

	Erik Hardy (erik@sei.cmu.edu)
	SEI/User Interface Project

marzano@hpfcdj.HP.COM (Lou Marzano) (09/07/89)

	Widgets can be addressed using typical Xlib function calls.  Often,
you just need to get the window Id or a pointer to the Display structure
of the widget in question.  The two calls I'm referring to are:
XtWindow(widget) and XtDisplay(widget).  For examples, I'd suggest getting
a copy of Doug Young's book, _X_Window_Systems_Programming_and_Applications_
_with_Xt_.  It's been a great help to me and I still haven't heard anyone
criticize it.

- Lou Marzano
  marzano@hpfcpq.HP.COM

swick@ATHENA.MIT.EDU (Ralph R. Swick) (09/07/89)

> How can I get an ordinary window into the widget
> hierarchy? Ordinary means: a window in which I can draw
> using the Xlib primitives.

You can't insert an existing plain window directly into the
widget hierarchy; it needs a "widget wrapper" around it to be
understood by the rest of Xt.  Any window created by any widget
is "ordinary" in the sense that any Xlib primitive works on it;
that's how widgets 'do their thing'.

There are numerous ways to get a widget set to create a window
for you into which you can draw (i.e. without interfering with
any drawing that the widget may be trying to do).  Some widget
sets have a "Canvas" or "Window" widget expressly for this
purpose but they typically do much more than you want or leave
out something of importance (such as a third pixel value, etc.).

At the most basic level, you can simply create an instance of
the Core widget.  The class name for Core is just widgetClass. 
You can then register event handlers on this widget to handle
such things as Expose.  If you want Xt to automatically get
resources for you and compress exposure events as it does for
other widgets, then you should read the last section of the
Athena Widgets manual and modify the Template widget to suit
your needs.

arnar@cs.hw.ac.uk (Arnar Nesset) (07/13/90)

I was just wondering if there were any possibilities of rotating text using
the standard Xlib routines (XDrawString, XDrawImageString, etc.). I have Jones's
book "Introduction to the X Window System", but I can't seem to find any indications
to how this might be achieved. The rotation I want is rotation of the base line
of the string, so that when I e.g. specify a rotation of 90 degrees I want the text
to stand upright, so that you must put your head at a similar angle to read it 
properly (just as in :-)...). The reason I'm being so specific is that I have
received suggestions of rotating the "origin" of the individual characters in the 
string to be printed, so that the characters still are printed horizontally, 
but the "line" of characters are printed in the specified angle. That's not what 
I'm looking for.


Please reply by e-mail if you have any suggestions.


Thanks,

Arnar  (arnar@cs.hw.ac.uk)