Re: gtkrc grammar



Mark McLoughlin <mark skynet ie> writes:

> Hey,
> 	I've thrown together some notes on the gtkrc2.0 file format
> that vaguely like a grammar. I'm just posting it as an offering to
> google or to anyone else who wants to clean it up ...

It might be nice to have some version of this attached to the reference
manual; probably not as the primary docs -- what's there right now
probably just needs to be fixed updated and expanded, but as a secondary
reference.

If you file a bug report pointing to this mail (you can just include
a link to the relevant message on mail.gnome.org/archives/gtk-devel-list),
it will be more likely to not get forgotten about.

Regards,
                                        Owen
> 
>         A crufty BNF style grammar compiled by browsing the code. Most likely
> wrong in some places.
> 
> Possible Locations
> ==================
> 
>         1. GTK_SYSCONFDIR/gtk-2.0/gtkrc
>         2. ~/.gtkrc-2.0
>         3. ~/.themes/$(name)/gtk-2.0/gtkrc
>         4. ~/.themes/$(name)/gtk-2.0-$(type)/gtkrc
>         5. $(theme_dir)/$(name)/gtk-2.0/gtkrc
>         6. $(theme_dir)/$(name)/gtk-2.0-$(type)/gtkrc
> 
> Grammar
> ======
> 
> <toplevel> :
>         ( <include> | <style> | <binding> | <pixmap_path>
>           <widget> | <widget_class> | <class>  | <module_path> |
>           <im_module_path> | <im_module_file> | <setting> ) *
> 
> <include> : include <string>:
> 
>         => include another gtkrc file.
> 
> <style> : style <string> [ '=' <string> ] '{'
>         (
>         <bg> | <fg> | <text> | <base> | <xthickness> | <ythickness> |
>         <bg_pixmap> | <font> | <fontset> | <font_name> | <engine> |
>         <stock> | <widget_prop_assignment>
>         ) *
>         '}'
> 
>         => the style name. an optional parent style.
> 
> <binding> : binding <string> '{'
>         <bind> *
>         '}'
> 
>         => a set of key bindings
> 
> <pixmap_path> : <string>
> 
>         => a path to search for pixmaps ?
> 
> <widget> : widget <path>
> 
> <widget_class> :  widget_class <path>
> 
> <class> : class <path>
> 
>         => setting a binding or style to a widget.
> 
> <module_path> : module_path <string> 
> 
> <im_module_path> : module_path <string> 
> 
> <im_module_file> : module_path <string> 
> 
>         => search paths ?
> 
> <setting> : <string> <assigment>
> 
>         => global setting ?
> 
> <bind> : bind <string> '{' <signal> '}'
> 
> <signal> : <string> '(' [ ( <param> ',' ) * ] <param> ')'
> 
> <param> : [ '-' ] <int> | <float> | <string>
> 
> <path> : <string> ( style | binding ) [ ':' <priority> ] <string>
> 
> <priority> : ( lowest | gtk | application | theme | rc | highest )
> 
> <bg> : bg <state> '=' <color>
> <fg> : fg <state> '=' <color>
> 
>         => a background/foreground color for a certain state.
> 
> <text> : text <state> '=' <color>
> <base> : base <state> '=' <color>
> 
>         => style->text and style->base colors.
> 
> 
> <xthickness> : xthickness '=' <int>
> <ythickness> : ythickness '=' <int>
> 
>         => style->xthickness and style->ythickness.
> 
> <bg_pixmap> : bg_pixmap '=' ( <string> | "<parent>" | "<none>" )
> 
>         => backgroud pixmap.
> 
> <font> : font '=' <string>
> 
>         => ignored.
>         
> <fontset> : fontset '=' <string>
> 
>         => ignored.
> 
> <font_name> : font_name '=' <string>
> 
>         => passed to pango_font_description_from_string.
> 
> <engine> : engine <string> '{'
> 
>         '}'
> 
>         => the engine is parsed elsewhere.
> 
> <stock> : stock '[' <string> ']' '=' '{'
>         <string> [ ','
>         ( "LTR" | "RTL" | '*' ) [ ','
>         ( <normal> | <active> | <prelight> |
>           <selected> | <insensitive> | '*') [ ','
>         ( '*' | <string> ) ] ] ]
>         '}'
> 
>         => stockid, left-to-right/right-to-left, state, size.
> 
>         => size can be something like "gtk-menu" or "gtk-large-toolbar"
> 
> <widget_prop_assignment> : <string> ':' ':' <string> <assignment>
> 
>         => property identifier like "GtkScrollbar::spacing"
> 
> <assignment> : '=' [ '-' ] ( <int> | <float> | <string> | <compound> )
> 
>         => haven't figured out compound.
> 
> <state> : '[' ( <normal> | <active> | <prelight> |
>                 <selected> | <insensitive> )
>           ']'
> 
> <normal> : NORMAL
> <active> : ACTIVE
> <prelight> : PRELIGHT
> <selected> : SELECTED
> <insensitive> : INSENSITIVE
> 
> <color> : ( '{' ( <int> | <float> ),
>               ( <int> | <float> ),
>               ( <int> | <float> )
>             '}' |
>             <string>
>           )
> 
>         => either an rgb or a string passed to gdk_color_parse.
> 
> <string> : ( '\'' char * '\'' | '"' char * '"' )
> 
>         => double quoted strings can take escaped values e.g. '\n'



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