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 glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gsv.SourceCompletionProposalIF;
31 private import gsv.SourceCompletionProposalT;
32 private import gsvc.gsv;
33 public  import gsvc.gsvtypes;
34 
35 
36 public class SourceCompletionItem : ObjectG, SourceCompletionProposalIF
37 {
38 	/** the main Gtk struct */
39 	protected GtkSourceCompletionItem* gtkSourceCompletionItem;
40 
41 	/** Get the main Gtk struct */
42 	public GtkSourceCompletionItem* getSourceCompletionItemStruct()
43 	{
44 		return gtkSourceCompletionItem;
45 	}
46 
47 	/** the main Gtk struct as a void* */
48 	protected override void* getStruct()
49 	{
50 		return cast(void*)gtkSourceCompletionItem;
51 	}
52 
53 	protected override void setStruct(GObject* obj)
54 	{
55 		gtkSourceCompletionItem = cast(GtkSourceCompletionItem*)obj;
56 		super.setStruct(obj);
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 	public static GType getType()
107 	{
108 		return gtk_source_completion_item_get_type();
109 	}
110 
111 	/**
112 	 * Creates a new #GtkSourceCompletionItem from a stock item. If @label is %NULL,
113 	 * the stock label will be used.
114 	 *
115 	 * Deprecated: Use gtk_source_completion_item_new() instead.
116 	 *
117 	 * Params:
118 	 *     label = The item label.
119 	 *     text = The item text.
120 	 *     stock = The stock icon.
121 	 *     info = The item extra information.
122 	 *
123 	 * Return: a new #GtkSourceCompletionItem.
124 	 *
125 	 * Throws: ConstructionException GTK+ fails to create the object.
126 	 */
127 	public this(string label, string text, string stock, string info)
128 	{
129 		auto p = gtk_source_completion_item_new_from_stock(Str.toStringz(label), Str.toStringz(text), Str.toStringz(stock), Str.toStringz(info));
130 		
131 		if(p is null)
132 		{
133 			throw new ConstructionException("null returned by new_from_stock");
134 		}
135 		
136 		this(cast(GtkSourceCompletionItem*) p, true);
137 	}
138 }