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 	/** */
78 	public static GType getType()
79 	{
80 		return gtk_target_entry_get_type();
81 	}
82 
83 	/**
84 	 * Makes a new #GtkTargetEntry.
85 	 *
86 	 * Params:
87 	 *     target = String identifier for target
88 	 *     flags = Set of flags, see #GtkTargetFlags
89 	 *     info = an ID that will be passed back to the application
90 	 *
91 	 * Return: a pointer to a new #GtkTargetEntry.
92 	 *     Free with gtk_target_entry_free()
93 	 *
94 	 * Throws: ConstructionException GTK+ fails to create the object.
95 	 */
96 	public this(string target, uint flags, uint info)
97 	{
98 		auto p = gtk_target_entry_new(Str.toStringz(target), flags, info);
99 		
100 		if(p is null)
101 		{
102 			throw new ConstructionException("null returned by new");
103 		}
104 		
105 		this(cast(GtkTargetEntry*) p);
106 	}
107 
108 	/**
109 	 * Makes a copy of a #GtkTargetEntry and its data.
110 	 *
111 	 * Return: a pointer to a copy of @data.
112 	 *     Free with gtk_target_entry_free()
113 	 */
114 	public TargetEntry copy()
115 	{
116 		auto p = gtk_target_entry_copy(gtkTargetEntry);
117 		
118 		if(p is null)
119 		{
120 			return null;
121 		}
122 		
123 		return ObjectG.getDObject!(TargetEntry)(cast(GtkTargetEntry*) p);
124 	}
125 
126 	/**
127 	 * Frees a #GtkTargetEntry returned from
128 	 * gtk_target_entry_new() or gtk_target_entry_copy().
129 	 */
130 	public void free()
131 	{
132 		gtk_target_entry_free(gtkTargetEntry);
133 	}
134 }