1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2006 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <c_version>2.8.17</c_version> 
  26. --  <group>Obsolescent widgets</group> 
  27. --  <testgtk>create_preview_color.adb</testgtk> 
  28.  
  29. with Glib.Properties; 
  30. with Gdk.Color; 
  31. with Gdk.GC; 
  32. with Gdk.Visual; 
  33. with Gdk.Window; 
  34. with Gtk.Enums; use Gtk.Enums; 
  35. with Gtk.Widget; 
  36.  
  37. package Gtk.Preview is 
  38.    pragma Obsolescent; 
  39.  
  40.    type Gtk_Preview_Record is new Gtk.Widget.Gtk_Widget_Record with private; 
  41.    type Gtk_Preview is access all Gtk_Preview_Record'Class; 
  42.  
  43.    type Gtk_Preview_Info_Record is new Gtk.Widget.Gtk_Widget_Record 
  44.      with private; 
  45.    type Gtk_Preview_Info is access all Gtk_Preview_Info_Record'Class; 
  46.  
  47.    procedure Draw_Row 
  48.      (Preview : access Gtk_Preview_Record; 
  49.       Data    : Guchar_Array; 
  50.       X       : Gint; 
  51.       Y       : Gint; 
  52.       W       : Gint); 
  53.    --  The size required for Data depends of the color depth of the 
  54.    --  preview. No verification is done by Ada, everything is left to 
  55.    --  gtk. You might get some segmentation fault ! 
  56.    --  for a color preview, Data'Length = W * 3  (for R, G ,B) 
  57.    --  for a grey preview, Data'Length = W; 
  58.  
  59.    function Get_Cmap return Gdk.Color.Gdk_Colormap; 
  60.  
  61.    function Get_Info return Gtk_Preview_Info; 
  62.  
  63.    function Get_Visual return Gdk.Visual.Gdk_Visual; 
  64.  
  65.    procedure Gtk_New 
  66.      (Preview  : out Gtk_Preview; The_Type : Gtk_Preview_Type); 
  67.  
  68.    procedure Initialize 
  69.      (Preview  : access Gtk_Preview_Record'Class; 
  70.       The_Type : Gtk_Preview_Type); 
  71.  
  72.    function Get_Type return Glib.GType; 
  73.    --  Return the internal value associated with a Gtk_Preview. 
  74.  
  75.    procedure Put 
  76.      (Preview : access Gtk_Preview_Record; 
  77.       Window  : Gdk.Window.Gdk_Window; 
  78.       Gc      : Gdk.GC.Gdk_GC; 
  79.       Srcx    : Gint; 
  80.       Srcy    : Gint; 
  81.       Destx   : Gint; 
  82.       Desty   : Gint; 
  83.       Width   : Gint; 
  84.       Height  : Gint); 
  85.  
  86.    procedure Reset; 
  87.  
  88.    procedure Set_Color_Cube 
  89.      (Nred_Shades   : Guint; 
  90.       Ngreen_Shades : Guint; 
  91.       Nblue_Shades  : Guint; 
  92.       Ngray_Shades  : Guint); 
  93.  
  94.    procedure Set_Expand 
  95.      (Preview : access Gtk_Preview_Record; 
  96.       Expand  : Boolean); 
  97.  
  98.    procedure Set_Gamma (Gamma : Gdouble); 
  99.  
  100.    procedure Set_Install_Cmap (Install_Cmap : Gint); 
  101.  
  102.    procedure Set_Reserved (Nreserved : Gint); 
  103.  
  104.    procedure Size 
  105.      (Preview : access Gtk_Preview_Record; 
  106.       Width   : Gint; 
  107.       Height  : Gint); 
  108.  
  109.    procedure Uninit; 
  110.  
  111.    ---------------- 
  112.    -- Properties -- 
  113.    ---------------- 
  114.  
  115.    --  <properties> 
  116.    --  The following properties are defined for this widget. See 
  117.    --  Glib.Properties for more information on properties. 
  118.    -- 
  119.    --  Name:  Expand_Property 
  120.    --  Type:  Boolean 
  121.    --  Descr: Whether the preview widget should take up the entire space it is 
  122.    --         allocated 
  123.    -- 
  124.    --  </properties> 
  125.  
  126.    Expand_Property : constant Glib.Properties.Property_Boolean; 
  127.  
  128. private 
  129.    type Gtk_Preview_Record is new Gtk.Widget.Gtk_Widget_Record 
  130.      with null record; 
  131.  
  132.    type Gtk_Preview_Info_Record is new Gtk.Widget.Gtk_Widget_Record 
  133.      with null record; 
  134.  
  135.    Expand_Property : constant Glib.Properties.Property_Boolean := 
  136.      Glib.Properties.Build ("expand"); 
  137.  
  138.    pragma Import (C, Get_Visual, "gtk_preview_get_visual"); 
  139.    pragma Import (C, Get_Cmap, "gtk_preview_get_cmap"); 
  140.    pragma Import (C, Get_Type, "gtk_preview_get_type"); 
  141.    pragma Import (C, Reset, "gtk_preview_reset"); 
  142.    pragma Import (C, Set_Gamma, "gtk_preview_set_gamma"); 
  143.    pragma Import (C, Set_Install_Cmap, "gtk_preview_set_install_cmap"); 
  144.    pragma Import (C, Set_Reserved, "gtk_preview_set_reserved"); 
  145.    pragma Import (C, Uninit, "gtk_preview_uninit"); 
  146.  
  147. end Gtk.Preview; 
  148.  
  149. --  No binding: gtk_preview_set_dither