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

« back to all changes in this revision

Viewing changes to src/gtk-type_conversion.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:
2
2
--          GtkAda - Ada95 binding for the Gimp Toolkit              --
3
3
--                                                                   --
4
4
--   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --
 
5
--                Copyright (C) 2000-2008, AdaCore                   --
5
6
--                                                                   --
6
7
-- This library is free software; you can redistribute it and/or     --
7
8
-- modify it under the terms of the GNU General Public               --
21
21
--                                                                   --
22
22
-----------------------------------------------------------------------
23
23
 
24
 
pragma Warnings (Off);
25
 
with Gtk.Adjustment;
26
 
with Gtk.Alignment;
27
 
with Gtk.Arrow;
28
 
with Gtk.Aspect_Frame;
29
 
with Gtk.Bin;
30
 
with Gtk.Box;
31
 
with Gtk.Button_Box;
32
 
with Gtk.Calendar;
33
 
with Gtk.Check_Button;
34
 
with Gtk.Color_Selection;
35
 
with Gtk.Color_Selection_Dialog;
36
 
with Gtk.Container;
37
 
with Gtk.Curve;
38
 
with Gtk.Dialog;
39
 
with Gtk.Drawing_Area;
40
 
with Gtk.Editable;
41
 
with Gtk.Event_Box;
42
 
with Gtk.File_Selection;
43
 
with Gtk.Fixed;
44
 
with Gtk.Font_Selection;
45
 
with Gtk.Font_Selection_Dialog;
46
 
with Gtk.Frame;
47
 
with Gtk.Gamma_Curve;
48
 
with Gtk.GEntry;
49
 
with Gtk.GRange;
50
 
with Gtk.Handle_Box;
51
 
with Gtk.Hbutton_Box;
52
 
with Gtk.Image;
53
 
with Gtk.Input_Dialog;
54
 
with Gtk.Invisible;
55
 
with Gtk.Layout;
56
 
with Gtk.Menu_Shell;
57
 
with Gtk.Misc;
58
 
with Gtk.Notebook;
59
 
with Gtk.Object;
60
 
with Gtk.Paned;
61
 
with Gtk.Plug;
62
 
pragma Warnings (Off);  --  These packages are obsolescent
63
 
with Gtk.Combo;
64
 
with Gtk.Item_Factory;
65
 
with Gtk.List;
66
 
with Gtk.Option_Menu;
67
 
with Gtk.Pixmap;
68
 
with Gtk.Preview;
69
 
with Gtk.Progress;
70
 
with Gtk.Ctree;
71
 
with Gtk.Clist;
72
 
with Gtk.Text;
73
 
with Gtk.Tips_Query;
74
 
pragma Warnings (On);
75
 
with Gtk.Progress_Bar;
76
 
with Gtk.Radio_Button;
77
 
with Gtk.Ruler;
78
 
with Gtk.Scale;
79
 
with Gtk.Scrollbar;
80
 
with Gtk.Scrolled_Window;
81
 
with Gtk.Separator;
82
 
with Gtk.Socket;
83
 
with Gtk.Spin_Button;
84
 
with Gtk.Status_Bar;
85
 
with Gtk.Table;
86
 
with Gtk.Toggle_Button;
87
 
with Gtk.Toolbar;
88
 
with Gtk.Tooltips;
89
 
with Gtk.Vbutton_Box;
90
 
with Gtk.Viewport;
91
 
with Gtk.Widget;
92
 
with Gtk.Window;
93
 
pragma Warnings (On);
94
 
 
95
 
with Glib.Type_Conversion_Hooks;
96
 
pragma Elaborate_All (Glib.Type_Conversion_Hooks);
97
 
 
98
24
package body Gtk.Type_Conversion is
99
25
 
100
 
   function Full_Conversion (Type_Name : String) return GObject;
101
 
   --  This function knows about all base widgets present in GtkAda.
102
 
   --  One noticeable difference is Gtk_Label that is recognized by default,
103
 
   --  to avoid the need of this package for the common usage.
104
 
 
105
26
   ----------
106
27
   -- Init --
107
28
   ----------
120
30
   procedure Init is
121
31
   begin
122
32
      null;
123
 
      --  This function is only used to force the 'with' of this unit. All the
124
 
      --  actual work is done in the elaboration part of this package.
125
33
   end Init;
126
34
 
127
 
   ---------------------
128
 
   -- Full_Conversion --
129
 
   ---------------------
130
 
 
131
 
   function Full_Conversion (Type_Name : String) return GObject is
132
 
   begin
