1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2007 AdaCore                    -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  The Gtk_Font_Button is a button which displays the currently selected font 
  26. --  an allows to open a font selection dialog to change the font. It is 
  27. --  suitable widget for selecting a font in a preference dialog. 
  28. --  </description> 
  29. --  <c_version>2.8.17</c_version> 
  30. --  <group>Selectors</group> 
  31. --  <screenshot>font-button.png</screenshot> 
  32.  
  33. with Glib.Properties; 
  34. with Gtk.Button; 
  35.  
  36. package Gtk.Font_Button is 
  37.  
  38.    type Gtk_Font_Button_Record is new Gtk.Button.Gtk_Button_Record with 
  39.      null record; 
  40.    type Gtk_Font_Button is access all Gtk_Font_Button_Record'Class; 
  41.  
  42.    procedure Gtk_New (Font_Button : out Gtk_Font_Button); 
  43.    procedure Initialize (Font_Button : access Gtk_Font_Button_Record'Class); 
  44.    --  Creates a new font picker widget. 
  45.  
  46.    procedure Gtk_New_With_Font 
  47.      (Font_Button : out Gtk_Font_Button; Fontname : String); 
  48.    procedure Initialize_With_Font 
  49.      (Font_Button : access Gtk_Font_Button_Record'Class; Fontname : String); 
  50.    --  Creates a new font picker widget. 
  51.  
  52.    function Get_Type return Gtk.Gtk_Type; 
  53.    --  Return the internal value associated with a Gtk_Font_Button 
  54.  
  55.    function Set_Font_Name 
  56.      (Font_Button : access Gtk_Font_Button_Record; 
  57.       Fontname    : String) return Boolean; 
  58.    function Get_Font_Name 
  59.      (Font_Button : access Gtk_Font_Button_Record) return String; 
  60.    --  Sets or updates the currently-displayed font in font picker dialog. 
  61.    --  Returns the value of Gtk.Font_Selection.Set_Font_Name if the font 
  62.    --  selection dialog exists, False otherwise. 
  63.  
  64.    procedure Set_Show_Size 
  65.      (Font_Button : access Gtk_Font_Button_Record; Show_Size : Boolean); 
  66.    function Get_Show_Size 
  67.      (Font_Button : access Gtk_Font_Button_Record) return Boolean; 
  68.    --  If Show_Size is True, the font size will be displayed along with the 
  69.    --  name of the selected font. 
  70.  
  71.    procedure Set_Show_Style 
  72.      (Font_Button : access Gtk_Font_Button_Record; Show_Style : Boolean); 
  73.    function Get_Show_Style 
  74.      (Font_Button : access Gtk_Font_Button_Record) return Boolean; 
  75.    --  Returns whether the name of the font style will be shown in the label. 
  76.  
  77.    procedure Set_Title 
  78.      (Font_Button : access Gtk_Font_Button_Record; Title : String); 
  79.    function Get_Title 
  80.      (Font_Button : access Gtk_Font_Button_Record) return String; 
  81.    --  Retrieves the title of the font selection dialog. 
  82.  
  83.    procedure Set_Use_Font 
  84.      (Font_Button : access Gtk_Font_Button_Record; Use_Font : Boolean); 
  85.    function Get_Use_Font 
  86.      (Font_Button : access Gtk_Font_Button_Record) return Boolean; 
  87.    --  If Use_Font is True, the font name will be written using the selected 
  88.    --  font. 
  89.  
  90.    procedure Set_Use_Size 
  91.      (Font_Button : access Gtk_Font_Button_Record; Use_Size : Boolean); 
  92.    function Get_Use_Size 
  93.      (Font_Button : access Gtk_Font_Button_Record) return Boolean; 
  94.    --  If Use_Size is True, the font name will be written using the selected 
  95.    --  size. 
  96.  
  97.    ---------------- 
  98.    -- Properties -- 
  99.    ---------------- 
  100.  
  101.    --  <properties> 
  102.    --  The following properties are defined for this widget. See 
  103.    --  Glib.Properties for more information on properties. 
  104.    -- 
  105.    --  Name:  Font_Name_Property 
  106.    --  Type:  String 
  107.    --  Descr: The name of the selected font 
  108.    -- 
  109.    --  Name:  Show_Size_Property 
  110.    --  Type:  Boolean 
  111.    --  Descr: Whether selected font size is shown in the label 
  112.    -- 
  113.    --  Name:  Show_Style_Property 
  114.    --  Type:  Boolean 
  115.    --  Descr: Whether the selected font style is shown in the label 
  116.    -- 
  117.    --  Name:  Title_Property 
  118.    --  Type:  String 
  119.    --  Descr: The title of the font selection dialog 
  120.    -- 
  121.    --  Name:  Use_Font_Property 
  122.    --  Type:  Boolean 
  123.    --  Descr: Whether the label is drawn in the selected font 
  124.    -- 
  125.    --  Name:  Use_Size_Property 
  126.    --  Type:  Boolean 
  127.    --  Descr: Whether the label is drawn with the selected font size 
  128.    -- 
  129.    --  </properties> 
  130.  
  131.    Font_Name_Property  : constant Glib.Properties.Property_String; 
  132.    Show_Size_Property  : constant Glib.Properties.Property_Boolean; 
  133.    Show_Style_Property : constant Glib.Properties.Property_Boolean; 
  134.    Title_Property      : constant Glib.Properties.Property_String; 
  135.    Use_Font_Property   : constant Glib.Properties.Property_Boolean; 
  136.    Use_Size_Property   : constant Glib.Properties.Property_Boolean; 
  137.  
  138.    ------------- 
  139.    -- Signals -- 
  140.    ------------- 
  141.  
  142.    --  <signals> 
  143.    --  The following new signals are defined for this widget: 
  144.    -- 
  145.    --  - "font-set" 
  146.    --    procedure Handler (Button : access Gtk_Font_Button_Record'Class); 
  147.    --    The font-set signal is emitted when the user selects a font. When 
  148.    --    handling this signal, use Get_Font_Name to find out which font was 
  149.    --    just selected. 
  150.    --    Note that this signal is only emitted when the user changes the font. 
  151.    --    If you need to react to programmatic font changes as well, use the 
  152.    --    notify::font-name signal. 
  153.    --  </signals> 
  154.  
  155.    Signal_Font_Set : constant Glib.Signal_Name := "font-set"; 
  156.  
  157. private 
  158.    Font_Name_Property : constant Glib.Properties.Property_String := 
  159.      Glib.Properties.Build ("font-name"); 
  160.    Show_Size_Property : constant Glib.Properties.Property_Boolean := 
  161.      Glib.Properties.Build ("show-size"); 
  162.    Show_Style_Property : constant Glib.Properties.Property_Boolean := 
  163.      Glib.Properties.Build ("show-style"); 
  164.    Title_Property : constant Glib.Properties.Property_String := 
  165.      Glib.Properties.Build ("title"); 
  166.    Use_Font_Property : constant Glib.Properties.Property_Boolean := 
  167.      Glib.Properties.Build ("use-font"); 
  168.    Use_Size_Property : constant Glib.Properties.Property_Boolean := 
  169.      Glib.Properties.Build ("use-size"); 
  170.  
  171.    pragma Import (C, Get_Type, "gtk_font_button_get_type"); 
  172. end Gtk.Font_Button;