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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WSelectionBox Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WSelectionBox.html">WSelectionBox</a>
</div>
</div>
<div class="contents">
<h1>Wt::WSelectionBox Class Reference<br>
<small>
[<a class="el" href="group__modelview.html">Model/view system</a>]</small>
</h1><!-- doxytag: class="Wt::WSelectionBox" --><!-- doxytag: inherits="Wt::WComboBox" -->A selection box allows selection from a list of options.
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WSelectionBox></code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WSelectionBox:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WSelectionBox__inherit__graph.png" border="0" usemap="#Wt_1_1WSelectionBox__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WSelectionBox__inherit__map">
<area shape="rect" href="classWt_1_1WComboBox.html" title="A widget that provides a drop-down combo-box control." alt="" coords="16,379,136,405"><area shape="rect" href="classWt_1_1WFormWidget.html" title="An abstract widget that corresponds to an HTML form element." alt="" coords="12,304,140,331"><area shape="rect" href="classWt_1_1WInteractWidget.html" title="An abstract widget that can receive user-interface interaction." alt="" coords="5,229,147,256"><area shape="rect" href="classWt_1_1WWebWidget.html" title="A base class for widgets with an HTML counterpart." alt="" coords="15,155,137,181"><area shape="rect" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component." alt="" coords="28,80,124,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="28,5,124,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classWt_1_1WSelectionBox-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="079089ad7d220d5fd2b17d342fd65375"></a><!-- doxytag: member="Wt::WSelectionBox::WSelectionBox" ref="079089ad7d220d5fd2b17d342fd65375" args="(WContainerWidget *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#079089ad7d220d5fd2b17d342fd65375">WSelectionBox</a> (<a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#0aa28564501cd4c2653fdc45c4fd1a20">verticalSize</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the number of items that are visible. <a href="#0aa28564501cd4c2653fdc45c4fd1a20"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="90bcf3611a6f54e0358b7f208b0cb478"></a><!-- doxytag: member="Wt::WSelectionBox::setVerticalSize" ref="90bcf3611a6f54e0358b7f208b0cb478" args="(int items)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#90bcf3611a6f54e0358b7f208b0cb478">setVerticalSize</a> (int items)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of items that are visible. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#a3119417024e25b7b24e66cab17edb31">setSelectionMode</a> (<a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a> mode)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the selection mode. <a href="#a3119417024e25b7b24e66cab17edb31"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#22a94e26ce301d967efa0893093f73c9">selectionMode</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the selection mode. <a href="#22a94e26ce301d967efa0893093f73c9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const std::set< int > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#e27b849b2eeef1bf35ddbaca3659e539">selectedIndexes</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the current selection (in <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode). <a href="#e27b849b2eeef1bf35ddbaca3659e539"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#4fcb25c6d7c00f5659959180df9a337c">setSelectedIndexes</a> (const std::set< int > &selection)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the selection (in <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode). <a href="#4fcb25c6d7c00f5659959180df9a337c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSelectionBox.html#2925ed26e7e56d8ce7bca40dc338f5e0">clearSelection</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clears the current selection. <a href="#2925ed26e7e56d8ce7bca40dc338f5e0"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A selection box allows selection from a list of options.
<p>
By default, a selection box may be used to let the user select one item from a list. This may be changed to multiple selection mode using <a class="el" href="classWt_1_1WSelectionBox.html#a3119417024e25b7b24e66cab17edb31" title="Sets the selection mode.">setSelectionMode()</a>.<p>
The current selection may be set and read using <a class="el" href="classWt_1_1WComboBox.html#903e2d98c6860fe09198bdb43f0566bd" title="Changes the current selection.">setCurrentIndex()</a> and <a class="el" href="classWt_1_1WComboBox.html#94b6a87121adab0abbf23562d35a716e" title="Returns the currently selected item.">currentIndex()</a>, for <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc4fd3c5ba6ce5289a1e732d85f002882a">SingleSelection</a> mode, or <a class="el" href="classWt_1_1WSelectionBox.html#4fcb25c6d7c00f5659959180df9a337c" title="Sets the selection (in Wt::ExtendedSelection mode).">setSelectedIndexes()</a> and <a class="el" href="classWt_1_1WSelectionBox.html#e27b849b2eeef1bf35ddbaca3659e539" title="Returns the current selection (in Wt::ExtendedSelection mode).">selectedIndexes()</a> for <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode. The <a class="el" href="classWt_1_1WComboBox.html#c39b46ccd8134a5397b4cbd87dc9f01f" title="Signal emitted when the selection changed.">activated()</a> and <a class="el" href="classWt_1_1WComboBox.html#06401499734540c65db26fceb60bfdbf" title="Signal emitted when the selection changed.">sactivated()</a> signals are not emited in the <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode, use the <a class="el" href="classWt_1_1WFormWidget.html#5216ba1594b5dc525cc47cad593c7ba8" title="Signal emitted when the value was changed.">changed()</a> signal <a class="el" href="classWt_1_1WFormWidget.html#5216ba1594b5dc525cc47cad593c7ba8" title="Signal emitted when the value was changed.">changed()</a>.<p>
WSelectionBox is an MVC view class, using a simple string list model by default. The model may be populated using <a class="el" href="classWt_1_1WComboBox.html#9b2308a7d962ceb17c1ee32627b106d4" title="Adds an option item.">WComboBox::addItem()</a> or <a class="el" href="classWt_1_1WComboBox.html#2092c15c7c0c2f77342d0abdc393ca6b" title="Inserts an item at the specified position.">WComboBox::insertItem()</a> and the contents can be cleared through <a class="el" href="classWt_1_1WComboBox.html#0ed207e9616b51089d97030cc767409d" title="Clears all items.">clear()</a>. These methods manipulate the underlying <a class="el" href="classWt_1_1WComboBox.html#20b54b2271b0219c2375775538d454a3" title="Returns the data model.">model()</a>.<p>
To use the selectionbox with a custom model instead of the default <a class="el" href="classWt_1_1WStringListModel.html" title="An model that manages a list of strings.">WStringListModel</a>, use <a class="el" href="classWt_1_1WComboBox.html#3d10438b053fe43dcd05e66b7ca78826" title="Sets the model to be used for the items.">setModel()</a>.<p>
Usage example: <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WSelectionBox.html" title="A selection box allows selection from a list of options.">Wt::WSelectionBox</a> *selectionBox = <span class="keyword">new</span> <a class="code" href="classWt_1_1WSelectionBox.html" title="A selection box allows selection from a list of options.">Wt::WSelectionBox</a>(<span class="keyword">this</span>);
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#9b2308a7d962ceb17c1ee32627b106d4" title="Adds an option item.">addItem</a>(<span class="stringliteral">"Clint Eastwood"</span>);
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#9b2308a7d962ceb17c1ee32627b106d4" title="Adds an option item.">addItem</a>(<span class="stringliteral">"Mick Jagger"</span>);
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#9b2308a7d962ceb17c1ee32627b106d4" title="Adds an option item.">addItem</a>(<span class="stringliteral">"Johnny Depp"</span>);
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#9b2308a7d962ceb17c1ee32627b106d4" title="Adds an option item.">addItem</a>(<span class="stringliteral">"Kate Winslet"</span>);
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#903e2d98c6860fe09198bdb43f0566bd" title="Changes the current selection.">setCurrentIndex</a>(2); <span class="comment">// Johnny Depp</span>
selectionBox-><a class="code" href="classWt_1_1WComboBox.html#c39b46ccd8134a5397b4cbd87dc9f01f" title="Signal emitted when the selection changed.">activated</a>().connect(SLOT(<span class="keyword">this</span>, MyWidget::comboChanged));
</pre></div><p>
WSelectionBox is an <a class="el" href="classWt_1_1WWidget.html#c78e3af143883334c82031790c87416e">inline </a> widget.<p>
<h3>CSS</h3>
<p>
The widget corresponds to the HTML <code><select></code> tag and does not provide styling. It can be styled using inline or external CSS as appropriate. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="0aa28564501cd4c2653fdc45c4fd1a20"></a><!-- doxytag: member="Wt::WSelectionBox::verticalSize" ref="0aa28564501cd4c2653fdc45c4fd1a20" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Wt::WSelectionBox::verticalSize </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the number of items that are visible.
<p>
If more items are available, a scroll-bar is provided.
</div>
</div><p>
<a class="anchor" name="a3119417024e25b7b24e66cab17edb31"></a><!-- doxytag: member="Wt::WSelectionBox::setSelectionMode" ref="a3119417024e25b7b24e66cab17edb31" args="(SelectionMode mode)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSelectionBox::setSelectionMode </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a> </td>
<td class="paramname"> <em>mode</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the selection mode.
<p>
The default selection mode is SingleSelection. You can change to <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> to allow selection of multiple items.
</div>
</div><p>
<a class="anchor" name="22a94e26ce301d967efa0893093f73c9"></a><!-- doxytag: member="Wt::WSelectionBox::selectionMode" ref="22a94e26ce301d967efa0893093f73c9" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a> Wt::WSelectionBox::selectionMode </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the selection mode.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WSelectionBox.html#a3119417024e25b7b24e66cab17edb31" title="Sets the selection mode.">setSelectionMode(SelectionMode)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e27b849b2eeef1bf35ddbaca3659e539"></a><!-- doxytag: member="Wt::WSelectionBox::selectedIndexes" ref="e27b849b2eeef1bf35ddbaca3659e539" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::set<int>& Wt::WSelectionBox::selectedIndexes </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the current selection (in <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode).
<p>
Get the list of currently selected items. This method is only defined when <a class="el" href="classWt_1_1WSelectionBox.html#22a94e26ce301d967efa0893093f73c9" title="Returns the selection mode.">selectionMode()</a> is <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a>. Otherwise, you should use <a class="el" href="classWt_1_1WComboBox.html#94b6a87121adab0abbf23562d35a716e" title="Returns the currently selected item.">currentIndex()</a> to get item currently selected.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WComboBox.html#94b6a87121adab0abbf23562d35a716e" title="Returns the currently selected item.">currentIndex()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="4fcb25c6d7c00f5659959180df9a337c"></a><!-- doxytag: member="Wt::WSelectionBox::setSelectedIndexes" ref="4fcb25c6d7c00f5659959180df9a337c" args="(const std::set< int > &selection)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSelectionBox::setSelectedIndexes </td>
<td>(</td>
<td class="paramtype">const std::set< int > & </td>
<td class="paramname"> <em>selection</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the selection (in <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode).
<p>
For an <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc7784d55577e92022399052c3d4d69954" title="Multiple selection.">Wt::ExtendedSelection</a> mode, set the list of currently selected items.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WSelectionBox.html#e27b849b2eeef1bf35ddbaca3659e539" title="Returns the current selection (in Wt::ExtendedSelection mode).">selectedIndexes()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="2925ed26e7e56d8ce7bca40dc338f5e0"></a><!-- doxytag: member="Wt::WSelectionBox::clearSelection" ref="2925ed26e7e56d8ce7bca40dc338f5e0" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSelectionBox::clearSelection </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Clears the current selection.
<p>
Clears the current selection.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WComboBox.html#903e2d98c6860fe09198bdb43f0566bd" title="Changes the current selection.">setCurrentIndex()</a>, <a class="el" href="classWt_1_1WSelectionBox.html#4fcb25c6d7c00f5659959180df9a337c" title="Sets the selection (in Wt::ExtendedSelection mode).">setSelectedIndexes()</a> </dd></dl>
</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:07 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>
|