[gtkada] Question about Style and Pragmas

Preben Randhol randhol at pvv.org
Wed Apr 18 15:53:38 CEST 2001


Emmanuel Briot <briot at gnat.com> wrote on 18/04/2001 (15:12) :
> For efficiency reasons.
> Since this code is automatically generated, we know that there is no error that
> will be raised by the checks (or so we hope), and thus there is no point in
> losing time doing the checks. This actually makes quite a difference for big
> XML files...

I see :-)

> You can of course share a style between widgets, since, like most other
> things in gtk+, styles are reference counted. When you are done with using a
> style for a specific line, just call Unref on it. When the reference counter
> reaches 0, the style is removed from memory.
> Does this answer your question, or did I incorrectly understand it ?

Not sure. The reason I ask is that if one do someting like this:

   Style_1 := Get_Style (Some_Widget_1);
   Set_Background (Style_1, State_Normal, Colour_1)
   Set_Style (Some_Widget_1, Style_1);

   Style_2 := Get_Style (Some_Widget_2);
   Set_Background (Style_2, State_Normal, Colour_2)
   Set_Style (Some_Widget_2, Style_2);

Then both Some_Widget_1 and Some_Widget_2 gets Colour_2. And I don't
understand this. I guess I get the Style of the underlying widget in
this case the window and change this ? As if I do:

   Style_1 := Copy (Get_Style (Some_Widget_1));
   Style_2 := Copy (Get_Style (Some_Widget_2));

it works.
-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»




More information about the gtkada mailing list