<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Graphics.UI.Gtk.General.RcStyle</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Graphics-UI-Gtk-General-RcStyle.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Graphics-UI-Gtk-General-RcStyle.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">gtk-0.12.0: Binding to the Gtk+ graphical user interface library.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable (depends on GHC)</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>gtk2hs-users@lists.sourceforge.net</td></tr></table><p class="caption">Graphics.UI.Gtk.General.RcStyle</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Detail </a><ul><li><a href="#g:2">Default files </a></li><li><a href="#g:3">Pathnames and patterns </a></li><li><a href="#g:4">Optimizing RC Style Matches </a></li><li><a href="#g:5">Toplevel declarations </a></li><li><a href="#g:6">Styles </a></li><li><a href="#g:7">Key bindings </a></li></ul></li><li><a href="#g:8">Class Hierarchy </a></li><li><a href="#g:9">Types </a></li><li><a href="#g:10">Constructors </a></li><li><a href="#g:11">Methods </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Routines for handling resource files </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:RcStyle">RcStyle</a> </li><li class="src short"><span class="keyword">class</span> <a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObjectClass">GObjectClass</a> o => <a href="#t:RcStyleClass">RcStyleClass</a> o </li><li class="src short"><a href="#v:castToRcStyle">castToRcStyle</a> :: <a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObjectClass">GObjectClass</a> obj => obj -> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></li><li class="src short"><a href="#v:gTypeRcStyle">gTypeRcStyle</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:GType">GType</a></li><li class="src short"><a href="#v:toRcStyle">toRcStyle</a> :: <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> o => o -> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></li><li class="src short"><a href="#v:rcStyleNew">rcStyleNew</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></li><li class="src short"><a href="#v:rcStyleCopy">rcStyleCopy</a> :: <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> self => self -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></li><li class="src short"><a href="#v:rcAddDefaultFile">rcAddDefaultFile</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:rcGetDefaultFiles">rcGetDefaultFiles</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]</li><li class="src short"><a href="#v:rcGetImModuleFile">rcGetImModuleFile</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:rcGetModuleDir">rcGetModuleDir</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:rcGetStyle">rcGetStyle</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> widget => widget -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a></li><li class="src short"><a href="#v:rcGetStyleByPaths">rcGetStyleByPaths</a> :: Settings -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:GType">GType</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a></li><li class="src short"><a href="#v:rcGetThemeDir">rcGetThemeDir</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:rcParse">rcParse</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:rcParseString">rcParseString</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:rcReparseAll">rcReparseAll</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:rcReparseAllForSettings">rcReparseAllForSettings</a> :: Settings -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:rcResetStyles">rcResetStyles</a> :: Settings -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:rcSetDefaultFiles">rcSetDefaultFiles</a> :: [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>] -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">Detail </h1><div class="doc"><p>Gtk+ provides resource file mechanism for configuring various aspects of the operation of a Gtk+ program at runtime. </p></div><h2 id="g:2">Default files </h2><div class="doc"><p>An application can cause Gtk+ to parse a specific RC file by calling <code><a href="Graphics-UI-Gtk-General-RcStyle.html#v:rcParse">rcParse</a></code>. In addition to this, certain files will be read at the end of <code>initGUI</code>. Unless modified, the files looked for will be <code><SYSCONFDIR>/gtk-2.0/gtkrc</code> and <code>.gtkrc-2.0</code> in the users home directory. <code>(<SYSCONFDIR></code> defaults to <code>/usr/local/etc</code>. It can be changed with the --prefix or --sysconfdir options when configuring Gtk+.) Note that although the filenames contain the version number 2.0, all 2.x versions of Gtk+ look for these files. </p><p>The set of these default files can be retrieved with <code><a href="Graphics-UI-Gtk-General-RcStyle.html#v:rcGetDefaultFiles">rcGetDefaultFiles</a></code> and modified with <code><a href="Graphics-UI-Gtk-General-RcStyle.html#v:rcAddDefaultFile">rcAddDefaultFile</a></code> and <code><a href="Graphics-UI-Gtk-General-RcStyle.html#v:rcSetDefaultFiles">rcSetDefaultFiles</a></code>. Additionally, the <code>GTK2_RC_FILES</code> environment variable can be set to a <code><a href=":.html">:</a></code>-separated list of files in order to overwrite the set of default files at runtime. </p><p>For each RC file, in addition to the file itself, Gtk+ will look for a locale-specific file that will be parsed after the main file. For instance, if <code>LANG</code> is set to <code>ja_JP.ujis</code>, when loading the default file <code>~/.gtkrc</code> then Gtk+ looks for <code>~/.gtkrc.ja_JP</code> and <code>~/.gtkrc.ja</code>, and parses the first of those that exists. </p></div><h2 id="g:3">Pathnames and patterns </h2><div class="doc"><p>A resource file defines a number of styles and key bindings and attaches them to particular widgets. The attachment is done by the <code>widget</code>, <code>widget_class</code>, and <code>class</code> declarations. As an example of such a statement: attaches the style <code>"my-entry-class"</code> to all widgets whose widget path matches the pattern <code>"mywindow.*.GtkEntry"</code>. That is, all <code><a href="Graphics-UI-Gtk-Entry-Entry.html#t:Entry">Entry</a></code> widgets which are part of a <code><a href="Graphics-UI-Gtk-Windows-Window.html#t:Window">Window</a></code> named <code>"mywindow"</code>. </p><pre> widget "mywindow.*.GtkEntry" style "my-entry-class" </pre><p>The patterns here are given in the standard shell glob syntax. The <code>"?"</code> wildcard matches any character, while <code>"*"</code> matches zero or more of any character. The three types of matching are against the widget path, the class path and the class hierarchy. Both the widget path and the class path consist of a <code>"."</code> separated list of all the parents of the widget and the widget itself from outermost to innermost. The difference is that in the widget path, the name assigned by <code>widgetSetName</code> is used if present, otherwise the class name of the widget, while for the class path, the class name is always used. </p><p>Since Gtk+ 2.10, <code>widget_class</code> paths can also contain <code><classname></code> substrings, which are matching the class with the given name and any derived classes. For instance, will match <code><a href="Graphics-UI-Gtk-Display-Label.html#t:Label">Label</a></code> widgets which are contained in any kind of menu item. </p><pre> widget_class "*GtkMenuItem.GtkLabel" style "my-style" </pre><p>So, if you have a <code><a href="Graphics-UI-Gtk-Entry-Entry.html#t:Entry">Entry</a></code> named <code>"myentry"</code>, inside of a horizontal box in a window named <code>"mywindow"</code>, then the widget path is: <code>"mywindow.GtkHBox.myentry"</code> while the class path is: <code>"GtkWindow.GtkHBox.GtkEntry"</code>. </p><p>Matching against class is a little different. The pattern match is done against all class names in the widgets class hierarchy (not the layout hierarchy) in sequence, so the pattern: will match not just <code><a href="Graphics-UI-Gtk-Buttons-Button.html#t:Button">Button</a></code> widgets, but also <code><a href="Graphics-UI-Gtk-Buttons-ToggleButton.html#t:ToggleButton">ToggleButton</a></code> and <code><a href="Graphics-UI-Gtk-Buttons-CheckButton.html#t:CheckButton">CheckButton</a></code> widgets, since those classes derive from <code><a href="Graphics-UI-Gtk-Buttons-Button.html#t:Button">Button</a></code>. </p><pre> class "GtkButton" style "my-style" </pre><p>Additionally, a priority can be specified for each pattern, and styles override other styles first by priority, then by pattern type and then by order of specification (later overrides earlier). The priorities that can be specified are (highest to lowest): </p><ul><li><pre>highest</pre></li><li><pre>rc</pre></li><li><pre>theme</pre></li><li><pre>application</pre></li><li><pre>gtk</pre></li><li><pre>lowest</pre></li></ul><p><code>rc</code> is the default for styles read from an RC file, <code>theme</code> is the default for styles read from theme RC files, <code>application</code> should be used for styles an application sets up, and <code>gtk</code> is used for styles that Gtk+ creates internally. </p></div><h2 id="g:4">Optimizing RC Style Matches </h2><div class="doc"><p>Everytime a widget is created and added to the layout hierarchy of a <code><a href="Graphics-UI-Gtk-Windows-Window.html#t:Window">Window</a></code> ("anchored" to be exact), a list of matching RC styles out of all RC styles read in so far is composed. For this, every RC style is matched against the widgets class path, the widgets name path and widgets inheritance hierarchy. As a consequence, significant slowdown can be caused by utilization of many RC styles and by using RC style patterns that are slow or complicated to match against a given widget. The following ordered list provides a number of advices (prioritized by effectiveness) to reduce the performance overhead associated with RC style matches: </p><p>Move RC styles for specific applications into RC files dedicated to those applications and parse application specific RC files only from applications that are affected by them. This reduces the overall amount of RC styles that have to be considered for a match across a group of applications. </p><p>Merge multiple styles which use the same matching rule, for instance: is faster to match as: </p><pre> style "Foo" { foo_content } class "X" style "Foo" style "Bar" { bar_content } class "X" style "Bar" </pre><pre> style "FooBar" { foo_content bar_content } class "X" style "FooBar" </pre><p>Use of wildcards should be avoided, this can reduce the individual RC style match to a single integer comparison in most cases. </p><p>To avoid complex recursive matching, specification of full class names (for <code>class</code> matches) or full path names (for <code>widget</code> and <code>widget_class</code> matches) is to be preferred over shortened names containing <code>"*"</code> or <code>"?"</code>. </p><p>If at all necessary, wildcards should only be used at the tail or head of a pattern. This reduces the match complexity to a string comparison per RC style. </p><p>When using wildcards, use of <code>"?"</code> should be preferred over <code>"*"</code>. This can reduce the matching complexity from O(n^2) to O(n). For example <code>"Gtk*Box"</code> can be turned into <code>"Gtk?Box"</code> and will still match <code><a href="Graphics-UI-Gtk-Layout-HBox.html#t:HBox">HBox</a></code> and <code><a href="Graphics-UI-Gtk-Layout-VBox.html#t:VBox">VBox</a></code>. </p><p>The use of <code>"*"</code> wildcards should be restricted as much as possible, because matching <code>"A*B*C*RestString"</code> can result in matching complexities of O(n^2) worst case. </p></div><h2 id="g:5">Toplevel declarations </h2><div class="doc"><p>An RC file is a text file which is composed of a sequence of declarations. <code>'#'</code> characters delimit comments and the portion of a line after a <code>'#'</code> is ignored when parsing an RC file. </p><p>The possible toplevel declarations are: </p><dl><dt><code>binding name { ... }</code></dt><dd> Declares a binding set. </dd><dt><code>class pattern [ style | binding ][ : priority ] name</code></dt><dd> Specifies a style or binding set for a particular branch of the inheritance hierarchy. </dd><dt><code>include filename</code></dt><dd> Parses another file at this point. If filename is not an absolute filename, it is searched in the directories of the currently open RC files. Gtk+ also tries to load a locale-specific variant of the included file. </dd><dt><code>module_path path</code></dt><dd> Sets a path (a list of directories separated by colons) that will be searched for theme engines referenced in RC files. </dd><dt><code>pixmap_path path</code></dt><dd> Sets a path (a list of directories separated by colons) that will be searched for pixmaps referenced in RC files. </dd><dt><code>im_module_file pathname</code></dt><dd> Sets the pathname for the IM modules file. Setting this from RC files is deprecated; you should use the environment variable GTK_IM_MODULE_FILE instead. </dd><dt><code>style name [ = parent ] { ... }</code></dt><dd> Declares a style. </dd><dt><code>widget pattern [ style | binding ][ : priority ] name</code></dt><dd> Specifies a style or binding set for a particular group of widgets by matching on the widget pathname. </dd><dt><code>widget_class pattern [ style | binding ][ : priority ] name</code></dt><dd> Specifies a style or binding set for a particular group of widgets by matching on the class pathname. </dd><dt>setting = value</dt><dd> Specifies a value for a setting. Note that settings in RC files are overwritten by system-wide settings (which are managed by an XSettings manager on X11). </dd></dl></div><h2 id="g:6">Styles </h2><div class="doc"><p>A RC style is specified by a <code>style</code> declaration in a RC file, and then bound to widgets with a <code>widget</code>, <code>widget_class</code>, or <code>class</code> declaration. All styles applying to a particular widget are composited together with <code>widget</code> declarations overriding <code>widget_class</code> declarations which, in turn, override <code>class</code> declarations. Within each type of declaration, later declarations override earlier ones. </p><p>Within a <code>style</code> declaration, the possible elements are: </p><dl><dt><code>bg[state] = color</code></dt><dd> Sets the color used for the background of most widgets. </dd><dt><code>fg[state] = color</code></dt><dd> Sets the color used for the foreground of most widgets. </dd><dt><code>base[state] = color</code></dt><dd> Sets the color used for the background of widgets displaying editable text. This color is used for the background of, among others, {GtkText, FIXME: unknown type/value}, <code><a href="Graphics-UI-Gtk-Entry-Entry.html#t:Entry">Entry</a></code>, <code>List</code>, and <code>CList</code>. </dd><dt><code>text[state] = color</code></dt><dd> Sets the color used for foreground of widgets using <code>base</code> for the background color. </dd><dt><code>xthickness = number</code></dt><dd> Sets the xthickness, which is used for various horizontal padding values in Gtk+. </dd><dt><code>ythickness = number</code></dt><dd> Sets the ythickness, which is used for various vertical padding values in Gtk+. </dd><dt><code>bg_pixmap[state] = pixmap</code></dt><dd> Sets a background pixmap to be used in place of the <code>bg</code> color (or for {GtkText, FIXME: unknown type/value}, in place of the <code>base</code> color. The special value <code>"<parent>"</code> may be used to indicate that the widget should use the same background pixmap as its parent. The special value <code>"<none>"</code> may be used to indicate no background pixmap. </dd><dt><code>font = font</code></dt><dd> Starting with Gtk+ 2.0, the "font" and "fontset" declarations are ignored; use "font_name" declarations instead. </dd><dt><code>fontset = font</code></dt><dd> Starting with Gtk+ 2.0, the "font" and "fontset" declarations are ignored; use "font_name" declarations instead. </dd><dt><code>font_name = font</code></dt><dd> Sets the font for a widget. font must be a Pango font name, e.g. <code>"Sans Italic 10"</code>. For details about Pango font names, see <code>fontDescriptionFromString</code>. </dd><dt><code>stock["stock-id"] = { icon source specifications }</code></dt><dd> Defines the icon for a stock item. </dd><dt><code>color["color-name"] = color specification</code></dt><dd> Since 2.10, this element can be used to defines symbolic colors. See below for the syntax of color specifications. </dd><dt><code>engine "engine" { engine-specific settings }</code></dt><dd> Defines the engine to be used when drawing with this style. </dd><dt><code>class::property = value</code></dt><dd> Sets a style property for a widget class. </dd></dl><p>The colors and background pixmaps are specified as a function of the state of the widget. The states are: </p><dl><dt><code>NORMAL</code></dt><dd> A color used for a widget in its normal state. </dd><dt><code>ACTIVE</code></dt><dd> A variant of the <code>NORMAL</code> color used when the widget is in the <code>StateActive</code> state, and also for the trough of a ScrollBar, tabs of a NoteBook other than the current tab and similar areas. Frequently, this should be a darker variant of the <code>NORMAL</code> color. </dd><dt><code>PRELIGHT</code></dt><dd> A color used for widgets in the <code>StatePrelight</code> state. This state is the used for Buttons and MenuItems that have the mouse cursor over them, and for their children. </dd><dt><code>SELECTED</code></dt><dd> A color used to highlight data selected by the user. for instance, the selected items in a list widget, and the selection in an editable widget. </dd><dt><code>INSENSITIVE</code></dt><dd> A color used for the background of widgets that have been set insensitive with <code>widgetSetSensitive</code>. </dd></dl><p>Colors can be specified as a string containing a color name (GTK+ knows all names from the X color database /usr/lib/X11/rgb.txt), in one of the hexadecimal forms <code><a name="rrrrggggbbbb@, @"></a>rrrgggbbb</code>, <code><a name="rrggbb@, or @"></a>rgb</code>, where <code>r</code>, <code>g</code> and <code>b</code> are hex digits, or they can be specified as a triplet <code>{ r, g, b}</code>, where <code>r</code>, <code>g</code> and <code>b</code> are either integers in the range 0-65535 or floats in the range 0.0-1.0. </p><p>Since 2.10, colors can also be specified by refering to a symbolic color, as follows: <code>@color-name</code>, or by using expressions to combine colors. The following expressions are currently supported: </p><dl><dt>mix (factor, color1, color2)</dt><dd> Computes a new color by mixing color1 and color2. The factor determines how close the new color is to color1. A factor of 1.0 gives pure color1, a factor of 0.0 gives pure color2. </dd><dt>shade (factor, color)</dt><dd> Computes a lighter or darker variant of color. A factor of 1.0 leaves the color unchanged, smaller factors yield darker colors, larger factors yield lighter colors. </dd><dt>lighter (color)</dt><dd> This is an abbreviation for <code>shade (1.3, color)</code>. </dd><dt>darker (color)</dt><dd> This is an abbreviation for <code>shade (0.7, color)</code>. </dd></dl><p>Here are some examples of color expressions: </p><pre> mix (0.5, "red", "blue") shade (1.5, mix (0.3, "#0abbc0", { 0.3, 0.5, 0.9 })) lighter (@foreground) </pre><p>In a <code>stock</code> definition, icon sources are specified as a 4-tuple of image filename or icon name, text direction, widget state, and size, in that order. Each icon source specifies an image filename or icon name to use with a given direction, state, and size. Filenames are specified as a string such as <code>"itemltr.png"</code>, while icon names (looked up in the current icon theme), are specified with a leading <code>@</code>, such as <code>@"item-ltr"</code>. The <code>*</code> character can be used as a wildcard, and if direction/state/size are omitted they default to <code>*</code>. So for example, the following specifies different icons to use for left-to-right and right-to-left languages: This could be abbreviated as follows: </p><pre> stock["my-stock-item"] = { { "itemltr.png", LTR, *, * }, { "itemrtl.png", RTL, *, * } } </pre><pre> stock["my-stock-item"] = { { "itemltr.png", LTR }, { "itemrtl.png", RTL } } </pre><p>You can specify custom icons for specific sizes, as follows: The sizes that come with Gtk+ itself are <code>"gtk-menu"</code>, <code>"gtk-small-toolbar"</code>, <code>"gtk-large-toolbar"</code>, <code>"gtk-button"</code>, <code>"gtk-dialog"</code>. Applications can define other sizes. </p><pre> stock["my-stock-item"] = { { "itemmenusize.png", *, *, "gtk-menu" }, { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" } { "itemgeneric.png" } } </pre><p>It's also possible to use custom icons for a given state, for example: </p><pre> stock["my-stock-item"] = { { "itemprelight.png", *, PRELIGHT }, { "iteminsensitive.png", *, INSENSITIVE }, { "itemgeneric.png" } } </pre><p>When selecting an icon source to use, Gtk+ will consider text direction most important, state second, and size third. It will select the best match based on those criteria. If an attribute matches exactly (e.g. you specified <code>PRELIGHT</code> or specified the size), Gtk+ won't modify the image; if the attribute matches with a wildcard, Gtk+ will scale or modify the image to match the state and size the user requested. </p></div><h2 id="g:7">Key bindings </h2><div class="doc"><p>Key bindings allow the user to specify actions to be taken on particular key presses. The form of a binding set declaration is: </p><p>key is a string consisting of a series of modifiers followed by the name of a key. The modifiers can be: </p><ul><li><pre><alt></pre></li><li><pre><ctl></pre></li><li><pre><control></pre></li><li><pre><meta></pre></li><li><pre><hyper></pre></li><li><pre><super></pre></li><li><pre><mod1></pre></li><li><pre><mod2></pre></li><li><pre><mod3></pre></li><li><pre><mod4></pre></li><li><pre><mod5></pre></li><li><pre><release></pre></li><li><pre><shft></pre></li><li><pre><shift></pre></li></ul><p><code><shft></code> is an alias for <code><shift></code>, <code><ctl></code> is an alias for <code><control></code>, and <code><alt></code> is an alias for <code><mod1></code>. </p><p>The action that is bound to the key is a sequence of signal names (strings) followed by parameters for each signal. The signals must be action signals. (See <code>gSignalNew</code>). Each parameter can be a float, integer, string, or unquoted string representing an enumeration value. The types of the parameters specified must match the types of the parameters of the signal. </p><p>Binding sets are connected to widgets in the same manner as styles, with one difference: Binding sets override other binding sets first by pattern type, then by priority and then by order of specification. The priorities that can be specified and their default values are the same as for styles. </p></div><h1 id="g:8">Class Hierarchy </h1><div class="doc"><pre> | <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObject">GObject</a></code> | +----RcStyle </pre></div><h1 id="g:9">Types </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:RcStyle" class="def">RcStyle</a> <a href="src/Graphics-UI-Gtk-Types.html#RcStyle" class="link">Source</a></p><div class="subs instances"><p id="control.i:RcStyle" class="caption collapser" onclick="toggleSection('i:RcStyle')">Instances</p><div id="section.i:RcStyle" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObjectClass">GObjectClass</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObjectClass">GObjectClass</a> o => <a name="t:RcStyleClass" class="def">RcStyleClass</a> o <a href="src/Graphics-UI-Gtk-Types.html#RcStyleClass" class="link">Source</a></p><div class="subs instances"><p id="control.i:RcStyleClass" class="caption collapser" onclick="toggleSection('i:RcStyleClass')">Instances</p><div id="section.i:RcStyleClass" class="show"><table><tr><td class="src"><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:castToRcStyle" class="def">castToRcStyle</a> :: <a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GObject.html#t:GObjectClass">GObjectClass</a> obj => obj -> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a><a href="src/Graphics-UI-Gtk-Types.html#castToRcStyle" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:gTypeRcStyle" class="def">gTypeRcStyle</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:GType">GType</a><a href="src/Graphics-UI-Gtk-Types.html#gTypeRcStyle" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:toRcStyle" class="def">toRcStyle</a> :: <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> o => o -> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a><a href="src/Graphics-UI-Gtk-Types.html#toRcStyle" class="link">Source</a></p></div><h1 id="g:10">Constructors </h1><div class="top"><p class="src"><a name="v:rcStyleNew" class="def">rcStyleNew</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcStyleNew" class="link">Source</a></p><div class="doc"><p>Creates a new <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code> with no fields set. The <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code> structure is used to represent a set of information about the appearance of a widget. This can later be composited together with other <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code> structures to form a <code><a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a></code>. </p></div></div><h1 id="g:11">Methods </h1><div class="top"><p class="src"><a name="v:rcStyleCopy" class="def">rcStyleCopy</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcStyleCopy" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyleClass">RcStyleClass</a> self</td><td class="doc empty"> </td></tr><tr><td class="src">=> self</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></td><td class="doc"><p>returns the resulting <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code> </p></td></tr></table></div><div class="doc"><p>Makes a copy of the specified <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code>. This function will correctly copy an RC style that is a member of a class derived from <code><a href="Graphics-UI-Gtk-General-RcStyle.html#t:RcStyle">RcStyle</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:rcAddDefaultFile" class="def">rcAddDefaultFile</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcAddDefaultFile" class="link">Source</a></p><div class="doc"><p>Adds a file to the list of files to be parsed at the end of <code>initGUI</code>. </p></div></div><div class="top"><p class="src"><a name="v:rcGetDefaultFiles" class="def">rcGetDefaultFiles</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]<a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetDefaultFiles" class="link">Source</a></p><div class="doc"><p>etrieves the current list of RC files that will be parsed at the end of <code>initGUI</code>. </p></div></div><div class="top"><p class="src"><a name="v:rcGetImModuleFile" class="def">rcGetImModuleFile</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetImModuleFile" class="link">Source</a></p><div class="doc"><p>Obtains the path to the IM modules file. See the documentation of the <code>GTK_IM_MODULE_FILE</code> environment variable for more details. </p></div></div><div class="top"><p class="src"><a name="v:rcGetModuleDir" class="def">rcGetModuleDir</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetModuleDir" class="link">Source</a></p><div class="doc"><p>Returns a directory in which GTK+ looks for theme engines. </p></div></div><div class="top"><p class="src"><a name="v:rcGetStyle" class="def">rcGetStyle</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> widget => widget -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetStyle" class="link">Source</a></p><div class="doc"><p>Finds all matching RC styles for a given widget, composites them together, and then creates a GtkStyle representing the composite appearance. (GTK+ actually keeps a cache of previously created styles, so a new style may not be created.) </p></div></div><div class="top"><p class="src"><a name="v:rcGetStyleByPaths" class="def">rcGetStyleByPaths</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetStyleByPaths" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: Settings</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p><code>widgetPath</code> : the widget path to use when looking up the style, or <code>Nothing</code> if no matching against the widget path should be done </p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p><code>classPath</code> : the class path to use when looking up the style, or <code>Nothing</code> if no matching against the class path should be done. </p></td></tr><tr><td class="src">-> <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:GType">GType</a></td><td class="doc"><p><code>type</code> : a type that will be used along with parent types of this type when matching against class styles, or <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-GTypeConstants.html#v:none">none</a></code> </p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Creates up a <code><a href="Graphics-UI-Gtk-General-Style.html#t:Style">Style</a></code> from styles defined in a RC file by providing the raw components used in matching. This function may be useful when creating pseudo-widgets that should be themed like widgets but don't actually have corresponding GTK+ widgets. </p></div></div><div class="top"><p class="src"><a name="v:rcGetThemeDir" class="def">rcGetThemeDir</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcGetThemeDir" class="link">Source</a></p><div class="doc"><p>Returns the standard directory in which themes should be installed. (GTK+ does not actually use this directory itself.) </p></div></div><div class="top"><p class="src"><a name="v:rcParse" class="def">rcParse</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcParse" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p><code>filename</code> : the <code>filename</code> of a file to parse. If <code>filename</code> is not absolute, it is searched in the current directory. </p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Parses a given resource file. </p></div></div><div class="top"><p class="src"><a name="v:rcParseString" class="def">rcParseString</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcParseString" class="link">Source</a></p><div class="doc"><p>Parses resource information directly from a string. </p></div></div><div class="top"><p class="src"><a name="v:rcReparseAll" class="def">rcReparseAll</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcReparseAll" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p><code>True</code> if the files were reread. </p></td></tr></table></div><div class="doc"><p>If the modification time on any previously read file for the default <code>Settings</code> has changed, discard all style information and then reread all previously read RC files. </p></div></div><div class="top"><p class="src"><a name="v:rcReparseAllForSettings" class="def">rcReparseAllForSettings</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcReparseAllForSettings" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: Settings</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p><code>forceLoad</code> : load whether or not anything changed </p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p><code>True</code> if the files were reread. </p></td></tr></table></div><div class="doc"><p>f the modification time on any previously read file for the given <code>Settings</code> has changed, discard all style information and then reread all previously read RC files. </p></div></div><div class="top"><p class="src"><a name="v:rcResetStyles" class="def">rcResetStyles</a> :: Settings -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcResetStyles" class="link">Source</a></p><div class="doc"><p>This function recomputes the styles for all widgets that use a particular <code>Settings</code> object. (There is one <code>Settings</code> object per <code><a href="Graphics-UI-Gtk-Gdk-Screen.html#t:Screen">Screen</a></code>, see <code>settingsGetForScreen</code>.) It is useful when some global parameter has changed that affects the appearance of all widgets, because when a widget gets a new style, it will both redraw and recompute any cached information about its appearance. As an example, it is used when the default font size set by the operating system changes. Note that this function doesn't affect widgets that have a style set explicitely on them with <code>widgetSetStyle</code>. </p></div></div><div class="top"><p class="src"><a name="v:rcSetDefaultFiles" class="def">rcSetDefaultFiles</a> :: [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>] -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-RcStyle.html#rcSetDefaultFiles" class="link">Source</a></p><div class="doc"><p>Sets the list of files that GTK+ will read at the end of <code>initGUI</code>. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>