how to make sure a drawing area honors style changes



Hi,

I use GtkDrawingArea to display some text by using a set of
PangoLayouts.

The text should change if user changes the default style.
I did not manage to achieve that: the PangoLayouts are
always using the "Sans 10" default font description.

The drawing area is inside a class inherited from a table (I
call it xtable for further reference)

Here is how the drawing is made:

1. when the GtkDrawingArea is created (not yet realized),
a set of pango layouts are created by using
gtk_widget_create_pango_layout()

2. Texts for PangoLayouts are set

3. Whenever an expose event occurs, I draw the PangoLayout
with:

gdk_draw_layout(darea->window, darea->style->text_gc[state], x, y, layout);
(darea being a GtkWidget *)

What should I do to have the drawing area respond to style
changes?

I made a function to unref and recreate the pango_layout 
when the style_set class member function (of its parent 
container xtable) is called.  This function is called at 
application startup and when I use switch2, but
the PangoLayouts do not change styles (font family, size...).

In short how to make sure a drawing area honors style 
changes?

Thanks.

-- 
Melvin Hadasht



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