📄 gtkfilechooserdialog.html
字号:
</div></div><br class="example-break"><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="gtkfilechooserdialog-response-codes"></a>Response Codes</h2></div></div></div><p> <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a> inherits from <a class="link" href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>, so buttons that go in its action area have response codes such as <a class="link" href="GtkDialog.html#GTK-RESPONSE-ACCEPT:CAPS"><span class="type">GTK_RESPONSE_ACCEPT</span></a> and <a class="link" href="GtkDialog.html#GTK-RESPONSE-CANCEL:CAPS"><span class="type">GTK_RESPONSE_CANCEL</span></a>. For example, you could call <a class="link" href="GtkFileChooserDialog.html#gtk-file-chooser-dialog-new"><code class="function">gtk_file_chooser_dialog_new()</code></a> as follows: </p><pre class="programlisting">GtkWidget *dialog;dialog = gtk_file_chooser_dialog_new ("Open File", parent_window, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); </pre><p> This will create buttons for "Cancel" and "Open" that use stock response identifiers from <a class="link" href="GtkDialog.html#GtkResponseType"><span class="type">GtkResponseType</span></a>. For most dialog boxes you can use your own custom response codes rather than the ones in <a class="link" href="GtkDialog.html#GtkResponseType"><span class="type">GtkResponseType</span></a>, but <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a> assumes that its "accept"-type action, e.g. an "Open" or "Save" button, <span class="emphasis"><em>will</em></span> have one of the following response codes: <a name="gtkfilechooserdialog-responses"></a></p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="link" href="GtkDialog.html#GTK-RESPONSE-ACCEPT:CAPS"><span class="type">GTK_RESPONSE_ACCEPT</span></a></td></tr><tr><td><a class="link" href="GtkDialog.html#GTK-RESPONSE-OK:CAPS"><span class="type">GTK_RESPONSE_OK</span></a></td></tr><tr><td><a class="link" href="GtkDialog.html#GTK-RESPONSE-YES:CAPS"><span class="type">GTK_RESPONSE_YES</span></a></td></tr><tr><td><a class="link" href="GtkDialog.html#GTK-RESPONSE-APPLY:CAPS"><span class="type">GTK_RESPONSE_APPLY</span></a></td></tr></table><p> </p><p> This is because <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a> must intercept responses and switch to folders if appropriate, rather than letting the dialog terminate — the implementation uses these known response codes to know which responses can be blocked if appropriate. </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> To summarize, make sure you use a <a class="link" href="GtkFileChooserDialog.html#gtkfilechooserdialog-responses">stock response code</a> when you use <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a> to ensure proper operation. </p></div></div></div><div class="refsect1" lang="en"><a name="id4037988"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id4037998"></a><h3><a name="GtkFileChooserDialog-struct"></a>GtkFileChooserDialog</h3><a class="indexterm" name="id4038012"></a><pre class="programlisting">typedef struct _GtkFileChooserDialog GtkFileChooserDialog;</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id4038028"></a><h3><a name="gtk-file-chooser-dialog-new"></a>gtk_file_chooser_dialog_new ()</h3><a class="indexterm" name="id4038043"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_file_chooser_dialog_new (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *title, <a class="link" href="GtkWindow.html" title="GtkWindow">GtkWindow</a> *parent, <a class="link" href="GtkFileChooser.html#GtkFileChooserAction">GtkFileChooserAction</a> action, const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *first_button_text, ...);</pre><p>Creates a new <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a>. This function is analogous to<a class="link" href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</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>title</code></em> :</span></p></td><td> Title of the dialog, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td><td> Transient parent of the dialog, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td><td> Open or save mode for the dialog</td></tr><tr><td><p><span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></p></td><td> stock ID or text to go in the first button, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td> response ID for the first button, then additional (button, id) pairs, ending with <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></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="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a></td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id4038262"></a><h3><a name="gtk-file-chooser-dialog-new-with-backend"></a>gtk_file_chooser_dialog_new_with_backend ()</h3><a class="indexterm" name="id4038279"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_file_chooser_dialog_new_with_backend (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *title, <a class="link" href="GtkWindow.html" title="GtkWindow">GtkWindow</a> *parent, <a class="link" href="GtkFileChooser.html#GtkFileChooserAction">GtkFileChooserAction</a> action, const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *backend, const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *first_button_text, ...);</pre><p>Creates a new <a class="link" href="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a> with a specified backend. This isespecially useful if you use <a class="link" href="GtkFileChooser.html#gtk-file-chooser-set-local-only"><code class="function">gtk_file_chooser_set_local_only()</code></a> to allownon-local files and you use a more expressive vfs, such as gnome-vfs,to load files.</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>title</code></em> :</span></p></td><td> Title of the dialog, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td><td> Transient parent of the dialog, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td><td> Open or save mode for the dialog</td></tr><tr><td><p><span class="term"><em class="parameter"><code>backend</code></em> :</span></p></td><td> The name of the specific filesystem backend to use.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></p></td><td> stock ID or text to go in the first button, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td> response ID for the first button, then additional (button, id) pairs, ending with <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></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="GtkFileChooserDialog.html" title="GtkFileChooserDialog"><span class="type">GtkFileChooserDialog</span></a></td></tr></tbody></table></div><p class="since">Since 2.4</p></div></div><div class="refsect1" lang="en"><a name="id4038525"></a><h2>See Also</h2><p> <a class="link" href="GtkFileChooser.html" title="GtkFileChooser"><span class="type">GtkFileChooser</span></a>, <a class="link" href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> </p></div><div class="refsect1" lang="en"><a name="id4038551"></a><div class="refsect2" lang="en"><a name="id4038552"></a></div><hr><div class="refsect2" lang="en"><a name="id4038553"></a></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -