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