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.EventController; 26 27 private import gdk.Event; 28 private import gobject.ObjectG; 29 private import gtk.Widget; 30 private import gtkc.gtk; 31 public import gtkc.gtktypes; 32 33 34 /** 35 * #GtkEventController is a base, low-level implementation for event 36 * controllers. Those react to a series of #GdkEvents, and possibly trigger 37 * actions as a consequence of those. 38 */ 39 public class EventController : ObjectG 40 { 41 /** the main Gtk struct */ 42 protected GtkEventController* gtkEventController; 43 44 /** Get the main Gtk struct */ 45 public GtkEventController* getEventControllerStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gtkEventController; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gtkEventController; 56 } 57 58 protected override void setStruct(GObject* obj) 59 { 60 gtkEventController = cast(GtkEventController*)obj; 61 super.setStruct(obj); 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GtkEventController* gtkEventController, bool ownedRef = false) 68 { 69 this.gtkEventController = gtkEventController; 70 super(cast(GObject*)gtkEventController, ownedRef); 71 } 72 73 74 /** */ 75 public static GType getType() 76 { 77 return gtk_event_controller_get_type(); 78 } 79 80 /** 81 * Gets the propagation phase at which @controller handles events. 82 * 83 * Returns: the propagation phase 84 * 85 * Since: 3.14 86 */ 87 public GtkPropagationPhase getPropagationPhase() 88 { 89 return gtk_event_controller_get_propagation_phase(gtkEventController); 90 } 91 92 /** 93 * Returns the #GtkWidget this controller relates to. 94 * 95 * Returns: a #GtkWidget 96 * 97 * Since: 3.14 98 */ 99 public Widget getWidget() 100 { 101 auto p = gtk_event_controller_get_widget(gtkEventController); 102 103 if(p is null) 104 { 105 return null; 106 } 107 108 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 109 } 110 111 /** 112 * Feeds an events into @controller, so it can be interpreted 113 * and the controller actions triggered. 114 * 115 * Params: 116 * event = a #GdkEvent 117 * 118 * Returns: %TRUE if the event was potentially useful to trigger the 119 * controller action 120 * 121 * Since: 3.14 122 */ 123 public bool handleEvent(Event event) 124 { 125 return gtk_event_controller_handle_event(gtkEventController, (event is null) ? null : event.getEventStruct()) != 0; 126 } 127 128 /** 129 * Resets the @controller to a clean state. Every interaction 130 * the controller did through #GtkEventController::handle-event 131 * will be dropped at this point. 132 * 133 * Since: 3.14 134 */ 135 public void reset() 136 { 137 gtk_event_controller_reset(gtkEventController); 138 } 139 140 /** 141 * Sets the propagation phase at which a controller handles events. 142 * 143 * If @phase is %GTK_PHASE_NONE, no automatic event handling will be 144 * performed, but other additional gesture maintenance will. In that phase, 145 * the events can be managed by calling gtk_event_controller_handle_event(). 146 * 147 * Params: 148 * phase = a propagation phase 149 * 150 * Since: 3.14 151 */ 152 public void setPropagationPhase(GtkPropagationPhase phase) 153 { 154 gtk_event_controller_set_propagation_phase(gtkEventController, phase); 155 } 156 }