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