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.TargetEntry; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 public import gtkc.gtktypes; 34 private import gtkd.Loader; 35 36 37 /** 38 * A #GtkTargetEntry represents a single type of 39 * data than can be supplied for by a widget for a selection 40 * or for supplied or received during drag-and-drop. 41 */ 42 public final class TargetEntry 43 { 44 /** the main Gtk struct */ 45 protected GtkTargetEntry* gtkTargetEntry; 46 protected bool ownedRef; 47 48 /** Get the main Gtk struct */ 49 public GtkTargetEntry* getTargetEntryStruct(bool transferOwnership = false) 50 { 51 if (transferOwnership) 52 ownedRef = false; 53 return gtkTargetEntry; 54 } 55 56 /** the main Gtk struct as a void* */ 57 protected void* getStruct() 58 { 59 return cast(void*)gtkTargetEntry; 60 } 61 62 /** 63 * Sets our main struct and passes it to the parent class. 64 */ 65 public this (GtkTargetEntry* gtkTargetEntry, bool ownedRef = false) 66 { 67 this.gtkTargetEntry = gtkTargetEntry; 68 this.ownedRef = ownedRef; 69 } 70 71 ~this () 72 { 73 if ( Linker.isLoaded(LIBRARY_GTK) && ownedRef ) 74 gtk_target_entry_free(gtkTargetEntry); 75 } 76 77 78 /** 79 * a string representation of the target type 80 */ 81 public @property string target() 82 { 83 return Str.toString(gtkTargetEntry.target); 84 } 85 86 /** Ditto */ 87 public @property void target(string value) 88 { 89 gtkTargetEntry.target = Str.toStringz(value); 90 } 91 92 /** 93 * #GtkTargetFlags for DND 94 */ 95 public @property uint flags() 96 { 97 return gtkTargetEntry.flags; 98 } 99 100 /** Ditto */ 101 public @property void flags(uint value) 102 { 103 gtkTargetEntry.flags = value; 104 } 105 106 /** 107 * an application-assigned integer ID which will 108 * get passed as a parameter to e.g the #GtkWidget::selection-get 109 * signal. It allows the application to identify the target 110 * type without extensive string compares. 111 */ 112 public @property uint info() 113 { 114 return gtkTargetEntry.info; 115 } 116 117 /** Ditto */ 118 public @property void info(uint value) 119 { 120 gtkTargetEntry.info = value; 121 } 122 123 /** */ 124 public static GType getType() 125 { 126 return gtk_target_entry_get_type(); 127 } 128 129 /** 130 * Makes a new #GtkTargetEntry. 131 * 132 * Params: 133 * target = String identifier for target 134 * flags = Set of flags, see #GtkTargetFlags 135 * info = an ID that will be passed back to the application 136 * 137 * Returns: a pointer to a new #GtkTargetEntry. 138 * Free with gtk_target_entry_free() 139 * 140 * Throws: ConstructionException GTK+ fails to create the object. 141 */ 142 public this(string target, uint flags, uint info) 143 { 144 auto p = gtk_target_entry_new(Str.toStringz(target), flags, info); 145 146 if(p is null) 147 { 148 throw new ConstructionException("null returned by new"); 149 } 150 151 this(cast(GtkTargetEntry*) p); 152 } 153 154 /** 155 * Makes a copy of a #GtkTargetEntry and its data. 156 * 157 * Returns: a pointer to a copy of @data. 158 * Free with gtk_target_entry_free() 159 */ 160 public TargetEntry copy() 161 { 162 auto p = gtk_target_entry_copy(gtkTargetEntry); 163 164 if(p is null) 165 { 166 return null; 167 } 168 169 return ObjectG.getDObject!(TargetEntry)(cast(GtkTargetEntry*) p, true); 170 } 171 172 /** 173 * Frees a #GtkTargetEntry returned from 174 * gtk_target_entry_new() or gtk_target_entry_copy(). 175 */ 176 public void free() 177 { 178 gtk_target_entry_free(gtkTargetEntry); 179 ownedRef = false; 180 } 181 }