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. --  GtkGradient is a boxed type that represents a gradient. It is the result 
  26. --  of parsing a <link linkend="gtkcssprovider-gradients">gradient 
  27. --  expression</link>. To obtain the gradient represented by a GtkGradient, it 
  28. --  has to be resolved with Gtk.Gradient.Resolve, which replaces all symbolic 
  29. --  color references by the colors they refer to (in a given context) and 
  30. --  constructs a cairo_pattern_t value. 
  31. -- 
  32. --  It is not normally necessary to deal directly with Gtk_Gradients, since 
  33. --  they are mostly used behind the scenes by 
  34. --  Gtk.Style_Context.Gtk_Style_Context and Gtk.Css_Provider.Gtk_Css_Provider. 
  35. -- 
  36. --  Gtk.Gradient.Gtk_Gradient is deprecated. It was used internally by GTK's 
  37. --  CSS engine to represent gradients. As its handling is not conforming to 
  38. --  modern web standards, it is not used anymore. If you want to use gradients 
  39. --  in your own code, please use Cairo directly. 
  40. -- 
  41. --  </description> 
  42. pragma Ada_2005; 
  43.  
  44. pragma Warnings (Off, "*is already use-visible*"); 
  45. with Cairo;                use Cairo; 
  46. with Glib;                 use Glib; 
  47. with Gtk.Style_Context;    use Gtk.Style_Context; 
  48. with Gtk.Style_Properties; use Gtk.Style_Properties; 
  49. with Gtk.Symbolic_Color;   use Gtk.Symbolic_Color; 
  50.  
  51. package Gtk.Gradient is 
  52.  
  53.    type Gtk_Gradient is new Glib.C_Boxed with null record; 
  54.    Null_Gtk_Gradient : constant Gtk_Gradient; 
  55.  
  56.    function From_Object (Object : System.Address) return Gtk_Gradient; 
  57.    function From_Object_Free (B : access Gtk_Gradient'Class) return Gtk_Gradient; 
  58.    pragma Inline (From_Object_Free, From_Object); 
  59.  
  60.    ------------------ 
  61.    -- Constructors -- 
  62.    ------------------ 
  63.  
  64.    procedure Gtk_New_Linear 
  65.       (Self : out Gtk_Gradient; 
  66.        X0   : Gdouble; 
  67.        Y0   : Gdouble; 
  68.        X1   : Gdouble; 
  69.        Y1   : Gdouble); 
  70.    --  Creates a new linear gradient along the line defined by (x0, y0) and 
  71.    --  (x1, y1). Before using the gradient a number of stop colors must be 
  72.    --  added through Gtk.Gradient.Add_Color_Stop. 
  73.    --  Since: gtk+ 3.0 
  74.    --  "x0": X coordinate of the starting point 
  75.    --  "y0": Y coordinate of the starting point 
  76.    --  "x1": X coordinate of the end point 
  77.    --  "y1": Y coordinate of the end point 
  78.  
  79.    function Gtk_Gradient_New_Linear 
  80.       (X0 : Gdouble; 
  81.        Y0 : Gdouble; 
  82.        X1 : Gdouble; 
  83.        Y1 : Gdouble) return Gtk_Gradient; 
  84.    --  Creates a new linear gradient along the line defined by (x0, y0) and 
  85.    --  (x1, y1). Before using the gradient a number of stop colors must be 
  86.    --  added through Gtk.Gradient.Add_Color_Stop. 
  87.    --  Since: gtk+ 3.0 
  88.    --  "x0": X coordinate of the starting point 
  89.    --  "y0": Y coordinate of the starting point 
  90.    --  "x1": X coordinate of the end point 
  91.    --  "y1": Y coordinate of the end point 
  92.  
  93.    procedure Gtk_New_Radial 
  94.       (Self    : out Gtk_Gradient; 
  95.        X0      : Gdouble; 
  96.        Y0      : Gdouble; 
  97.        Radius0 : Gdouble; 
  98.        X1      : Gdouble; 
  99.        Y1      : Gdouble; 
  100.        Radius1 : Gdouble); 
  101.    --  Creates a new radial gradient along the two circles defined by (x0, y0, 
  102.    --  radius0) and (x1, y1, radius1). Before using the gradient a number of 
  103.    --  stop colors must be added through Gtk.Gradient.Add_Color_Stop. 
  104.    --  Since: gtk+ 3.0 
  105.    --  "x0": X coordinate of the start circle 
  106.    --  "y0": Y coordinate of the start circle 
  107.    --  "radius0": radius of the start circle 
  108.    --  "x1": X coordinate of the end circle 
  109.    --  "y1": Y coordinate of the end circle 
  110.    --  "radius1": radius of the end circle 
  111.  
  112.    function Gtk_Gradient_New_Radial 
  113.       (X0      : Gdouble; 
  114.        Y0      : Gdouble; 
  115.        Radius0 : Gdouble; 
  116.        X1      : Gdouble; 
  117.        Y1      : Gdouble; 
  118.        Radius1 : Gdouble) return Gtk_Gradient; 
  119.    --  Creates a new radial gradient along the two circles defined by (x0, y0, 
  120.    --  radius0) and (x1, y1, radius1). Before using the gradient a number of 
  121.    --  stop colors must be added through Gtk.Gradient.Add_Color_Stop. 
  122.    --  Since: gtk+ 3.0 
  123.    --  "x0": X coordinate of the start circle 
  124.    --  "y0": Y coordinate of the start circle 
  125.    --  "radius0": radius of the start circle 
  126.    --  "x1": X coordinate of the end circle 
  127.    --  "y1": Y coordinate of the end circle 
  128.    --  "radius1": radius of the end circle 
  129.  
  130.    function Get_Type return Glib.GType; 
  131.    pragma Import (C, Get_Type, "gtk_gradient_get_type"); 
  132.  
  133.    ------------- 
  134.    -- Methods -- 
  135.    ------------- 
  136.  
  137.    procedure Add_Color_Stop 
  138.       (Self   : Gtk_Gradient; 
  139.        Offset : Gdouble; 
  140.        Color  : Gtk.Symbolic_Color.Gtk_Symbolic_Color); 
  141.    pragma Obsolescent (Add_Color_Stop); 
  142.    --  Adds a stop color to Gradient. 
  143.    --  Since: gtk+ 3.0 
  144.    --  Deprecated since 3.8, Gtk.Gradient.Gtk_Gradient is deprecated. 
  145.    --  "offset": offset for the color stop 
  146.    --  "color": color to use 
  147.  
  148.    function Ref (Self : Gtk_Gradient) return Gtk_Gradient; 
  149.    pragma Obsolescent (Ref); 
  150.    --  Increases the reference count of Gradient. 
  151.    --  Since: gtk+ 3.0 
  152.    --  Deprecated since 3.8, Gtk.Gradient.Gtk_Gradient is deprecated. 
  153.  
  154.    function Resolve 
  155.       (Self              : Gtk_Gradient; 
  156.        Props             : not null access Gtk.Style_Properties.Gtk_Style_Properties_Record'Class; 
  157.        Resolved_Gradient : access Cairo.Cairo_Pattern) return Boolean; 
  158.    pragma Obsolescent (Resolve); 
  159.    --  If Gradient is resolvable, Resolved_Gradient will be filled in with the 
  160.    --  resolved gradient as a cairo_pattern_t, and True will be returned. 
  161.    --  Generally, if Gradient can't be resolved, it is due to it being defined 
  162.    --  on top of a named color that doesn't exist in Props. 
  163.    --  Since: gtk+ 3.0 
  164.    --  Deprecated since 3.8, Gtk.Gradient.Gtk_Gradient is deprecated. 
  165.    --  "props": Gtk.Style_Properties.Gtk_Style_Properties to use when 
  166.    --  resolving named colors 
  167.    --  "resolved_gradient": return location for the resolved pattern 
  168.  
  169.    function Resolve_For_Context 
  170.       (Self    : Gtk_Gradient; 
  171.        Context : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class) 
  172.        return Cairo.Cairo_Pattern; 
  173.  
  174.    function To_String (Self : Gtk_Gradient) return UTF8_String; 
  175.    pragma Obsolescent (To_String); 
  176.    --  Creates a string representation for Gradient that is suitable for using 
  177.    --  in GTK CSS files. 
  178.    --  Deprecated since 3.8, Gtk.Gradient.Gtk_Gradient is deprecated. 
  179.  
  180.    procedure Unref (Self : Gtk_Gradient); 
  181.    pragma Obsolescent (Unref); 
  182.    --  Decreases the reference count of Gradient, freeing its memory if the 
  183.    --  reference count reaches 0. 
  184.    --  Since: gtk+ 3.0 
  185.    --  Deprecated since 3.8, Gtk.Gradient.Gtk_Gradient is deprecated. 
  186.  
  187. private 
  188.  
  189.    Null_Gtk_Gradient : constant Gtk_Gradient := (Glib.C_Boxed with null record); 
  190.  
  191. end Gtk.Gradient;