550 lines
26 KiB
HTML
550 lines
26 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>GtkSwitch: 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="ButtonWidgets.html" title="Buttons and Toggles">
|
||
<link rel="prev" href="GtkMenuButton.html" title="GtkMenuButton">
|
||
<link rel="next" href="GtkScaleButton.html" title="GtkScaleButton">
|
||
<meta name="generator" content="GTK-Doc V1.33.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">
|
||
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.properties" class="shortcut">Properties</a></span><span id="nav_style_properties"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.style-properties" class="shortcut">Style Properties</a></span><span id="nav_signals"> <span class="dim">|</span>
|
||
<a href="#GtkSwitch.signals" class="shortcut">Signals</a></span>
|
||
</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="ButtonWidgets.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||
<td><a accesskey="p" href="GtkMenuButton.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||
<td><a accesskey="n" href="GtkScaleButton.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||
</tr></table>
|
||
<div class="refentry">
|
||
<a name="GtkSwitch"></a><div class="titlepage"></div>
|
||
<div class="refnamediv"><table width="100%"><tr>
|
||
<td valign="top">
|
||
<h2><span class="refentrytitle"><a name="GtkSwitch.top_of_page"></a>GtkSwitch</span></h2>
|
||
<p>GtkSwitch — A “light switch” style toggle</p>
|
||
</td>
|
||
<td class="gallery_image" valign="top" align="right"><img src="switch.png"></td>
|
||
</tr></table></div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.functions"></a><h2>Functions</h2>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="functions_proto_type">
|
||
<col class="functions_proto_name">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="function_type">
|
||
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
|
||
</td>
|
||
<td class="function_name">
|
||
<a class="link" href="GtkSwitch.html#gtk-switch-new" title="gtk_switch_new ()">gtk_switch_new</a> <span class="c_punctuation">()</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="function_type">
|
||
<span class="returnvalue">void</span>
|
||
</td>
|
||
<td class="function_name">
|
||
<a class="link" href="GtkSwitch.html#gtk-switch-set-active" title="gtk_switch_set_active ()">gtk_switch_set_active</a> <span class="c_punctuation">()</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="function_type">
|
||
<span class="returnvalue">gboolean</span>
|
||
</td>
|
||
<td class="function_name">
|
||
<a class="link" href="GtkSwitch.html#gtk-switch-get-active" title="gtk_switch_get_active ()">gtk_switch_get_active</a> <span class="c_punctuation">()</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="function_type">
|
||
<span class="returnvalue">void</span>
|
||
</td>
|
||
<td class="function_name">
|
||
<a class="link" href="GtkSwitch.html#gtk-switch-set-state" title="gtk_switch_set_state ()">gtk_switch_set_state</a> <span class="c_punctuation">()</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="function_type">
|
||
<span class="returnvalue">gboolean</span>
|
||
</td>
|
||
<td class="function_name">
|
||
<a class="link" href="GtkSwitch.html#gtk-switch-get-state" title="gtk_switch_get_state ()">gtk_switch_get_state</a> <span class="c_punctuation">()</span>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.properties"></a><h2>Properties</h2>
|
||
<div class="informaltable"><table class="informaltable" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="properties_type">
|
||
<col width="300px" class="properties_name">
|
||
<col width="200px" class="properties_flags">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="property_type"><span class="type">gboolean</span></td>
|
||
<td class="property_name"><a class="link" href="GtkSwitch.html#GtkSwitch--active" title="The “active” property">active</a></td>
|
||
<td class="property_flags">Read / Write</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="property_type"><span class="type">gboolean</span></td>
|
||
<td class="property_name"><a class="link" href="GtkSwitch.html#GtkSwitch--state" title="The “state” property">state</a></td>
|
||
<td class="property_flags">Read / Write</td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.style-properties"></a><h2>Style Properties</h2>
|
||
<div class="informaltable"><table class="informaltable" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="style_properties_type">
|
||
<col width="300px" class="style_properties_name">
|
||
<col width="200px" class="style_properties_flags">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="property_type"><span class="type">int</span></td>
|
||
<td class="property_name"><a class="link" href="GtkSwitch.html#GtkSwitch--s-slider-height" title="The “slider-height” style property">slider-height</a></td>
|
||
<td class="property_flags">Read</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="property_type"><span class="type">int</span></td>
|
||
<td class="property_name"><a class="link" href="GtkSwitch.html#GtkSwitch--s-slider-width" title="The “slider-width” style property">slider-width</a></td>
|
||
<td class="property_flags">Read</td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.signals"></a><h2>Signals</h2>
|
||
<div class="informaltable"><table class="informaltable" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="signal_proto_type">
|
||
<col width="300px" class="signal_proto_name">
|
||
<col width="200px" class="signal_proto_flags">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="signal_type"><span class="returnvalue">void</span></td>
|
||
<td class="signal_name"><a class="link" href="GtkSwitch.html#GtkSwitch-activate" title="The “activate” signal">activate</a></td>
|
||
<td class="signal_flags">Action</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signal_type"><span class="returnvalue">gboolean</span></td>
|
||
<td class="signal_name"><a class="link" href="GtkSwitch.html#GtkSwitch-state-set" title="The “state-set” signal">state-set</a></td>
|
||
<td class="signal_flags">Run Last</td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.other"></a><h2>Types and Values</h2>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="other_proto_type">
|
||
<col class="other_proto_name">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="datatype_keyword">struct</td>
|
||
<td class="function_name"><a class="link" href="GtkSwitch.html#GtkSwitch-struct" title="struct GtkSwitch">GtkSwitch</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="datatype_keyword">struct</td>
|
||
<td class="function_name"><a class="link" href="GtkSwitch.html#GtkSwitchClass" title="struct GtkSwitchClass">GtkSwitchClass</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.object-hierarchy"></a><h2>Object Hierarchy</h2>
|
||
<pre class="screen"> GObject
|
||
<span class="lineart">╰──</span> GInitiallyUnowned
|
||
<span class="lineart">╰──</span> <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
|
||
<span class="lineart">╰──</span> GtkSwitch
|
||
</pre>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
|
||
<p>
|
||
GtkSwitch implements
|
||
AtkImplementorIface, <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>, <a class="link" href="GtkActionable.html" title="GtkActionable">GtkActionable</a> and <a class="link" href="GtkActivatable.html" title="GtkActivatable">GtkActivatable</a>.</p>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.includes"></a><h2>Includes</h2>
|
||
<pre class="synopsis">#include <gtk/gtk.h>
|
||
</pre>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.description"></a><h2>Description</h2>
|
||
<p><a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> is a widget that has two states: on or off. The user can control
|
||
which state should be active by clicking the empty area, or by dragging the
|
||
handle.</p>
|
||
<p>GtkSwitch can also handle situations where the underlying state changes with
|
||
a delay. See <a class="link" href="GtkSwitch.html#GtkSwitch-state-set" title="The “state-set” signal"><span class="type">“state-set”</span></a> for details.</p>
|
||
<div class="refsect2">
|
||
<a name="id-1.3.9.8.11.4"></a><h3>CSS nodes</h3>
|
||
<div class="informalexample">
|
||
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
||
<tbody>
|
||
<tr>
|
||
<td class="listing_lines" align="right"><pre>1
|
||
2</pre></td>
|
||
<td class="listing_code"><pre class="programlisting"><span class="k">switch</span><span class="w"></span>
|
||
<span class="err">╰──</span><span class="w"> </span><span class="n">slider</span><span class="w"></span></pre></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<p></p>
|
||
<p>GtkSwitch has two css nodes, the main node with the name switch and a subnode
|
||
named slider. Neither of them is using any style classes.</p>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.functions_details"></a><h2>Functions</h2>
|
||
<div class="refsect2">
|
||
<a name="gtk-switch-new"></a><h3>gtk_switch_new ()</h3>
|
||
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
|
||
gtk_switch_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
|
||
<p>Creates a new <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> widget.</p>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-new.returns"></a><h4>Returns</h4>
|
||
<p> the newly created <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> instance</p>
|
||
</div>
|
||
<p class="since">Since: <a class="link" href="api-index-3-0.html#api-index-3.0">3.0</a></p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="gtk-switch-set-active"></a><h3>gtk_switch_set_active ()</h3>
|
||
<pre class="programlisting"><span class="returnvalue">void</span>
|
||
gtk_switch_set_active (<em class="parameter"><code><a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>,
|
||
<em class="parameter"><code><span class="type">gboolean</span> is_active</code></em>);</pre>
|
||
<p>Changes the state of <em class="parameter"><code>sw</code></em>
|
||
to the desired one.</p>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-set-active.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="parameter_name"><p>sw</p></td>
|
||
<td class="parameter_description"><p>a <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a></p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="parameter_name"><p>is_active</p></td>
|
||
<td class="parameter_description"><p><code class="literal">TRUE</code> if <em class="parameter"><code>sw</code></em>
|
||
should be active, and <code class="literal">FALSE</code> otherwise</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<p class="since">Since: <a class="link" href="api-index-3-0.html#api-index-3.0">3.0</a></p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="gtk-switch-get-active"></a><h3>gtk_switch_get_active ()</h3>
|
||
<pre class="programlisting"><span class="returnvalue">gboolean</span>
|
||
gtk_switch_get_active (<em class="parameter"><code><a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>);</pre>
|
||
<p>Gets whether the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> is in its “on” or “off” state.</p>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-get-active.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody><tr>
|
||
<td class="parameter_name"><p>sw</p></td>
|
||
<td class="parameter_description"><p>a <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a></p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr></tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-get-active.returns"></a><h4>Returns</h4>
|
||
<p> <code class="literal">TRUE</code> if the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> is active, and <code class="literal">FALSE</code> otherwise</p>
|
||
</div>
|
||
<p class="since">Since: <a class="link" href="api-index-3-0.html#api-index-3.0">3.0</a></p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="gtk-switch-set-state"></a><h3>gtk_switch_set_state ()</h3>
|
||
<pre class="programlisting"><span class="returnvalue">void</span>
|
||
gtk_switch_set_state (<em class="parameter"><code><a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>,
|
||
<em class="parameter"><code><span class="type">gboolean</span> state</code></em>);</pre>
|
||
<p>Sets the underlying state of the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a>.</p>
|
||
<p>Normally, this is the same as <a class="link" href="GtkSwitch.html#GtkSwitch--active" title="The “active” property"><span class="type">“active”</span></a>, unless the switch
|
||
is set up for delayed state changes. This function is typically
|
||
called from a <a class="link" href="GtkSwitch.html#GtkSwitch-state-set" title="The “state-set” signal"><span class="type">“state-set”</span></a> signal handler.</p>
|
||
<p>See <a class="link" href="GtkSwitch.html#GtkSwitch-state-set" title="The “state-set” signal"><span class="type">“state-set”</span></a> for details.</p>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-set-state.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="parameter_name"><p>sw</p></td>
|
||
<td class="parameter_description"><p>a <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a></p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="parameter_name"><p>state</p></td>
|
||
<td class="parameter_description"><p>the new state</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<p class="since">Since: <a class="link" href="api-index-3-14.html#api-index-3.14">3.14</a></p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="gtk-switch-get-state"></a><h3>gtk_switch_get_state ()</h3>
|
||
<pre class="programlisting"><span class="returnvalue">gboolean</span>
|
||
gtk_switch_get_state (<em class="parameter"><code><a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>);</pre>
|
||
<p>Gets the underlying state of the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a>.</p>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-get-state.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody><tr>
|
||
<td class="parameter_name"><p>sw</p></td>
|
||
<td class="parameter_description"><p>a <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a></p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr></tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect3">
|
||
<a name="gtk-switch-get-state.returns"></a><h4>Returns</h4>
|
||
<p> the underlying state</p>
|
||
</div>
|
||
<p class="since">Since: <a class="link" href="api-index-3-14.html#api-index-3.14">3.14</a></p>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.other_details"></a><h2>Types and Values</h2>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch-struct"></a><h3>struct GtkSwitch</h3>
|
||
<pre class="programlisting">struct GtkSwitch;</pre>
|
||
<p>The <a class="link" href="GtkSwitch.html#GtkSwitch-struct" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> contains private
|
||
data and it should only be accessed using the provided API.</p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitchClass"></a><h3>struct GtkSwitchClass</h3>
|
||
<pre class="programlisting">struct GtkSwitchClass {
|
||
GtkWidgetClass parent_class;
|
||
|
||
void (* activate) (GtkSwitch *sw);
|
||
|
||
gboolean (* state_set) (GtkSwitch *sw, gboolean state);
|
||
};
|
||
</pre>
|
||
<div class="refsect3">
|
||
<a name="GtkSwitchClass.members"></a><h4>Members</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="300px" class="struct_members_name">
|
||
<col class="struct_members_description">
|
||
<col width="200px" class="struct_members_annotations">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkSwitchClass.activate"></a>activate</code></em> ()</p></td>
|
||
<td class="struct_member_description"><p>An action signal and emitting it causes the switch to animate.</p></td>
|
||
<td class="struct_member_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkSwitchClass.state-set"></a>state_set</code></em> ()</p></td>
|
||
<td class="struct_member_description"><p>Class handler for the ::state-set signal.</p></td>
|
||
<td class="struct_member_annotations"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.property-details"></a><h2>Property Details</h2>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch--active"></a><h3>The <code class="literal">“active”</code> property</h3>
|
||
<pre class="programlisting"> “active” <span class="type">gboolean</span></pre>
|
||
<p>Whether the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> widget is in its on or off state.</p>
|
||
<p>Owner: GtkSwitch</p>
|
||
<p>Flags: Read / Write</p>
|
||
<p>Default value: FALSE</p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch--state"></a><h3>The <code class="literal">“state”</code> property</h3>
|
||
<pre class="programlisting"> “state” <span class="type">gboolean</span></pre>
|
||
<p>The backend state that is controlled by the switch.
|
||
|
||
See <a class="link" href="GtkSwitch.html#GtkSwitch-state-set" title="The “state-set” signal"><span class="type">“state-set”</span></a> for details.</p>
|
||
<p>Owner: GtkSwitch</p>
|
||
<p>Flags: Read / Write</p>
|
||
<p>Default value: FALSE</p>
|
||
<p class="since">Since: <a class="link" href="api-index-3-14.html#api-index-3.14">3.14</a></p>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.style-property-details"></a><h2>Style Property Details</h2>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch--s-slider-height"></a><h3>The <code class="literal">“slider-height”</code> style property</h3>
|
||
<pre class="programlisting"> “slider-height” <span class="type">int</span></pre>
|
||
<p>The minimum height of the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> handle, in pixels.</p>
|
||
<div class="warning">
|
||
<p><code class="literal">GtkSwitch:slider-height</code> has been deprecated since version 3.20 and should not be used in newly-written code.</p>
|
||
<p>Use the CSS min-height property instead.</p>
|
||
</div>
|
||
<p>Owner: GtkSwitch</p>
|
||
<p>Flags: Read</p>
|
||
<p>Allowed values: >= 22</p>
|
||
<p>Default value: 22</p>
|
||
<p class="since">Since: <a class="link" href="api-index-3-18.html#api-index-3.18">3.18</a></p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch--s-slider-width"></a><h3>The <code class="literal">“slider-width”</code> style property</h3>
|
||
<pre class="programlisting"> “slider-width” <span class="type">int</span></pre>
|
||
<p>The minimum width of the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> handle, in pixels.</p>
|
||
<div class="warning">
|
||
<p><code class="literal">GtkSwitch:slider-width</code> has been deprecated since version 3.20 and should not be used in newly-written code.</p>
|
||
<p>Use the CSS min-width property instead.</p>
|
||
</div>
|
||
<p>Owner: GtkSwitch</p>
|
||
<p>Flags: Read</p>
|
||
<p>Allowed values: >= 36</p>
|
||
<p>Default value: 36</p>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.signal-details"></a><h2>Signal Details</h2>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch-activate"></a><h3>The <code class="literal">“activate”</code> signal</h3>
|
||
<pre class="programlisting"><span class="returnvalue">void</span>
|
||
user_function (<a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *widget,
|
||
<span class="type">gpointer</span> user_data)</pre>
|
||
<p>The ::activate signal on GtkSwitch is an action signal and
|
||
emitting it causes the switch to animate.
|
||
Applications should never connect to this signal, but use the
|
||
notify::active signal.</p>
|
||
<div class="refsect3">
|
||
<a name="GtkSwitch-activate.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="parameter_name"><p>widget</p></td>
|
||
<td class="parameter_description"><p>the object which received the signal.</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="parameter_name"><p>user_data</p></td>
|
||
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<p>Flags: Action</p>
|
||
</div>
|
||
<hr>
|
||
<div class="refsect2">
|
||
<a name="GtkSwitch-state-set"></a><h3>The <code class="literal">“state-set”</code> signal</h3>
|
||
<pre class="programlisting"><span class="returnvalue">gboolean</span>
|
||
user_function (<a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *widget,
|
||
<span class="type">gboolean</span> state,
|
||
<span class="type">gpointer</span> user_data)</pre>
|
||
<p>The ::state-set signal on GtkSwitch is emitted to change the underlying
|
||
state. It is emitted when the user changes the switch position. The
|
||
default handler keeps the state in sync with the <a class="link" href="GtkSwitch.html#GtkSwitch--active" title="The “active” property"><span class="type">“active”</span></a>
|
||
property.</p>
|
||
<p>To implement delayed state change, applications can connect to this signal,
|
||
initiate the change of the underlying state, and call <a class="link" href="GtkSwitch.html#gtk-switch-set-state" title="gtk_switch_set_state ()"><code class="function">gtk_switch_set_state()</code></a>
|
||
when the underlying state change is complete. The signal handler should
|
||
return <code class="literal">TRUE</code> to prevent the default handler from running.</p>
|
||
<p>Visually, the underlying state is represented by the trough color of
|
||
the switch, while the <a class="link" href="GtkSwitch.html#GtkSwitch--active" title="The “active” property"><span class="type">“active”</span></a> property is represented by the
|
||
position of the switch.</p>
|
||
<div class="refsect3">
|
||
<a name="GtkSwitch-state-set.parameters"></a><h4>Parameters</h4>
|
||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||
<colgroup>
|
||
<col width="150px" class="parameters_name">
|
||
<col class="parameters_description">
|
||
<col width="200px" class="parameters_annotations">
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="parameter_name"><p>widget</p></td>
|
||
<td class="parameter_description"><p>the object on which the signal was emitted</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="parameter_name"><p>state</p></td>
|
||
<td class="parameter_description"><p>the new state of the switch</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="parameter_name"><p>user_data</p></td>
|
||
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
|
||
<td class="parameter_annotations"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table></div>
|
||
</div>
|
||
<div class="refsect3">
|
||
<a name="GtkSwitch-state-set.returns"></a><h4>Returns</h4>
|
||
<p> <code class="literal">TRUE</code> to stop the signal emission</p>
|
||
</div>
|
||
<p>Flags: Run Last</p>
|
||
<p class="since">Since: <a class="link" href="api-index-3-14.html#api-index-3.14">3.14</a></p>
|
||
</div>
|
||
</div>
|
||
<div class="refsect1">
|
||
<a name="GtkSwitch.see-also"></a><h2>See Also</h2>
|
||
<p><a class="link" href="GtkToggleButton.html" title="GtkToggleButton"><span class="type">GtkToggleButton</span></a></p>
|
||
</div>
|
||
</div>
|
||
<div class="footer">
|
||
<hr>Generated by GTK-Doc V1.33.1</div>
|
||
</body>
|
||
</html> |