Canvas item sensitivity (a la GtkWidget)?



I've been working on the equivalent of a circuit editor, using subclasses
of the CanvasGroup to create/hold each individual item.  That means the
object holds a border (rect), resize box (rect), text label, and soon many
more things.  The architecture I have also defines container items that
are hopefully (I'm on the 3rd or 4th redesign now) going to be subclasses
of the generic item, with the ability to hold more sub-items.

The issue I'm running into is that various canvas items, such as the text
label, are capturing events, and causing things like bizarre simultaneous
leave,enter on the parent items. 

What I'm wondering is if we can add an argument to the CanvasItem class
called "sensitive", which similar to the Gtk argument of the same name
will, when FALSE, render the item incapable of accepting or responding to
events.  pick_current_item would use this flag in addition to
GNOME_CANVAS_ITEM_VISIBLE in the test on lines 284[01] of gnome-canvas.c,
as per latest CVS checkout: 

  if ((canvas->root->object.flags & GNOME_CANVAS_ITEM_VISIBLE) &&
      (canvas->root->object.flags & GNOME_CANVAS_ITEM_SENSITIVE))
    gnome_canvas_item_invoke_point(canvas->root, x, y, cx, cy,
                                   &canvas->new_current_item);

It would default to TRUE, since that wouldn't change standard behavior at
all.  Then in my case I can turn off event sensitivity for items that are
supposed to just sit there and look pretty, such as the label. 

Does this sound like a reasonable addition to the canvas?  At least for
me, it would make life quite a bit easier...

TTYL,
    Omega

         Erik Walthinsen <omega@cse.ogi.edu> - Staff Programmer @ OGI
        Quasar project - http://www.cse.ogi.edu/DISC/projects/quasar/
   Video4Linux Two drivers and stuff - http://www.cse.ogi.edu/~omega/v4l2/
        __
       /  \             SEUL: Simple End-User Linux - http://www.seul.org/
      |    | M E G A           Helping Linux become THE choice
      _\  /_                          for the home or office user





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]