gtk3/docs/reference/gtk/html/gtk-migrating-theme-GtkStyleContext-engines.html
2017-12-21 20:47:04 -05:00

132 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Migrating theme engines: 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-GtkStyleContext.html" title="Theming changes">
<link rel="next" href="gtk-migrating-GtkStyleContext-parser-extensions.html" title="Extending the CSS parser">
<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-GtkStyleContext.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-GtkStyleContext-parser-extensions.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-theme-GtkStyleContext-engines"></a>Migrating theme engines</h2></div></div></div>
<p>
Migrating a <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a> based engine to a <a class="link" href="GtkThemingEngine.html" title="GtkThemingEngine"><span class="type">GtkThemingEngine</span></a> based one
should be straightforward for most of the vfuncs. Besides a cleanup
in the available paint methods and a simplification in the passed
arguments (in favor of <a class="link" href="GtkStyleContext.html" title="GtkStyleContext"><span class="type">GtkStyleContext</span></a> containing all the information),
the available render methods resemble those of <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a> quite
evidently. Notable differences include:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
All variations of <a class="link" href="GtkStyle.html#gtk-paint-box" title="gtk_paint_box ()"><code class="function">gtk_paint_box()</code></a>, <a class="link" href="GtkStyle.html#gtk-paint-flat-box" title="gtk_paint_flat_box ()"><code class="function">gtk_paint_flat_box()</code></a>,
<a class="link" href="GtkStyle.html#gtk-paint-shadow" title="gtk_paint_shadow ()"><code class="function">gtk_paint_shadow()</code></a>, <a class="link" href="GtkStyle.html#gtk-paint-box-gap" title="gtk_paint_box_gap ()"><code class="function">gtk_paint_box_gap()</code></a> and <a class="link" href="GtkStyle.html#gtk-paint-shadow-gap" title="gtk_paint_shadow_gap ()"><code class="function">gtk_paint_shadow_gap()</code></a>
are replaced by <a class="link" href="GtkStyleContext.html#gtk-render-background" title="gtk_render_background ()"><code class="function">gtk_render_background()</code></a>, <a class="link" href="GtkStyleContext.html#gtk-render-frame" title="gtk_render_frame ()"><code class="function">gtk_render_frame()</code></a> and
<a class="link" href="GtkStyleContext.html#gtk-render-frame-gap" title="gtk_render_frame_gap ()"><code class="function">gtk_render_frame_gap()</code></a>. The first function renders frameless
backgrounds and the last two render frames in various forms.
</li>
<li class="listitem">
<a class="link" href="GtkStyle.html#gtk-paint-resize-grip" title="gtk_paint_resize_grip ()"><code class="function">gtk_paint_resize_grip()</code></a> has been subsumed by <a class="link" href="GtkStyleContext.html#gtk-render-handle" title="gtk_render_handle ()"><code class="function">gtk_render_handle()</code></a>
with a <a class="link" href="GtkStyleContext.html#GTK-STYLE-CLASS-GRIP:CAPS" title="GTK_STYLE_CLASS_GRIP"><span class="type">GTK_STYLE_CLASS_GRIP</span></a> class set in the style context.
</li>
<li class="listitem">
<a class="link" href="GtkStyle.html#gtk-paint-spinner" title="gtk_paint_spinner ()"><code class="function">gtk_paint_spinner()</code></a> disappears in favor of <a class="link" href="GtkStyleContext.html#gtk-render-activity" title="gtk_render_activity ()"><code class="function">gtk_render_activity()</code></a>
with a <a class="link" href="GtkStyleContext.html#GTK-STYLE-CLASS-SPINNER:CAPS" title="GTK_STYLE_CLASS_SPINNER"><span class="type">GTK_STYLE_CLASS_SPINNER</span></a> class set in the style context.
</li>
</ol></div>
<p>
The list of available render methods is:
</p>
<table border="0" summary="Simple list" class="simplelist">
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-background" title="gtk_render_background ()"><code class="function">gtk_render_background()</code></a>: Renders a widget/area background.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-frame" title="gtk_render_frame ()"><code class="function">gtk_render_frame()</code></a>: Renders a frame border around the given rectangle.
Usually the detail of the border depends on the theme information,
plus the current widget state.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-frame-gap" title="gtk_render_frame_gap ()"><code class="function">gtk_render_frame_gap()</code></a>: Renders a frame border with a gap on one side.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-layout" title="gtk_render_layout ()"><code class="function">gtk_render_layout()</code></a>: Renders a <a href="../pango/pango-Layout-Objects.html#PangoLayout-struct"><span class="type">PangoLayout</span></a>.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-handle" title="gtk_render_handle ()"><code class="function">gtk_render_handle()</code></a>: Renders all kind of handles and resize grips,
depending on the style class.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-check" title="gtk_render_check ()"><code class="function">gtk_render_check()</code></a>: Render checkboxes.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-option" title="gtk_render_option ()"><code class="function">gtk_render_option()</code></a>: Render radiobuttons.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-arrow" title="gtk_render_arrow ()"><code class="function">gtk_render_arrow()</code></a>: Renders an arrow pointing to a direction.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-expander" title="gtk_render_expander ()"><code class="function">gtk_render_expander()</code></a>: Renders an expander indicator, such as in
<a class="link" href="GtkExpander.html" title="GtkExpander"><span class="type">GtkExpander</span></a>.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-focus" title="gtk_render_focus ()"><code class="function">gtk_render_focus()</code></a>: Renders the indication that a widget has the
keyboard focus.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-line" title="gtk_render_line ()"><code class="function">gtk_render_line()</code></a>: Renders a line from one coordinate to another.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-slider" title="gtk_render_slider ()"><code class="function">gtk_render_slider()</code></a>: Renders a slider, such as in <a class="link" href="GtkScale.html" title="GtkScale"><span class="type">GtkScale</span></a>.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-extension" title="gtk_render_extension ()"><code class="function">gtk_render_extension()</code></a>: Renders an extension that protrudes from
a UI element, such as a notebook tab.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-activity" title="gtk_render_activity ()"><code class="function">gtk_render_activity()</code></a>: Renders an area displaying activity, be it
a progressbar or a spinner.
</td></tr>
<tr><td>
<a class="link" href="GtkStyleContext.html#gtk-render-icon-pixbuf" title="gtk_render_icon_pixbuf ()"><code class="function">gtk_render_icon_pixbuf()</code></a>: Renders an icon into a <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf-struct"><span class="type">GdkPixbuf</span></a>.
</td></tr>
</table>
<p>
One of the main differences to <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a>-based engines is that the
rendered widget is totally isolated from the theme engine, all style
information is meant to be retrieved from the <a class="link" href="GtkThemingEngine.html" title="GtkThemingEngine"><span class="type">GtkThemingEngine</span></a> API,
or from the <a class="link" href="gtk3-GtkWidgetPath.html#GtkWidgetPath" title="GtkWidgetPath"><span class="type">GtkWidgetPath</span></a> obtained from <a class="link" href="GtkThemingEngine.html#gtk-theming-engine-get-path" title="gtk_theming_engine_get_path ()"><code class="function">gtk_theming_engine_get_path()</code></a>,
which fully represents the rendered widget's hierarchy from a styling
point of view.
</p>
<p>
The detail string available in <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a>-based engines has been
replaced by widget regions and style classes. Regions are a way for
complex widgets to associate different styles with different areas,
such as even and odd rows in a treeview. Style classes allow sharing
of style information between widgets, regardless of their type.
Regions and style classes can be used in style sheets to associate
styles, and them engines can also access them. There are several
predefined classes and regions such as <a class="link" href="GtkStyleContext.html#GTK-STYLE-CLASS-BUTTON:CAPS" title="GTK_STYLE_CLASS_BUTTON"><code class="literal">GTK_STYLE_CLASS_BUTTON</code></a> or
<a class="link" href="GtkStyleContext.html#GTK-STYLE-REGION-TAB:CAPS" title="GTK_STYLE_REGION_TAB"><code class="literal">GTK_STYLE_REGION_TAB</code></a> in <code class="filename">gtkstylecontext.h</code>,
although custom widgets may define their own, which themes may
attempt to handle.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>