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.SourceCompletionProposalT;
26 
27 public  import gdkpixbuf.Pixbuf;
28 public  import gio.IconIF;
29 public  import glib.Str;
30 public  import gobject.ObjectG;
31 public  import gobject.Signals;
32 public  import gsv.c.functions;
33 public  import gsv.c.types;
34 public  import gsvc.gsvtypes;
35 public  import std.algorithm;
36 
37 
38 /** */
39 public template SourceCompletionProposalT(TStruct)
40 {
41 	/** Get the main Gtk struct */
42 	public GtkSourceCompletionProposal* getSourceCompletionProposalStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return cast(GtkSourceCompletionProposal*)getStruct();
47 	}
48 
49 
50 	/**
51 	 * Emits the "changed" signal on @proposal. This should be called by
52 	 * implementations whenever the name, icon or info of the proposal has
53 	 * changed.
54 	 */
55 	public void changed()
56 	{
57 		gtk_source_completion_proposal_changed(getSourceCompletionProposalStruct());
58 	}
59 
60 	/**
61 	 * Get whether two proposal objects are the same.  This is used to (together
62 	 * with gtk_source_completion_proposal_hash()) to match proposals in the
63 	 * completion model. By default, it uses direct equality (g_direct_equal()).
64 	 *
65 	 * Params:
66 	 *     other = a #GtkSourceCompletionProposal.
67 	 *
68 	 * Returns: %TRUE if @proposal and @object are the same proposal
69 	 */
70 	public bool equal(SourceCompletionProposalIF other)
71 	{
72 		return gtk_source_completion_proposal_equal(getSourceCompletionProposalStruct(), (other is null) ? null : other.getSourceCompletionProposalStruct()) != 0;
73 	}
74 
75 	/**
76 	 * Gets the #GIcon for the icon of @proposal.
77 	 *
78 	 * Returns: A #GIcon with the icon of @proposal.
79 	 *
80 	 * Since: 3.18
81 	 */
82 	public IconIF getGicon()
83 	{
84 		auto p = gtk_source_completion_proposal_get_gicon(getSourceCompletionProposalStruct());
85 
86 		if(p is null)
87 		{
88 			return null;
89 		}
90 
91 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) p);
92 	}
93 
94 	/**
95 	 * Gets the #GdkPixbuf for the icon of @proposal.
96 	 *
97 	 * Returns: A #GdkPixbuf with the icon of @proposal.
98 	 */
99 	public Pixbuf getIcon()
100 	{
101 		auto p = gtk_source_completion_proposal_get_icon(getSourceCompletionProposalStruct());
102 
103 		if(p is null)
104 		{
105 			return null;
106 		}
107 
108 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
109 	}
110 
111 	/**
112 	 * Gets the icon name of @proposal.
113 	 *
114 	 * Returns: The icon name of @proposal.
115 	 *
116 	 * Since: 3.18
117 	 */
118 	public string getIconName()
119 	{
120 		return Str.toString(gtk_source_completion_proposal_get_icon_name(getSourceCompletionProposalStruct()));
121 	}
122 
123 	/**
124 	 * Gets extra information associated to the proposal. This information will be
125 	 * used to present the user with extra, detailed information about the
126 	 * selected proposal. The returned string must be freed with g_free().
127 	 *
128 	 * Returns: a newly-allocated string containing
129 	 *     extra information of @proposal or %NULL if no extra information is associated
130 	 *     to @proposal.
131 	 */
132 	public string getInfo()
133 	{
134 		auto retStr = gtk_source_completion_proposal_get_info(getSourceCompletionProposalStruct());
135 
136 		scope(exit) Str.freeString(retStr);
137 		return Str.toString(retStr);
138 	}
139 
140 	/**
141 	 * Gets the label of @proposal. The label is shown in the list of proposals as
142 	 * plain text. If you need any markup (such as bold or italic text), you have
143 	 * to implement gtk_source_completion_proposal_get_markup(). The returned string
144 	 * must be freed with g_free().
145 	 *
146 	 * Returns: a new string containing the label of @proposal.
147 	 */
148 	public string getLabel()
149 	{
150 		auto retStr = gtk_source_completion_proposal_get_label(getSourceCompletionProposalStruct());
151 
152 		scope(exit) Str.freeString(retStr);
153 		return Str.toString(retStr);
154 	}
155 
156 	/**
157 	 * Gets the label of @proposal with markup. The label is shown in the list of
158 	 * proposals and may contain markup. This will be used instead of
159 	 * gtk_source_completion_proposal_get_label() if implemented. The returned string
160 	 * must be freed with g_free().
161 	 *
162 	 * Returns: a new string containing the label of @proposal with markup.
163 	 */
164 	public string getMarkup()
165 	{
166 		auto retStr = gtk_source_completion_proposal_get_markup(getSourceCompletionProposalStruct());
167 
168 		scope(exit) Str.freeString(retStr);
169 		return Str.toString(retStr);
170 	}
171 
172 	/**
173 	 * Gets the text of @proposal. The text that is inserted into
174 	 * the text buffer when the proposal is activated by the default activation.
175 	 * You are free to implement a custom activation handler in the provider and
176 	 * not implement this function. For more information, see
177 	 * gtk_source_completion_provider_activate_proposal(). The returned string must
178 	 * be freed with g_free().
179 	 *
180 	 * Returns: a new string containing the text of @proposal.
181 	 */
182 	public string getText()
183 	{
184 		auto retStr = gtk_source_completion_proposal_get_text(getSourceCompletionProposalStruct());
185 
186 		scope(exit) Str.freeString(retStr);
187 		return Str.toString(retStr);
188 	}
189 
190 	/**
191 	 * Get the hash value of @proposal. This is used to (together with
192 	 * gtk_source_completion_proposal_equal()) to match proposals in the completion
193 	 * model. By default, it uses a direct hash (g_direct_hash()).
194 	 *
195 	 * Returns: The hash value of @proposal.
196 	 */
197 	public uint hash()
198 	{
199 		return gtk_source_completion_proposal_hash(getSourceCompletionProposalStruct());
200 	}
201 
202 	/**
203 	 * Emitted when the proposal has changed. The completion popup
204 	 * will react to this by updating the shown information.
205 	 */
206 	gulong addOnChanged(void delegate(SourceCompletionProposalIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
207 	{
208 		return Signals.connect(this, "changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
209 	}
210 }