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 gobject.ObjectG;
30 private import gtkc.Loader;
31 private import gtkc.gtk;
32 public  import gtkc.gtktypes;
33 private import gtkc.paths;
34 
35 
36 /**
37  * A #GtkTargetEntry represents a single type of
38  * data than can be supplied for by a widget for a selection
39  * or for supplied or received during drag-and-drop.
40  */
41 public class TargetEntry
42 {
43 	/** the main Gtk struct */
44 	protected GtkTargetEntry* gtkTargetEntry;
45 	protected bool ownedRef;
46 
47 	/** Get the main Gtk struct */
48 	public GtkTargetEntry* getTargetEntryStruct()
49 	{
50 		return gtkTargetEntry;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected void* getStruct()
55 	{
56 		return cast(void*)gtkTargetEntry;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (GtkTargetEntry* gtkTargetEntry, bool ownedRef = false)
63 	{
64 		this.gtkTargetEntry = gtkTargetEntry;
65 		this.ownedRef = ownedRef;
66 	}
67 
68 	~this ()
69 	{
70 		if (  Linker.isLoaded(LIBRARY.GTK) && ownedRef )
71 		{
72 			gtk_target_entry_free(gtkTargetEntry);
73 		}
74 	}
75 
76 	/**
77 	 */
78 
79 	/** */
80 	public static GType getType()
81 	{
82 		return gtk_target_entry_get_type();
83 	}
84 
85 	/**
86 	 * Makes a new #GtkTargetEntry.
87 	 *
88 	 * Params:
89 	 *     target = String identifier for target
90 	 *     flags = Set of flags, see #GtkTargetFlags
91 	 *     info = an ID that will be passed back to the application
92 	 *
93 	 * Return: a pointer to a new #GtkTargetEntry.
94 	 *     Free with gtk_target_entry_free()
95 	 *
96 	 * Throws: ConstructionException GTK+ fails to create the object.
97 	 */
98 	public this(string target, uint flags, uint info)
99 	{
100 		auto p = gtk_target_entry_new(Str.toStringz(target), flags, info);
101 		
102 		if(p is null)
103 		{
104 			throw new ConstructionException("null returned by new");
105 		}
106 		
107 		this(cast(GtkTargetEntry*) p);
108 	}
109 
110 	/**
111 	 * Makes a copy of a #GtkTargetEntry and its data.
112 	 *
113 	 * Return: a pointer to a copy of @data.
114 	 *     Free with gtk_target_entry_free()
115 	 */
116 	public TargetEntry copy()
117 	{
118 		auto p = gtk_target_entry_copy(gtkTargetEntry);
119 		
120 		if(p is null)
121 		{
122 			return null;
123 		}
124 		
125 		return ObjectG.getDObject!(TargetEntry)(cast(GtkTargetEntry*) p, true);
126 	}
127 
128 	/**
129 	 * Frees a #GtkTargetEntry returned from
130 	 * gtk_target_entry_new() or gtk_target_entry_copy().
131 	 */
132 	public void free()
133 	{
134 		gtk_target_entry_free(gtkTargetEntry);
135 	}
136 }