1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Extending the CSS parser: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="gtk-migrating-GtkStyleContext.html" title="Theming changes">
<link rel="prev" href="gtk-migrating-theme-GtkStyleContext-engines.html" title="Migrating theme engines">
<link rel="next" href="gtk-migrating-GtkStyleContext-css.html" title="Using the CSS file format">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gtk-migrating-GtkStyleContext.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk-migrating-theme-GtkStyleContext-engines.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-GtkStyleContext-css.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="gtk-migrating-GtkStyleContext-parser-extensions"></a>Extending the CSS parser</h2></div></div></div>
<p>
In <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a>-based engines, GtkRCStyle provided ways to extend the
gtkrc parser with engine-specific extensions. This has been replaced
by <a class="link" href="GtkThemingEngine.html#gtk-theming-engine-register-property" title="gtk_theming_engine_register_property ()"><code class="function">gtk_theming_engine_register_property()</code></a>, which lets a theme engine
register new properties with an arbitrary type. While there is built-in
support for most basic types, it is possible to use a custom parser
for the property.
</p>
<p>
The installed properties depend on the <a class="link" href="GtkThemingEngine.html#GtkThemingEngine--name" title="The “name” property"><span class="type">“name”</span></a> property,
so they should be added in the <code class="literal"><code class="function">constructed()</code></code> vfunc.
For example, if an engine with the name "Clearlooks" installs a
"focus-color" property with the type <a href="http://developer.gnome.org/gdk3/gdk4-RGBA-Colors.html#GdkRGBA"><span class="type">GdkRGBA</span></a>, the property
<code class="literal">-Clearlooks-focus-color</code> will be registered and
accepted in CSS like this:
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting">GtkEntry <span class="gtkdoc opt">{</span>
<span class="gtkdoc opt">-</span>Clearlooks<span class="gtkdoc opt">-</span>focus<span class="gtkdoc opt">-</span>color<span class="gtkdoc opt">:</span> <span class="function">rgba</span><span class="gtkdoc opt">(</span><span class="number">255</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">1.0</span><span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
</p>
<p>
Widget style properties also follow a similar syntax, with the widget
type name used as a prefix. For example, the <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> focus-line-width
style property can be modified in CSS as
<code class="literal">-GtkWidget-focus-line-width</code>.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>
|