📄 gtk-resource-files.html
字号:
</tr><tr><td><p><span class="term"><code class="literal">text[<em class="replaceable"><code>state</code></em>] = <em class="replaceable"><code>color</code></em></code></span></p></td><td><p> Sets the color used for foreground of widgets using <code class="literal">base</code> for the background color. </p></td></tr><tr><td><p><span class="term"><code class="literal">xthickness = <em class="replaceable"><code>number</code></em></code></span></p></td><td><p> Sets the xthickness, which is used for various horizontal padding values in GTK+. </p></td></tr><tr><td><p><span class="term"><code class="literal">ythickness = <em class="replaceable"><code>number</code></em></code></span></p></td><td><p> Sets the ythickness, which is used for various vertical padding values in GTK+. </p></td></tr><tr><td><p><span class="term"><code class="literal">bg_pixmap[<em class="replaceable"><code>state</code></em>] = <em class="replaceable"><code>pixmap</code></em></code></span></p></td><td><p> Sets a background pixmap to be used in place of the <code class="literal">bg</code> color (or for <a class="link" href="GtkText.html" title="GtkText"><span class="type">GtkText</span></a>, in place of the <code class="literal">base</code> color. The special value <code class="literal">"<parent>"</code> may be used to indicate that the widget should use the same background pixmap as its parent. The special value <code class="literal">"<none>"</code> may be used to indicate no background pixmap. </p></td></tr><tr><td><p><span class="term"><code class="literal">font = <em class="replaceable"><code>font</code></em></code></span></p></td><td><p> Starting with GTK+ 2.0, the "font" and "fontset" declarations are ignored; use "font_name" declarations instead. </p></td></tr><tr><td><p><span class="term"><code class="literal">fontset = <em class="replaceable"><code>font</code></em></code></span></p></td><td><p> Starting with GTK+ 2.0, the "font" and "fontset" declarations are ignored; use "font_name" declarations instead. </p></td></tr><tr><td><p><span class="term"><code class="literal">font_name = <em class="replaceable"><code>font</code></em></code></span></p></td><td><p> Sets the font for a widget. <em class="replaceable"><code>font</code></em> must be a Pango font name, e.g. <code class="literal">"Sans Italic 10"</code>. For details about Pango font names, see <ahref="/usr/share/gtk-doc/html/pango/pango-Fonts.html#pango-font-description-from-string"><code class="function">pango_font_description_from_string()</code></a>. </p></td></tr><tr><td><p><span class="term"><code class="literal">stock[<em class="replaceable"><code>"stock-id"</code></em>] = { <em class="replaceable"><code>icon source specifications</code></em> }</code></span></p></td><td><p> Defines the icon for a stock item. </p></td></tr><tr><td><p><span class="term"><code class="literal">color[<em class="replaceable"><code>"color-name"</code></em>] = <em class="replaceable"><code>color specification</code></em></code></span></p></td><td><p> Since 2.10, this element can be used to defines symbolic colors. See below for the syntax of color specifications. </p></td></tr><tr><td><p><span class="term"><code class="literal">engine <em class="replaceable"><code>"engine"</code></em> { <em class="replaceable"><code>engine-specificsettings</code></em> }</code></span></p></td><td><p> Defines the engine to be used when drawing with this style. </p></td></tr><tr><td><p><span class="term"><code class="literal"><em class="replaceable"><code>class</code></em>::<em class="replaceable"><code>property</code></em> = <em class="replaceable"><code>value</code></em></code></span></p></td><td><p> Sets a <a class="link" href="GtkWidget.html#style-properties">style property</a> for a widget class. </p></td></tr></tbody></table></div><p></p><p>The colors and background pixmaps are specified as a function of thestate of the widget. The states are:</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><code class="literal">NORMAL</code></span></p></td><td><p> A color used for a widget in its normal state. </p></td></tr><tr><td><p><span class="term"><code class="literal">ACTIVE</code></span></p></td><td><p> A variant of the <code class="literal">NORMAL</code> color used when the widget is in the <a class="link" href="gtk-Standard-Enumerations.html#GTK-STATE-ACTIVE:CAPS"><code class="literal">GTK_STATE_ACTIVE</code></a> 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 class="literal">NORMAL</code> color. </p></td></tr><tr><td><p><span class="term"><code class="literal">PRELIGHT</code></span></p></td><td><p> A color used for widgets in the <a class="link" href="gtk-Standard-Enumerations.html#GTK-STATE-PRELIGHT:CAPS"><code class="literal">GTK_STATE_PRELIGHT</code></a> state. This state is the used for Buttons and MenuItems that have the mouse cursor over them, and for their children. </p></td></tr><tr><td><p><span class="term"><code class="literal">SELECTED</code></span></p></td><td><p> 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. </p></td></tr><tr><td><p><span class="term"><code class="literal">INSENSITIVE</code></span></p></td><td><p> A color used for the background of widgets that have been set insensitive with <a class="link" href="GtkWidget.html#gtk-widget-set-sensitive"><code class="function">gtk_widget_set_sensitive()</code></a>. </p></td></tr></tbody></table></div><p></p><p><a name="color-format"></a>Colors can be specified as a string containing a color name (GTK+ knowsall names from the X color database <code class="filename">/usr/lib/X11/rgb.txt</code>), in one of the hexadecimal forms <code class="literal">#rrrrggggbbbb</code>,<code class="literal">#rrrgggbbb</code>, <code class="literal">#rrggbb</code>,or <code class="literal">#rgb</code>, where <code class="literal">r</code>,<code class="literal">g</code> and <code class="literal">b</code> arehex digits, or they can be specified as a triplet <code class="literal">{ <em class="replaceable"><code>r</code></em>, <em class="replaceable"><code>g</code></em>,<em class="replaceable"><code>b</code></em>}</code>, where <code class="literal">r</code>,<code class="literal">g</code> and <code class="literal">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, asfollows: <code class="literal">@color-name</code>, or by using expressions to combinecolors. The following expressions are currently supported: </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term">mix (<em class="replaceable"><code>factor</code></em>, <em class="replaceable"><code>color1</code></em>, <em class="replaceable"><code>color2</code></em>)</span></p></td><td><p> Computes a new color by mixing <em class="replaceable"><code>color1</code></em> and <em class="replaceable"><code>color2</code></em>. The <em class="replaceable"><code>factor</code></em> determines how close the new color is to <em class="replaceable"><code>color1</code></em>. A factor of 1.0 gives pure <em class="replaceable"><code>color1</code></em>, a factor of 0.0 gives pure <em class="replaceable"><code>color2</code></em>. </p></td></tr><tr><td><p><span class="term">shade (<em class="replaceable"><code>factor</code></em>, <em class="replaceable"><code>color</code></em>)</span></p></td><td><p> Computes a lighter or darker variant of <em class="replaceable"><code>color</code></em>. A <em class="replaceable"><code>factor</code></em> of 1.0 leaves the color unchanged, smaller factors yield darker colors, larger factors yield lighter colors. </p></td></tr><tr><td><p><span class="term">lighter (<em class="replaceable"><code>color</code></em>)</span></p></td><td><p> This is an abbreviation for <code class="literal">shade (1.3, <em class="replaceable"><code>color</code></em>)</code>. </p></td></tr><tr><td><p><span class="term">darker (<em class="replaceable"><code>color</code></em>)</span></p></td><td><p> This is an abbreviation for <code class="literal">shade (0.7, <em class="replaceable"><code>color</code></em>)</code>. </p></td></tr></tbody></table></div><p> </p><p>Here are some examples of color expressions:</p><div class="informalexample"><pre class="programlisting"> mix (0.5, "red", "blue") shade (1.5, mix (0.3, "#0abbc0", { 0.3, 0.5, 0.9 })) lighter (@foreground)</pre></div><p></p><p>In a <code class="literal">stock</code> definition, icon sources are specified as a4-tuple of image filename or icon name, text direction, widget state, and size, in thatorder. Each icon source specifies an image filename or icon name to use with a givendirection, state, and size. Filenames are specified as a string suchas <code class="literal">"itemltr.png"</code>, while icon names (looked upin the current icon theme), are specified with a leading<code class="literal">@</code>, such as <code class="literal">@"item-ltr"</code>.The <code class="literal">*</code> character can be used as awildcard, and if direction/state/size are omitted they default to<code class="literal">*</code>. So for example, the following specifies different icons touse for left-to-right and right-to-left languages:</p><div class="informalexample"><pre class="programlisting">stock["my-stock-item"] = { { "itemltr.png", LTR, *, * }, { "itemrtl.png", RTL, *, * }}</pre></div><p>This could be abbreviated as follows:</p><div class="informalexample"><pre class="programlisting">stock["my-stock-item"] = { { "itemltr.png", LTR }, { "itemrtl.png", RTL }}</pre></div><p></p><p>You can specify custom icons for specific sizes, as follows:</p><div class="informalexample"><pre class="programlisting">stock["my-stock-item"] = { { "itemmenusize.png", *, *, "gtk-menu" }, { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" } { "itemgeneric.png" } /* implicit *, *, * as a fallback */}</pre></div><p>The sizes that come with GTK+ itself are <code class="literal">"gtk-menu"</code>,<code class="literal">"gtk-small-toolbar"</code>, <code class="literal">"gtk-large-toolbar"</code>,<code class="literal">"gtk-button"</code>, <code class="literal">"gtk-dialog"</code>. Applicationscan define other sizes.</p><p>It's also possible to use custom icons for a given state, for example:</p><div class="informalexample"><pre class="programlisting">stock["my-stock-item"] = { { "itemprelight.png", *, PRELIGHT }, { "iteminsensitive.png", *, INSENSITIVE }, { "itemgeneric.png" } /* implicit *, *, * as a fallback */}</pre></div><p></p><p>When selecting an icon source to use, GTK+ will consider text direction mostimportant, state second, and size third. It will select the best match based onthose criteria. If an attribute matches exactly (e.g. you specified
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -