~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to src/gtk-file_chooser_button.ads

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-08-11 09:46:51 UTC
  • mfrom: (6.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20080811094651-9mjd6acwa98ffw5c
Tags: 2.12.0-2ubuntu1
Add lpia to supported architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-----------------------------------------------------------------------
 
2
--              GtkAda - Ada95 binding for Gtk+/Gnome                --
 
3
--                                                                   --
 
4
--                Copyright (C) 2006, AdaCore                        --
 
5
--                                                                   --
 
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.  --
 
10
--                                                                   --
 
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.                          --
 
15
--                                                                   --
 
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.                                       --
 
20
--                                                                   --
 
21
-----------------------------------------------------------------------
 
22
 
 
23
--  <description>
 
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.
 
29
--
 
30
--  The Gtk_File_Chooser_Button supports the File_Chooser_Actions
 
31
--  Action_Open and Action_Select_Folder.
 
32
--
 
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.
 
37
--  </description>
 
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>
 
42
 
 
43
with Glib.Properties;
 
44
with Glib.Types;
 
45
with Gtk.Box;
 
46
with Gtk.File_Chooser;
 
47
with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog;
 
48
 
 
49
package Gtk.File_Chooser_Button is
 
50
 
 
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;
 
55
 
 
56
   function Get_Type return GType;
 
57
   --  Return the internal value associated with a Gtk_File_Chooser_Button
 
58
 
 
59
   procedure Gtk_New
 
60
     (Button : out Gtk_File_Chooser_Button;
 
61
      Title  : String;
 
62
      Action : Gtk.File_Chooser.File_Chooser_Action);
 
63
   procedure Initialize
 
64
     (Button : access Gtk_File_Chooser_Button_Record'Class;
 
65
      Title  : String;
 
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
 
69
 
 
70
   procedure Gtk_New_With_Backend
 
71
     (Button  : out Gtk_File_Chooser_Button;
 
72
      Title   : String;
 
73
      Action  : Gtk.File_Chooser.File_Chooser_Action;
 
74
      Backend : String);
 
75
   procedure Initialize_With_Backend
 
76
     (Button  : access Gtk_File_Chooser_Button_Record'Class;
 
77
      Title   : String;
 
78
      Action  : Gtk.File_Chooser.File_Chooser_Action;
 
79
      Backend : String);
 
80
   --  Creates a new file-selecting button widget using Backend. See also
 
81
   --  Gtk.File_System.
 
82
 
 
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.
 
91
 
 
92
   procedure Set_Title
 
93
     (Button : access Gtk_File_Chooser_Button_Record; Title  : String);
 
94
   function Get_Title
 
95
     (Button : access Gtk_File_Chooser_Button_Record) return String;
 
96
   --  Modifies the Title of the browse dialog used by Button.
 
97
 
 
98
   procedure Set_Width_Chars
 
99
     (Button  : access Gtk_File_Chooser_Button_Record;
 
100
      N_Chars : Gint);
 
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.
 
104
 
 
105
   ----------------
 
106
   -- Interfaces --
 
107
   ----------------
 
108
   --  This class implements several interfaces. See Glib.Types
 
109
   --
 
110
   --  - "Gtk_File_Chooser"
 
111
 
 
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);
 
115
   function "+"
 
116
     (Button : access Gtk_File_Chooser_Button_Record'Class)
 
117
      return Gtk.File_Chooser.Gtk_File_Chooser
 
118
      renames Implements_File_Chooser.To_Interface;
 
119
   function "-"
 
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
 
124
 
 
125
   ----------------
 
126
   -- Properties --
 
127
   ----------------
 
128
   --  <properties>
 
129
   --  Name:  Dialog_Property
 
130
   --  Type:  Object
 
131
   --  Descr: The file chooser dialog to use.
 
132
   --
 
133
   --  Name:  Title_Property
 
134
   --  Type:  String
 
135
   --  Descr: The title of the file chooser dialog.
 
136
   --
 
137
   --  Name:  Width_Chars_Property
 
138
   --  Type:  Int
 
139
   --  Descr: The desired width of the button widget, in characters.
 
140
   --
 
141
   --  </properties>
 
142
 
 
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;
 
146
 
 
147
private
 
148
   pragma Import (C, Get_Type, "gtk_file_chooser_button_get_type");
 
149
 
 
150
 
 
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");
 
157
 
 
158
end Gtk.File_Chooser_Button;