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