📄 gtkbutton.html
字号:
<a name="id3491779"></a><h2>Description</h2><p>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget is generally used to attach a function to thatis called when the button is pressed. The various signals and how to usethem are outlined below.</p><p>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget can hold any valid child widget. That is it canhold most any other standard <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a>. The most commonly used child isthe <a class="link" href="GtkLabel.html" title="GtkLabel"><span class="type">GtkLabel</span></a>.</p></div><div class="refsect1" lang="en"><a name="id3491833"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3491843"></a><h3><a name="GtkButton-struct"></a>GtkButton</h3><a class="indexterm" name="id3491856"></a><pre class="programlisting">typedef struct _GtkButton GtkButton;</pre><p>This should not be accessed directly. Use the accessor functions below.</p></div><hr><div class="refsect2" lang="en"><a name="id3491872"></a><h3><a name="gtk-button-new"></a>gtk_button_new ()</h3><a class="indexterm" name="id3491884"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_button_new (void);</pre><p>Creates a new <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget. To add a child widget to the button,use <a class="link" href="GtkContainer.html#gtk-container-add"><code class="function">gtk_container_add()</code></a>.</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>The newly created <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3491949"></a><h3><a name="gtk-button-new-with-label"></a>gtk_button_new_with_label ()</h3><a class="indexterm" name="id3491963"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_button_new_with_label (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *label);</pre><p>Creates a <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget with a <a class="link" href="GtkLabel.html" title="GtkLabel"><span class="type">GtkLabel</span></a> child containing the giventext.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>The text you want the <a class="link" href="GtkLabel.html" title="GtkLabel"><span class="type">GtkLabel</span></a> to hold.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>The newly created <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492052"></a><h3><a name="gtk-button-new-with-mnemonic"></a>gtk_button_new_with_mnemonic ()</h3><a class="indexterm" name="id3492066"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_button_new_with_mnemonic (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *label);</pre><p>Creates a new <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> containing a label.If characters in <em class="parameter"><code>label</code></em> are preceded by an underscore, they are underlined.If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic.Pressing Alt and that key activates the button.</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>label</code></em> :</span></p></td><td> The text of the button, with an underscore in front of the mnemonic character</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="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492154"></a><h3><a name="gtk-button-new-from-stock"></a>gtk_button_new_from_stock ()</h3><a class="indexterm" name="id3492168"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_button_new_from_stock (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *stock_id);</pre><p>Creates a new <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> containing the image and text from a stock item.Some stock ids have preprocessor macros like <a class="link" href="gtk-Stock-Items.html#GTK-STOCK-OK:CAPS"><span class="type">GTK_STOCK_OK</span></a> and<a class="link" href="gtk-Stock-Items.html#GTK-STOCK-APPLY:CAPS"><span class="type">GTK_STOCK_APPLY</span></a>.</p><p>If <em class="parameter"><code>stock_id</code></em> is unknown, then it will be treated as a mnemoniclabel (as for <a class="link" href="GtkButton.html#gtk-button-new-with-mnemonic"><code class="function">gtk_button_new_with_mnemonic()</code></a>).</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>stock_id</code></em> :</span></p></td><td> the name of the stock item </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="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492285"></a><h3><a name="gtk-button-pressed"></a>gtk_button_pressed ()</h3><a class="indexterm" name="id3492298"></a><pre class="programlisting">void gtk_button_pressed (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button);</pre><p>Emits a <a class="link" href="GtkButton.html#GtkButton-pressed"><span class="type">"pressed"</span></a> signal to the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</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>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to send the signal to.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492369"></a><h3><a name="gtk-button-released"></a>gtk_button_released ()</h3><a class="indexterm" name="id3492382"></a><pre class="programlisting">void gtk_button_released (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button);</pre><p>Emits a <a class="link" href="GtkButton.html#GtkButton-released"><span class="type">"released"</span></a> signal to the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</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>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to send the signal to.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492453"></a><h3><a name="gtk-button-clicked"></a>gtk_button_clicked ()</h3><a class="indexterm" name="id3492467"></a><pre class="programlisting">void gtk_button_clicked (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button);</pre><p>Emits a <a class="link" href="GtkButton.html#GtkButton-clicked"><span class="type">"clicked"</span></a> signal to the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</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>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to send the signal to.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492538"></a><h3><a name="gtk-button-enter"></a>gtk_button_enter ()</h3><a class="indexterm" name="id3492550"></a><pre class="programlisting">void gtk_button_enter (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button);</pre><p>Emits a <a class="link" href="GtkButton.html#GtkButton-enter"><span class="type">"enter"</span></a> signal to the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</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>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to send the signal to.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492622"></a><h3><a name="gtk-button-leave"></a>gtk_button_leave ()</h3><a class="indexterm" name="id3492635"></a><pre class="programlisting">void gtk_button_leave (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button);</pre><p>Emits a <a class="link" href="GtkButton.html#GtkButton-leave"><span class="type">"leave"</span></a> signal to the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</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>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to send the signal to.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3492706"></a><h3><a name="gtk-button-set-relief"></a>gtk_button_set_relief ()</h3><a class="indexterm" name="id3492719"></a><pre class="programlisting">void gtk_button_set_relief (<a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a> *button, <a class="link" href="gtk-Standard-Enumerations.html#GtkReliefStyle">GtkReliefStyle</a> newstyle);</pre><p>Sets the relief style of the edges of the given <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> widget.Three styles exist, GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, GTK_RELIEF_NONE.The default style is, as one can guess, GTK_RELIEF_NORMAL.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>button</code></em> :</span></p></td><td>The <a class="link" href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a> you want to set relief styles of.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>newstyle</code></em> :</span></p></td><td>The GtkReliefStyle as described above.</td></tr></tbody>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -