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. --  The Gtk_Handle_Box widget allows a portion of a window to be "torn off". 
  27. --  It is a bin widget which displays its child and a handle that the user can 
  28. --  drag to tear off a separate window (the float window) containing the child 
  29. --  widget. A thin ghost is drawn in the original location of the handlebox. By 
  30. --  dragging the separate window back to its original location, it can be 
  31. --  reattached. 
  32. -- 
  33. --  When reattaching, the ghost and float window, must be aligned along one of 
  34. --  the edges, the snap edge. This either can be specified by the application 
  35. --  programmer explicitely, or GtkAda will pick a reasonable default based on 
  36. --  the handle position. 
  37. -- 
  38. --  To make detaching and reattaching the handlebox as minimally confusing as 
  39. --  possible to the user, it is important to set the snap edge so that the snap 
  40. --  edge does not move when the handlebox is detached. For instance, if the 
  41. --  handlebox is packed at the bottom of a Vbox, then when the handlebox is 
  42. --  detached, the bottom edge of the handlebox's allocation will remain fixed 
  43. --  as the height of the handlebox shrinks, so the snap edge should be set to 
  44. --  Pos_Bottom. 
  45. --  </description> 
  46. --  <c_version>2.16.6</c_version> 
  47. --  <group>Menus and Toolbars</group> 
  48. --  <testgtk>create_handle_box.adb</testgtk> 
  49. --  <screenshot>gtk-handle_box</screenshot> 
  50.  
  51. with Glib.Properties; 
  52. with Gtk.Bin; 
  53. with Gtk.Enums; 
  54.  
  55. package Gtk.Handle_Box is 
  56.  
  57.    type Gtk_Handle_Box_Record is new Gtk.Bin.Gtk_Bin_Record with private; 
  58.    type Gtk_Handle_Box is access all Gtk_Handle_Box_Record'Class; 
  59.  
  60.    procedure Gtk_New (Handle_Box : out Gtk_Handle_Box); 
  61.    --  Create a new Handle_Box. 
  62.  
  63.    procedure Initialize (Handle_Box : access Gtk_Handle_Box_Record'Class); 
  64.    --  Internal initialization function. 
  65.    --  See the section "Creating your own widgets" in the documentation. 
  66.  
  67.    function Get_Type return Gtk.Gtk_Type; 
  68.    --  Return the internal value associated with a Gtk_Dialog. 
  69.  
  70.    procedure Set_Shadow_Type 
  71.      (Handle_Box : access Gtk_Handle_Box_Record; 
  72.       Typ        : Enums.Gtk_Shadow_Type); 
  73.    function Get_Shadow_Type 
  74.      (Handle_Box : access Gtk_Handle_Box_Record) return Enums.Gtk_Shadow_Type; 
  75.    --  Sets or gets the type of shadow to be drawn around the border of the 
  76.    --  Handle_Box. 
  77.  
  78.    procedure Set_Handle_Position 
  79.      (Handle_Box : access  Gtk_Handle_Box_Record; 
  80.       Position   : Enums.Gtk_Position_Type); 
  81.    function Get_Handle_Position 
  82.      (Handle_Box : access  Gtk_Handle_Box_Record) 
  83.       return Enums.Gtk_Position_Type; 
  84.    --  Sets or gets the side of the Handle_Box where the handle is drawn. 
  85.  
  86.    procedure Set_Snap_Edge 
  87.      (Handle_Box : access  Gtk_Handle_Box_Record; 
  88.       Edge       : Enums.Gtk_Position_Type); 
  89.    function Get_Snap_Edge 
  90.      (Handle_Box : access  Gtk_Handle_Box_Record) 
  91.       return Enums.Gtk_Position_Type; 
  92.    --  Sets or gets the snap edge of a Handle_Box. 
  93.    --  The snap edge is the edge of the detached child that must be aligned 
  94.    --  with the corresponding edge of the "ghost" left behind when the child 
  95.    --  was detached to reattach the torn-off window. Usually, the snap edge 
  96.    --  should be chosen so that it stays in the same place on the screen when 
  97.    --  the Handle_Box is torn off. 
  98.    -- 
  99.    --  If the snap edge is not set, then an appropriate value will be guessed 
  100.    --  from the handle position. If the handle position is Pos_Right or 
  101.    --  Pos_Left, then the snap edge will be Pos_Top, otherwise it will be 
  102.    --  Pos_Left. 
  103.  
  104.    function Get_Child_Detached 
  105.      (Handle_Box : access Gtk_Handle_Box_Record) 
  106.       return Boolean; 
  107.    --  Returns whether the handlebox's child is currently detached. 
  108.  
  109.    ---------------- 
  110.    -- Properties -- 
  111.    ---------------- 
  112.  
  113.    --  <properties> 
  114.    --  The following properties are defined for this widget. See 
  115.    --  Glib.Properties for more information on properties. 
  116.    -- 
  117.    --  - Name:  Child_Detached_Property 
  118.    --    Type:  Boolean 
  119.    --    Descr: A boolean value indicating whether the handlebox's child is 
  120.    --           attached or detached. 
  121.    -- 
  122.    --  - Name:  Shadow_Property and Shadow_Type_Property 
  123.    --    Type:  Gtk_Shadow_Type 
  124.    --    Flags: read-write 
  125.    --    Descr: Appearance of the shadow that surrounds the container. 
  126.    --    See also: Set_Shadow_Type 
  127.    -- 
  128.    --  - Name:  Handle_Position_Property 
  129.    --    Type:  Gtk_Position_Type 
  130.    --    Flags: read-write 
  131.    --    Descr: Position of the handle relative to the child widget. 
  132.    --    See also: Set_Handle_Position 
  133.    -- 
  134.    --  - Name:  Snap_Edge_Property 
  135.    --    Type:  Gtk_Position_Type 
  136.    --    Flags: read-write 
  137.    --    Descr: Side of the handlebox that's lined up with the docking point 
  138.    --           to dock the handlebox. 
  139.    --    See also: Set_Snap_Edge 
  140.    -- 
  141.    --  - Name:  Snap_Edge_Set_Property 
  142.    --    Type:  Boolean 
  143.    --    Descr: Whether to use the value from the Snap_Edge_Property, or a 
  144.    --           value derived from Handle_Position 
  145.    -- 
  146.    --  </properties> 
  147.  
  148.    Child_Detached_Property  : constant Glib.Properties.Property_Boolean; 
  149.    Shadow_Property          : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  150.    Shadow_Type_Property     : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  151.    Handle_Position_Property : constant Gtk.Enums.Property_Gtk_Position_Type; 
  152.    Snap_Edge_Property       : constant Gtk.Enums.Property_Gtk_Position_Type; 
  153.    Snap_Edge_Set_Property   : constant Glib.Properties.Property_Boolean; 
  154.  
  155.    ------------- 
  156.    -- Signals -- 
  157.    ------------- 
  158.  
  159.    --  <signals> 
  160.    --  The following new signals are defined for this widget: 
  161.    -- 
  162.    --  - "child_attached" 
  163.    --    procedure Handler 
  164.    --      (Handle_Box : access Gtk_Handle_Box_Record'Class; 
  165.    --       Widget     : access Gtk_Widget_Record'Class); 
  166.    --    Emitted when the contents of the Handle_Box are reattached to the main 
  167.    --    window. 
  168.    --    Widget is the child widget of the Handle_Box. (this argument provides 
  169.    --    no extra information and is here only for backwards-compatibility) 
  170.    -- 
  171.    --  - "child_detached" 
  172.    --    procedure Handler 
  173.    --      (Handle_Box : access Gtk_Handle_Box_Record'Class; 
  174.    --       Widget     : access Gtk_Widget_Record'Class); 
  175.    --    Emitted when the contents of the Handle_Box are detached from the main 
  176.    --    window. See "child-attached" for drtails on the parameters. 
  177.    -- 
  178.    --  </signals> 
  179.  
  180.    Signal_Child_Attached : constant Glib.Signal_Name := "child_attached"; 
  181.    Signal_Child_Detached : constant Glib.Signal_Name := "child_detached"; 
  182.  
  183. private 
  184.    type Gtk_Handle_Box_Record is new Gtk.Bin.Gtk_Bin_Record with null record; 
  185.  
  186.    Child_Detached_Property  : constant Glib.Properties.Property_Boolean := 
  187.      Glib.Properties.Build ("child-detached"); 
  188.    Shadow_Property          : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  189.      Gtk.Enums.Build ("shadow-type");  --  Same as Shadow_Type ! 
  190.    Shadow_Type_Property     : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  191.      Gtk.Enums.Build ("shadow-type"); 
  192.    Handle_Position_Property : constant Gtk.Enums.Property_Gtk_Position_Type := 
  193.      Gtk.Enums.Build ("handle_position"); 
  194.    Snap_Edge_Property       : constant Gtk.Enums.Property_Gtk_Position_Type := 
  195.      Gtk.Enums.Build ("snap_edge"); 
  196.    Snap_Edge_Set_Property   : constant Glib.Properties.Property_Boolean := 
  197.      Glib.Properties.Build ("snap-edge-set"); 
  198.  
  199.    pragma Import (C, Get_Type, "gtk_handle_box_get_type"); 
  200. end Gtk.Handle_Box;