📄 gtkcombobox.html
字号:
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> : Read / Write</pre></div><div class="refsect1" lang="en"><a name="id3868762"></a><h2>Style Properties</h2><pre class="synopsis"> "<a class="link" href="GtkComboBox.html#GtkComboBox--appears-as-list">appears-as-list</a>" <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> : Read "<a class="link" href="GtkComboBox.html#GtkComboBox--arrow-size">arrow-size</a>" <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> : Read "<a class="link" href="GtkComboBox.html#GtkComboBox--shadow-type">shadow-type</a>" <a class="link" href="gtk-Standard-Enumerations.html#GtkShadowType">GtkShadowType</a> : Read</pre></div><div class="refsect1" lang="en"><a name="id3868831"></a><h2>Signals</h2><pre class="synopsis"> "<a class="link" href="GtkComboBox.html#GtkComboBox-changed">changed</a>" : Run Last "<a class="link" href="GtkComboBox.html#GtkComboBox-move-active">move-active</a>" : Run Last / Action "<a class="link" href="GtkComboBox.html#GtkComboBox-popdown">popdown</a>" : Run Last / Action "<a class="link" href="GtkComboBox.html#GtkComboBox-popup">popup</a>" : Run Last / Action</pre></div><div class="refsect1" lang="en"><a name="id3868890"></a><h2>Description</h2><p>A <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> is a widget that allows the user to choose from alist of valid choices. The <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> displays the selected choice. When activated, the <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> displays a popup which allows the user to make a new choice. The style in which the selected value is displayed, and the style of the popup isdetermined by the current theme. It may be similar to a <a class="link" href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>,or similar to a Windows-style combo box.</p><p>Unlike its predecessors <a class="link" href="GtkCombo.html" title="GtkCombo"><span class="type">GtkCombo</span></a> and <a class="link" href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>, the <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a>uses the model-view pattern; the list of valid choices is specified in theform of a tree model, and the display of the choices can be adapted tothe data in the model by using cell renderers, as you would in a tree view.This is possible since <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> implements the <a class="link" href="GtkCellLayout.html" title="GtkCellLayout"><span class="type">GtkCellLayout</span></a> interface.The tree model holding the valid choices is not restricted to a flat list,it can be a real tree, and the popup will reflect the tree structure.</p><p>In addition to the model-view API, <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> offers a simple API which is suitable for text-only combo boxes, and hides the complexity of managingthe data in a model. It consists of the functions <a class="link" href="GtkComboBox.html#gtk-combo-box-new-text"><code class="function">gtk_combo_box_new_text()</code></a>, <a class="link" href="GtkComboBox.html#gtk-combo-box-append-text"><code class="function">gtk_combo_box_append_text()</code></a>, <a class="link" href="GtkComboBox.html#gtk-combo-box-insert-text"><code class="function">gtk_combo_box_insert_text()</code></a>, <a class="link" href="GtkComboBox.html#gtk-combo-box-prepend-text"><code class="function">gtk_combo_box_prepend_text()</code></a>, <a class="link" href="GtkComboBox.html#gtk-combo-box-remove-text"><code class="function">gtk_combo_box_remove_text()</code></a> and <a class="link" href="GtkComboBox.html#gtk-combo-box-get-active-text"><code class="function">gtk_combo_box_get_active_text()</code></a>.</p></div><div class="refsect1" lang="en"><a name="id3869072"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3869083"></a><h3><a name="GtkComboBox-struct"></a>GtkComboBox</h3><a class="indexterm" name="id3869095"></a><pre class="programlisting">typedef struct _GtkComboBox GtkComboBox;</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id3869110"></a><h3><a name="gtk-combo-box-new"></a>gtk_combo_box_new ()</h3><a class="indexterm" name="id3869126"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_combo_box_new (void);</pre><p>Creates a new empty <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> A new <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3869188"></a><h3><a name="gtk-combo-box-new-with-model"></a>gtk_combo_box_new_with_model ()</h3><a class="indexterm" name="id3869204"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_combo_box_new_with_model (<a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a> *model);</pre><p>Creates a new <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a> with the model initialized to <em class="parameter"><code>model</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>model</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> A new <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3869301"></a><h3><a name="gtk-combo-box-get-wrap-width"></a>gtk_combo_box_get_wrap_width ()</h3><a class="indexterm" name="id3869316"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gtk_combo_box_get_wrap_width (<a class="link" href="GtkComboBox.html" title="GtkComboBox">GtkComboBox</a> *combo_box);</pre><p>Returns the wrap width which is used to determine the number of columns for the popup menu. If the wrap width is larger than 1, the combo box is in table mode.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>combo_box</code></em> :</span></p></td><td> A <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the wrap width.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3869394"></a><h3><a name="gtk-combo-box-set-wrap-width"></a>gtk_combo_box_set_wrap_width ()</h3><a class="indexterm" name="id3869410"></a><pre class="programlisting">void gtk_combo_box_set_wrap_width (<a class="link" href="GtkComboBox.html" title="GtkComboBox">GtkComboBox</a> *combo_box, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> width);</pre><p>Sets the wrap width of <em class="parameter"><code>combo_box</code></em> to be <em class="parameter"><code>width</code></em>. The wrap width is basicallythe preferred number of columns when you want the popup to be layed outin a table.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>combo_box</code></em> :</span></p></td><td> A <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td><td> Preferred number of columns</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3869510"></a><h3><a name="gtk-combo-box-get-row-span-column"></a>gtk_combo_box_get_row_span_column ()</h3><a class="indexterm" name="id3869527"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gtk_combo_box_get_row_span_column (<a class="link" href="GtkComboBox.html" title="GtkComboBox">GtkComboBox</a> *combo_box);</pre><p>Returns the column with row span information for <em class="parameter"><code>combo_box</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>combo_box</code></em> :</span></p></td><td> A <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the row span column.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3869608"></a><h3><a name="gtk-combo-box-set-row-span-column"></a>gtk_combo_box_set_row_span_column ()</h3><a class="indexterm" name="id3869625"></a><pre class="programlisting">void gtk_combo_box_set_row_span_column (<a class="link" href="GtkComboBox.html" title="GtkComboBox">GtkComboBox</a> *combo_box, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> row_span);</pre><p>Sets the column with row span information for <em class="parameter"><code>combo_box</code></em> to be <em class="parameter"><code>row_span</code></em>.The row span column contains integers which indicate how many rowsan item should span.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>combo_box</code></em> :</span></p></td><td> A <a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>row_span</code></em> :</span></p></td><td> A column in the model passed during construction.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3869725"></a><h3><a name="gtk-combo-box-get-column-span-column"></a>gtk_combo_box_get_column_span_column ()</h3><a class="indexterm" name="id3869741"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gtk_combo_box_get_column_span_column (<a class="link" href="GtkComboBox.html" title="GtkComboBox">GtkComboBox</a> *combo_box);</pre><p>Returns the column with column span information for <em class="parameter"><code>combo_box</code></em>.</p><p></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -