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

📄 gtkfileselection.html

📁 该压缩包包含了GTK+的大量API函数
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><HEAD><TITLE>GtkFileSelection</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="GTK+ Reference Manual"HREF="index.html"><LINKREL="UP"TITLE="GTK+ Widgets and Objects"HREF="gtkobjects.html"><LINKREL="PREVIOUS"TITLE="GtkEventBox"HREF="gtkeventbox.html"><LINKREL="NEXT"TITLE="GtkFixed"HREF="gtkfixed.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">GTK+ Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="gtkeventbox.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>&#60;&#60;&#60; Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="index.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="gtkobjects.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="gtkfixed.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page &#62;&#62;&#62;</B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="GTKFILESELECTION">GtkFileSelection</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN25685"></A><H2>Name</H2>GtkFileSelection&nbsp;--&nbsp;prompt the user for a file or directory name.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN25688"></A><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS">&#13;#include &lt;gtk/gtk.h&gt;struct      <AHREF="gtkfileselection.html#GTKFILESELECTION-STRUCT">GtkFileSelection</A>;<AHREF="gtkwidget.html">GtkWidget</A>*  <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-NEW">gtk_file_selection_new</A>          (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *title);void        <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-SET-FILENAME">gtk_file_selection_set_filename</A> (<AHREF="gtkfileselection.html">GtkFileSelection</A> *filesel,                                             const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *filename);<AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A>*      <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-GET-FILENAME">gtk_file_selection_get_filename</A> (<AHREF="gtkfileselection.html">GtkFileSelection</A> *filesel);void        <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-COMPLETE">gtk_file_selection_complete</A>     (<AHREF="gtkfileselection.html">GtkFileSelection</A> *filesel,                                             const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *pattern);void        <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-SHOW-FILEOP-BUTTONS">gtk_file_selection_show_fileop_buttons</A>                                            (<AHREF="gtkfileselection.html">GtkFileSelection</A> *filesel);void        <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-HIDE-FILEOP-BUTTONS">gtk_file_selection_hide_fileop_buttons</A>                                            (<AHREF="gtkfileselection.html">GtkFileSelection</A> *filesel);&#13;</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN25708"></A><H2>Object Hierarchy</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS">&#13;  <AHREF="gtkobject.html">GtkObject</A>   +----<AHREF="gtkwidget.html">GtkWidget</A>         +----<AHREF="gtkcontainer.html">GtkContainer</A>               +----<AHREF="gtkbin.html">GtkBin</A>                     +----<AHREF="gtkwindow.html">GtkWindow</A>                           +----GtkFileSelection</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN25716"></A><H2>Description</H2><P>GtkFileSelection should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list or the drop-down history menu. Alternatively, the TAB key can be used to navigate using filename completion - common in text based editors such as emacs and jed.</P><P>File selection dialogs are created with a call to <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-NEW">gtk_file_selection_new</A>().</P><P>The default filename can be set using <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-SET-FILENAME">gtk_file_selection_set_filename</A>() and the selected filename retrieved using <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-GET-FILENAME">gtk_file_selection_get_filename</A>().</P><P>Use <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-COMPLETE">gtk_file_selection_complete</A>() to display files that match a given pattern. This can be used for example, to show only *.txt files, or only files beginning with gtk*.</P><P>Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-HIDE-FILEOP-BUTTONS">gtk_file_selection_hide_fileop_buttons</A>() and shown again using <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-SHOW-FILEOP-BUTTONS">gtk_file_selection_show_fileop_buttons</A>().</P><P><DIVCLASS="EXAMPLE"><ANAME="AEN25730"></A><P><B>Example 1. Getting a filename from the user</B></P><TABLEBORDER="0"BGCOLOR="#D8F8D8"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">&#13;/* The file selection widget and the string to store the chosen filename */GtkWidget *file_selector;gchar *selected_filename;void store_filename(GtkFileSelection *selector, gpointer user_data) {   selected_filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION(file_selector));}void create_file_selection(void) {   /* Create the selector */      file_selector = gtk_file_selection_new("Please select a file for editing.");      gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)-&#62;ok_button),   			   "clicked", GTK_SIGNAL_FUNC (store_filename), NULL);   			      /* Ensure that the dialog box is destroyed when the user clicks a button. */      gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)-&#62;ok_button),   					  "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),   					  (gpointer) file_selector);   gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)-&#62;cancel_button),   					  "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),   					  (gpointer) file_selector);      /* Display that dialog */      gtk_widget_show (file_selector);}&#13;</PRE></TD></TR></TABLE></DIV></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN25733"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN25735"></A><H3><ANAME="GTKFILESELECTION-STRUCT"></A>struct GtkFileSelection</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkFileSelection;</PRE></TD></TR></TABLE><P>The <AHREF="gtkfileselection.html">GtkFileSelection</A> struct contains the following <AHREF="gtkwidget.html">GtkWidget</A> fields:<DIVCLASS="INFORMALTABLE"><ANAME="AEN25742"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFF0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="LEFT"VALIGN="TOP">*fileop_dialog;</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the dialog box used to display the <AHREF="gtkfileselection.html">GtkFileSelection</A>. It can be customized by adding/removing widgets from it using the standard <AHREF="gtkdialog.html">GtkDialog</A> functions.</TD></TR><TR><TDWIDTH="20%"ALIGN="LEFT"VALIGN="TOP">*dir_list, *file_list;</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the two <AHREF="gtkclist.html">GtkCList</A> widgets corresponding to directories and files.</TD></TR><TR><TDWIDTH="20%"ALIGN="LEFT"VALIGN="TOP">*ok_button, *cancel_button;</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the two main buttons that signals should be connected to in order to perform an action when the user hits either OK or Cancel.</TD></TR><TR><TDWIDTH="20%"ALIGN="LEFT"VALIGN="TOP">*history_pulldown;</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the <AHREF="gtkoptionmenu.html">GtkOptionMenu</A> used to create the drop-down directory history.</TD></TR><TR><TDWIDTH="20%"ALIGN="LEFT"VALIGN="TOP">*fileop_c_dir, *fileop_del_file, *fileop_ren_file;</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the buttons that appear at the top of the file selection dialog. These "operation buttons" can be hidden and redisplayed with <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-HIDE-FILEOP-BUTTONS">gtk_file_selection_hide_fileop_buttons</A>() and  <AHREF="gtkfileselection.html#GTK-FILE-SELECTION-SHOW-FILEOP-BUTTONS">gtk_file_selection_show_fileop_buttons</A>() respectively.</TD></TR></TBODY></TABLE><P></P></DIV>&#13;</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN25768"></A><H3><ANAME="GTK-FILE-SELECTION-NEW"></A>gtk_file_selection_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>*  gtk_file_selection_new          (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *title);</PRE></TD></TR></TABLE><P>Creates a new file selection dialog box. By default it will contain a <AHREF="gtkclist.html">GtkCList</A> of the application's current working directory, and a file listing. Operation buttons that allow the user to create a directory, delete files and rename files, are also present.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN25776"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>title</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a message that will be placed in the file requestor's titlebar.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the new file selection.&#13;</TD></TR></TBODY

⌨️ 快捷键说明

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