1
1
-----------------------------------------------------------------------
2
2
-- GtkAda - Ada95 binding for Gtk+/Gnome --
4
-- Copyright (C) 2004-2008, AdaCore --
5
6
-- This library is free software; you can redistribute it and/or --
6
7
-- modify it under the terms of the GNU General Public --
28
28
with Interfaces.C.Strings; use Interfaces.C.Strings;
29
29
with Gtk.Widget; use Gtk.Widget;
31
with Glib.Type_Conversion_Hooks;
31
33
package body Gtk.Icon_Factory is
35
package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
36
(Get_Type'Access, Gtk_Icon_Factory_Record);
37
pragma Warnings (Off, Type_Conversion);
219
225
function Get_Sizes (Icon_Set : Gtk_Icon_Set) return Gint_Array is
220
227
procedure Internal
221
228
(Icon_Set : Gtk_Icon_Set;
222
Result : access System.Address;
229
Result : access Unbounded_Array_Access;
223
230
N_Sizes : access Gint);
224
231
pragma Import (C, Internal, "gtk_icon_set_get_sizes");
226
type Big_Int_Array is array (Natural) of Gint;
227
pragma Convention (C, Big_Int_Array);
229
type Big_Int_Array_Access is access Big_Int_Array;
230
function Convert is new Ada.Unchecked_Conversion
231
(System.Address, Big_Int_Array_Access);
233
procedure G_Free (S : System.Address);
234
pragma Import (C, G_Free, "g_free");
235
-- External binding: g_free
237
233
Count : aliased Gint;
238
Result : aliased System.Address;
234
Result : aliased Unbounded_Array_Access;
240
236
Internal (Icon_Set, Result'Access, Count'Access);
241
if Result = System.Null_Address then
242
return (1 .. 0 => 0);
245
Result2 : constant Big_Int_Array_Access := Convert (Result);
246
Output : Gint_Array (0 .. Natural (Count - 1));
248
for O in Output'Range loop
249
Output (O) := Result2 (O);
238
Output : constant Gint_Array := To_Array (Result, Integer (Count));
257
245
---------------------
297
285
Detail : chars_ptr)
298
286
return Gdk_Pixbuf;
299
287
pragma Import (C, Internal, "gtk_icon_set_render_icon");
300
Str : chars_ptr := Null_Ptr;
288
Str : chars_ptr := String_Or_Null (Detail);
301
289
W : System.Address := System.Null_Address;
302
290
Result : Gdk_Pixbuf;
305
Str := New_String (Detail);
308
292
if Widget /= null then
309
293
W := Get_Object (Widget);
343
327
pragma Import (C, Internal, "gtk_style_render_icon");
344
328
-- External binding: gtk_style_render_icon
346
Str : chars_ptr := Null_Ptr;
330
Str : chars_ptr := String_Or_Null (Detail);
347
331
W : System.Address := System.Null_Address;
348
332
Result : Gdk_Pixbuf;
351
Str := New_String (Detail);
354
334
if Widget /= null then
355
335
W := Get_Object (Widget);