133
 
      case Type_Name (Type_Name'First + 3) is
134
 
         when 'A' =>
135
 
            if Type_Name = "GtkAdjustment" then
136
 
               return new Gtk.Adjustment.Gtk_Adjustment_Record;
137
 
            elsif Type_Name = "GtkAlignment" then
138
 
               return new Gtk.Alignment.Gtk_Alignment_Record;
139
 
            elsif Type_Name = "GtkArrow" then
140
 
               return new Gtk.Arrow.Gtk_Arrow_Record;
141
 
            elsif Type_Name = "GtkAspectFrame" then
142
 
               return new Gtk.Aspect_Frame.Gtk_Aspect_Frame_Record;
143
 
            end if;
144
 
         when 'B' =>
145
 
            if Type_Name = "GtkBin" then
146
 
               return new Gtk.Bin.Gtk_Bin_Record;
147
 
            --  elsif Type_Name = "GtkBorderCombo" then
148
 
            --     return new Gtk.Extra.Border_Combo.Gtk_Border_Combo_Record;
149
 
            elsif Type_Name = "GtkBox" then
150
 
               return new Gtk.Box.Gtk_Box_Record;
151
 
            elsif Type_Name = "GtkButtonBox" then
152
 
               return new Gtk.Button_Box.Gtk_Button_Box_Record;
153
 
            end if;
154
 
         when 'C' =>
155
 
            if Type_Name = "GtkCalendar" then
156
 
               return new Gtk.Calendar.Gtk_Calendar_Record;
157
 
            elsif Type_Name = "GtkCheckButton" then
158
 
               return new Gtk.Check_Button.Gtk_Check_Button_Record;
159
 
            elsif Type_Name = "GtkCList" then
160
 
               pragma Warnings (Off);  --  Gtk.Clist is obsolescent
161
 
               return new Gtk.Clist.Gtk_Clist_Record;
162
 
               pragma Warnings (On);
163
 
            --  elsif Type_Name = "GtkColorCombo" then
164
 
            --     return new Gtk.Extra.Color_Combo.Gtk_Color_Combo_Record;
165
 
            elsif Type_Name = "GtkColorSelection" then
166
 
               return new Gtk.Color_Selection.Gtk_Color_Selection_Record;
167
 
            elsif Type_Name = "GtkColorSelectionDialog" then
168
 
               return new
169
 
                 Gtk.Color_Selection_Dialog.Gtk_Color_Selection_Dialog_Record;
170
 
            elsif Type_Name = "GtkCombo" then
171
 
               pragma Warnings (Off);  --  Gtk.Combo is obsolescent
172
 
               return new Gtk.Combo.Gtk_Combo_Record;
173
 
               pragma Warnings (On);
174
 
            --  elsif Type_Name = "GtkComboBox" then
175
 
            --     return new Gtk.Extra.Combo_Box.Gtk_Combo_Box_Record;
176
 
            elsif Type_Name = "GtkContainer" then
177
 
               return new Gtk.Container.Gtk_Container_Record;
178
 
            elsif Type_Name = "GtkCtree" then
179
 
               pragma Warnings (Off);  --  Gtk.Ctree is obsolescent
180
 
               return new Gtk.Ctree.Gtk_Ctree_Record;
181
 
               pragma Warnings (On);
182
 
            elsif Type_Name = "GtkCurve" then
183
 
               return new Gtk.Curve.Gtk_Curve_Record;
184
 
            end if;
185
 
         when 'D' =>
186
 
            if Type_Name = "GtkDialog" then
187
 
               return new Gtk.Dialog.Gtk_Dialog_Record;
188
 
            elsif Type_Name = "GtkDrawingArea" then
189
 
               return new Gtk.Drawing_Area.Gtk_Drawing_Area_Record;
190
 
            end if;
191
 
         when 'E' =>
192
 
            if Type_Name = "GtkEditable" then
193
 
               return new Gtk.Editable.Gtk_Editable_Record;
194
 
            elsif Type_Name = "GtkEventBox" then
195
 
               return new Gtk.Event_Box.Gtk_Event_Box_Record;
196
 
            elsif Type_Name = "GtkEntry" then
197
 
               return new Gtk.GEntry.Gtk_Entry_Record;
198
 
            end if;
199
 
         when 'F' =>
200
 
            if Type_Name = "GtkFileSelection" then
201
 
               return new Gtk.File_Selection.Gtk_File_Selection_Record;
202
 
            elsif Type_Name = "GtkFixed" then
203
 
               return new Gtk.Fixed.Gtk_Fixed_Record;
204
 
            --  elsif Type_Name = "GtkFontCombo" then
205
 
            --     return new Gtk.Extra.Font_Combo.Gtk_Font_Combo_Record;
206
 
            elsif Type_Name = "GtkFontSelection" then
207
 
               return new Gtk.Font_Selection.Gtk_Font_Selection_Record;
208
 
            elsif Type_Name = "GtkFontSelectionDialog" then
209
 
               return new
210
 
                 Gtk.Font_Selection_Dialog.Gtk_Font_Selection_Dialog_Record;
211
 
            elsif Type_Name = "GtkFrame" then
212
 
               return new Gtk.Frame.Gtk_Frame_Record;
213
 
            end if;
214
 
         when 'G' =>
215
 
            if Type_Name = "GtkGammaCurve" then
216
 
               return new Gtk.Gamma_Curve.Gtk_Gamma_Curve_Record;
217
 
            end if;
218
 
         when 'H' =>
219
 
            if Type_Name = "GtkHBox" then
220
 
               return new Gtk.Box.Gtk_Box_Record;
221
 
            elsif Type_Name = "GtkHandleBox" then
222
 
               return new Gtk.Handle_Box.Gtk_Handle_Box_Record;
223
 
            elsif Type_Name = "GtkHButtonBox" then
224
 
               return new Gtk.Hbutton_Box.Gtk_Hbutton_Box_Record;
225
 
            elsif Type_Name = "GtkHPaned" then
226
 
               return new Gtk.Paned.Gtk_Paned_Record;
227
 
            end if;
228
 
         when 'I' =>
229
 
            if False then
230
 
               return null;
231
 
            --  if Type_Name = "GtkItemEntry" then
232
 
            --     return new Gtk.Extra.Item_Entry.Gtk_IEntry_Record;
233
 
            elsif Type_Name = "GtkImage" then
234
 
               return new Gtk.Image.Gtk_Image_Record;
235
 
            elsif Type_Name = "GtkInputDialog" then
236
 
               return new Gtk.Input_Dialog.Gtk_Input_Dialog_Record;
237
 
            elsif Type_Name = "GtkInvisible" then
238
 
               return new Gtk.Invisible.Gtk_Invisible_Record;
239
 
            elsif Type_Name = "GtkItemFactory" then
240
 
               pragma Warnings (Off);  --  Gtk.Item_Factory is obsolescent
241
 
               return new Gtk.Item_Factory.Gtk_Item_Factory_Record;
242
 
               pragma Warnings (On);
243
 
            end if;
244
 
         when 'L' =>
245
 
            if Type_Name = "GtkLayout" then
246
 
               return new Gtk.Layout.Gtk_Layout_Record;
247
 
            elsif Type_Name = "GtkList" then
248
 
               pragma Warnings (Off); --  Gtk_List is obsolescent
249
 
               return new Gtk.List.Gtk_List_Record;
250
 
               pragma Warnings (On);
251
 
            end if;
252
 
         when 'M' =>
253
 
            if Type_Name = "GtkMenuShell" then
254
 
               return new Gtk.Menu_Shell.Gtk_Menu_Shell_Record;
255
 
            elsif Type_Name = "GtkMisc" then
256
 
               return new Gtk.Misc.Gtk_Misc_Record;
257
 
            end if;
258
 
         when 'N' =>
259
 
            if Type_Name = "GtkNotebook" then
260
 
               return new Gtk.Notebook.Gtk_Notebook_Record;
261
 
            end if;
262
 
         when 'O' =>
263
 
            if Type_Name = "GtkObject" then
264
 
               return new Gtk.Object.Gtk_Object_Record;
265
 
            elsif Type_Name = "GtkOptionMenu" then
266
 
               pragma Warnings (Off); --  Gtk.Option_Menu is obsolescent;
267
 
               return new Gtk.Option_Menu.Gtk_Option_Menu_Record;
268
 
               pragma Warnings (On);
269
 
            end if;
270
 
         when 'P' =>
271
 
            if Type_Name = "GtkPixmap" then
272
 
               pragma Warnings (Off); --  Gtk_Pixmap is obsolescent
273
 
               return new Gtk.Pixmap.Gtk_Pixmap_Record;
274
 
               pragma Warnings (On);
275
 
            elsif Type_Name = "GtkPlug" then
276
 
               return new Gtk.Plug.Gtk_Plug_Record;
277
 
            --  elsif Type_Name = "GtkPlot" then
278
 
            --     return new Gtk.Extra.Plot.Gtk_Plot_Record;
279
 
            --  elsif Type_Name = "GtkPlotCanvas" then
280
 
            --     return new Gtk.Extra.Plot_Canvas.Gtk_Plot_Canvas_Record;
281
 
            elsif Type_Name = "GtkPreview" then
282
 
               pragma Warnings (Off); --  Gtk_Preview is obsolescent
283
 
               return new Gtk.Preview.Gtk_Preview_Record;
284
 
               pragma Warnings (On);
285
 
            elsif Type_Name = "GtkProgress" then
286
 
               pragma Warnings (Off);
287
 
               return new Gtk.Progress.Gtk_Progress_Record;
288
 
               pragma Warnings (On);
289
 
               --  Gtk.Progress is obsolete
290
 
            elsif Type_Name = "GtkProgressBar" then
291
 
               return new Gtk.Progress_Bar.Gtk_Progress_Bar_Record;
292
 
            end if;
293
 
         when 'R' =>
294
 
            if Type_Name = "GtkRadioButton" then
295
 
               return new Gtk.Radio_Button.Gtk_Radio_Button_Record;
296
 
            elsif Type_Name = "GtkRange" then
297
 
               return new Gtk.GRange.Gtk_Range_Record;
298
 
            elsif Type_Name = "GtkRuler" then
299
 
               return new Gtk.Ruler.Gtk_Ruler_Record;
300
 
            end if;
301
 
         when 'S' =>
302
 
            if Type_Name = "GtkScale" then
303
 
               return new Gtk.Scale.Gtk_Scale_Record;
304
 
            elsif Type_Name = "GtkScrollbar" then
305
 
               return new Gtk.Scrollbar.Gtk_Scrollbar_Record;
306
 
            elsif Type_Name = "GtkScrolledWindow" then
307
 
               return new Gtk.Scrolled_Window.Gtk_Scrolled_Window_Record;
308
 
            elsif Type_Name = "GtkSeparator" then
309
 
               return new Gtk.Separator.Gtk_Separator_Record;
310
 
            --  elsif Type_Name = "GtkSheet" then
311
 
            --     return new Gtk.Extra.Sheet.Gtk_Sheet_Record;
312
 
            elsif Type_Name = "GtkSocket" then
313
 
               return new Gtk.Socket.Gtk_Socket_Record;
314
 
            elsif Type_Name = "GtkSpinButton" then
315
 
               return new Gtk.Spin_Button.Gtk_Spin_Button_Record;
316
 
            elsif Type_Name = "GtkStatusBar" then
317
 
               return new Gtk.Status_Bar.Gtk_Status_Bar_Record;
318
 
            end if;
319
 
         when 'T' =>
320
 
            if Type_Name = "GtkTable" then
321
 
               return new Gtk.Table.Gtk_Table_Record;
322
 
            elsif Type_Name = "GtkText" then
323
 
               pragma Warnings (Off); --  Gtk.Text is obsolescent
324
 
               return new Gtk.Text.Gtk_Text_Record;
325
 
               pragma Warnings (On);
326
 
            elsif Type_Name = "GtkTipsQuery" then
327
 
               pragma Warnings (Off); -- Gtk_Tips_Query is obsolescent
328
 
               return new Gtk.Tips_Query.Gtk_Tips_Query_Record;
329
 
               pragma Warnings (On);
330
 
            elsif Type_Name = "GtkToggleButton" then
331
 
               return new Gtk.Toggle_Button.Gtk_Toggle_Button_Record;
332
 
            elsif Type_Name = "GtkToolbar" then
333
 
               return new Gtk.Toolbar.Gtk_Toolbar_Record;
334
 
            elsif Type_Name = "GtkTooltips" then
335
 
               return new Gtk.Tooltips.Gtk_Tooltips_Record;
336
 
            end if;
337
 
         when 'V' =>
338
 
            if Type_Name = "GtkVBox" then
339
 
               return new Gtk.Box.Gtk_Box_Record;
340
 
            elsif Type_Name = "GtkVButtonBox" then
341
 
               return new Gtk.Vbutton_Box.Gtk_Vbutton_Box_Record;
342
 
            elsif Type_Name = "GtkViewport" then
343
 
               return new Gtk.Viewport.Gtk_Viewport_Record;
344
 
            elsif Type_Name = "GtkVPaned" then
345
 
               return new Gtk.Paned.Gtk_Paned_Record;
346
 
            elsif Type_Name = "GtkVScrollbar" then
347
 
               return new Gtk.Scrollbar.Gtk_Scrollbar_Record;
348
 
            end if;
349
 
         when 'W' =>
350
 
            if Type_Name = "GtkWidget" then
351
 
               return new Gtk.Widget.Gtk_Widget_Record;
352
 
            elsif Type_Name = "GtkWindow" then
353
 
               return new Gtk.Window.Gtk_Window_Record;
354
 
            end if;
355
 
         when others => null;
356
 
      end case;
357
 
 
358
 
      return null;
359
 
   end Full_Conversion;
360
 
 
361
 
begin
362
 
   Glib.Type_Conversion_Hooks.Add_Hook (Full_Conversion'Access);
363
35
end Gtk.Type_Conversion;