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