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. --  The Gtk.Color_Chooser_Widget.Gtk_Color_Chooser_Widget widget lets the user 
  26. --  select a color. By default, the chooser presents a prefined palette of 
  27. --  colors, plus a small number of settable custom colors. It is also possible 
  28. --  to select a different color with the single-color editor. To enter the 
  29. --  single-color editing mode, use the context menu of any color of the 
  30. --  palette, or use the '+' button to add a new custom color. 
  31. -- 
  32. --  The chooser automatically remembers the last selection, as well as custom 
  33. --  colors. 
  34. -- 
  35. --  To change the initially selected color, use Gtk.Color_Chooser.Set_Rgba. To 
  36. --  get the selected font use Gtk.Color_Chooser.Get_Rgba. 
  37. -- 
  38. --  The Gtk.Color_Chooser_Widget.Gtk_Color_Chooser_Widget is used in the 
  39. --  Gtk.Color_Chooser_Dialog.Gtk_Color_Chooser_Dialog to provide a dialog for 
  40. --  selecting colors. 
  41. -- 
  42. --  </description> 
  43. pragma Ada_2005; 
  44.  
  45. pragma Warnings (Off, "*is already use-visible*"); 
  46. with Gdk.RGBA;          use Gdk.RGBA; 
  47. with Glib;              use Glib; 
  48. with Glib.Properties;   use Glib.Properties; 
  49. with Glib.Types;        use Glib.Types; 
  50. with Gtk.Box;           use Gtk.Box; 
  51. with Gtk.Buildable;     use Gtk.Buildable; 
  52. with Gtk.Color_Chooser; use Gtk.Color_Chooser; 
  53. with Gtk.Enums;         use Gtk.Enums; 
  54. with Gtk.Orientable;    use Gtk.Orientable; 
  55.  
  56. package Gtk.Color_Chooser_Widget is 
  57.  
  58.    type Gtk_Color_Chooser_Widget_Record is new Gtk_Box_Record with null record; 
  59.    type Gtk_Color_Chooser_Widget is access all Gtk_Color_Chooser_Widget_Record'Class; 
  60.  
  61.    ------------------ 
  62.    -- Constructors -- 
  63.    ------------------ 
  64.  
  65.    procedure Gtk_New (Self : out Gtk_Color_Chooser_Widget); 
  66.    procedure Initialize 
  67.       (Self : not null access Gtk_Color_Chooser_Widget_Record'Class); 
  68.    --  Creates a new Gtk.Color_Chooser_Widget.Gtk_Color_Chooser_Widget. 
  69.    --  Since: gtk+ 3.4 
  70.  
  71.    function Gtk_Color_Chooser_Widget_New return Gtk_Color_Chooser_Widget; 
  72.    --  Creates a new Gtk.Color_Chooser_Widget.Gtk_Color_Chooser_Widget. 
  73.    --  Since: gtk+ 3.4 
  74.  
  75.    function Get_Type return Glib.GType; 
  76.    pragma Import (C, Get_Type, "gtk_color_chooser_widget_get_type"); 
  77.  
  78.    --------------------------------------------- 
  79.    -- Inherited subprograms (from interfaces) -- 
  80.    --------------------------------------------- 
  81.    --  Methods inherited from the Buildable interface are not duplicated here 
  82.    --  since they are meant to be used by tools, mostly. If you need to call 
  83.    --  them, use an explicit cast through the "-" operator below. 
  84.  
  85.    procedure Add_Palette 
  86.       (Self            : not null access Gtk_Color_Chooser_Widget_Record; 
  87.        Orientation     : Gtk.Enums.Gtk_Orientation; 
  88.        Colors_Per_Line : Gint; 
  89.        N_Colors        : Gint; 
  90.        Colors          : array_of_Gdk_RGBA); 
  91.  
  92.    procedure Get_Rgba 
  93.       (Self  : not null access Gtk_Color_Chooser_Widget_Record; 
  94.        Color : out Gdk.RGBA.Gdk_RGBA); 
  95.  
  96.    procedure Set_Rgba 
  97.       (Self  : not null access Gtk_Color_Chooser_Widget_Record; 
  98.        Color : Gdk.RGBA.Gdk_RGBA); 
  99.  
  100.    function Get_Use_Alpha 
  101.       (Self : not null access Gtk_Color_Chooser_Widget_Record) 
  102.        return Boolean; 
  103.  
  104.    procedure Set_Use_Alpha 
  105.       (Self      : not null access Gtk_Color_Chooser_Widget_Record; 
  106.        Use_Alpha : Boolean); 
  107.  
  108.    function Get_Orientation 
  109.       (Self : not null access Gtk_Color_Chooser_Widget_Record) 
  110.        return Gtk.Enums.Gtk_Orientation; 
  111.  
  112.    procedure Set_Orientation 
  113.       (Self        : not null access Gtk_Color_Chooser_Widget_Record; 
  114.        Orientation : Gtk.Enums.Gtk_Orientation); 
  115.  
  116.    ---------------- 
  117.    -- Properties -- 
  118.    ---------------- 
  119.    --  The following properties are defined for this widget. See 
  120.    --  Glib.Properties for more information on properties) 
  121.  
  122.    Show_Editor_Property : constant Glib.Properties.Property_Boolean; 
  123.    --  The ::show-editor property is True when the color chooser is showing 
  124.    --  the single-color editor. It can be set to switch the color chooser into 
  125.    --  single-color editing mode. 
  126.  
  127.    ---------------- 
  128.    -- Interfaces -- 
  129.    ---------------- 
  130.    --  This class implements several interfaces. See Glib.Types 
  131.    -- 
  132.    --  - "Buildable" 
  133.    -- 
  134.    --  - "ColorChooser" 
  135.    -- 
  136.    --  - "Orientable" 
  137.  
  138.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  139.      (Gtk.Buildable.Gtk_Buildable, Gtk_Color_Chooser_Widget_Record, Gtk_Color_Chooser_Widget); 
  140.    function "+" 
  141.      (Widget : access Gtk_Color_Chooser_Widget_Record'Class) 
  142.    return Gtk.Buildable.Gtk_Buildable 
  143.    renames Implements_Gtk_Buildable.To_Interface; 
  144.    function "-" 
  145.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  146.    return Gtk_Color_Chooser_Widget 
  147.    renames Implements_Gtk_Buildable.To_Object; 
  148.  
  149.    package Implements_Gtk_Color_Chooser is new Glib.Types.Implements 
  150.      (Gtk.Color_Chooser.Gtk_Color_Chooser, Gtk_Color_Chooser_Widget_Record, Gtk_Color_Chooser_Widget); 
  151.    function "+" 
  152.      (Widget : access Gtk_Color_Chooser_Widget_Record'Class) 
  153.    return Gtk.Color_Chooser.Gtk_Color_Chooser 
  154.    renames Implements_Gtk_Color_Chooser.To_Interface; 
  155.    function "-" 
  156.      (Interf : Gtk.Color_Chooser.Gtk_Color_Chooser) 
  157.    return Gtk_Color_Chooser_Widget 
  158.    renames Implements_Gtk_Color_Chooser.To_Object; 
  159.  
  160.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  161.      (Gtk.Orientable.Gtk_Orientable, Gtk_Color_Chooser_Widget_Record, Gtk_Color_Chooser_Widget); 
  162.    function "+" 
  163.      (Widget : access Gtk_Color_Chooser_Widget_Record'Class) 
  164.    return Gtk.Orientable.Gtk_Orientable 
  165.    renames Implements_Gtk_Orientable.To_Interface; 
  166.    function "-" 
  167.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  168.    return Gtk_Color_Chooser_Widget 
  169.    renames Implements_Gtk_Orientable.To_Object; 
  170.  
  171. private 
  172.    Show_Editor_Property : constant Glib.Properties.Property_Boolean := 
  173.      Glib.Properties.Build ("show-editor"); 
  174. end Gtk.Color_Chooser_Widget;