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.Event_Box.Gtk_Event_Box widget is a subclass of Gtk.Bin.Gtk_Bin 
  26. --  which also has its own window. It is useful since it allows you to catch 
  27. --  events for widgets which do not have their own window. 
  28. -- 
  29. --  </description> 
  30. --  <group>Layout Containers</group> 
  31. pragma Ada_2005; 
  32.  
  33. pragma Warnings (Off, "*is already use-visible*"); 
  34. with Glib;            use Glib; 
  35. with Glib.Properties; use Glib.Properties; 
  36. with Glib.Types;      use Glib.Types; 
  37. with Gtk.Bin;         use Gtk.Bin; 
  38. with Gtk.Buildable;   use Gtk.Buildable; 
  39.  
  40. package Gtk.Event_Box is 
  41.  
  42.    type Gtk_Event_Box_Record is new Gtk_Bin_Record with null record; 
  43.    type Gtk_Event_Box is access all Gtk_Event_Box_Record'Class; 
  44.  
  45.    ------------------ 
  46.    -- Constructors -- 
  47.    ------------------ 
  48.  
  49.    procedure Gtk_New (Event_Box : out Gtk_Event_Box); 
  50.    procedure Initialize 
  51.       (Event_Box : not null access Gtk_Event_Box_Record'Class); 
  52.    --  Create a new box. 
  53.    --  The box's child can then be set using the Gtk.Container.Add function. 
  54.  
  55.    function Gtk_Event_Box_New return Gtk_Event_Box; 
  56.    --  Create a new box. 
  57.    --  The box's child can then be set using the Gtk.Container.Add function. 
  58.  
  59.    function Get_Type return Glib.GType; 
  60.    pragma Import (C, Get_Type, "gtk_event_box_get_type"); 
  61.  
  62.    ------------- 
  63.    -- Methods -- 
  64.    ------------- 
  65.  
  66.    function Get_Above_Child 
  67.       (Event_Box : not null access Gtk_Event_Box_Record) return Boolean; 
  68.    --  Returns whether the event box window is above or below the windows of 
  69.    --  its child. See Gtk.Event_Box.Set_Above_Child for details. 
  70.    --  Since: gtk+ 2.4 
  71.  
  72.    procedure Set_Above_Child 
  73.       (Event_Box   : not null access Gtk_Event_Box_Record; 
  74.        Above_Child : Boolean); 
  75.    --  Set whether the event box window is positioned above the windows of its 
  76.    --  child, as opposed to below it. If the window is above, all events inside 
  77.    --  the event box will go to the event box. If the window is below, events 
  78.    --  in windows of child widgets will first got to that widget, and then to 
  79.    --  its parents. 
  80.    --  The default is to keep the window below the child. 
  81.    --  Since: gtk+ 2.4 
  82.    --  "above_child": True if the event box window is above its child 
  83.  
  84.    function Get_Visible_Window 
  85.       (Event_Box : not null access Gtk_Event_Box_Record) return Boolean; 
  86.    --  Returns whether the event box has a visible window. See 
  87.    --  Gtk.Event_Box.Set_Visible_Window for details. 
  88.    --  Since: gtk+ 2.4 
  89.  
  90.    procedure Set_Visible_Window 
  91.       (Event_Box      : not null access Gtk_Event_Box_Record; 
  92.        Visible_Window : Boolean); 
  93.    --  Set whether the event box uses a visible or invisible child window. The 
  94.    --  default is to use visible windows. 
  95.    --  In an invisible window event box, the window that the event box creates 
  96.    --  is a Gdk.Input_Only window, which means that it is invisible and only 
  97.    --  serves to receive events. 
  98.    --  A visible window event box creates a visible (Gdk.Input_Output) window 
  99.    --  that acts as the parent window for all the widgets contained in the 
  100.    --  event box. 
  101.    --  You should generally make your event box invisible if you just want to 
  102.    --  trap events. Creating a visible window may cause artifacts that are 
  103.    --  visible to the user, especially if the user is using a theme with 
  104.    --  gradients or pixmaps. 
  105.    --  The main reason to create a non input-only event box is if you want to 
  106.    --  set the background to a different color or draw on it. 
  107.    --  Note: 
  108.    --  There is one unexpected issue for an invisible event box that has its 
  109.    --  window below the child. (See Gtk.Event_Box.Set_Above_Child.) Since the 
  110.    --  input-only window is not an ancestor window of any windows that 
  111.    --  descendent widgets of the event box create, events on these windows 
  112.    --  aren't propagated up by the windowing system, but only by GTK+. The 
  113.    --  practical effect of this is if an event isn't in the event mask for the 
  114.    --  descendant window (see Gtk.Widget.Add_Events), it won't be received by 
  115.    --  the event box. 
  116.    --  This problem doesn't occur for visible event boxes, because in that 
  117.    --  case, the event box window is actually the ancestor of the descendant 
  118.    --  windows, not just at the same place on the screen. 
  119.    --  Since: gtk+ 2.4 
  120.    --  "visible_window": True to make the event box have a visible window 
  121.  
  122.    ---------------- 
  123.    -- Properties -- 
  124.    ---------------- 
  125.    --  The following properties are defined for this widget. See 
  126.    --  Glib.Properties for more information on properties) 
  127.  
  128.    Above_Child_Property : constant Glib.Properties.Property_Boolean; 
  129.  
  130.    Visible_Window_Property : constant Glib.Properties.Property_Boolean; 
  131.  
  132.    ---------------- 
  133.    -- Interfaces -- 
  134.    ---------------- 
  135.    --  This class implements several interfaces. See Glib.Types 
  136.    -- 
  137.    --  - "Buildable" 
  138.  
  139.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  140.      (Gtk.Buildable.Gtk_Buildable, Gtk_Event_Box_Record, Gtk_Event_Box); 
  141.    function "+" 
  142.      (Widget : access Gtk_Event_Box_Record'Class) 
  143.    return Gtk.Buildable.Gtk_Buildable 
  144.    renames Implements_Gtk_Buildable.To_Interface; 
  145.    function "-" 
  146.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  147.    return Gtk_Event_Box 
  148.    renames Implements_Gtk_Buildable.To_Object; 
  149.  
  150. private 
  151.    Visible_Window_Property : constant Glib.Properties.Property_Boolean := 
  152.      Glib.Properties.Build ("visible-window"); 
  153.    Above_Child_Property : constant Glib.Properties.Property_Boolean := 
  154.      Glib.Properties.Build ("above-child"); 
  155. end Gtk.Event_Box;