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

« back to all changes in this revision

Viewing changes to src/gtk-file_chooser_button.adb

  • 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-2008, 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
--  </description>
 
25
--  <c_version>2.8.17</c_version>
 
26
--  <group>Selectors</group>
 
27
--  <screenshot>file-button.png</screenshot>
 
28
 
 
29
with Gtk.File_Chooser;     use Gtk.File_Chooser;
 
30
with Interfaces.C.Strings; use Interfaces.C.Strings;
 
31
with System;
 
32
 
 
33
with Glib.Type_Conversion_Hooks;
 
34
 
 
35
package body Gtk.File_Chooser_Button is
 
36
 
 
37
   package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
 
38
     (Get_Type'Access, Gtk_File_Chooser_Button_Record);
 
39
   pragma Warnings (Off, Type_Conversion);
 
40
 
 
41
   ---------------
 
42
   -- Get_Title --
 
43
   ---------------
 
44
 
 
45
   function Get_Title
 
46
     (Button : access Gtk_File_Chooser_Button_Record)
 
47
      return String
 
48
   is
 
49
      function Internal (Button : System.Address) return chars_ptr;
 
50
      pragma Import (C, Internal, "gtk_file_chooser_button_get_title");
 
51
   begin
 
52
      --  Returned value still owned by gtk+
 
53
      return Value (Internal (Get_Object (Button)));
 
54
   end Get_Title;
 
55
 
 
56
   ---------------------
 
57
   -- Get_Width_Chars --
 
58
   ---------------------
 
59
 
 
60
   function Get_Width_Chars
 
61
     (Button : access Gtk_File_Chooser_Button_Record)
 
62
      return Gint
 
63
   is
 
64
      function Internal (Button : System.Address) return Gint;
 
65
      pragma Import (C, Internal, "gtk_file_chooser_button_get_width_chars");
 
66
   begin
 
67
      return Internal (Get_Object (Button));
 
68
   end Get_Width_Chars;
 
69
 
 
70
   -------------
 
71
   -- Gtk_New --
 
72
   -------------
 
73
 
 
74
   procedure Gtk_New
 
75
     (Button : out Gtk_File_Chooser_Button;
 
76
      Title  : String;
 
77
      Action : Gtk.File_Chooser.File_Chooser_Action) is
 
78
   begin
 
79
      Button := new Gtk_File_Chooser_Button_Record;
 
80
      Initialize (Button, Title, Action);
 
81
   end Gtk_New;
 
82
 
 
83
   --------------------------
 
84
   -- Gtk_New_With_Backend --
 
85
   --------------------------
 
86
 
 
87
   procedure Gtk_New_With_Backend
 
88
     (Button  : out Gtk_File_Chooser_Button;
 
89
      Title   : String;
 
90
      Action  : Gtk.File_Chooser.File_Chooser_Action;
 
91
      Backend : String) is
 
92
   begin
 
93
      Button := new Gtk_File_Chooser_Button_Record;
 
94
      Initialize_With_Backend (Button, Title, Action, Backend);
 
95
   end Gtk_New_With_Backend;
 
96
 
 
97
   -------------------------
 
98
   -- Gtk_New_With_Dialog --
 
99
   -------------------------
 
100
 
 
101
   procedure Gtk_New_With_Dialog
 
102
     (Button  : out Gtk_File_Chooser_Button;
 
103
      Dialog  : access Gtk_File_Chooser_Dialog_Record'Class) is
 
104
   begin
 
105
      Button := new Gtk_File_Chooser_Button_Record;
 
106
      Initialize_With_Dialog (Button, Dialog);
 
107
   end Gtk_New_With_Dialog;
 
108
 
 
109
   ----------------
 
110
   -- Initialize --
 
111
   ----------------
 
112
 
 
113
   procedure Initialize
 
114
     (Button : access Gtk_File_Chooser_Button_Record'Class;
 
115
      Title  : String;
 
116
      Action : Gtk.File_Chooser.File_Chooser_Action)
 
117
   is
 
118
      function Internal
 
119
        (Title : String; Action : File_Chooser_Action) return System.Address;
 
120
      pragma Import (C, Internal, "gtk_file_chooser_button_new");
 
121
   begin
 
122
      Set_Object (Button, Internal (Title & ASCII.NUL, Action));
 
123
   end Initialize;
 
124
 
 
125
   -----------------------------
 
126
   -- Initialize_With_Backend --
 
127
   -----------------------------
 
128
 
 
129
   procedure Initialize_With_Backend
 
130
     (Button  : access Gtk_File_Chooser_Button_Record'Class;
 
131
      Title   : String;
 
132
      Action  : Gtk.File_Chooser.File_Chooser_Action;
 
133
      Backend : String)
 
134
   is
 
135
      function Internal
 
136
        (Title   : String;
 
137
         Action  : File_Chooser_Action;
 
138
         Backend : String) return System.Address;
 
139
      pragma Import (C, Internal, "gtk_file_chooser_button_new_with_backend");
 
140
   begin
 
141
      Set_Object
 
142
        (Button, Internal (Title & ASCII.NUL, Action, Backend & ASCII.NUL));
 
143
   end Initialize_With_Backend;
 
144
 
 
145
   ----------------------------
 
146
   -- Initialize_With_Dialog --
 
147
   ----------------------------
 
148
 
 
149
   procedure Initialize_With_Dialog
 
150
     (Button : access Gtk_File_Chooser_Button_Record'Class;
 
151
      Dialog : access Gtk_File_Chooser_Dialog_Record'Class)
 
152
   is
 
153
      function Internal (Dialog : System.Address) return System.Address;
 
154
      pragma Import (C, Internal, "gtk_file_chooser_button_new_with_dialog");
 
155
   begin
 
156
      Set_Object (Button, Internal (Get_Object (Dialog)));
 
157
   end Initialize_With_Dialog;
 
158
 
 
159
   ---------------
 
160
   -- Set_Title --
 
161
   ---------------
 
162
 
 
163
   procedure Set_Title
 
164
     (Button : access Gtk_File_Chooser_Button_Record;
 
165
      Title  : String)
 
166
   is
 
167
      procedure Internal (Button : System.Address; Title  : String);
 
168
      pragma Import (C, Internal, "gtk_file_chooser_button_set_title");
 
169
   begin
 
170
      Internal (Get_Object (Button), Title & ASCII.NUL);
 
171
   end Set_Title;
 
172
 
 
173
   ---------------------
 
174
   -- Set_Width_Chars --
 
175
   ---------------------
 
176
 
 
177
   procedure Set_Width_Chars
 
178
     (Button  : access Gtk_File_Chooser_Button_Record;
 
179
      N_Chars : Gint)
 
180
   is
 
181
      procedure Internal (Button  : System.Address; N_Chars : Gint);
 
182
      pragma Import (C, Internal, "gtk_file_chooser_button_set_width_chars");
 
183
   begin
 
184
      Internal (Get_Object (Button), N_Chars);
 
185
   end Set_Width_Chars;
 
186
 
 
187
end Gtk.File_Chooser_Button;