Re: Is Gtk_DrawingArea in gtk-- usable?




Jon Trowbridge <trow@emccta.com> writes:

> I'm trying to use the Gtk_DrawingArea class in gtk--...
> 
> Tero Pulkkinen <terop@students.cc.tut.fi> writes:
> > In gtk-- you can just override the expose_event_impl virtual function - just
> > like the gtk's builtin widgets does:
> >
> > class foo : public Gtk_Drawing_Area {
> > public:
> >    ...
> >   gint expose_event_impl(GdkEventExpose *e) {
> >      Gtk_Drawing_Area::expose_event_impl(e); // call base class expose
> >      GdkWindow *win=GTK_WIDGET(gtkobject)->window;
> >      /* use drawing functions here from the C interface */
> >      gdk_draw_arc(win,my_gc,TRUE,my_x,my_y,my_width,my_height,my_start_angle,my_sweep_angle);
> >   }
> >   ...
> > };
> 
> I'm having trouble with this approach.  When I do this,
> expose_event_impl() gets called only when the window is initially drawn,
> and *not* at the time of future exposures.  I tried the same technique
> deriving from Gtk_Button, and it worked correctly... expose_event_impl()
> was actually called every time the object was exposed.
> 
> Is this a bug or feature?  Or am I doing something else wrong?

You need to do the gtk-- equivalent:

  gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK) 

Hope this helps,
                                        Owen





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