<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ToggleButton</title> <link rel="stylesheet" href="style.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Programming with gtkmm"> <link rel="up" href="chapter-button-widget.html" title="Chapter 4. Buttons"> <link rel="prev" href="chapter-button-widget.html" title="Chapter 4. Buttons"> <link rel="next" href="sec-checkboxes.html" title="CheckButton"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">ToggleButton</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="chapter-button-widget.html"><img src="icons/prev.png" alt="Prev"></a> </td> <th width="60%" align="center">Chapter 4. Buttons</th> <td width="20%" align="right"> <a accesskey="n" href="sec-checkboxes.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> </table> <hr> </div> <div class="sect1" title="ToggleButton"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sec-toggle-buttons"></a>ToggleButton</h2></div></div></div> <p><code class="classname">ToggleButton</code>s are like normal <code class="classname">Button</code>s, but when clicked they remain activated, or pressed, until clicked again.</p> <p> To retrieve the state of the <code class="classname">ToggleButton</code>, you can use the <code class="methodname">get_active()</code> method. This returns <code class="literal">true</code> if the button is "down". You can also set the toggle button's state, with <code class="methodname">set_active()</code>. Note that, if you do this, and the state actually changes, it causes the "clicked" signal to be emitted. This is usually what you want. </p> <p> You can use the <code class="methodname">toggled()</code> method to toggle the button, rather than forcing it to be up or down: This switches the button's state, and causes the <code class="literal">toggled</code> signal to be emitted. </p> <p> <code class="classname">Gtk::ToggleButton</code> is most useful as a base class for the <code class="classname">Gtk::CheckButton</code> and <code class="classname">Gtk::RadioButton</code> classes. </p> <p><a class="ulink" href="http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1ToggleButton.html" target="_top">Reference</a></p> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="chapter-button-widget.html"><img src="icons/prev.png" alt="Prev"></a> </td> <td width="20%" align="center"><a accesskey="u" href="chapter-button-widget.html"><img src="icons/up.png" alt="Up"></a></td> <td width="40%" align="right"> <a accesskey="n" href="sec-checkboxes.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> <tr> <td width="40%" align="left" valign="top">Chapter 4. Buttons </td> <td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td> <td width="40%" align="right" valign="top"> CheckButton</td> </tr> </table> </div> </body> </html>