## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --               GtkAda - Ada95 binding for Gtk+/Gnome               --

3.     --                                                                   --

4.     --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --

5.     --                Copyright (C) 2000-2006 AdaCore                    --

6.     --                                                                   --

7.     -- This library is free software; you can redistribute it and/or     --

8.     -- modify it under the terms of the GNU General Public               --

9.     -- License as published by the Free Software Foundation; either      --

10.     -- version 2 of the License, or (at your option) any later version.  --

11.     --                                                                   --

12.     -- This library is distributed in the hope that it will be useful,   --

13.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

14.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

15.     -- General Public License for more details.                          --

16.     --                                                                   --

17.     -- You should have received a copy of the GNU General Public         --

18.     -- License along with this library; if not, write to the             --

19.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

20.     -- Boston, MA 02111-1307, USA.                                       --

21.     --                                                                   --

22.     -- As a special exception, if other files instantiate generics from  --

23.     -- this unit, or you link this unit with other files to produce an   --

24.     -- executable, this  unit  does not  by itself cause  the resulting  --

25.     -- executable to be covered by the GNU General Public License. This  --

26.     -- exception does not however invalidate any other reasons why the   --

27.     -- executable file  might be covered by the  GNU Public License.     --

28.     -----------------------------------------------------------------------

30.     --  <description>

31.     --  A Gtk_File_Selection is a general widget to interactively select file.

32.     --  It displays a dialog in which the user can navigate through directories,

33.     --  select a file, and even manipulate files with operations like removing,

34.     --  renaming,...

35.     --  Currently, only one file can be selected in the dialog.

36.     --  </description>

37.     --  <c_version>2.8.17</c_version>

38.     --  <group>Selectors</group>

39.     --  <testgtk>create_file_selection.adb</testgtk>

40.     --  <screenshot>gtk-file_selection</screenshot>

42.     with Glib.PropertiesTo API docTo specTo body;

43.     with Gtk.BoxTo API docTo specTo body;

44.     with Gtk.ButtonTo API docTo specTo body;

45.     with Gtk.WidgetTo API docTo specTo body;

46.     with Gtk.DialogTo API docTo specTo body;

47.     with GNAT.Strings;

49.     package Gtk.File_SelectionTo API docTo specTo body is

51.        type Gtk_File_Selection_RecordTo API docTo body is new

52.          Gtk.Dialog.Gtk_Dialog_RecordTo API docTo spec with private;

53.        type Gtk_File_Selection is access all Gtk_File_Selection_RecordTo API docTo specTo body'Class;

55.        ------------------------------

56.        -- Operations on the dialog --

57.        ------------------------------

59.        procedure Gtk_NewTo API docTo body

60.          (File_Selection : out Gtk_File_SelectionTo API docTo spec; Title : UTF8_StringTo API docTo spec);

61.        procedure InitializeTo API docTo body

62.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body'Class;

63.           Title          : UTF8_StringTo API docTo spec);

64.        --  Creates or initializes a new file selection dialog.

65.        --  Title is the name of the dialog, as displayed in its title bar.

67.        function Get_TypeTo API docTo body return Gtk.Gtk_TypeTo API docTo spec;

68.        --  Return the internal value associated with a Gtk_File_Selection.

70.        procedure Set_FilenameTo API docTo body

71.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body;

72.           Filename       : UTF8_StringTo API docTo spec);

73.        function Get_FilenameTo API docTo body

74.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body) return UTF8_StringTo API docTo spec;

75.        --  Highlight the given file in the dialog.

76.        --  Note that this does not close the dialog.

77.        --  You can also use this procedure to select the directory to be displayed

78.        --  in the dialog. Along with Complete, this allows you to set some filters

79.        --  in the dialog.

81.        function Get_SelectionsTo API docTo body

82.          (Filesel : access Gtk_File_Selection_RecordTo API docTo specTo body)

83.           return GNAT.Strings.String_List;

84.        --  Retrieves the list of file selections the user has made in the dialog

85.        --  box. This function is intended for use when the user can select multiple

86.        --  files in the file list.

87.        --  The filenames are in the GLib file name encoding. To convert to UTF-8,

88.        --  call g_filename_to_utf8() on each string.

89.        --  The returned value must be freed by the caller

91.        procedure CompleteTo API docTo body

92.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body;

93.           Pattern        : UTF8_StringTo API docTo spec);

94.        --  Set the filter used to display the files.

95.        --  The pattern is displayed in the entry at the bottom of the dialog, and

96.        --  the list of files displayed in the list.

98.        procedure Show_Fileop_ButtonsTo API docTo body

99.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body);

100.        procedure Hide_Fileop_ButtonsTo API docTo body

101.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body);

102.        --  When this function is called, the dialog includes a series of buttons

103.        --  for file operations (create directory, rename a file, delete a file).

105.        procedure Set_Show_File_Op_ButtonsTo API docTo body

106.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body;

107.           Flag           : Boolean);

108.        --  Choose whether to display or not the file operation buttons.

109.        --  If Flag is true, calls Show_Fileop_Buttons, otherwise calls

110.        --  Hide_Fileop_Buttons.

112.        procedure Set_Select_MultipleTo API docTo body

113.          (Filesel         : access Gtk_File_Selection_RecordTo API docTo specTo body;

114.           Select_Multiple : Boolean);

