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