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.Handle_Box.Gtk_Handle_Box widget allows a portion of a window to 
  26. --  be "torn off". It is a bin widget which displays its child and a handle 
  27. --  that the user can drag to tear off a separate window (the 'float window') 
  28. --  containing the child widget. A thin 'ghost' is drawn in the original 
  29. --  location of the handlebox. By dragging the separate window back to its 
  30. --  original location, it can be reattached. 
  31. -- 
  32. --  When reattaching, the ghost and float window, must be aligned along one of 
  33. --  the edges, the 'snap edge'. This either can be specified by the application 
  34. --  programmer explicitely, or GTK+ will pick a reasonable default based on the 
  35. --  handle position. 
  36. -- 
  37. --  To make detaching and reattaching the handlebox as minimally confusing as 
  38. --  possible to the user, it is important to set the snap edge so that the snap 
  39. --  edge does not move when the handlebox is deattached. For instance, if the 
  40. --  handlebox is packed at the bottom of a VBox, then when the handlebox is 
  41. --  detached, the bottom edge of the handlebox's allocation will remain fixed 
  42. --  as the height of the handlebox shrinks, so the snap edge should be set to 
  43. --  Gtk.Enums.Pos_Bottom. 
  44. -- 
  45. --  Note: Gtk.Handle_Box.Gtk_Handle_Box has been deprecated. It is very 
  46. --  specialized, lacks features to make it useful and most importantly does not 
  47. --  fit well into modern application design. Do not use it. There is no 
  48. --  replacement. 
  49. -- 
  50. --  </description> 
  51. pragma Ada_2005; 
  52.  
  53. pragma Warnings (Off, "*is already use-visible*"); 
  54. with Glib;            use Glib; 
  55. with Glib.Object;     use Glib.Object; 
  56. with Glib.Properties; use Glib.Properties; 
  57. with Glib.Types;      use Glib.Types; 
  58. with Gtk.Bin;         use Gtk.Bin; 
  59. with Gtk.Buildable;   use Gtk.Buildable; 
  60. with Gtk.Enums;       use Gtk.Enums; 
  61. with Gtk.Widget;      use Gtk.Widget; 
  62.  
  63. package Gtk.Handle_Box is 
  64.  
  65.    pragma Obsolescent; 
  66.  
  67.    type Gtk_Handle_Box_Record is new Gtk_Bin_Record with null record; 
  68.    type Gtk_Handle_Box is access all Gtk_Handle_Box_Record'Class; 
  69.  
  70.    ------------------ 
  71.    -- Constructors -- 
  72.    ------------------ 
  73.  
  74.    procedure Gtk_New (Handle_Box : out Gtk_Handle_Box); 
  75.    procedure Initialize 
  76.       (Handle_Box : not null access Gtk_Handle_Box_Record'Class); 
  77.    --  Create a new handle box. 
  78.  
  79.    function Gtk_Handle_Box_New return Gtk_Handle_Box; 
  80.    --  Create a new handle box. 
  81.  
  82.    function Get_Type return Glib.GType; 
  83.    pragma Import (C, Get_Type, "gtk_handle_box_get_type"); 
  84.  
  85.    ------------- 
  86.    -- Methods -- 
  87.    ------------- 
  88.  
  89.    function Get_Child_Detached 
  90.       (Handle_Box : not null access Gtk_Handle_Box_Record) return Boolean; 
  91.    pragma Obsolescent (Get_Child_Detached); 
  92.    --  Whether the handlebox's child is currently detached. 
  93.    --  Since: gtk+ 2.14 
  94.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  95.    --  deprecated. 
  96.  
  97.    function Get_Handle_Position 
  98.       (Handle_Box : not null access Gtk_Handle_Box_Record) 
  99.        return Gtk.Enums.Gtk_Position_Type; 
  100.    pragma Obsolescent (Get_Handle_Position); 
  101.    --  Gets the handle position of the handle box. See 
  102.    --  Gtk.Handle_Box.Set_Handle_Position. 
  103.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  104.    --  deprecated. 
  105.  
  106.    procedure Set_Handle_Position 
  107.       (Handle_Box : not null access Gtk_Handle_Box_Record; 
  108.        Position   : Gtk.Enums.Gtk_Position_Type); 
  109.    pragma Obsolescent (Set_Handle_Position); 
  110.    --  Sets the side of the handlebox where the handle is drawn. 
  111.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  112.    --  deprecated. 
  113.    --  "position": the side of the handlebox where the handle should be drawn. 
  114.  
  115.    function Get_Shadow_Type 
  116.       (Handle_Box : not null access Gtk_Handle_Box_Record) 
  117.        return Gtk.Enums.Gtk_Shadow_Type; 
  118.    pragma Obsolescent (Get_Shadow_Type); 
  119.    --  Gets the type of shadow drawn around the handle box. See 
  120.    --  Gtk.Handle_Box.Set_Shadow_Type. 
  121.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  122.    --  deprecated. 
  123.  
  124.    procedure Set_Shadow_Type 
  125.       (Handle_Box : not null access Gtk_Handle_Box_Record; 
  126.        The_Type   : Gtk.Enums.Gtk_Shadow_Type); 
  127.    pragma Obsolescent (Set_Shadow_Type); 
  128.    --  Sets the type of shadow to be drawn around the border of the handle 
  129.    --  box. 
  130.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  131.    --  deprecated. 
  132.    --  "type": the shadow type. 
  133.  
  134.    function Get_Snap_Edge 
  135.       (Handle_Box : not null access Gtk_Handle_Box_Record) 
  136.        return Gtk.Enums.Gtk_Position_Type; 
  137.    pragma Obsolescent (Get_Snap_Edge); 
  138.    --  Gets the edge used for determining reattachment of the handle box. See 
  139.    --  Gtk.Handle_Box.Set_Snap_Edge. 
  140.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  141.    --  deprecated. 
  142.  
  143.    procedure Set_Snap_Edge 
  144.       (Handle_Box : not null access Gtk_Handle_Box_Record; 
  145.        Edge       : Gtk.Enums.Gtk_Position_Type); 
  146.    pragma Obsolescent (Set_Snap_Edge); 
  147.    --  Sets the snap edge of a handlebox. The snap edge is the edge of the 
  148.    --  detached child that must be aligned with the corresponding edge of the 
  149.    --  "ghost" left behind when the child was detached to reattach the torn-off 
  150.    --  window. Usually, the snap edge should be chosen so that it stays in the 
  151.    --  same place on the screen when the handlebox is torn off. 
  152.    --  If the snap edge is not set, then an appropriate value will be guessed 
  153.    --  from the handle position. If the handle position is Gtk.Enums.Pos_Right 
  154.    --  or Gtk.Enums.Pos_Left, then the snap edge will be Gtk.Enums.Pos_Top, 
  155.    --  otherwise it will be Gtk.Enums.Pos_Left. 
  156.    --  Deprecated since 3.4, Gtk.Handle_Box.Gtk_Handle_Box has been 
  157.    --  deprecated. 
  158.    --  "edge": the snap edge, or -1 to unset the value; in which case GTK+ 
  159.    --  will try to guess an appropriate value in the future. 
  160.  
  161.    ---------------- 
  162.    -- Properties -- 
  163.    ---------------- 
  164.    --  The following properties are defined for this widget. See 
  165.    --  Glib.Properties for more information on properties) 
  166.  
  167.    Child_Detached_Property : constant Glib.Properties.Property_Boolean; 
  168.  
  169.    Handle_Position_Property : constant Gtk.Enums.Property_Gtk_Position_Type; 
  170.  
  171.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  172.  
  173.    Snap_Edge_Property : constant Gtk.Enums.Property_Gtk_Position_Type; 
  174.  
  175.    Snap_Edge_Set_Property : constant Glib.Properties.Property_Boolean; 
  176.  
  177.    ------------- 
  178.    -- Signals -- 
  179.    ------------- 
  180.  
  181.    type Cb_Gtk_Handle_Box_Gtk_Widget_Void is not null access procedure 
  182.      (Self   : access Gtk_Handle_Box_Record'Class; 
  183.       Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  184.  
  185.    type Cb_GObject_Gtk_Widget_Void is not null access procedure 
  186.      (Self   : access Glib.Object.GObject_Record'Class; 
  187.       Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  188.  
  189.    Signal_Child_Attached : constant Glib.Signal_Name := "child-attached"; 
  190.    procedure On_Child_Attached 
  191.       (Self  : not null access Gtk_Handle_Box_Record; 
  192.        Call  : Cb_Gtk_Handle_Box_Gtk_Widget_Void; 
  193.        After : Boolean := False); 
  194.    procedure On_Child_Attached 
  195.       (Self  : not null access Gtk_Handle_Box_Record; 
  196.        Call  : Cb_GObject_Gtk_Widget_Void; 
  197.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  198.        After : Boolean := False); 
  199.    --  This signal is emitted when the contents of the handlebox are 
  200.    --  reattached to the main window. 
  201.  
  202.    Signal_Child_Detached : constant Glib.Signal_Name := "child-detached"; 
  203.    procedure On_Child_Detached 
  204.       (Self  : not null access Gtk_Handle_Box_Record; 
  205.        Call  : Cb_Gtk_Handle_Box_Gtk_Widget_Void; 
  206.        After : Boolean := False); 
  207.    procedure On_Child_Detached 
  208.       (Self  : not null access Gtk_Handle_Box_Record; 
  209.        Call  : Cb_GObject_Gtk_Widget_Void; 
  210.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  211.        After : Boolean := False); 
  212.    --  This signal is emitted when the contents of the handlebox are detached 
  213.    --  from the main window. 
  214.  
  215.    ---------------- 
  216.    -- Interfaces -- 
  217.    ---------------- 
  218.    --  This class implements several interfaces. See Glib.Types 
  219.    -- 
  220.    --  - "Buildable" 
  221.  
  222.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  223.      (Gtk.Buildable.Gtk_Buildable, Gtk_Handle_Box_Record, Gtk_Handle_Box); 
  224.    function "+" 
  225.      (Widget : access Gtk_Handle_Box_Record'Class) 
  226.    return Gtk.Buildable.Gtk_Buildable 
  227.    renames Implements_Gtk_Buildable.To_Interface; 
  228.    function "-" 
  229.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  230.    return Gtk_Handle_Box 
  231.    renames Implements_Gtk_Buildable.To_Object; 
  232.  
  233. private 
  234.    Snap_Edge_Set_Property : constant Glib.Properties.Property_Boolean := 
  235.      Glib.Properties.Build ("snap-edge-set"); 
  236.    Snap_Edge_Property : constant Gtk.Enums.Property_Gtk_Position_Type := 
  237.      Gtk.Enums.Build ("snap-edge"); 
  238.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  239.      Gtk.Enums.Build ("shadow-type"); 
  240.    Handle_Position_Property : constant Gtk.Enums.Property_Gtk_Position_Type := 
  241.      Gtk.Enums.Build ("handle-position"); 
  242.    Child_Detached_Property : constant Glib.Properties.Property_Boolean := 
  243.      Glib.Properties.Build ("child-detached"); 
  244. end Gtk.Handle_Box;