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. --  A container which can hide its child. 
  26. --  </description> 
  27. --  <c_version>2.8.17</c_version> 
  28. --  <group>Layout containers</group> 
  29. --  <screenshot>gtk-expander</screenshot> 
  30.  
  31. with Glib.Properties; 
  32. with Gtk.Bin; 
  33. with Gtk.Widget; 
  34.  
  35. package Gtk.Expander is 
  36.  
  37.    type Gtk_Expander_Record is new Gtk.Bin.Gtk_Bin_Record with null record; 
  38.    type Gtk_Expander is access all Gtk_Expander_Record'Class; 
  39.  
  40.    procedure Gtk_New (Expander : out Gtk_Expander; Label : String); 
  41.    procedure Initialize 
  42.      (Expander : access Gtk_Expander_Record'Class; Label  : String); 
  43.    --  Creates or initializes a new expander, using Label as the text of the 
  44.    --  label. 
  45.  
  46.    procedure Gtk_New_With_Mnemonic 
  47.      (Expander : out Gtk_Expander; Label : String); 
  48.    procedure Initialize_With_Mnemonic 
  49.      (Expander : access Gtk_Expander_Record'Class; Label  : String); 
  50.    --  Creates or initializes a new expander, using Label as the text of the 
  51.    --  label. 
  52.    --  If characters in Label are preceded by an underscore, they are 
  53.    --  underlined. If you need a literal underscore character in a label, use 
  54.    --  '__' (two underscores). The first underlined character represents a 
  55.    --  keyboard accelerator called a mnemonic. 
  56.    --  Pressing Alt and that key activates the button. 
  57.  
  58.    function Get_Type return Glib.GType; 
  59.    --  Returns the internal value used for an expander 
  60.  
  61.    procedure Set_Expanded 
  62.      (Expander : access Gtk_Expander_Record; Expanded : Boolean); 
  63.    function Get_Expanded 
  64.      (Expander : access Gtk_Expander_Record) return Boolean; 
  65.    --  Sets the state of the expander. Set to True, if you want 
  66.    --  the child widget to be revealed, and False if you want the 
  67.    --  child widget to be hidden. 
  68.  
  69.    procedure Set_Label 
  70.      (Expander : access Gtk_Expander_Record; Label : String); 
  71.    function Get_Label 
  72.      (Expander : access Gtk_Expander_Record) return String; 
  73.    --  Sets the text of the label of the expander to Label. 
  74.  
  75.    procedure Set_Label_Widget 
  76.      (Expander     : access Gtk_Expander_Record; 
  77.       Label_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  78.    function Get_Label_Widget 
  79.      (Expander : access Gtk_Expander_Record) return Gtk.Widget.Gtk_Widget; 
  80.    --  Set the label widget for the expander. This is the widget 
  81.    --  that will appear embedded alongside the expander arrow. 
  82.  
  83.    procedure Set_Spacing 
  84.      (Expander : access Gtk_Expander_Record; Spacing  : Gint); 
  85.    function Get_Spacing 
  86.      (Expander : access Gtk_Expander_Record) return Gint; 
  87.    --  Sets the spacing field of Expander, which is the number of pixels to 
  88.    --  place between expander and the child. 
  89.  
  90.    procedure Set_Use_Markup 
  91.      (Expander : access Gtk_Expander_Record; Use_Markup : Boolean); 
  92.    function Get_Use_Markup 
  93.      (Expander : access Gtk_Expander_Record) return Boolean; 
  94.    --  Sets whether the text of the label contains markup in Pango's text 
  95.    --  markup language. See Gtk.Label.Set_Markup. 
  96.  
  97.    procedure Set_Use_Underline 
  98.      (Expander : access Gtk_Expander_Record; Use_Underline : Boolean); 
  99.    function Get_Use_Underline 
  100.      (Expander : access Gtk_Expander_Record) return Boolean; 
  101.    --  If true, an underline in the text of the expander label indicates 
  102.    --  the next character should be used for the mnemonic accelerator key. 
  103.  
  104.    ---------------- 
  105.    -- Properties -- 
  106.    ---------------- 
  107.    --  The following properties are defined for this widget. See 
  108.    --  Glib.Properties for more information on properties. 
  109.  
  110.    --  <properties> 
  111.    --  Name:  Expanded_Property 
  112.    --  Type:  Boolean 
  113.    --  Descr: Whether the expander has been opened to reveal the child widget 
  114.    -- 
  115.    --  Name:  Label_Property 
  116.    --  Type:  String 
  117.    --  Descr: Text of the expander's label 
  118.    -- 
  119.    --  Name:  Label_Widget_Property 
  120.    --  Type:  Object 
  121.    --  Descr: A widget to display in place of the usual expander label 
  122.    -- 
  123.    --  Name:  Spacing_Property 
  124.    --  Type:  Int 
  125.    --  Descr: Space to put between the label and the child 
  126.    -- 
  127.    --  Name:  Use_Markup_Property 
  128.    --  Type:  Boolean 
  129.    --  Descr: The text of the label includes XML markup. See pango_parse_markup 
  130.    -- 
  131.    --  Name:  Use_Underline_Property 
  132.    --  Type:  Boolean 
  133.    --  Descr: If set, an underline in the text indicates the next character 
  134.    --         should be used for the mnemonic accelerator key 
  135.    --  </properties> 
  136.  
  137.    Expanded_Property      : constant Glib.Properties.Property_Boolean; 
  138.    Label_Property         : constant Glib.Properties.Property_String; 
  139.    Label_Widget_Property  : constant Glib.Properties.Property_Object; 
  140.    Spacing_Property       : constant Glib.Properties.Property_Int; 
  141.    Use_Markup_Property    : constant Glib.Properties.Property_Boolean; 
  142.    Use_Underline_Property : constant Glib.Properties.Property_Boolean; 
  143.  
  144.    ---------------------- 
  145.    -- Style Properties -- 
  146.    ---------------------- 
  147.    --  The following properties can be changed through the gtk theme and 
  148.    --  configuration files, and retrieved through Gtk.Widget.Style_Get_Property 
  149.  
  150.    --  <style_properties> 
  151.    --  Name:  Expander_Size_Property 
  152.    --  Type:  Int 
  153.    --  Descr: Size of the expander arrow 
  154.    -- 
  155.    --  Name:  Expander_Spacing_Property 
  156.    --  Type:  Int 
  157.    --  Descr: Spacing around expander arrow 
  158.    --  </style_properties> 
  159.  
  160.    Expander_Size_Property    : constant Glib.Properties.Property_Int; 
  161.    Expander_Spacing_Property : constant Glib.Properties.Property_Int; 
  162.  
  163.    ------------- 
  164.    -- Signals -- 
  165.    ------------- 
  166.  
  167.    --  <signals> 
  168.    --  The following new signals are defined for this widget: 
  169.    -- 
  170.    --  - "activate" 
  171.    --    procedure Handler (Expander : access Gtk_Expander_Record'Class); 
  172.    --    Send this signal if you want to toggle the state of the expander, as 
  173.    --    if the user had clicked on it. This is mostly useful when associated 
  174.    --    with a keybinding 
  175.    -- 
  176.    --  - "notify::expanded" 
  177.    --    This is the general "notify" signal, but will only call the handler 
  178.    --    when the "expanded property changes. This can be used to monitor state 
  179.    --    changes for the expander 
  180.    -- 
  181.    --  </signals> 
  182.  
  183.    Signal_Activate : constant Glib.Signal_Name := "activate"; 
  184.  
  185. private 
  186.    pragma Import (C, Get_Type, "gtk_expander_get_type"); 
  187.  
  188.    Expanded_Property : constant Glib.Properties.Property_Boolean := 
  189.      Glib.Properties.Build ("expanded"); 
  190.    Label_Property : constant Glib.Properties.Property_String := 
  191.      Glib.Properties.Build ("label"); 
  192.    Label_Widget_Property : constant Glib.Properties.Property_Object := 
  193.      Glib.Properties.Build ("label-widget"); 
  194.    Spacing_Property : constant Glib.Properties.Property_Int := 
  195.      Glib.Properties.Build ("spacing"); 
  196.    Use_Markup_Property : constant Glib.Properties.Property_Boolean := 
  197.      Glib.Properties.Build ("use-markup"); 
  198.    Use_Underline_Property : constant Glib.Properties.Property_Boolean := 
  199.      Glib.Properties.Build ("use-underline"); 
  200.  
  201.    Expander_Size_Property : constant Glib.Properties.Property_Int := 
  202.      Glib.Properties.Build ("expander-size"); 
  203.    Expander_Spacing_Property : constant Glib.Properties.Property_Int := 
  204.      Glib.Properties.Build ("expander-spacing"); 
  205.  
  206. end Gtk.Expander;