Re: how to make sure a drawing area honors style changes



Melvin Hadasht wrote:
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()

Try either waiting until the GtkDrawingArea is realized or calling gtk_widget_ensure_style on it before creating the layouts.

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

I'm not sure how to handle style changes. Are you rememdering to redraw the GtkDrawingArea after recreating the layouts? I think that gtk_widget_queue_draw will do this.

--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/




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