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 gtkc.gtk;
32 public  import gtkc.gtktypes;
33 
34 
35 /**
36  * The #GtkEventBox widget is a subclass of #GtkBin which also has its
37  * own window. It is useful since it allows you to catch events for widgets
38  * which do not have their own window.
39  */
40 public class EventBox : Bin
41 {
42 	/** the main Gtk struct */
43 	protected GtkEventBox* gtkEventBox;
44 
45 	/** Get the main Gtk struct */
46 	public GtkEventBox* getEventBoxStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return gtkEventBox;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)gtkEventBox;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		gtkEventBox = cast(GtkEventBox*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GtkEventBox* gtkEventBox, bool ownedRef = false)
69 	{
70 		this.gtkEventBox = gtkEventBox;
71 		super(cast(GtkBin*)gtkEventBox, ownedRef);
72 	}
73 
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return gtk_event_box_get_type();
79 	}
80 
81 	/**
82 	 * Creates a new #GtkEventBox.
83 	 *
84 	 * Returns: a new #GtkEventBox
85 	 *
86 	 * Throws: ConstructionException GTK+ fails to create the object.
87 	 */
88 	public this()
89 	{
90 		auto p = gtk_event_box_new();
91 		
92 		if(p is null)
93 		{
94 			throw new ConstructionException("null returned by new");
95 		}
96 		
97 		this(cast(GtkEventBox*) p);
98 	}
99 
100 	/**
101 	 * Returns whether the event box window is above or below the
102 	 * windows of its child. See gtk_event_box_set_above_child()
103 	 * for details.
104 	 *
105 	 * Returns: %TRUE if the event box window is above the
106 	 *     window of its child
107 	 *
108 	 * Since: 2.4
109 	 */
110 	public bool getAboveChild()
111 	{
112 		return gtk_event_box_get_above_child(gtkEventBox) != 0;
113 	}
114 
115 	/**
116 	 * Returns whether the event box has a visible window.
117 	 * See gtk_event_box_set_visible_window() for details.
118 	 *
119 	 * Returns: %TRUE if the event box window is visible
120 	 *
121 	 * Since: 2.4
122 	 */
123 	public bool getVisibleWindow()
124 	{
125 		return gtk_event_box_get_visible_window(gtkEventBox) != 0;
126 	}
127 
128 	/**
129 	 * Set whether the event box window is positioned above the windows
130 	 * of its child, as opposed to below it. If the window is above, all
131 	 * events inside the event box will go to the event box. If the window
132 	 * is below, events in windows of child widgets will first got to that
133 	 * widget, and then to its parents.
134 	 *
135 	 * The default is to keep the window below the child.
136 	 *
137 	 * Params:
138 	 *     aboveChild = %TRUE if the event box window is above its child
139 	 *
140 	 * Since: 2.4
141 	 */
142 	public void setAboveChild(bool aboveChild)
143 	{
144 		gtk_event_box_set_above_child(gtkEventBox, aboveChild);
145 	}
146 
147 	/**
148 	 * Set whether the event box uses a visible or invisible child
149 	 * window. The default is to use visible windows.
150 	 *
151 	 * In an invisible window event box, the window that the
152 	 * event box creates is a %GDK_INPUT_ONLY window, which
153 	 * means that it is invisible and only serves to receive
154 	 * events.
155 	 *
156 	 * A visible window event box creates a visible (%GDK_INPUT_OUTPUT)
157 	 * window that acts as the parent window for all the widgets
158 	 * contained in the event box.
159 	 *
160 	 * You should generally make your event box invisible if
161 	 * you just want to trap events. Creating a visible window
162 	 * may cause artifacts that are visible to the user, especially
163 	 * if the user is using a theme with gradients or pixmaps.
164 	 *
165 	 * The main reason to create a non input-only event box is if
166 	 * you want to set the background to a different color or
167 	 * draw on it.
168 	 *
169 	 * There is one unexpected issue for an invisible event box that has its
170 	 * window below the child. (See gtk_event_box_set_above_child().)
171 	 * Since the input-only window is not an ancestor window of any windows
172 	 * that descendent widgets of the event box create, events on these
173 	 * windows aren’t propagated up by the windowing system, but only by GTK+.
174 	 * The practical effect of this is if an event isn’t in the event
175 	 * mask for the descendant window (see gtk_widget_add_events()),
176 	 * it won’t be received by the event box.
177 	 *
178 	 * This problem doesn’t occur for visible event boxes, because in
179 	 * that case, the event box window is actually the ancestor of the
180 	 * descendant windows, not just at the same place on the screen.
181 	 *
182 	 * Params:
183 	 *     visibleWindow = %TRUE to make the event box have a visible window
184 	 *
185 	 * Since: 2.4
186 	 */
187 	public void setVisibleWindow(bool visibleWindow)
188 	{
189 		gtk_event_box_set_visible_window(gtkEventBox, visibleWindow);
190 	}
191 }