1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.EventBox;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Bin;
30 private import gtk.Widget;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 public  import gtkc.gtktypes;
34 
35 
36 /**
37  * The #GtkEventBox widget is a subclass of #GtkBin which also has its
38  * own window. It is useful since it allows you to catch events for widgets
39  * which do not have their own window.
40  */
41 public class EventBox : Bin
42 {
43 	/** the main Gtk struct */
44 	protected GtkEventBox* gtkEventBox;
45 
46 	/** Get the main Gtk struct */
47 	public GtkEventBox* getEventBoxStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gtkEventBox;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected override void* getStruct()
56 	{
57 		return cast(void*)gtkEventBox;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GtkEventBox* gtkEventBox, bool ownedRef = false)
64 	{
65 		this.gtkEventBox = gtkEventBox;
66 		super(cast(GtkBin*)gtkEventBox, ownedRef);
67 	}
68 
69 
70 	/** */
71 	public static GType getType()
72 	{
73 		return gtk_event_box_get_type();
74 	}
75 
76 	/**
77 	 * Creates a new #GtkEventBox.
78 	 *
79 	 * Returns: a new #GtkEventBox
80 	 *
81 	 * Throws: ConstructionException GTK+ fails to create the object.
82 	 */
83 	public this()
84 	{
85 		auto p = gtk_event_box_new();
86 
87 		if(p is null)
88 		{
89 			throw new ConstructionException("null returned by new");
90 		}
91 
92 		this(cast(GtkEventBox*) p);
93 	}
94 
95 	/**
96 	 * Returns whether the event box window is above or below the
97 	 * windows of its child. See gtk_event_box_set_above_child()
98 	 * for details.
99 	 *
100 	 * Returns: %TRUE if the event box window is above the
101 	 *     window of its child
102 	 *
103 	 * Since: 2.4
104 	 */
105 	public bool getAboveChild()
106 	{
107 		return gtk_event_box_get_above_child(gtkEventBox) != 0;
108 	}
109 
110 	/**
111 	 * Returns whether the event box has a visible window.
112 	 * See gtk_event_box_set_visible_window() for details.
113 	 *
114 	 * Returns: %TRUE if the event box window is visible
115 	 *
116 	 * Since: 2.4
117 	 */
118 	public bool getVisibleWindow()
119 	{
120 		return gtk_event_box_get_visible_window(gtkEventBox) != 0;
121 	}
122 
123 	/**
124 	 * Set whether the event box window is positioned above the windows
125 	 * of its child, as opposed to below it. If the window is above, all
126 	 * events inside the event box will go to the event box. If the window
127 	 * is below, events in windows of child widgets will first got to that
128 	 * widget, and then to its parents.
129 	 *
130 	 * The default is to keep the window below the child.
131 	 *
132 	 * Params:
133 	 *     aboveChild = %TRUE if the event box window is above its child
134 	 *
135 	 * Since: 2.4
136 	 */
137 	public void setAboveChild(bool aboveChild)
138 	{
139 		gtk_event_box_set_above_child(gtkEventBox, aboveChild);
140 	}
141 
142 	/**
143 	 * Set whether the event box uses a visible or invisible child
144 	 * window. The default is to use visible windows.
145 	 *
146 	 * In an invisible window event box, the window that the
147 	 * event box creates is a %GDK_INPUT_ONLY window, which
148 	 * means that it is invisible and only serves to receive
149 	 * events.
150 	 *
151 	 * A visible window event box creates a visible (%GDK_INPUT_OUTPUT)
152 	 * window that acts as the parent window for all the widgets
153 	 * contained in the event box.
154 	 *
155 	 * You should generally make your event box invisible if
156 	 * you just want to trap events. Creating a visible window
157 	 * may cause artifacts that are visible to the user, especially
158 	 * if the user is using a theme with gradients or pixmaps.
159 	 *
160 	 * The main reason to create a non input-only event box is if
161 	 * you want to set the background to a different color or
162 	 * draw on it.
163 	 *
164 	 * There is one unexpected issue for an invisible event box that has its
165 	 * window below the child. (See gtk_event_box_set_above_child().)
166 	 * Since the input-only window is not an ancestor window of any windows
167 	 * that descendent widgets of the event box create, events on these
168 	 * windows aren’t propagated up by the windowing system, but only by GTK+.
169 	 * The practical effect of this is if an event isn’t in the event
170 	 * mask for the descendant window (see gtk_widget_add_events()),
171 	 * it won’t be received by the event box.
172 	 *
173 	 * This problem doesn’t occur for visible event boxes, because in
174 	 * that case, the event box window is actually the ancestor of the
175 	 * descendant windows, not just at the same place on the screen.
176 	 *
177 	 * Params:
178 	 *     visibleWindow = %TRUE to make the event box have a visible window
179 	 *
180 	 * Since: 2.4
181 	 */
182 	public void setVisibleWindow(bool visibleWindow)
183 	{
184 		gtk_event_box_set_visible_window(gtkEventBox, visibleWindow);
185 	}
186 }