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.Font_Chooser_Widget.Gtk_Font_Chooser_Widget widget lists the 
  26. --  available fonts, styles and sizes, allowing the user to select a font. It 
  27. --  is used in the Gtk.Font_Chooser_Dialog.Gtk_Font_Chooser_Dialog widget to 
  28. --  provide a dialog box for selecting fonts. 
  29. -- 
  30. --  To set the font which is initially selected, use Gtk.Font_Chooser.Set_Font 
  31. --  or Gtk.Font_Chooser.Set_Font_Desc. 
  32. -- 
  33. --  To get the selected font use Gtk.Font_Chooser.Get_Font or 
  34. --  Gtk.Font_Chooser.Get_Font_Desc. 
  35. -- 
  36. --  To change the text which is shown in the preview area, use 
  37. --  Gtk.Font_Chooser.Set_Preview_Text. 
  38. -- 
  39. --  </description> 
  40. pragma Ada_2005; 
  41.  
  42. pragma Warnings (Off, "*is already use-visible*"); 
  43. with Glib;              use Glib; 
  44. with Glib.Types;        use Glib.Types; 
  45. with Gtk.Box;           use Gtk.Box; 
  46. with Gtk.Buildable;     use Gtk.Buildable; 
  47. with Gtk.Enums;         use Gtk.Enums; 
  48. with Gtk.Font_Chooser;  use Gtk.Font_Chooser; 
  49. with Gtk.Orientable;    use Gtk.Orientable; 
  50. with Pango.Font;        use Pango.Font; 
  51. with Pango.Font_Face;   use Pango.Font_Face; 
  52. with Pango.Font_Family; use Pango.Font_Family; 
  53.  
  54. package Gtk.Font_Chooser_Widget is 
  55.  
  56.    type Gtk_Font_Chooser_Widget_Record is new Gtk_Box_Record with null record; 
  57.    type Gtk_Font_Chooser_Widget is access all Gtk_Font_Chooser_Widget_Record'Class; 
  58.  
  59.    --------------- 
  60.    -- Callbacks -- 
  61.    --------------- 
  62.  
  63.    type Gtk_Font_Filter_Func is access function 
  64.      (Family : not null access Pango.Font_Family.Pango_Font_Family_Record'Class; 
  65.       Face   : not null access Pango.Font_Face.Pango_Font_Face_Record'Class) 
  66.    return Boolean; 
  67.    --  The type of function that is used for deciding what fonts get shown in 
  68.    --  a Gtk.Font_Chooser.Gtk_Font_Chooser. See 
  69.    --  Gtk.Font_Chooser.Set_Filter_Func. 
  70.    --  "family": a Pango.Font_Family.Pango_Font_Family 
  71.    --  "face": a Pango.Font_Face.Pango_Font_Face belonging to Family 
  72.  
  73.    ------------------ 
  74.    -- Constructors -- 
  75.    ------------------ 
  76.  
  77.    procedure Gtk_New (Self : out Gtk_Font_Chooser_Widget); 
  78.    procedure Initialize 
  79.       (Self : not null access Gtk_Font_Chooser_Widget_Record'Class); 
  80.    --  Creates a new Gtk.Font_Chooser_Widget.Gtk_Font_Chooser_Widget. 
  81.    --  Since: gtk+ 3.2 
  82.  
  83.    function Gtk_Font_Chooser_Widget_New return Gtk_Font_Chooser_Widget; 
  84.    --  Creates a new Gtk.Font_Chooser_Widget.Gtk_Font_Chooser_Widget. 
  85.    --  Since: gtk+ 3.2 
  86.  
  87.    function Get_Type return Glib.GType; 
  88.    pragma Import (C, Get_Type, "gtk_font_chooser_widget_get_type"); 
  89.  
  90.    ------------- 
  91.    -- Methods -- 
  92.    ------------- 
  93.  
  94.    procedure Set_Filter_Func 
  95.       (Self   : not null access Gtk_Font_Chooser_Widget_Record; 
  96.        Filter : Gtk_Font_Filter_Func); 
  97.    --  Adds a filter function that decides which fonts to display in the font 
  98.    --  chooser. 
  99.    --  Since: gtk+ 3.2 
  100.    --  "filter": a Gtk_Font_Filter_Func, or null 
  101.  
  102.    generic 
  103.       type User_Data_Type (<>) is private; 
  104.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  105.    package Set_Filter_Func_User_Data is 
  106.  
  107.       type Gtk_Font_Filter_Func is access function 
  108.         (Family : not null access Pango.Font_Family.Pango_Font_Family_Record'Class; 
  109.          Face   : not null access Pango.Font_Face.Pango_Font_Face_Record'Class; 
  110.          Data   : User_Data_Type) return Boolean; 
  111.       --  The type of function that is used for deciding what fonts get shown in 
  112.       --  a Gtk.Font_Chooser.Gtk_Font_Chooser. See 
  113.       --  Gtk.Font_Chooser.Set_Filter_Func. 
  114.       --  "family": a Pango.Font_Family.Pango_Font_Family 
  115.       --  "face": a Pango.Font_Face.Pango_Font_Face belonging to Family 
  116.       --  "data": user data passed to Gtk.Font_Chooser.Set_Filter_Func 
  117.  
  118.       procedure Set_Filter_Func 
  119.          (Self      : not null access Gtk.Font_Chooser_Widget.Gtk_Font_Chooser_Widget_Record'Class; 
  120.           Filter    : Gtk_Font_Filter_Func; 
  121.           User_Data : User_Data_Type); 
  122.       --  Adds a filter function that decides which fonts to display in the 
  123.       --  font chooser. 
  124.       --  Since: gtk+ 3.2 
  125.       --  "filter": a Gtk_Font_Filter_Func, or null 
  126.       --  "user_data": data to pass to Filter 
  127.  
  128.    end Set_Filter_Func_User_Data; 
  129.  
  130.    --------------------------------------------- 
  131.    -- Inherited subprograms (from interfaces) -- 
  132.    --------------------------------------------- 
  133.    --  Methods inherited from the Buildable interface are not duplicated here 
  134.    --  since they are meant to be used by tools, mostly. If you need to call 
  135.    --  them, use an explicit cast through the "-" operator below. 
  136.  
  137.    function Get_Font 
  138.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  139.        return UTF8_String; 
  140.  
  141.    procedure Set_Font 
  142.       (Self     : not null access Gtk_Font_Chooser_Widget_Record; 
  143.        Fontname : UTF8_String); 
  144.  
  145.    function Get_Font_Desc 
  146.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  147.        return Pango.Font.Pango_Font_Description; 
  148.  
  149.    procedure Set_Font_Desc 
  150.       (Self      : not null access Gtk_Font_Chooser_Widget_Record; 
  151.        Font_Desc : Pango.Font.Pango_Font_Description); 
  152.  
  153.    function Get_Font_Face 
  154.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  155.        return Pango.Font_Face.Pango_Font_Face; 
  156.  
  157.    function Get_Font_Family 
  158.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  159.        return Pango.Font_Family.Pango_Font_Family; 
  160.  
  161.    function Get_Font_Size 
  162.       (Self : not null access Gtk_Font_Chooser_Widget_Record) return Gint; 
  163.  
  164.    function Get_Preview_Text 
  165.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  166.        return UTF8_String; 
  167.  
  168.    procedure Set_Preview_Text 
  169.       (Self : not null access Gtk_Font_Chooser_Widget_Record; 
  170.        Text : UTF8_String); 
  171.  
  172.    function Get_Show_Preview_Entry 
  173.       (Self : not null access Gtk_Font_Chooser_Widget_Record) return Boolean; 
  174.  
  175.    procedure Set_Show_Preview_Entry 
  176.       (Self               : not null access Gtk_Font_Chooser_Widget_Record; 
  177.        Show_Preview_Entry : Boolean); 
  178.  
  179.    function Get_Orientation 
  180.       (Self : not null access Gtk_Font_Chooser_Widget_Record) 
  181.        return Gtk.Enums.Gtk_Orientation; 
  182.  
  183.    procedure Set_Orientation 
  184.       (Self        : not null access Gtk_Font_Chooser_Widget_Record; 
  185.        Orientation : Gtk.Enums.Gtk_Orientation); 
  186.  
  187.    ---------------- 
  188.    -- Interfaces -- 
  189.    ---------------- 
  190.    --  This class implements several interfaces. See Glib.Types 
  191.    -- 
  192.    --  - "Buildable" 
  193.    -- 
  194.    --  - "FontChooser" 
  195.    -- 
  196.    --  - "Orientable" 
  197.  
  198.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  199.      (Gtk.Buildable.Gtk_Buildable, Gtk_Font_Chooser_Widget_Record, Gtk_Font_Chooser_Widget); 
  200.    function "+" 
  201.      (Widget : access Gtk_Font_Chooser_Widget_Record'Class) 
  202.    return Gtk.Buildable.Gtk_Buildable 
  203.    renames Implements_Gtk_Buildable.To_Interface; 
  204.    function "-" 
  205.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  206.    return Gtk_Font_Chooser_Widget 
  207.    renames Implements_Gtk_Buildable.To_Object; 
  208.  
  209.    package Implements_Gtk_Font_Chooser is new Glib.Types.Implements 
  210.      (Gtk.Font_Chooser.Gtk_Font_Chooser, Gtk_Font_Chooser_Widget_Record, Gtk_Font_Chooser_Widget); 
  211.    function "+" 
  212.      (Widget : access Gtk_Font_Chooser_Widget_Record'Class) 
  213.    return Gtk.Font_Chooser.Gtk_Font_Chooser 
  214.    renames Implements_Gtk_Font_Chooser.To_Interface; 
  215.    function "-" 
  216.      (Interf : Gtk.Font_Chooser.Gtk_Font_Chooser) 
  217.    return Gtk_Font_Chooser_Widget 
  218.    renames Implements_Gtk_Font_Chooser.To_Object; 
  219.  
  220.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  221.      (Gtk.Orientable.Gtk_Orientable, Gtk_Font_Chooser_Widget_Record, Gtk_Font_Chooser_Widget); 
  222.    function "+" 
  223.      (Widget : access Gtk_Font_Chooser_Widget_Record'Class) 
  224.    return Gtk.Orientable.Gtk_Orientable 
  225.    renames Implements_Gtk_Orientable.To_Interface; 
  226.    function "-" 
  227.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  228.    return Gtk_Font_Chooser_Widget 
  229.    renames Implements_Gtk_Orientable.To_Object; 
  230.  
  231. end Gtk.Font_Chooser_Widget;