📄 cha-dialogs-special.html
字号:
</tr> </table> <p> <code><code class="FUNCDEF">GtkWidget* <tt class= "FUNCTION"> gnome_property_box_new</tt></code>(void);</code> </p> <p> <code><code class="FUNCDEF">gint <tt class= "FUNCTION"> gnome_property_box_append_page</tt></code>(GnomePropertyBox* <tt class="PARAMETER"><i>pb</i></tt>, GtkWidget* <tt class="PARAMETER"><i>page</i></tt>, GtkWidget* <tt class="PARAMETER"><i>tab</i></tt>);</code> </p> </div> <p> <b>Figure 8. <tt class="CLASSNAME"> GnomePropertyBox</tt></b> </p> </div> <p> You then create a widget for each page (probably a container with a number of controls inside), and append it to the property box with <tt class="FUNCTION"> gnome_property_box_append_page()</tt> (<a href= "cha-dialogs-special.html#FL-PROPERTYBOX">Figure 8</a>). Its <span class="STRUCTNAME">page</span> argument is the widget to place inside the new notebook page, and <span class="STRUCTNAME">tab</span> is a widget to use on the notebook tab. The page number of the newly-added page is returned, so you don't have to keep a count yourself. </p> <p> It's your responsibility to keep track of any user interaction with the contents of each page. When the user changes a setting, you must notify the property box; it uses this information to set the "Apply" and "OK" buttons sensitive if and only if there are unapplied changes. The relevant routines are in <a href= "cha-dialogs-special.html#FL-PROPBOXCHANGED">Figure 9</a>. </p> <div class="FIGURE"> <a name="FL-PROPBOXCHANGED"></a> <div class="FUNCSYNOPSIS"> <a name="FL-PROPBOXCHANGED.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO"> #include <libgnomeui/gnome-propertybox.h> </pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_property_box_changed</tt></code>(GnomePropertyBox* <tt class="PARAMETER"><i>pb</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_property_box_set_state</tt></code>(GnomePropertyBox* <tt class="PARAMETER"><i>pb</i></tt>, gboolean <tt class="PARAMETER"><i>setting</i></tt>);</code> </p> </div> <p> <b>Figure 9. Property Box State</b> </p> </div> <p> <tt class="FUNCTION">gnome_property_box_changed()</tt> tells the property box about changes; the property box will automatically unset its internal "changes pending" flag when <span class="SYMBOL">"apply"</span> is emitted. If you need to change that internal flag for some reason (unlikely), you can use <tt class="FUNCTION"> gnome_property_box_set_state()</tt>. </p> </div> <div class="SECT2"> <h2 class="SECT2"> <a name="SEC-MESSAGEBOX"><tt class="CLASSNAME"> GnomeMessageBox</tt></a> </h2> <p> A <tt class="CLASSNAME">GnomeMessageBox</tt> is a <tt class="CLASSNAME">GnomeDialog</tt> subclass that conveys a short message or asks a simple question. Gnome provides several "types" of message box; they have different icons next to the text, and corresponding titles. The icons look nice, and allow users to quickly classify the message being presented. </p> <p> The API is very simple; there are no functions specific to <tt class="CLASSNAME">GnomeMessageBox</tt> other than the constructor, in <a href= "cha-dialogs-special.html#FL-MSGBOX">Figure 10</a>. The first argument is the message to display; the second is a string encoding the message box type. Then you can list any buttons, just as you would with <tt class="FUNCTION"> gnome_dialog_new()</tt>. Unlike the unadorned <tt class= "CLASSNAME">GnomeDialog</tt>, <tt class="CLASSNAME"> GnomeMessageBox</tt> closes on any button click by default. Of course you can change this behavior using <tt class="FUNCTION">gnome_dialog_set_close()</tt>. </p> <div class="FIGURE"> <a name="FL-MSGBOX"></a> <div class="FUNCSYNOPSIS"> <a name="FL-MSGBOX.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO"> #include <libgnomeui/gnome-messagebox.h> </pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">GtkWidget* <tt class= "FUNCTION">gnome_message_box_new</tt></code> (const gchar* <tt class="PARAMETER"><i>message</i></tt>, const gchar* <tt class="PARAMETER"><i> messagebox_type</i></tt>, <tt class="PARAMETER"><i> ...</i></tt>);</code> </p> </div> <p> <b>Figure 10. Message Box Constructor</b> </p> </div> <p> Macros are provided for the available message box types. </p> <ul> <li> <p> <tt class="FUNCTION">GNOME_MESSAGE_BOX_INFO</tt> should be used for "FYI" messages. </p> </li> <li> <p> <tt class="FUNCTION">GNOME_MESSAGE_BOX_WARNING</tt> should be used for nonfatal errors. </p> </li> <li> <p> <tt class="FUNCTION">GNOME_MESSAGE_BOX_ERROR</tt> should be used if an operation fails entirely. </p> </li> <li> <p> <tt class="FUNCTION">GNOME_MESSAGE_BOX_QUESTION</tt> should be used if your dialog asks a question. </p> </li> <li> <p> <tt class="FUNCTION">GNOME_MESSAGE_BOX_GENERIC</tt> should be used if none of the other types apply. </p> </li> </ul> <p> Here's how you might use <tt class="CLASSNAME"> GnomeMessageBox</tt>: </p> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="PROGRAMLISTING"> GtkWidget * mbox; mbox = gnome_message_box_new (message, GNOME_MESSAGE_BOX_INFO, GNOME_STOCK_BUTTON_OK, NULL); gtk_widget_show (mbox); </pre> </td> </tr> </table> <p> Notice that <tt class="CLASSNAME">GnomeMessageBox</tt>, like most <tt class="CLASSNAME">GnomeDialog</tt> subclasses but not <tt class="CLASSNAME">GnomeDialog</tt> itself, automatically closes when clicked. So there is no need to destroy it by hand. </p> </div> </div> <div class="NAVFOOTER"> <br> <br> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="z101.html"><font color="#0000ff" size="2"><b> <<< Previous</b></font></a> </td> <td width="25%" colspan="2" bgcolor="#ffffff" align= "center"> <font color="#0000ff" size="2"><b><a href="ggad.html"> <font color="#0000ff" size="2"><b> Home</b></font></a></b></font> </td> <td width="25%" bgcolor="#ffffff" align="right"> <a href="sec-dialogs-convenience.html"><font color= "#0000ff" size="2"><b>Next >>></b></font></a> </td> </tr> <tr> <td colspan="2" align="left"> <font color="#000000" size="2"><b>A Dialog Example</b></font> </td> <td colspan="2" align="right"> <font color="#000000" size="2"><b>Convenience Routines</b></font> </td> </tr> </table> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -