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-2011, 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. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  This widget is an adapter: it can contain any child, and will make it 
  27. --  scrollable. Its use is not necessary inside a Gtk_Scrolled_Window, which 
  28. --  automatically uses a Gtk_Viewport when necessary. 
  29. -- 
  30. --  </description> 
  31. --  <group>Scrolling</group> 
  32.  
  33. pragma Warnings (Off, "*is already use-visible*"); 
  34. with Gdk.Window;      use Gdk.Window; 
  35. with Glib;            use Glib; 
  36. with Glib.Properties; use Glib.Properties; 
  37. with Glib.Types;      use Glib.Types; 
  38. with Gtk.Adjustment;  use Gtk.Adjustment; 
  39. with Gtk.Bin;         use Gtk.Bin; 
  40. with Gtk.Buildable;   use Gtk.Buildable; 
  41. with Gtk.Enums;       use Gtk.Enums; 
  42. with Gtk.Widget;      use Gtk.Widget; 
  43.  
  44. package Gtk.Viewport is 
  45.  
  46.    type Gtk_Viewport_Record is new Gtk_Bin_Record with null record; 
  47.    type Gtk_Viewport is access all Gtk_Viewport_Record'Class; 
  48.  
  49.    ------------------ 
  50.    -- Constructors -- 
  51.    ------------------ 
  52.  
  53.    procedure Gtk_New 
  54.       (Viewport    : out Gtk_Viewport; 
  55.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  56.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  57.    procedure Initialize 
  58.       (Viewport    : access Gtk_Viewport_Record'Class; 
  59.        Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null; 
  60.        Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null); 
  61.    --  Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments. 
  62.    --  "hadjustment": horizontal adjustment. 
  63.    --  "vadjustment": vertical adjustment. 
  64.  
  65.    function Get_Type return Glib.GType; 
  66.    pragma Import (C, Get_Type, "gtk_viewport_get_type"); 
  67.  
  68.    ------------- 
  69.    -- Methods -- 
  70.    ------------- 
  71.  
  72.    function Get_Bin_Window 
  73.       (Viewport : access Gtk_Viewport_Record) return Gdk.Window.Gdk_Window; 
  74.    --  Gets the bin window of the Gtk.Viewport.Gtk_Viewport. 
  75.    --  Since: gtk+ 2.20 
  76.    --  Returns a Gdk.Window.Gdk_Window 
  77.  
  78.    function Get_Hadjustment 
  79.       (Viewport : access Gtk_Viewport_Record) 
  80.        return Gtk.Adjustment.Gtk_Adjustment; 
  81.    procedure Set_Hadjustment 
  82.       (Viewport   : access Gtk_Viewport_Record; 
  83.        Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  84.    --  Sets the horizontal adjustment of the viewport. 
  85.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment. 
  86.  
  87.    function Get_Shadow_Type 
  88.       (Viewport : access Gtk_Viewport_Record) 
  89.        return Gtk.Enums.Gtk_Shadow_Type; 
  90.    procedure Set_Shadow_Type 
  91.       (Viewport : access Gtk_Viewport_Record; 
  92.        The_Type : Gtk.Enums.Gtk_Shadow_Type); 
  93.    --  Sets the shadow type of the viewport. 
  94.    --  "type": the new shadow type. 
  95.  
  96.    function Get_Vadjustment 
  97.       (Viewport : access Gtk_Viewport_Record) 
  98.        return Gtk.Adjustment.Gtk_Adjustment; 
  99.    procedure Set_Vadjustment 
  100.       (Viewport   : access Gtk_Viewport_Record; 
  101.        Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  102.    --  Sets the vertical adjustment of the viewport. 
  103.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment. 
  104.  
  105.    function Get_View_Window 
  106.       (Viewport : access Gtk_Viewport_Record) return Gdk.Window.Gdk_Window; 
  107.    --  Gets the view window of the Gtk.Viewport.Gtk_Viewport. 
  108.    --  Since: gtk+ 2.22 
  109.    --  Returns a Gdk.Window.Gdk_Window 
  110.  
  111.    ---------------- 
  112.    -- Interfaces -- 
  113.    ---------------- 
  114.    --  This class implements several interfaces. See Glib.Types 
  115.    -- 
  116.    --  - "Buildable" 
  117.  
  118.    package Implements_Buildable is new Glib.Types.Implements 
  119.      (Gtk.Buildable.Gtk_Buildable, Gtk_Viewport_Record, Gtk_Viewport); 
  120.    function "+" 
  121.      (Widget : access Gtk_Viewport_Record'Class) 
  122.    return Gtk.Buildable.Gtk_Buildable 
  123.    renames Implements_Buildable.To_Interface; 
  124.    function "-" 
  125.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  126.    return Gtk_Viewport 
  127.    renames Implements_Buildable.To_Object; 
  128.  
  129.    ---------------- 
  130.    -- Properties -- 
  131.    ---------------- 
  132.    --  The following properties are defined for this widget. See 
  133.    --  Glib.Properties for more information on properties) 
  134.    -- 
  135.    --  Name: Hadjustment_Property 
  136.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  137.    --  Flags: read-write 
  138.    -- 
  139.    --  Name: Shadow_Type_Property 
  140.    --  Type: Gtk.Enums.Gtk_Shadow_Type 
  141.    --  Flags: read-write 
  142.    -- 
  143.    --  Name: Vadjustment_Property 
  144.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  145.    --  Flags: read-write 
  146.  
  147.    Hadjustment_Property : constant Glib.Properties.Property_Object; 
  148.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  149.    Vadjustment_Property : constant Glib.Properties.Property_Object; 
  150.  
  151.    ------------- 
  152.    -- Signals -- 
  153.    ------------- 
  154.    --  The following new signals are defined for this widget: 
  155.    -- 
  156.    --  "set-scroll-adjustments" 
  157.    --     procedure Handler 
  158.    --       (Self   : access Gtk_Viewport_Record'Class; 
  159.    --        Object : Gtk.Adjustment.Gtk_Adjustment; 
  160.    --        P0     : Gtk.Adjustment.Gtk_Adjustment); 
  161.    --  Set the scroll adjustments for the viewport. Usually scrolled 
  162.    --  containers like Gtk.Scrolledwindow.Gtk_Scrolledwindow will emit this 
  163.    --  signal to connect two instances of Gtk.Scrollbar.Gtk_Scrollbar to the 
  164.    --  scroll directions of the Gtk.Viewport.Gtk_Viewport. 
  165.  
  166.    Signal_Set_Scroll_Adjustments : constant Glib.Signal_Name := "set-scroll-adjustments"; 
  167.  
  168. private 
  169.    Hadjustment_Property : constant Glib.Properties.Property_Object := 
  170.      Glib.Properties.Build ("hadjustment"); 
  171.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  172.      Gtk.Enums.Build ("shadow-type"); 
  173.    Vadjustment_Property : constant Glib.Properties.Property_Object := 
  174.      Glib.Properties.Build ("vadjustment"); 
  175. end Gtk.Viewport;