⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkspinbutton.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<div class="refsect1" lang="en"><a name="id3547042"></a><h2>Signals</h2><pre class="synopsis">  "<a class="link" href="GtkSpinButton.html#GtkSpinButton-change-value">change-value</a>"                                   : Run Last / Action  "<a class="link" href="GtkSpinButton.html#GtkSpinButton-input">input</a>"                                          : Run Last  "<a class="link" href="GtkSpinButton.html#GtkSpinButton-output">output</a>"                                         : Run Last  "<a class="link" href="GtkSpinButton.html#GtkSpinButton-value-changed">value-changed</a>"                                  : Run Last  "<a class="link" href="GtkSpinButton.html#GtkSpinButton-wrapped">wrapped</a>"                                        : Run Last</pre></div><div class="refsect1" lang="en"><a name="id3547113"></a><h2>Description</h2><p>A <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a <a class="link" href="GtkEntry.html" title="GtkEntry"><span class="type">GtkEntry</span></a>, <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range.</p><p>The main properties of a <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> are through a <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>. See the <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a> section for more details about an adjustment's properties.</p><p></p><div class="example"><a name="id3547187"></a><p class="title"><b>Example&#160;12.&#160;Using a <span class="structname">GtkSpinButton</span> to get an integer.</b></p><div class="example-contents"><pre class="programlisting">/* Provides a function to retrieve an integer value from a GtkSpinButton * and creates a spin button to model percentage values. */gint grab_int_value (GtkSpinButton *a_spinner, gpointer user_data) {   return gtk_spin_button_get_value_as_int (a_spinner);}void create_integer_spin_button (void) {   GtkWidget *window, *spinner;   GtkAdjustment *spinner_adj;   spinner_adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 5.0);      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);   gtk_container_set_border_width (GTK_CONTAINER (window), 5);      /* creates the spinner, with no decimal places */   spinner = gtk_spin_button_new (spinner_adj, 1.0, 0);   gtk_container_add (GTK_CONTAINER (window), spinner);      gtk_widget_show_all (window);   return;}</pre></div></div><p><br class="example-break"></p><p></p><div class="example"><a name="id3547220"></a><p class="title"><b>Example&#160;13.&#160;Using a <span class="structname">GtkSpinButton</span> to get a floating point value.</b></p><div class="example-contents"><pre class="programlisting">/* Provides a function to retrieve a floating point value from a * GtkSpinButton, and creates a high precision spin button. */gfloat grab_int_value (GtkSpinButton *a_spinner, gpointer user_data) {   return gtk_spin_button_get_value (a_spinner);}void create_floating_spin_button (void) {   GtkWidget *window, *spinner;   GtkAdjustment *spinner_adj;   spinner_adj = (GtkAdjustment *) gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.1);      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);   gtk_container_set_border_width (GTK_CONTAINER (window), 5);      /* creates the spinner, with three decimal places */   spinner = gtk_spin_button_new (spinner_adj, 0.001, 3);   gtk_container_add (GTK_CONTAINER (window), spinner);      gtk_widget_show_all (window);   return;}</pre></div></div><p><br class="example-break"></p></div><div class="refsect1" lang="en"><a name="id3547252"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3547262"></a><h3><a name="GtkSpinButton-struct"></a>GtkSpinButton</h3><a class="indexterm" name="id3547276"></a><pre class="programlisting">typedef struct _GtkSpinButton GtkSpinButton;</pre><p><em class="structfield"><code>entry</code></em> is the <a class="link" href="GtkEntry.html" title="GtkEntry"><span class="type">GtkEntry</span></a> part of the <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> widget, and can be used accordingly. All other fields contain private data and should only be modified using the functions below.</p></div><hr><div class="refsect2" lang="en"><a name="id3547314"></a><h3><a name="GtkSpinButtonUpdatePolicy"></a>enum GtkSpinButtonUpdatePolicy</h3><a class="indexterm" name="id3547327"></a><pre class="programlisting">typedef enum{  GTK_UPDATE_ALWAYS,  GTK_UPDATE_IF_VALID} GtkSpinButtonUpdatePolicy;</pre><p></p><div class="informaltable"><table width="100%" border="0"><colgroup><col><col></colgroup><tbody><tr><td>GTK_UPDATE_ALWAYS</td><td>When refreshing your <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a>, the value is always displayed.</td></tr><tr><td>GTK_UPDATE_IF_VALID</td><td>When refreshing your <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a>, the value is only displayed if it is valid within the bounds of the spin button's <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>.</td></tr></tbody></table></div><p></p></div><hr><div class="refsect2" lang="en"><a name="id3547417"></a><h3><a name="GtkSpinType"></a>enum GtkSpinType</h3><a class="indexterm" name="id3547430"></a><pre class="programlisting">typedef enum{  GTK_SPIN_STEP_FORWARD,  GTK_SPIN_STEP_BACKWARD,  GTK_SPIN_PAGE_FORWARD,  GTK_SPIN_PAGE_BACKWARD,  GTK_SPIN_HOME,  GTK_SPIN_END,  GTK_SPIN_USER_DEFINED} GtkSpinType;</pre><p></p><div class="informaltable"><table width="100%" border="0"><colgroup><col><col></colgroup><tbody><tr><td>GTK_SPIN_STEP_FORWARD, GTK_SPIN_STEP_BACKWARD, GTK_SPIN_PAGE_FORWARD, GTK_SPIN_PAGE_BACKWARD</td><td>These values spin a <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> by the relevant values of the spin button's <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>.</td></tr><tr><td>GTK_SPIN_HOME, GTK_SPIN_END</td><td>These set the spin button's value to the minimum or maxmimum possible values, (set by its <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>), respectively.</td></tr><tr><td>GTK_SPIN_USER_DEFINED</td><td>The programmer must specify the exact amount to spin the <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a>.</td></tr></tbody></table></div><p></p></div><hr><div class="refsect2" lang="en"><a name="id3547539"></a><h3><a name="gtk-spin-button-configure"></a>gtk_spin_button_configure ()</h3><a class="indexterm" name="id3547552"></a><pre class="programlisting">void                gtk_spin_button_configure           (<a class="link" href="GtkSpinButton.html" title="GtkSpinButton">GtkSpinButton</a> *spin_button,                                                         <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *adjustment,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble">gdouble</a> climb_rate,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> digits);</pre><p>Changes the properties of an existing spin button. The adjustment, climb rate, and number of decimal places are all changed accordingly, after this function call.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>spin_button</code></em>&#160;:</span></p></td><td>a <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>adjustment</code></em>&#160;:</span></p></td><td>a <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>climb_rate</code></em>&#160;:</span></p></td><td>the new climb rate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>digits</code></em>&#160;:</span></p></td><td>the number of decimal places to display in the spin button.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3547684"></a><h3><a name="gtk-spin-button-new"></a>gtk_spin_button_new ()</h3><a class="indexterm" name="id3547697"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>*          gtk_spin_button_new                 (<a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *adjustment,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble">gdouble</a> climb_rate,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> digits);</pre><p>Creates a new <a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>adjustment</code></em>&#160;:</span></p></td><td>the <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a> object that this spin button should use.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>climb_rate</code></em>&#160;:</span></p></td><td>specifies how much the spin button changes when an arrow is clicked on.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>digits</code></em>&#160;:</span></p></td><td>the number of decimal places to display.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td>The new spin button as a <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a>.</td></tr></tbody>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -