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. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <c_version>2.8.17</c_version> 
  31. --  <group>Obsolescent widgets</group> 
  32. --  <testgtk>create_preview_color.adb</testgtk> 
  33.  
  34. with Glib.Properties; 
  35. with Gdk.Color; 
  36. with Gdk.GC; 
  37. with Gdk.Visual; 
  38. with Gdk.Window; 
  39. with Gtk.Enums; use Gtk.Enums; 
  40. with Gtk.Widget; 
  41.  
  42. package Gtk.Preview is 
  43.    pragma Obsolescent; 
  44.  
  45.    type Gtk_Preview_Record is new Gtk.Widget.Gtk_Widget_Record with private; 
  46.    type Gtk_Preview is access all Gtk_Preview_Record'Class; 
  47.  
  48.    type Gtk_Preview_Info_Record is new Gtk.Widget.Gtk_Widget_Record 
  49.      with private; 
  50.    type Gtk_Preview_Info is access all Gtk_Preview_Info_Record'Class; 
  51.  
  52.    procedure Draw_Row 
  53.      (Preview : access Gtk_Preview_Record; 
  54.       Data    : Guchar_Array; 
  55.       X       : Gint; 
  56.       Y       : Gint; 
  57.       W       : Gint); 
  58.    --  The size required for Data depends of the color depth of the 
  59.    --  preview. No verification is done by Ada, everything is left to 
  60.    --  gtk. You might get some segmentation fault ! 
  61.    --  for a color preview, Data'Length = W * 3  (for R, G ,B) 
  62.    --  for a grey preview, Data'Length = W; 
  63.  
  64.    function Get_Cmap return Gdk.Color.Gdk_Colormap; 
  65.  
  66.    function Get_Info return Gtk_Preview_Info; 
  67.  
  68.    function Get_Visual return Gdk.Visual.Gdk_Visual; 
  69.  
  70.    procedure Gtk_New 
  71.      (Preview  : out Gtk_Preview; The_Type : Gtk_Preview_Type); 
  72.  
  73.    procedure Initialize 
  74.      (Preview  : access Gtk_Preview_Record'Class; 
  75.       The_Type : Gtk_Preview_Type); 
  76.  
  77.    function Get_Type return Glib.GType; 
  78.    --  Return the internal value associated with a Gtk_Preview. 
  79.  
  80.    procedure Put 
  81.      (Preview : access Gtk_Preview_Record; 
  82.       Window  : Gdk.Window.Gdk_Window; 
  83.       Gc      : Gdk.GC.Gdk_GC; 
  84.       Srcx    : Gint; 
  85.       Srcy    : Gint; 
  86.       Destx   : Gint; 
  87.       Desty   : Gint; 
  88.       Width   : Gint; 
  89.       Height  : Gint); 
  90.  
  91.    procedure Reset; 
  92.  
  93.    procedure Set_Color_Cube 
  94.      (Nred_Shades   : Guint; 
  95.       Ngreen_Shades : Guint; 
  96.       Nblue_Shades  : Guint; 
  97.       Ngray_Shades  : Guint); 
  98.  
  99.    procedure Set_Expand 
  100.      (Preview : access Gtk_Preview_Record; 
  101.       Expand  : Boolean); 
  102.  
  103.    procedure Set_Gamma (Gamma : Gdouble); 
  104.  
  105.    procedure Set_Install_Cmap (Install_Cmap : Gint); 
  106.  
  107.    procedure Set_Reserved (Nreserved : Gint); 
  108.  
  109.    procedure Size 
  110.      (Preview : access Gtk_Preview_Record; 
  111.       Width   : Gint; 
  112.       Height  : Gint); 
  113.  
  114.    procedure Uninit; 
  115.  
  116.    ---------------- 
  117.    -- Properties -- 
  118.    ---------------- 
  119.  
  120.    --  <properties> 
  121.    --  The following properties are defined for this widget. See 
  122.    --  Glib.Properties for more information on properties. 
  123.    -- 
  124.    --  Name:  Expand_Property 
  125.    --  Type:  Boolean 
  126.    --  Descr: Whether the preview widget should take up the entire space it is 
  127.    --         allocated 
  128.    -- 
  129.    --  </properties> 
  130.  
  131.    Expand_Property : constant Glib.Properties.Property_Boolean; 
  132.  
  133. private 
  134.    type Gtk_Preview_Record is new Gtk.Widget.Gtk_Widget_Record 
  135.      with null record; 
  136.  
  137.    type Gtk_Preview_Info_Record is new Gtk.Widget.Gtk_Widget_Record 
  138.      with null record; 
  139.  
  140.    Expand_Property : constant Glib.Properties.Property_Boolean := 
  141.      Glib.Properties.Build ("expand"); 
  142.  
  143.    pragma Import (C, Get_Visual, "gtk_preview_get_visual"); 
  144.    pragma Import (C, Get_Cmap, "gtk_preview_get_cmap"); 
  145.    pragma Import (C, Get_Type, "gtk_preview_get_type"); 
  146.    pragma Import (C, Reset, "gtk_preview_reset"); 
  147.    pragma Import (C, Set_Gamma, "gtk_preview_set_gamma"); 
  148.    pragma Import (C, Set_Install_Cmap, "gtk_preview_set_install_cmap"); 
  149.    pragma Import (C, Set_Reserved, "gtk_preview_set_reserved"); 
  150.    pragma Import (C, Uninit, "gtk_preview_uninit"); 
  151.  
  152. end Gtk.Preview; 
  153.  
  154. --  No binding: gtk_preview_set_dither