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-2010 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. --  A Gtk_Layout is a widget that can have an almost infinite size, without 
  27. --  occupying a lot of memory. Its children can be located anywhere within 
  28. --  it, but will only appear on the screen if the visible area of the layout 
  29. --  contains them. 
  30. --  Just like a Gtk_Viewport, its visible area is indicated by two 
  31. --  Gtk_Adjustment widgets, and thus a Gtk_Layout can be put as is in a 
  32. --  Gtk_Scrolled_Window. 
  33. --  As for Gtk_Fixed containers, the children can be located anywhere in the 
  34. --  layout (no automatic organization is done). But, as opposed to Gtk_Fixed 
  35. --  widgets, a Gtk_Layout does not try to resize itself to show all its 
  36. --  children. 
  37. -- 
  38. --  Starting from GtkAda 2.0, you have to call Set_Size and specify the maximum 
  39. --  size of the layout, otherwise children added with Put outside the size 
  40. --  defined for the layout will never be visible. 
  41. --  One way to do this is to systematically call Set_Size before calling Put, 
  42. --  and make sure you specify a size big enough for the layout. 
  43. -- 
  44. --  </description> 
  45. --  <c_version>2.8.17</c_version> 
  46. --  <group>Layout containers</group> 
  47. --  <testgtk>create_layout.adb</testgtk> 
  48. --  <screenshot>gtk-layout</screenshot> 
  49.  
  50. with Glib.Properties; 
  51. with Gdk.Window; 
  52. with Gtk.Adjustment; 
  53. with Gtk.Container; 
  54. with Gtk.Widget; 
  55.  
  56. package Gtk.Layout is 
  57.  
  58.    type Gtk_Layout_Record is new 
  59.      Gtk.Container.Gtk_Container_Record with private; 
  60.    type Gtk_Layout is access all Gtk_Layout_Record'Class; 
  61.  
  62.    procedure Gtk_New 
  63.      (Layout      : out Gtk_Layout; 
  64.       Hadjustment : Adjustment.Gtk_Adjustment := null; 
  65.       Vadjustment : Adjustment.Gtk_Adjustment := null); 
  66.    --  Create new layout. 
  67.    --  You can either give an explicit couple of adjustments, that will 
  68.    --  indicate the current visible area. If you don't specify any, they will 
  69.    --  be created automatically by GtkAda, which is the usual way to do. 
  70.    --  The Layout does not occupy any area on the screen, and you have to 
  71.    --  explicitly specify one with Set_Size below. 
  72.  
  73.    procedure Initialize 
  74.      (Layout      : access Gtk_Layout_Record'Class; 
  75.       Hadjustment : Gtk.Adjustment.Gtk_Adjustment; 
  76.       Vadjustment : Gtk.Adjustment.Gtk_Adjustment); 
  77.    --  Internal initialization function. 
  78.    --  See the section "Creating your own widgets" in the documentation. 
  79.  
  80.    function Get_Type return Gtk.Gtk_Type; 
  81.    --  Return the internal value associated with a Gtk_Layout. 
  82.  
  83.    procedure Put 
  84.      (Layout : access Gtk_Layout_Record; 
  85.       Widget : access Gtk.Widget.Gtk_Widget_Record'Class; 
  86.       X      : Gint; 
  87.       Y      : Gint); 
  88.    --  Insert a new child in the layout. 
  89.    --  The child will be displayed on the screen only if at least part of 
  90.    --  it intersects the visible area of the layout. 
  91.    --  The layout does not resize itself to automatically show the widget. 
  92.    --  You also need to call Set_Size, if the size you initially defined is 
  93.    --  smaller than (X, Y), or the child will never be visible even if the 
  94.    --  layout is scrolled. 
  95.  
  96.    procedure Move 
  97.      (Layout : access Gtk_Layout_Record; 
  98.       Widget : access Gtk.Widget.Gtk_Widget_Record'Class; 
  99.       X      : Gint; 
  100.       Y      : Gint); 
  101.    --  Move a child of the layout. 
  102.    --  Nothing is done if Widget is not already a child of Layout. 
  103.  
  104.    function Get_Bin_Window 
  105.      (Widget : access Gtk_Layout_Record) return Gdk.Window.Gdk_Window; 
  106.    --  Return the window associated with the layout. 
  107.    --  You should use this one rather than Gtk.Widget.Get_Window. 
  108.  
  109.    procedure Set_Size 
  110.      (Layout : access Gtk_Layout_Record; 
  111.       Width  : Guint; 
  112.       Height : Guint); 
  113.    procedure Get_Size 
  114.      (Layout : access Gtk_Layout_Record; 
  115.       Width  : out Guint; 
  116.       Height : out Guint); 
  117.    --  Specify an absolute size for the layout. 
  118.    --  This is not the size on the screen, but the internal size of the widget. 
  119.    --  The screen's size can be set with Gtk.Widget.Set_Usize. 
  120.  
  121.    procedure Set_Hadjustment 
  122.      (Layout     : access Gtk_Layout_Record; 
  123.       Adjustment : Gtk.Adjustment.Gtk_Adjustment); 
  124.    function Get_Hadjustment 
  125.      (Layout : access Gtk_Layout_Record) return Gtk.Adjustment.Gtk_Adjustment; 
  126.    --  Return the adjustment that indicate the horizontal visual area 
  127.    --  of the layout. 
  128.    --  You generally do not have to modify the value of this adjustment 
  129.    --  yourself, since this is done automatically when the layout has 
  130.    --  been put in a Gtk_Scrolled_Window. 
  131.  
  132.    procedure Set_Vadjustment 
  133.      (Layout     : access Gtk_Layout_Record; 
  134.       Adjustment : Gtk.Adjustment.Gtk_Adjustment); 
  135.    function Get_Vadjustment 
  136.      (Layout : access Gtk_Layout_Record) return Gtk.Adjustment.Gtk_Adjustment; 
  137.    --  Return the adjustment that indicate the vertical visual area 
  138.    --  of the layout. 
  139.    --  You generally do not have to modify the value of this adjustment 
  140.    --  yourself, since this is done automatically when the layout has 
  141.    --  been put in a Gtk_Scrolled_Window. 
  142.  
  143.    ----------------- 
  144.    -- Obsolescent -- 
  145.    ----------------- 
  146.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  147.    --  from future versions of gtk+ (and therefore GtkAda). 
  148.    --  To find out whether your code uses any of these, we recommend compiling 
  149.    --  with the -gnatwj switch 
  150.    --  <doc_ignore> 
  151.  
  152.    function Get_Width (Layout : access Gtk_Layout_Record) return Guint; 
  153.    pragma Obsolescent; 
  154.    --  Deprecated, only provided for compatibility, see Get_Size 
  155.  
  156.    function Get_Height (Layout : access Gtk_Layout_Record) return Guint; 
  157.    --  pragma Obsolescent; 
  158.    --  Deprecated, only provided for compatibility, see Get_Size 
  159.  
  160.    procedure Freeze (Layout : access Gtk_Layout_Record); 
  161.    pragma Obsolescent;  --  Freeze 
  162.    --  Deprecated, only provided for compatibility. 
  163.  
  164.    procedure Thaw (Layout : access Gtk_Layout_Record); 
  165.    pragma Obsolescent;  --  Thaw 
  166.    --  Deprecated, only provided for compatibility. 
  167.  
  168.    --  </doc_ignore> 
  169.  
  170.    ---------------- 
  171.    -- Properties -- 
  172.    ---------------- 
  173.    --  The following properties are defined for this widget. See 
  174.    --  Glib.Properties for more information on properties. 
  175.  
  176.    --  <properties> 
  177.    --  - Name:  Hadjustment_Property 
  178.    --    Type:  Gtk_Adjustment_Record'Class 
  179.    --    Flags: read-write 
  180.    --    Descr: The GtkAdjustment for the horizontal position. 
  181.    --    See also: Set_Hadjustment and Get_Hadjustment 
  182.    -- 
  183.    --  - Name:  Vadjustment_Property 
  184.    --    Type:  Gtk_Adjustment_Record'Class 
  185.    --    Flags: read-write 
  186.    --    Descr: The GtkAdjustment for the vertical position. 
  187.    --    See also: Set_Vadjustment and Get_Vadjustment 
  188.    -- 
  189.    --  - Name:  Width_Property 
  190.    --    Type:  Guint 
  191.    --    Flags: read-write 
  192.    --    Descr: The width of the layout. 
  193.    --    See also: Set_Size and Get_Width 
  194.    -- 
  195.    --  - Name:  Height_Property 
  196.    --    Type:  Guint 
  197.    --    Flags: read-write 
  198.    --    Descr: The height of the layout. 
  199.    --    See also: Set_Size and Get_Height 
  200.    --  </properties> 
  201.  
  202.    Hadjustment_Property : constant Glib.Properties.Property_Object; 
  203.    Vadjustment_Property : constant Glib.Properties.Property_Object; 
  204.    Width_Property       : constant Glib.Properties.Property_Uint; 
  205.    Height_Property      : constant Glib.Properties.Property_Uint; 
  206.  
  207.    ---------------------- 
  208.    -- Child Properties -- 
  209.    ---------------------- 
  210.    --  The following properties can be set on children of this widget. See 
  211.    --  in particular Gtk.Containers.Child_Set_Property. 
  212.  
  213.    --  <child_properties> 
  214.    --  Name:  X_Property 
  215.    --  Type:  Int 
  216.    --  Descr: X position of child widget 
  217.    -- 
  218.    --  Name:  Y_Property 
  219.    --  Type:  Int 
  220.    --  Descr: Y position of child widget 
  221.    --  </child_properties> 
  222.  
  223.    X_Property : constant Glib.Properties.Property_Int; 
  224.    Y_Property : constant Glib.Properties.Property_Int; 
  225.  
  226.    ------------- 
  227.    -- Signals -- 
  228.    ------------- 
  229.  
  230.    --  <signals> 
  231.    --  The following new signals are defined for this widget: 
  232.    -- 
  233.    --  - "set_scroll_adjustments" 
  234.    --    procedure Handler (Layout : access Gtk_Layout_Record'Class; 
  235.    --                       Hadj   : in Gtk.Adjustment.Gtk_Adjustment; 
  236.    --                       Vadj   : in Gtk.Adjustment.Gtk_Adjustment); 
  237.    -- 
  238.    --    Emitted whenever at least one of the adjustment of the layout is 
  239.    --    changed. 
  240.    --  </signals> 
  241.  
  242.    Signal_Set_Scroll_Adjustments : constant Glib.Signal_Name := 
  243.                                      "set_scroll_adjustments"; 
  244.  
  245. private 
  246.    type Gtk_Layout_Record is new Gtk.Container.Gtk_Container_Record 
  247.      with null record; 
  248.  
  249.    Hadjustment_Property : constant Glib.Properties.Property_Object := 
  250.      Glib.Properties.Build ("hadjustment"); 
  251.    Vadjustment_Property : constant Glib.Properties.Property_Object := 
  252.      Glib.Properties.Build ("vadjustment"); 
  253.    Width_Property       : constant Glib.Properties.Property_Uint := 
  254.      Glib.Properties.Build ("width"); 
  255.    Height_Property      : constant Glib.Properties.Property_Uint := 
  256.      Glib.Properties.Build ("height"); 
  257.  
  258.    X_Property : constant Glib.Properties.Property_Int := 
  259.      Glib.Properties.Build ("x"); 
  260.    Y_Property : constant Glib.Properties.Property_Int := 
  261.      Glib.Properties.Build ("y"); 
  262.  
  263.    pragma Import (C, Get_Type, "gtk_layout_get_type"); 
  264. end Gtk.Layout; 
  265.  
  266. --  No binding: gtk_layout_get_bin_window