<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libsigc++: Slots</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> </div> <div class="headertitle"> <h1>Slots<br/> <small> [<a class="el" href="group__sigcfunctors.html">Functors</a>]</small> </h1> </div> </div> <div class="contents"> <p>Slots are type-safe representations of callback methods and functions. <a href="#_details">More...</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot__base.html">sigc::slot_base</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Base type for slots. <a href="classsigc_1_1slot__base.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot0.html">sigc::slot0< T_return ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot0.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot1.html">sigc::slot1< T_return, T_arg1 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot1.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot2.html">sigc::slot2< T_return, T_arg1, T_arg2 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot2.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot3.html">sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot3.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot4.html">sigc::slot4< T_return, T_arg1, T_arg2, T_arg3, T_arg4 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot5.html">sigc::slot5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot5.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot6.html">sigc::slot6< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot6.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot7.html">sigc::slot7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an arbitrary functor to a unified type which is opaque. <a href="classsigc_1_1slot7.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classsigc_1_1slot.html">sigc::slot< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convenience wrapper for the numbered <a class="el" href="classsigc_1_1slot.html" title="Convenience wrapper for the numbered sigc::slot# templates.">sigc::slot</a># templates. <a href="classsigc_1_1slot.html#_details">More...</a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Slots are type-safe representations of callback methods and functions. </p> <p>A Slot can be constructed from any function, regardless of whether it is a global function, a member method, static, or virtual.</p> <p>Use the sigc::mem_fun() and sigc::ptr_fun() template functions to get a <a class="el" href="classsigc_1_1slot.html" title="Convenience wrapper for the numbered sigc::slot# templates.">sigc::slot</a>, like so:</p> <div class="fragment"><pre class="fragment"> <a class="code" href="classsigc_1_1slot.html" title="Convenience wrapper for the numbered sigc::slot# templates.">sigc::slot<void, int></a> sl = <a class="code" href="group__mem__fun.html#ga7d9ea809173f48bf5c76cf1989591602" title="Creates a functor of type sigc::mem_functor0 which wraps a method.">sigc::mem_fun</a>(someobj,& SomeClass::somemethod); </pre></div><p>or</p> <div class="fragment"><pre class="fragment"> <a class="code" href="classsigc_1_1slot.html" title="Convenience wrapper for the numbered sigc::slot# templates.">sigc::slot<void, int></a> sl = <a class="code" href="group__ptr__fun.html#gada8b678665c14dc85eb32d25b7299465" title="Creates a functor of type sigc::pointer_functor0 which wraps an existing non-member function...">sigc::ptr_fun</a>(&somefunction); </pre></div><p>or</p> <div class="fragment"><pre class="fragment"> m_Button.signal_clicked().connect( <a class="code" href="group__mem__fun.html#ga7d9ea809173f48bf5c76cf1989591602" title="Creates a functor of type sigc::mem_functor0 which wraps a method.">sigc::mem_fun</a>(*<span class="keyword">this</span>, &MyWindow::on_button_clicked) ); </pre></div><p>The compiler will complain if SomeClass::somemethod, etc. have the wrong signature.</p> <p>You can also pass slots as method parameters where you might normally pass a function pointer. </p> </div> <hr class="footer"/><address class="footer"><small>Generated on Tue Mar 8 2011 11:44:40 for libsigc++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address> </body> </html>