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 gsv.SourceCompletionItem;
26 
27 private import gdkpixbuf.Pixbuf;
28 private import gio.IconIF;
29 private import glib.ConstructionException;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import gsv.SourceCompletionProposalIF;
33 private import gsv.SourceCompletionProposalT;
34 private import gsv.c.functions;
35 public  import gsv.c.types;
36 public  import gsvc.gsvtypes;
37 
38 
39 /** */
40 public class SourceCompletionItem : ObjectG, SourceCompletionProposalIF
41 {
42 	/** the main Gtk struct */
43 	protected GtkSourceCompletionItem* gtkSourceCompletionItem;
44 
45 	/** Get the main Gtk struct */
46 	public GtkSourceCompletionItem* getSourceCompletionItemStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return gtkSourceCompletionItem;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)gtkSourceCompletionItem;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		gtkSourceCompletionItem = cast(GtkSourceCompletionItem*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GtkSourceCompletionItem* gtkSourceCompletionItem, bool ownedRef = false)
69 	{
70 		this.gtkSourceCompletionItem = gtkSourceCompletionItem;
71 		super(cast(GObject*)gtkSourceCompletionItem, ownedRef);
72 	}
73 
74 	// add the SourceCompletionProposal capabilities
75 	mixin SourceCompletionProposalT!(GtkSourceCompletionItem);
76 
77 	/**
78 	 * Create a new GtkSourceCompletionItem with label label, icon icon and
79 	 * extra information info. Both icon and info can be NULL in which case
80 	 * there will be no icon shown and no extra information available.
81 	 * Params:
82 	 * label = The item label.
83 	 * text = The item text.
84 	 * icon = The item icon. [allow-none]
85 	 * info = The item extra information. [allow-none]
86 	 * markup = If true label will be treated as markup. using gtk_source_completion_item_new_with_markup.
87 	 * Throws: ConstructionException GTK+ fails to create the object.
88 	 */
89 	public this (string label, string text, Pixbuf icon, string info, bool markup = false)
90 	{
91 		GtkSourceCompletionItem* p;
92 
93 		if ( markup )
94 		{
95 			p = gtk_source_completion_item_new_with_markup(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info));
96 		}
97 		else
98 		{
99 			p = gtk_source_completion_item_new(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info));
100 		}
101 
102 		if(p is null)
103 		{
104 			throw new ConstructionException("null returned by gtk_source_completion_item_new(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info))");
105 		}
106 		this(p, true);
107 	}
108 
109 	/**
110 	 */
111 
112 	/** */
113 	public static GType getType()
114 	{
115 		return gtk_source_completion_item_get_type();
116 	}
117 
118 	/**
119 	 * Creates a new #GtkSourceCompletionItem from a stock item. If @label is %NULL,
120 	 * the stock label will be used.
121 	 *
122 	 * Deprecated: Use gtk_source_completion_item_new2() instead.
123 	 *
124 	 * Params:
125 	 *     label = The item label.
126 	 *     text = The item text.
127 	 *     stock = The stock icon.
128 	 *     info = The item extra information.
129 	 *
130 	 * Returns: a new #GtkSourceCompletionItem.
131 	 *
132 	 * Throws: ConstructionException GTK+ fails to create the object.
133 	 */
134 	public this(string label, string text, string stock, string info)
135 	{
136 		auto p = gtk_source_completion_item_new_from_stock(Str.toStringz(label), Str.toStringz(text), Str.toStringz(stock), Str.toStringz(info));
137 
138 		if(p is null)
139 		{
140 			throw new ConstructionException("null returned by new_from_stock");
141 		}
142 
143 		this(cast(GtkSourceCompletionItem*) p, true);
144 	}
145 
146 	/**
147 	 * Creates a new #GtkSourceCompletionItem. The desired properties need to be set
148 	 * afterwards.
149 	 *
150 	 * Returns: a new #GtkSourceCompletionItem.
151 	 *
152 	 * Since: 3.24
153 	 *
154 	 * Throws: ConstructionException GTK+ fails to create the object.
155 	 */
156 	public this()
157 	{
158 		auto p = gtk_source_completion_item_new2();
159 
160 		if(p is null)
161 		{
162 			throw new ConstructionException("null returned by new2");
163 		}
164 
165 		this(cast(GtkSourceCompletionItem*) p, true);
166 	}
167 
168 	/** */
169 	public void setGicon(IconIF gicon)
170 	{
171 		gtk_source_completion_item_set_gicon(gtkSourceCompletionItem, (gicon is null) ? null : gicon.getIconStruct());
172 	}
173 
174 	/** */
175 	public void setIcon(Pixbuf icon)
176 	{
177 		gtk_source_completion_item_set_icon(gtkSourceCompletionItem, (icon is null) ? null : icon.getPixbufStruct());
178 	}
179 
180 	/** */
181 	public void setIconName(string iconName)
182 	{
183 		gtk_source_completion_item_set_icon_name(gtkSourceCompletionItem, Str.toStringz(iconName));
184 	}
185 
186 	/** */
187 	public void setInfo(string info)
188 	{
189 		gtk_source_completion_item_set_info(gtkSourceCompletionItem, Str.toStringz(info));
190 	}
191 
192 	/** */
193 	public void setLabel(string label)
194 	{
195 		gtk_source_completion_item_set_label(gtkSourceCompletionItem, Str.toStringz(label));
196 	}
197 
198 	/** */
199 	public void setMarkup(string markup)
200 	{
201 		gtk_source_completion_item_set_markup(gtkSourceCompletionItem, Str.toStringz(markup));
202 	}
203 
204 	/** */
205 	public void setText(string text)
206 	{
207 		gtk_source_completion_item_set_text(gtkSourceCompletionItem, Str.toStringz(text));
208 	}
209 }