[gtkada] Question about Style and Pragmas

Emmanuel Briot briot at gnat.com
Wed Apr 18 15:11:00 CEST 2001


Preben Randhol writes:
 > 1. Why are there pragma Suppress (All_Checks); in the source code
 >    generated by gate? Do they serve any particular reason, I would like to
 >    not remove the checks...


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...
You are of course completely free to remove the pragma if you want.

 > 2. I haven't quite understood how one deals with Styles. That is I can
 >    change the font's colors etc++ no prob. The problem is that I don't
 >    understand whether I can only use something like this:
 > 
 >       Style_Greek := Get_Row_Style (Clist, 1);
 >       .. -- change the font to a Greek font.
 >       Style_Norwegian := Get_Row_Style (Clist, 2);
 >       .. -- change the font to a Norwegian font.
 > 
 >    And then apply Style_Greek to rows 1,3,5,7,... etc and Style_Norwegian
 >    to 2,4,6,8,... as I make a list with alternating a Greek Word and
 >    an Explanation in Norwegian on the next line.


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 ?

Emmanuel




More information about the gtkada mailing list