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 /** 60 * Sets our main struct and passes it to the parent class. 61 */ 62 public this (GtkEventController* gtkEventController, bool ownedRef = false) 63 { 64 this.gtkEventController = gtkEventController; 65 super(cast(GObject*)gtkEventController, ownedRef); 66 } 67 68 69 /** */ 70 public static GType getType() 71 { 72 return gtk_event_controller_get_type(); 73 } 74 75 /** 76 * Gets the propagation phase at which @controller handles events. 77 * 78 * Returns: the propagation phase 79 * 80 * Since: 3.14 81 */ 82 public GtkPropagationPhase getPropagationPhase() 83 { 84 return gtk_event_controller_get_propagation_phase(gtkEventController); 85 } 86 87 /** 88 * Returns the #GtkWidget this controller relates to. 89 * 90 * Returns: a #GtkWidget 91 * 92 * Since: 3.14 93 */ 94 public Widget getWidget() 95 { 96 auto p = gtk_event_controller_get_widget(gtkEventController); 97 98 if(p is null) 99 { 100 return null; 101 } 102 103 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 104 } 105 106 /** 107 * Feeds an events into @controller, so it can be interpreted 108 * and the controller actions triggered. 109 * 110 * Params: 111 * event = a #GdkEvent 112 * 113 * Returns: %TRUE if the event was potentially useful to trigger the 114 * controller action 115 * 116 * Since: 3.14 117 */ 118 public bool handleEvent(Event event) 119 { 120 return gtk_event_controller_handle_event(gtkEventController, (event is null) ? null : event.getEventStruct()) != 0; 121 } 122 123 /** 124 * Resets the @controller to a clean state. Every interaction 125 * the controller did through #GtkEventController::handle-event 126 * will be dropped at this point. 127 * 128 * Since: 3.14 129 */ 130 public void reset() 131 { 132 gtk_event_controller_reset(gtkEventController); 133 } 134 135 /** 136 * Sets the propagation phase at which a controller handles events. 137 * 138 * If @phase is %GTK_PHASE_NONE, no automatic event handling will be 139 * performed, but other additional gesture maintenance will. In that phase, 140 * the events can be managed by calling gtk_event_controller_handle_event(). 141 * 142 * Params: 143 * phase = a propagation phase 144 * 145 * Since: 3.14 146 */ 147 public void setPropagationPhase(GtkPropagationPhase phase) 148 { 149 gtk_event_controller_set_propagation_phase(gtkEventController, phase); 150 } 151 }