115.        function Get_Select_MultipleTo API docTo body

116.          (Filesel : access Gtk_File_Selection_RecordTo API docTo specTo body)

117.           return Boolean;

118.        --  Sets whether the user is allowed to select multiple files in the file

119.        --  list.

120.        --  Use Get_selections to get the list of selected files.

122.        ------------------------

123.        -- Getting the fields --

124.        ------------------------

125.        --  The following functions are provided to access the fields of the

126.        --  file selection dialog.

127.        --  This dialog is divided into two main areas, the Action_Area which is

128.        --  the top part that contains the list of files, and the button area which

129.        --  is the bottom part that contains the OK and Cancel buttons.

131.        function Get_Action_AreaTo API docTo body

132.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

133.           return Gtk.Box.Gtk_BoxTo API docTo spec;

134.        --  Return the action area.

135.        --  This is the area that contains the list of files, the filter entry,etc.

137.        function Get_Button_AreaTo API docTo body

138.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

139.           return Gtk.Box.Gtk_BoxTo API docTo spec;

140.        --  Return the button area.

141.        --  This is the area that contains the OK and Cancel buttons.

143.        function Get_Dir_ListTo API docTo body

144.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

145.           return Gtk.Widget.Gtk_WidgetTo API docTo spec;

146.        --  Return the list that display the list of directories.

148.        function Get_File_ListTo API docTo body

149.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

150.           return Gtk.Widget.Gtk_WidgetTo API docTo spec;

151.        --  Return the list that display the list of files in the selected directory

153.        function Get_Cancel_ButtonTo API docTo body

154.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

155.           return Gtk.Button.Gtk_ButtonTo API docTo spec;

156.        --  Return the Cancel button.

157.        --  To remove this button from the dialog, call Hide on the return value.

158.        --  The callbacks on this button should simply close the dialog, but should

159.        --  ignore the file selected by the user.

161.        function Get_Help_ButtonTo API docTo body

162.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

163.           return Gtk.Button.Gtk_ButtonTo API docTo spec;

164.        --  Return the Help button.

165.        --  To remove this button from the dialog, call Hide on the return value.

166.        --  The callbacks on this button should display a new dialog that explain

167.        --  what file the user should select.

169.        function Get_Ok_ButtonTo API docTo body

170.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

171.           return Gtk.Button.Gtk_ButtonTo API docTo spec;

172.        --  Return the OK button.

173.        --  The callbacks on this button should close the dialog and do something

174.        --  with the file selected by the user.

176.        function Get_History_PulldownTo API docTo body

177.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

178.           return Gtk.Widget.Gtk_WidgetTo API docTo spec;

179.        --  Return the menu that display the history of directories

180.        --  for easy access by the user.

182.        function Get_Selection_EntryTo API docTo body

183.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

184.           return Gtk.Widget.Gtk_WidgetTo API docTo spec;

185.        --  Return the entry used to set the filter on the list of directories.

186.        --  The simplest way to insert text in this entry is to use the

187.        --  Complete procedure above.

189.        function Get_Selection_TextTo API docTo body

190.          (File_Selection : access Gtk_File_Selection_RecordTo API docTo specTo body)

191.           return Gtk.Widget.Gtk_WidgetTo API docTo spec;

192.        --  Return the text displayed just above the Selection_Entry.

194.        ----------------

195.        -- Properties --

196.        ----------------

198.        --  <properties>

199.        --  The following properties are defined for this widget. See

200.        --  Glib.Properties for more information on properties.

201.        --

202.        --  Name:  Filename_Property

203.        --  Type:  UTF8_String

204.        --  Flags: read-write

205.        --  Descr: The currently selected filename.

206.        --  See also: Set_Filename and Get_Filename

207.        --

208.        --  Name:  Show_Fileops_Property

209.        --  Type:  Boolean

210.        --  Flags: read-write

211.        --  Descr: Whether buttons for creating/manipulating files should

212.        --         be displayed.

213.        --  See also: Show_Fileop_Buttons and Hide_Fileop_Buttons

214.        --

215.        --  Name:  Select_Multiple_Property

216.        --  Type:  Boolean

217.        --  Descr: Whether to allow multiple files to be selected

218.        --

219.        --  </properties>

221.        Filename_Property        : constant Glib.Properties.Property_StringTo API docTo spec;

222.        Show_Fileops_Property    : constant Glib.Properties.Property_BooleanTo API docTo spec;

223.        Select_Multiple_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

225.        -------------

226.        -- Signals --

227.        -------------

229.        --  <signals>

230.        --  The following new signals are defined for this widget:

231.        --  </signals>

233.     private

234.        type Gtk_File_Selection_RecordTo API docTo spec is new

235.          Gtk.Dialog.Gtk_Dialog_RecordTo API docTo spec with null record;

237.        Filename_PropertyTo API docTo spec     : constant Glib.Properties.Property_StringTo API docTo spec :=

238.          Glib.Properties.BuildTo API docTo specTo body ("filename");

239.        Show_Fileops_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

240.          Glib.Properties.BuildTo API docTo specTo body ("show_fileops");

241.        Select_Multiple_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

242.          Glib.Properties.BuildTo API docTo specTo body ("select-multiple");

244.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_file_selection_get_type");

245.     end Gtk.File_SelectionTo API docTo specTo body;