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