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. --  Gtk.Scrollable.Gtk_Scrollable is an interface that is implemented by 
  26. --  widgets with native scrolling ability. 
  27. -- 
  28. --  To implement this interface you should override the 
  29. --  Gtk.Scrollable.Gtk_Scrollable:hadjustment and 
  30. --  Gtk.Scrollable.Gtk_Scrollable:vadjustment properties. 
  31. -- 
  32. --  == Creating a scrollable widget == 
  33. -- 
  34. --  All scrollable widgets should do the following. 
  35. -- 
  36. --  
  37. -- 
  38. --     * 
  39. -- 
  40. --  When a parent widget sets the scrollable child widget's adjustments, the 
  41. --  widget should populate the adjustments' 
  42. --  Gtk.Adjustment.Gtk_Adjustment:lower, Gtk.Adjustment.Gtk_Adjustment:upper, 
  43. --  Gtk.Adjustment.Gtk_Adjustment:step-increment, 
  44. --  Gtk.Adjustment.Gtk_Adjustment:page-increment and 
  45. --  Gtk.Adjustment.Gtk_Adjustment:page-size properties and connect to the 
  46. --  Gtk.Adjustment.Gtk_Adjustment::value-changed signal. 
  47. -- 
  48. --     * 
  49. -- 
  50. --  Because its preferred size is the size for a fully expanded widget, the 
  51. --  scrollable widget must be able to cope with underallocations. This means 
  52. --  that it must accept any value passed to its 
  53. --  Gtk.Widget.GObject_Class.size_allocate function. 
  54. -- 
  55. --     * 
  56. -- 
  57. --  When the parent allocates space to the scrollable child widget, the widget 
  58. --  should update the adjustments' properties with new values. 
  59. -- 
  60. --     * 
  61. -- 
  62. --  When any of the adjustments emits the 
  63. --  Gtk.Adjustment.Gtk_Adjustment::value-changed signal, the scrollable widget 
  64. --  should scroll its contents. 
  65. -- 
  66. -- 
  67. --  </description> 
  68. --  <group>Interfaces</group> 
  69. pragma Ada_2005; 
  70.  
  71. pragma Warnings (Off, "*is already use-visible*"); 
  72. with Glib;            use Glib; 
  73. with Glib.Properties; use Glib.Properties; 
  74. with Glib.Types;      use Glib.Types; 
  75. with Gtk.Adjustment;  use Gtk.Adjustment; 
  76. with Gtk.Enums;       use Gtk.Enums; 
  77.  
  78. package Gtk.Scrollable is 
  79.  
  80.    type Gtk_Scrollable is new Glib.Types.GType_Interface; 
  81.    Null_Gtk_Scrollable : constant Gtk_Scrollable; 
  82.  
  83.    ------------------ 
  84.    -- Constructors -- 
  85.    ------------------ 
  86.  
  87.    function Get_Type return Glib.GType; 
  88.    pragma Import (C, Get_Type, "gtk_scrollable_get_type"); 
  89.  
  90.    ------------- 
  91.    -- Methods -- 
  92.    ------------- 
  93.  
  94.    function Get_Hadjustment 
  95.       (Self : Gtk_Scrollable) return Gtk.Adjustment.Gtk_Adjustment; 
  96.    --  Retrieves the Gtk.Adjustment.Gtk_Adjustment used for horizontal 
  97.    --  scrolling. 
  98.    --  Since: gtk+ 3.0 
  99.  
  100.    procedure Set_Hadjustment 
  101.       (Self        : Gtk_Scrollable; 
  102.        Hadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  103.    --  Sets the horizontal adjustment of the Gtk.Scrollable.Gtk_Scrollable. 
  104.    --  Since: gtk+ 3.0 
  105.    --  "hadjustment": a Gtk.Adjustment.Gtk_Adjustment 
  106.  
  107.    function Get_Hscroll_Policy 
  108.       (Self : Gtk_Scrollable) return Gtk.Enums.Gtk_Scrollable_Policy; 
  109.    pragma Import (C, Get_Hscroll_Policy, "gtk_scrollable_get_hscroll_policy"); 
  110.    --  Gets the horizontal Gtk.Enums.Gtk_Scrollable_Policy. 
  111.    --  Since: gtk+ 3.0 
  112.  
  113.    procedure Set_Hscroll_Policy 
  114.       (Self   : Gtk_Scrollable; 
  115.        Policy : Gtk.Enums.Gtk_Scrollable_Policy); 
  116.    pragma Import (C, Set_Hscroll_Policy, "gtk_scrollable_set_hscroll_policy"); 
  117.    --  Sets the Gtk.Enums.Gtk_Scrollable_Policy to determine whether 
  118.    --  horizontal scrolling should start below the minimum width or below the 
  119.    --  natural width. 
  120.    --  Since: gtk+ 3.0 
  121.    --  "policy": the horizontal Gtk.Enums.Gtk_Scrollable_Policy 
  122.  
  123.    function Get_Vadjustment 
  124.       (Self : Gtk_Scrollable) return Gtk.Adjustment.Gtk_Adjustment; 
  125.    --  Retrieves the Gtk.Adjustment.Gtk_Adjustment used for vertical 
  126.    --  scrolling. 
  127.    --  Since: gtk+ 3.0 
  128.  
  129.    procedure Set_Vadjustment 
  130.       (Self        : Gtk_Scrollable; 
  131.        Vadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  132.    --  Sets the vertical adjustment of the Gtk.Scrollable.Gtk_Scrollable. 
  133.    --  Since: gtk+ 3.0 
  134.    --  "vadjustment": a Gtk.Adjustment.Gtk_Adjustment 
  135.  
  136.    function Get_Vscroll_Policy 
  137.       (Self : Gtk_Scrollable) return Gtk.Enums.Gtk_Scrollable_Policy; 
  138.    pragma Import (C, Get_Vscroll_Policy, "gtk_scrollable_get_vscroll_policy"); 
  139.    --  Gets the vertical Gtk.Enums.Gtk_Scrollable_Policy. 
  140.    --  Since: gtk+ 3.0 
  141.  
  142.    procedure Set_Vscroll_Policy 
  143.       (Self   : Gtk_Scrollable; 
  144.        Policy : Gtk.Enums.Gtk_Scrollable_Policy); 
  145.    pragma Import (C, Set_Vscroll_Policy, "gtk_scrollable_set_vscroll_policy"); 
  146.    --  Sets the Gtk.Enums.Gtk_Scrollable_Policy to determine whether vertical 
  147.    --  scrolling should start below the minimum height or below the natural 
  148.    --  height. 
  149.    --  Since: gtk+ 3.0 
  150.    --  "policy": the vertical Gtk.Enums.Gtk_Scrollable_Policy 
  151.  
  152.    ---------------- 
  153.    -- Properties -- 
  154.    ---------------- 
  155.    --  The following properties are defined for this widget. See 
  156.    --  Glib.Properties for more information on properties) 
  157.  
  158.    Hadjustment_Property : constant Glib.Properties.Property_Object; 
  159.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  160.    --  Horizontal Gtk.Adjustment.Gtk_Adjustment of the scrollable widget. This 
  161.    --  adjustment is shared between the scrollable widget and its parent. 
  162.  
  163.    Hscroll_Policy_Property : constant Gtk.Enums.Property_Gtk_Scrollable_Policy; 
  164.    --  Determines whether horizontal scrolling should start once the 
  165.    --  scrollable widget is allocated less than its minimum width or less than 
  166.    --  its natural width. 
  167.  
  168.    Vadjustment_Property : constant Glib.Properties.Property_Object; 
  169.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  170.    --  Verical Gtk.Adjustment.Gtk_Adjustment of the scrollable widget. This 
  171.    --  adjustment is shared between the scrollable widget and its parent. 
  172.  
  173.    Vscroll_Policy_Property : constant Gtk.Enums.Property_Gtk_Scrollable_Policy; 
  174.    --  Determines whether vertical scrolling should start once the scrollable 
  175.    --  widget is allocated less than its minimum height or less than its 
  176.    --  natural height. 
  177.  
  178.    ---------------- 
  179.    -- Interfaces -- 
  180.    ---------------- 
  181.    --  This class implements several interfaces. See Glib.Types 
  182.    -- 
  183.    --  - "Gtk_Scrollable" 
  184.  
  185.    function "+" (W : Gtk_Scrollable) return Gtk_Scrollable; 
  186.    pragma Inline ("+"); 
  187.  
  188. private 
  189.    Vscroll_Policy_Property : constant Gtk.Enums.Property_Gtk_Scrollable_Policy := 
  190.      Gtk.Enums.Build ("vscroll-policy"); 
  191.    Vadjustment_Property : constant Glib.Properties.Property_Object := 
  192.      Glib.Properties.Build ("vadjustment"); 
  193.    Hscroll_Policy_Property : constant Gtk.Enums.Property_Gtk_Scrollable_Policy := 
  194.      Gtk.Enums.Build ("hscroll-policy"); 
  195.    Hadjustment_Property : constant Glib.Properties.Property_Object := 
  196.      Glib.Properties.Build ("hadjustment"); 
  197.  
  198. Null_Gtk_Scrollable : constant Gtk_Scrollable := 
  199.    Gtk_Scrollable (Glib.Types.Null_Interface); 
  200. end Gtk.Scrollable;