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