1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2013, AdaCore                   -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <description> 
  31. --  This widget is an adapter: it can contain any child, and will make it 
  32. --  scrollable. Its use is not necessary inside a Gtk_Scrolled_Window, which 
  33. --  automatically uses a Gtk_Viewport when necessary. 
  34. -- 
  35. --  </description> 
  36. --  <group>Scrolling</group> 
  37.  
  38. pragma Warnings (Off, "*is already use-visible*"); 
  39. with Gdk.Window;      use Gdk.Window; 
  40. with Glib;            use Glib; 
  41. with Glib.Properties; use Glib.Properties; 
  42. with Glib.Types;      use Glib.Types; 
  43. with Gtk.Adjustment;  use Gtk.Adjustment; 
  44. with Gtk.Bin;         use Gtk.Bin; 
  45. with Gtk.Buildable;   use Gtk.Buildable; 
  46. with Gtk.Enums;       use Gtk.Enums; 
  47. with Gtk.Widget;      use Gtk.Widget; 
  48.  
  49. package Gtk.Viewport is 
  50.  
  51.    type Gtk_Viewport_Record is new Gtk_Bin_Record with null record; 
  52.    type Gtk_Viewport is access all Gtk_Viewport_Record'Class; 
  53.  
  54.    ------------------ 
  55.    -- Constructors -- 
  56.    ------------------ 
  57.  
  58.    procedure Gtk_New 
  59.       (Viewport    : out Gtk_Viewport; 
  60.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  61.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  62.    procedure Initialize 
  63.       (Viewport    : access Gtk_Viewport_Record'Class; 
  64.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  65.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  66.    --  Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments. 
  67.    --  "hadjustment": horizontal adjustment. 
  68.    --  "vadjustment": vertical adjustment. 
  69.  
  70.    function Get_Type return Glib.GType; 
  71.    pragma Import (C, Get_Type, "gtk_viewport_get_type"); 
  72.  
  73.    ------------- 
  74.    -- Methods -- 
  75.    ------------- 
  76.  
  77.    function Get_Bin_Window 
  78.       (Viewport : access Gtk_Viewport_Record) return Gdk.Window.Gdk_Window; 
  79.    --  Gets the bin window of the Gtk.Viewport.Gtk_Viewport. 
  80.    --  Since: gtk+ 2.20 
  81.  
  82.    function Get_Hadjustment 
  83.       (Viewport : access Gtk_Viewport_Record) 
  84.        return Gtk.Adjustment.Gtk_Adjustment; 
  85.    procedure Set_Hadjustment 
  86.       (Viewport   : access Gtk_Viewport_Record; 
  87.        Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  88.    --  Sets the horizontal adjustment of the viewport. 
  89.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment. 
  90.  
  91.    function Get_Shadow_Type 
  92.       (Viewport : access Gtk_Viewport_Record) 
  93.        return Gtk.Enums.Gtk_Shadow_Type; 
  94.    procedure Set_Shadow_Type 
  95.       (Viewport : access Gtk_Viewport_Record; 
  96.        The_Type : Gtk.Enums.Gtk_Shadow_Type); 
  97.    --  Sets the shadow type of the viewport. 
  98.    --  "type": the new shadow type. 
  99.  
  100.    function Get_Vadjustment 
  101.       (Viewport : access Gtk_Viewport_Record) 
  102.        return Gtk.Adjustment.Gtk_Adjustment; 
  103.    procedure Set_Vadjustment 
  104.       (Viewport   : access Gtk_Viewport_Record; 
  105.        Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  106.    --  Sets the vertical adjustment of the viewport. 
  107.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment. 
  108.  
  109.    function Get_View_Window 
  110.       (Viewport : access Gtk_Viewport_Record) return Gdk.Window.Gdk_Window; 
  111.    --  Gets the view window of the Gtk.Viewport.Gtk_Viewport. 
  112.    --  Since: gtk+ 2.22 
  113.  
  114.    ---------------- 
  115.    -- Interfaces -- 
  116.    ---------------- 
  117.    --  This class implements several interfaces. See Glib.Types 
  118.    -- 
  119.    --  - "Buildable" 
  120.  
  121.    package Implements_Buildable is new Glib.Types.Implements 
  122.      (Gtk.Buildable.Gtk_Buildable, Gtk_Viewport_Record, Gtk_Viewport); 
  123.    function "+" 
  124.      (Widget : access Gtk_Viewport_Record'Class) 
  125.    return Gtk.Buildable.Gtk_Buildable 
  126.    renames Implements_Buildable.To_Interface; 
  127.    function "-" 
  128.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  129.    return Gtk_Viewport 
  130.    renames Implements_Buildable.To_Object; 
  131.  
  132.    ---------------- 
  133.    -- Properties -- 
  134.    ---------------- 
  135.    --  The following properties are defined for this widget. See 
  136.    --  Glib.Properties for more information on properties) 
  137.    -- 
  138.    --  Name: Hadjustment_Property 
  139.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  140.    --  Flags: read-write 
  141.    -- 
  142.    --  Name: Shadow_Type_Property 
  143.    --  Type: Gtk.Enums.Gtk_Shadow_Type 
  144.    --  Flags: read-write 
  145.    -- 
  146.    --  Name: Vadjustment_Property 
  147.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  148.    --  Flags: read-write 
  149.  
  150.    Hadjustment_Property : constant Glib.Properties.Property_Object; 
  151.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  152.    Vadjustment_Property : constant Glib.Properties.Property_Object; 
  153.  
  154.    ------------- 
  155.    -- Signals -- 
  156.    ------------- 
  157.    --  The following new signals are defined for this widget: 
  158.    -- 
  159.    --  "set-scroll-adjustments" 
  160.    --     procedure Handler 
  161.    --       (Self   : access Gtk_Viewport_Record'Class; 
  162.    --        Object : Gtk.Adjustment.Gtk_Adjustment; 
  163.    --        P0     : Gtk.Adjustment.Gtk_Adjustment); 
  164.    --  Set the scroll adjustments for the viewport. Usually scrolled 
  165.    --  containers like Gtk.Scrolledwindow.Gtk_Scrolledwindow will emit this 
  166.    --  signal to connect two instances of Gtk.Scrollbar.Gtk_Scrollbar to the 
  167.    --  scroll directions of the Gtk.Viewport.Gtk_Viewport. 
  168.  
  169.    Signal_Set_Scroll_Adjustments : constant Glib.Signal_Name := "set-scroll-adjustments"; 
  170.  
  171. private 
  172.    Hadjustment_Property : constant Glib.Properties.Property_Object := 
  173.      Glib.Properties.Build ("hadjustment"); 
  174.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  175.      Gtk.Enums.Build ("shadow-type"); 
  176.    Vadjustment_Property : constant Glib.Properties.Property_Object := 
  177.      Glib.Properties.Build ("vadjustment"); 
  178. end Gtk.Viewport;