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