1
-----------------------------------------------------------------------
2
-- GtkAda - Ada95 binding for Gtk+/Gnome --
4
-- Copyright (C) 2006, AdaCore --
6
-- This library is free software; you can redistribute it and/or --
7
-- modify it under the terms of the GNU General Public --
8
-- License as published by the Free Software Foundation; either --
9
-- version 2 of the License, or (at your option) any later version. --
11
-- This library is distributed in the hope that it will be useful, --
12
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
14
-- General Public License for more details. --
16
-- You should have received a copy of the GNU General Public --
17
-- License along with this library; if not, write to the --
18
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
19
-- Boston, MA 02111-1307, USA. --
21
-----------------------------------------------------------------------
24
-- The Gtk_File_Chooser_Button is a widget that lets the user select a file.
25
-- It implements the Gtk_File_Chooser interface. Visually, it is a file name
26
-- with a button to bring up a Gtk_File_Chooser_Dialog. The user can then use
27
-- that dialog to change the file associated with that button. This widget
28
-- does not support setting the "select-multiple" property to TRUE.
30
-- The Gtk_File_Chooser_Button supports the File_Chooser_Actions
31
-- Action_Open and Action_Select_Folder.
33
-- The Gtk_File_Chooser_Button will ellipsize the label, and thus will request
34
-- little horizontal space. To give the button more space, you should call
35
-- Gtk.Widget.Size_Request, Set_Width_Chars, or pack the button in such a way
36
-- that other interface elements give space to the widget.
38
-- <c_version>2.8.17</c_version>
39
-- <group>Selectors</group>
40
-- <screenshot>file-button.png</screenshot>
41
-- <testgtk>create_file_chooser.adb</testgtk>
46
with Gtk.File_Chooser;
47
with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog;
49
package Gtk.File_Chooser_Button is
51
type Gtk_File_Chooser_Button_Record is
52
new Gtk.Box.Gtk_Hbox_Record with null record;
53
type Gtk_File_Chooser_Button is
54
access all Gtk_File_Chooser_Button_Record'Class;
56
function Get_Type return GType;
57
-- Return the internal value associated with a Gtk_File_Chooser_Button
60
(Button : out Gtk_File_Chooser_Button;
62
Action : Gtk.File_Chooser.File_Chooser_Action);
64
(Button : access Gtk_File_Chooser_Button_Record'Class;
66
Action : Gtk.File_Chooser.File_Chooser_Action);
67
-- Creates a new file-selecting button widget.
68
-- Title is the title of the browse dialog
70
procedure Gtk_New_With_Backend
71
(Button : out Gtk_File_Chooser_Button;
73
Action : Gtk.File_Chooser.File_Chooser_Action;
75
procedure Initialize_With_Backend
76
(Button : access Gtk_File_Chooser_Button_Record'Class;
78
Action : Gtk.File_Chooser.File_Chooser_Action;
80
-- Creates a new file-selecting button widget using Backend. See also
83
procedure Gtk_New_With_Dialog
84
(Button : out Gtk_File_Chooser_Button;
85
Dialog : access Gtk_File_Chooser_Dialog_Record'Class);
86
procedure Initialize_With_Dialog
87
(Button : access Gtk_File_Chooser_Button_Record'Class;
88
Dialog : access Gtk_File_Chooser_Dialog_Record'Class);
89
-- Creates a button widget which uses Dialog as it's file-picking window.
90
-- Note that dialog must not have Destroy_With_Parent set.
93
(Button : access Gtk_File_Chooser_Button_Record; Title : String);
95
(Button : access Gtk_File_Chooser_Button_Record) return String;
96
-- Modifies the Title of the browse dialog used by Button.
98
procedure Set_Width_Chars
99
(Button : access Gtk_File_Chooser_Button_Record;
101
function Get_Width_Chars
102
(Button : access Gtk_File_Chooser_Button_Record) return Gint;
103
-- Sets the width (in characters) that Button will use.
108
-- This class implements several interfaces. See Glib.Types
110
-- - "Gtk_File_Chooser"
112
package Implements_File_Chooser is new Glib.Types.Implements
113
(Gtk.File_Chooser.Gtk_File_Chooser,
114
Gtk_File_Chooser_Button_Record, Gtk_File_Chooser_Button);
116
(Button : access Gtk_File_Chooser_Button_Record'Class)
117
return Gtk.File_Chooser.Gtk_File_Chooser
118
renames Implements_File_Chooser.To_Interface;
120
(File : Gtk.File_Chooser.Gtk_File_Chooser)
121
return Gtk_File_Chooser_Button
122
renames Implements_File_Chooser.To_Object;
123
-- Converts to and from the Gtk_File_Chooser interface
129
-- Name: Dialog_Property
131
-- Descr: The file chooser dialog to use.
133
-- Name: Title_Property
135
-- Descr: The title of the file chooser dialog.
137
-- Name: Width_Chars_Property
139
-- Descr: The desired width of the button widget, in characters.
143
Dialog_Property : constant Glib.Properties.Property_Object;
144
Title_Property : constant Glib.Properties.Property_String;
145
Width_Chars_Property : constant Glib.Properties.Property_Int;
148
pragma Import (C, Get_Type, "gtk_file_chooser_button_get_type");
151
Dialog_Property : constant Glib.Properties.Property_Object :=
152
Glib.Properties.Build ("dialog");
153
Title_Property : constant Glib.Properties.Property_String :=
154
Glib.Properties.Build ("title");
155
Width_Chars_Property : constant Glib.Properties.Property_Int :=
156
Glib.Properties.Build ("width-chars");
158
end Gtk.File_Chooser_Button;