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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
|
<!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.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">
<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_return">
<col class="functions_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">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</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">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></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="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_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"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></td>
</tr>
<tr>
<td class="signal_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a></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"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></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="name">
<col class="description">
</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"> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
<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="keyword">switch</span>
╰── slider</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><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> 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><a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>sw</code></em>
should be active, and <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> 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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
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> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> is active, and <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> 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><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> 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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
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” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></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>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” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></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>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” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></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>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” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></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>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,
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> 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: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></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"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
user_function (<a class="link" href="GtkSwitch.html" title="GtkSwitch"><span class="type">GtkSwitch</span></a> *widget,
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> state,
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> 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 <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> 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> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to stop the signal emission</p>
</div>
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></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.25.1</div>
</body>
</html>
|