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.Viewport.Gtk_Viewport widget acts as an adaptor class, 
  26. --  implementing scrollability for child widgets that lack their own scrolling 
  27. --  capabilities. Use Gtk.Viewport.Gtk_Viewport to scroll child widgets such as 
  28. --  Gtk.Grid.Gtk_Grid, Gtk.Box.Gtk_Box, and so on. 
  29. -- 
  30. --  If a widget has native scrolling abilities, such as 
  31. --  Gtk.Text_View.Gtk_Text_View, Gtk.Tree_View.Gtk_Tree_View or 
  32. --  Gtk.Icon_View.Gtk_Icon_View, it can be added to a 
  33. --  Gtk.Scrolled_Window.Gtk_Scrolled_Window with Gtk.Container.Add. If a widget 
  34. --  does not, you must first add the widget to a Gtk.Viewport.Gtk_Viewport, 
  35. --  then add the viewport to the scrolled window. Gtk.Container.Add does this 
  36. --  automatically if a child that does not implement 
  37. --  Gtk.Scrollable.Gtk_Scrollable is added to a 
  38. --  Gtk.Scrolled_Window.Gtk_Scrolled_Window, so you can ignore the presence of 
  39. --  the viewport. 
  40. -- 
  41. --  The Gtk.Viewport.Gtk_Viewport will start scrolling content only if 
  42. --  allocated less than the child widget's minimum size in a given orientation. 
  43. -- 
  44. --  </description> 
  45. --  <group>Scrolling</group> 
  46. pragma Ada_2005; 
  47.  
  48. pragma Warnings (Off, "*is already use-visible*"); 
  49. with Gdk;            use Gdk; 
  50. with Glib;           use Glib; 
  51. with Glib.Types;     use Glib.Types; 
  52. with Gtk.Adjustment; use Gtk.Adjustment; 
  53. with Gtk.Bin;        use Gtk.Bin; 
  54. with Gtk.Buildable;  use Gtk.Buildable; 
  55. with Gtk.Enums;      use Gtk.Enums; 
  56. with Gtk.Scrollable; use Gtk.Scrollable; 
  57.  
  58. package Gtk.Viewport is 
  59.  
  60.    type Gtk_Viewport_Record is new Gtk_Bin_Record with null record; 
  61.    type Gtk_Viewport is access all Gtk_Viewport_Record'Class; 
  62.  
  63.    ------------------ 
  64.    -- Constructors -- 
  65.    ------------------ 
  66.  
  67.    procedure Gtk_New 
  68.       (Viewport    : out Gtk_Viewport; 
  69.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  70.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  71.    procedure Initialize 
  72.       (Viewport    : not null access Gtk_Viewport_Record'Class; 
  73.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  74.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  75.    --  Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments, or 
  76.    --  with default adjustments if none are given. 
  77.    --  "hadjustment": horizontal adjustment 
  78.    --  "vadjustment": vertical adjustment 
  79.  
  80.    function Gtk_Viewport_New 
  81.       (Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  82.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null) 
  83.        return Gtk_Viewport; 
  84.    --  Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments, or 
  85.    --  with default adjustments if none are given. 
  86.    --  "hadjustment": horizontal adjustment 
  87.    --  "vadjustment": vertical adjustment 
  88.  
  89.    function Get_Type return Glib.GType; 
  90.    pragma Import (C, Get_Type, "gtk_viewport_get_type"); 
  91.  
  92.    ------------- 
  93.    -- Methods -- 
  94.    ------------- 
  95.  
  96.    function Get_Bin_Window 
  97.       (Viewport : not null access Gtk_Viewport_Record) return Gdk.Gdk_Window; 
  98.    --  Gets the bin window of the Gtk.Viewport.Gtk_Viewport. 
  99.    --  Since: gtk+ 2.20 
  100.  
  101.    function Get_Shadow_Type 
  102.       (Viewport : not null access Gtk_Viewport_Record) 
  103.        return Gtk.Enums.Gtk_Shadow_Type; 
  104.    --  Gets the shadow type of the Gtk.Viewport.Gtk_Viewport. See 
  105.    --  Gtk.Viewport.Set_Shadow_Type. 
  106.  
  107.    procedure Set_Shadow_Type 
  108.       (Viewport : not null access Gtk_Viewport_Record; 
  109.        The_Type : Gtk.Enums.Gtk_Shadow_Type); 
  110.    --  Sets the shadow type of the viewport. 
  111.    --  "type": the new shadow type. 
  112.  
  113.    function Get_View_Window 
  114.       (Viewport : not null access Gtk_Viewport_Record) return Gdk.Gdk_Window; 
  115.    --  Gets the view window of the Gtk.Viewport.Gtk_Viewport. 
  116.    --  Since: gtk+ 2.22 
  117.  
  118.    --------------------------------------------- 
  119.    -- Inherited subprograms (from interfaces) -- 
  120.    --------------------------------------------- 
  121.    --  Methods inherited from the Buildable interface are not duplicated here 
  122.    --  since they are meant to be used by tools, mostly. If you need to call 
  123.    --  them, use an explicit cast through the "-" operator below. 
  124.  
  125.    function Get_Hadjustment 
  126.       (Self : not null access Gtk_Viewport_Record) 
  127.        return Gtk.Adjustment.Gtk_Adjustment; 
  128.  
  129.    procedure Set_Hadjustment 
  130.       (Self        : not null access Gtk_Viewport_Record; 
  131.        Hadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  132.  
  133.    function Get_Hscroll_Policy 
  134.       (Self : not null access Gtk_Viewport_Record) 
  135.        return Gtk.Enums.Gtk_Scrollable_Policy; 
  136.  
  137.    procedure Set_Hscroll_Policy 
  138.       (Self   : not null access Gtk_Viewport_Record; 
  139.        Policy : Gtk.Enums.Gtk_Scrollable_Policy); 
  140.  
  141.    function Get_Vadjustment 
  142.       (Self : not null access Gtk_Viewport_Record) 
  143.        return Gtk.Adjustment.Gtk_Adjustment; 
  144.  
  145.    procedure Set_Vadjustment 
  146.       (Self        : not null access Gtk_Viewport_Record; 
  147.        Vadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  148.  
  149.    function Get_Vscroll_Policy 
  150.       (Self : not null access Gtk_Viewport_Record) 
  151.        return Gtk.Enums.Gtk_Scrollable_Policy; 
  152.  
  153.    procedure Set_Vscroll_Policy 
  154.       (Self   : not null access Gtk_Viewport_Record; 
  155.        Policy : Gtk.Enums.Gtk_Scrollable_Policy); 
  156.  
  157.    ---------------- 
  158.    -- Properties -- 
  159.    ---------------- 
  160.    --  The following properties are defined for this widget. See 
  161.    --  Glib.Properties for more information on properties) 
  162.  
  163.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  164.  
  165.    ---------------- 
  166.    -- Interfaces -- 
  167.    ---------------- 
  168.    --  This class implements several interfaces. See Glib.Types 
  169.    -- 
  170.    --  - "Buildable" 
  171.    -- 
  172.    --  - "Scrollable" 
  173.  
  174.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  175.      (Gtk.Buildable.Gtk_Buildable, Gtk_Viewport_Record, Gtk_Viewport); 
  176.    function "+" 
  177.      (Widget : access Gtk_Viewport_Record'Class) 
  178.    return Gtk.Buildable.Gtk_Buildable 
  179.    renames Implements_Gtk_Buildable.To_Interface; 
  180.    function "-" 
  181.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  182.    return Gtk_Viewport 
  183.    renames Implements_Gtk_Buildable.To_Object; 
  184.  
  185.    package Implements_Gtk_Scrollable is new Glib.Types.Implements 
  186.      (Gtk.Scrollable.Gtk_Scrollable, Gtk_Viewport_Record, Gtk_Viewport); 
  187.    function "+" 
  188.      (Widget : access Gtk_Viewport_Record'Class) 
  189.    return Gtk.Scrollable.Gtk_Scrollable 
  190.    renames Implements_Gtk_Scrollable.To_Interface; 
  191.    function "-" 
  192.      (Interf : Gtk.Scrollable.Gtk_Scrollable) 
  193.    return Gtk_Viewport 
  194.    renames Implements_Gtk_Scrollable.To_Object; 
  195.  
  196. private 
  197.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  198.      Gtk.Enums.Build ("shadow-type"); 
  199. end Gtk.Viewport;