Re: on_style_changed signal



Jan Hudec wrote:
On Sun, Dec 12, 2004 at 21:39:24 -0600, Rob Benton wrote:

Paul Davis wrote:

When exactly does this signal get emitted? I'm trying to repaint my Gtk::DrawingArea when this happens but it looks like this signal gets emitted before the Gtk::DrawingArea is realized.


Repeat the Golden Mantra of all X Window toolkits:

     ONLY DRAW IN SOMETHING THAT HANDLES A (real or synthetic)
     EXPOSE EVENT.

If you want to draw because of something detected elsewhere in the
program, cause a synthetic expose event to be sent. In gtkmm, its done
like this:

   widget.queue_draw ()

--p



I have a Gtk::DrawingArea and a Gdk::Pixmap that share a Gdk::GC. I want to draw the new style bg color to the pixmap , then draw the pixmap to the drawingarea. But how can I make these changes before I call queue_draw() ?


If the Gdk::GC is only shared by those two, and no others, you just do
the changes and they will persist. But I believe there are some Gdk::GCs
in the style, that you can use so you don't need to create your own and
set it up.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb ucw cz>

The way I have approached this is to let all the drawing on the pixmap be done in a separate function which then calls queue_draw() on the drawingarea whose handler executes drawingarea->draw_drawable(pixmap). Should all the drawing logic be inside the expose_event handler instead?

The problem I have is that if on_style_changed is called before the drawingarea is realized I can't create a Gdk::GC.





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