On 4 April 2012 15:37, Tilton, James C. (GSFC-6063)
<james.c.til...@nasa.gov> wrote:
> Your response is very helpful. The one key question that remains for me is:
>
> How do I draw a "floating crosshair"?

You need to do it by hand, unfortunately, though it's not so hard (I think).

The trick (in my opinion) is to have a compositing model for your
drawing areas. Imagine them as a stack of 2D elements which you draw
back-to-front in your expose handler. I wrote a mail on this a month
or so ago, though it was in relation to rubber-banding:

--------

The implementation can be very simple, you don't need to really keep
separate layers around. You could just have a bool in your draw state
for "display rubberband" and that would be enough. Your expose might
looks like:

expose:
 draw background
 if rubber-band:
   draw rubberband

then in your mouse event handler you could have:

on left-down:
 set rubber-band
 queue draw for pixels touched by rubber band

on motion:
 if rubber-band:
   queue draw for pixels touched by rubber band
   update band position
   queue draw for pixels touched by rubber band

on left-up:
 unset rubber-band
 queue draw for pixels touched by rubber band

The various canvas widgets do basically exactly this for you.

J
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to