1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  A Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf can be used to render 
  26. --  an image in a cell. It allows to render either a given 
  27. --  Gdk.Pixbuf.Gdk_Pixbuf (set via the 
  28. --  Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf:pixbuf property) or a 
  29. --  stock icon (set via the 
  30. --  Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf:stock-id property). 
  31. -- 
  32. --  To support the tree view, 
  33. --  Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf also supports rendering 
  34. --  two alternative pixbufs, when the 
  35. --  Gtk.Cell_Renderer.Gtk_Cell_Renderer:is-expander property is True. If the 
  36. --  Gtk.Cell_Renderer.Gtk_Cell_Renderer:is-expanded property is True and the 
  37. --  Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf:pixbuf-expander-open 
  38. --  property is set to a pixbuf, it renders that pixbuf, if the 
  39. --  Gtk.Cell_Renderer.Gtk_Cell_Renderer:is-expanded property is False and the 
  40. --  Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf:pixbuf-expander-closed 
  41. --  property is set to a pixbuf, it renders that one. 
  42. -- 
  43. --  </description> 
  44. pragma Ada_2005; 
  45.  
  46. pragma Warnings (Off, "*is already use-visible*"); 
  47. with Glib;              use Glib; 
  48. with Glib.Properties;   use Glib.Properties; 
  49. with Gtk.Cell_Renderer; use Gtk.Cell_Renderer; 
  50.  
  51. package Gtk.Cell_Renderer_Pixbuf is 
  52.  
  53.    type Gtk_Cell_Renderer_Pixbuf_Record is new Gtk_Cell_Renderer_Record with null record; 
  54.    type Gtk_Cell_Renderer_Pixbuf is access all Gtk_Cell_Renderer_Pixbuf_Record'Class; 
  55.  
  56.    ------------------ 
  57.    -- Constructors -- 
  58.    ------------------ 
  59.  
  60.    procedure Gtk_New (Self : out Gtk_Cell_Renderer_Pixbuf); 
  61.    procedure Initialize 
  62.       (Self : not null access Gtk_Cell_Renderer_Pixbuf_Record'Class); 
  63.    --  Creates a new Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf. Adjust 
  64.    --  rendering parameters using object properties. Object properties can be 
  65.    --  set globally (with g_object_set). Also, with 
  66.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column, you can bind a property to a 
  67.    --  value in a Gtk.Tree_Model.Gtk_Tree_Model. For example, you can bind the 
  68.    --  "pixbuf" property on the cell renderer to a pixbuf value in the model, 
  69.    --  thus rendering a different image in each row of the 
  70.    --  Gtk.Tree_View.Gtk_Tree_View. 
  71.  
  72.    function Gtk_Cell_Renderer_Pixbuf_New return Gtk_Cell_Renderer_Pixbuf; 
  73.    --  Creates a new Gtk.Cell_Renderer_Pixbuf.Gtk_Cell_Renderer_Pixbuf. Adjust 
  74.    --  rendering parameters using object properties. Object properties can be 
  75.    --  set globally (with g_object_set). Also, with 
  76.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column, you can bind a property to a 
  77.    --  value in a Gtk.Tree_Model.Gtk_Tree_Model. For example, you can bind the 
  78.    --  "pixbuf" property on the cell renderer to a pixbuf value in the model, 
  79.    --  thus rendering a different image in each row of the 
  80.    --  Gtk.Tree_View.Gtk_Tree_View. 
  81.  
  82.    function Get_Type return Glib.GType; 
  83.    pragma Import (C, Get_Type, "gtk_cell_renderer_pixbuf_get_type"); 
  84.  
  85.    ---------------- 
  86.    -- Properties -- 
  87.    ---------------- 
  88.    --  The following properties are defined for this widget. See 
  89.    --  Glib.Properties for more information on properties) 
  90.  
  91.    Follow_State_Property : constant Glib.Properties.Property_Boolean; 
  92.    --  Specifies whether the rendered pixbuf should be colorized according to 
  93.    --  the Gtk.Cell_Renderer.Gtk_Cell_Renderer_State. 
  94.  
  95.    G_Icon_Property : constant Glib.Properties.Property_Boxed; 
  96.    --  Type: Glib.G_Icon.G_Icon 
  97.    --  The GIcon representing the icon to display. If the icon theme is 
  98.    --  changed, the image will be updated automatically. 
  99.  
  100.    Icon_Name_Property : constant Glib.Properties.Property_String; 
  101.    --  The name of the themed icon to display. This property only has an 
  102.    --  effect if not overridden by "stock_id" or "pixbuf" properties. 
  103.  
  104.    Pixbuf_Property : constant Glib.Properties.Property_Object; 
  105.    --  Type: Gdk.Pixbuf.Gdk_Pixbuf 
  106.  
  107.    Pixbuf_Expander_Closed_Property : constant Glib.Properties.Property_Object; 
  108.    --  Type: Gdk.Pixbuf.Gdk_Pixbuf 
  109.  
  110.    Pixbuf_Expander_Open_Property : constant Glib.Properties.Property_Object; 
  111.    --  Type: Gdk.Pixbuf.Gdk_Pixbuf 
  112.  
  113.    Stock_Detail_Property : constant Glib.Properties.Property_String; 
  114.  
  115.    Stock_Id_Property : constant Glib.Properties.Property_String; 
  116.  
  117.    Stock_Size_Property : constant Glib.Properties.Property_Uint; 
  118.  
  119. private 
  120.    Stock_Size_Property : constant Glib.Properties.Property_Uint := 
  121.      Glib.Properties.Build ("stock-size"); 
  122.    Stock_Id_Property : constant Glib.Properties.Property_String := 
  123.      Glib.Properties.Build ("stock-id"); 
  124.    Stock_Detail_Property : constant Glib.Properties.Property_String := 
  125.      Glib.Properties.Build ("stock-detail"); 
  126.    Pixbuf_Expander_Open_Property : constant Glib.Properties.Property_Object := 
  127.      Glib.Properties.Build ("pixbuf-expander-open"); 
  128.    Pixbuf_Expander_Closed_Property : constant Glib.Properties.Property_Object := 
  129.      Glib.Properties.Build ("pixbuf-expander-closed"); 
  130.    Pixbuf_Property : constant Glib.Properties.Property_Object := 
  131.      Glib.Properties.Build ("pixbuf"); 
  132.    Icon_Name_Property : constant Glib.Properties.Property_String := 
  133.      Glib.Properties.Build ("icon-name"); 
  134.    G_Icon_Property : constant Glib.Properties.Property_Boxed := 
  135.      Glib.Properties.Build ("gicon"); 
  136.    Follow_State_Property : constant Glib.Properties.Property_Boolean := 
  137.      Glib.Properties.Build ("follow-state"); 
  138. end Gtk.Cell_Renderer_Pixbuf;