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