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  * Conversion parameters:
26  * inFile  = GtkSourceCompletionProposal.html
27  * outPack = gsv
28  * outFile = SourceCompletionProposalT
29  * strct   = GtkSourceCompletionProposal
30  * realStrct=
31  * ctorStrct=
32  * clss    = SourceCompletionProposalT
33  * interf  = SourceCompletionProposalIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_source_completion_proposal_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gdk.Pixbuf
49  * structWrap:
50  * 	- GdkPixbuf* -> Pixbuf
51  * 	- GtkSourceCompletionProposal* -> SourceCompletionProposalIF
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gsv.SourceCompletionProposalT;
58 
59 public  import gsvc.gsvtypes;
60 
61 public import gsvc.gsv;
62 public import glib.ConstructionException;
63 public import gobject.ObjectG;
64 
65 public import gobject.Signals;
66 public  import gtkc.gdktypes;
67 
68 public import glib.Str;
69 public import gdk.Pixbuf;
70 
71 
72 
73 
74 /**
75  * Description
76  * The proposal interface represents a completion item in the completion window.
77  * It provides information on how to display the completion item and what action
78  * should be taken when the completion item is activated.
79  */
80 public template SourceCompletionProposalT(TStruct)
81 {
82 	
83 	/** the main Gtk struct */
84 	protected GtkSourceCompletionProposal* gtkSourceCompletionProposal;
85 	
86 	
87 	public GtkSourceCompletionProposal* getSourceCompletionProposalTStruct()
88 	{
89 		return cast(GtkSourceCompletionProposal*)getStruct();
90 	}
91 	
92 	
93 	/**
94 	 */
95 	int[string] connectedSignals;
96 	
97 	void delegate(SourceCompletionProposalIF)[] _onChangedListeners;
98 	void delegate(SourceCompletionProposalIF)[] onChangedListeners()
99 	{
100 		return  _onChangedListeners;
101 	}
102 	/**
103 	 * Emitted when the proposal has changed. The completion popup
104 	 * will react to this by updating the shown information.
105 	 */
106 	void addOnChanged(void delegate(SourceCompletionProposalIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
107 	{
108 		if ( !("changed" in connectedSignals) )
109 		{
110 			Signals.connectData(
111 			getStruct(),
112 			"changed",
113 			cast(GCallback)&callBackChanged,
114 			cast(void*)cast(SourceCompletionProposalIF)this,
115 			null,
116 			connectFlags);
117 			connectedSignals["changed"] = 1;
118 		}
119 		_onChangedListeners ~= dlg;
120 	}
121 	extern(C) static void callBackChanged(GtkSourceCompletionProposal* proposalStruct, SourceCompletionProposalIF _sourceCompletionProposalIF)
122 	{
123 		foreach ( void delegate(SourceCompletionProposalIF) dlg ; _sourceCompletionProposalIF.onChangedListeners )
124 		{
125 			dlg(_sourceCompletionProposalIF);
126 		}
127 	}
128 	
129 	
130 	/**
131 	 * Gets the label of proposal. The label is shown in the list of proposals as
132 	 * plain text. If you need any markup (such as bold or italic text), you have
133 	 * to implement gtk_source_completion_proposal_get_markup. The returned string
134 	 * must be freed with g_free().
135 	 * Returns: A new string containing the label of proposal.
136 	 */
137 	public string getLabel()
138 	{
139 		// gchar * gtk_source_completion_proposal_get_label  (GtkSourceCompletionProposal *proposal);
140 		return Str.toString(gtk_source_completion_proposal_get_label(getSourceCompletionProposalTStruct()));
141 	}
142 	
143 	/**
144 	 * Gets the label of proposal with markup. The label is shown in the list of
145 	 * proposals and may contain markup. This will be used instead of
146 	 * gtk_source_completion_proposal_get_label if implemented. The returned string
147 	 * must be freed with g_free().
148 	 * Returns: A new string containing the label of proposal with markup.
149 	 */
150 	public string getMarkup()
151 	{
152 		// gchar * gtk_source_completion_proposal_get_markup  (GtkSourceCompletionProposal *proposal);
153 		return Str.toString(gtk_source_completion_proposal_get_markup(getSourceCompletionProposalTStruct()));
154 	}
155 	
156 	/**
157 	 * Gets the text of proposal. The text that is inserted into
158 	 * the text buffer when the proposal is activated by the default activation.
159 	 * You are free to implement a custom activation handler in the provider and
160 	 * not implement this function. The returned string must be freed with g_free().
161 	 * Returns: A new string containing the text of proposal.
162 	 */
163 	public string getText()
164 	{
165 		// gchar * gtk_source_completion_proposal_get_text  (GtkSourceCompletionProposal *proposal);
166 		return Str.toString(gtk_source_completion_proposal_get_text(getSourceCompletionProposalTStruct()));
167 	}
168 	
169 	/**
170 	 * Gets the icon of proposal.
171 	 * Returns: The icon of proposal.
172 	 */
173 	public Pixbuf getIcon()
174 	{
175 		// GdkPixbuf * gtk_source_completion_proposal_get_icon  (GtkSourceCompletionProposal *proposal);
176 		auto p = gtk_source_completion_proposal_get_icon(getSourceCompletionProposalTStruct());
177 		
178 		if(p is null)
179 		{
180 			return null;
181 		}
182 		
183 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
184 	}
185 	
186 	/**
187 	 * Gets extra information associated to the proposal. This information will be
188 	 * used to present the user with extra, detailed information about the
189 	 * selected proposal. The returned string must be freed with g_free().
190 	 * Returns: A new string containing extra information of proposal or NULL if no extra information is associated to proposal.
191 	 */
192 	public string getInfo()
193 	{
194 		// gchar * gtk_source_completion_proposal_get_info  (GtkSourceCompletionProposal *proposal);
195 		return Str.toString(gtk_source_completion_proposal_get_info(getSourceCompletionProposalTStruct()));
196 	}
197 	
198 	/**
199 	 * Emits the "changed" signal on proposal. This should be called by
200 	 * implementations whenever the name, icon or info of the proposal has
201 	 * changed.
202 	 */
203 	public void changed()
204 	{
205 		// void gtk_source_completion_proposal_changed  (GtkSourceCompletionProposal *proposal);
206 		gtk_source_completion_proposal_changed(getSourceCompletionProposalTStruct());
207 	}
208 	
209 	/**
210 	 * Get the hash value of proposal. This is used to (together with
211 	 * gtk_source_completion_proposal_equal) to match proposals in the completion
212 	 * model. By default, it uses a direct hash (g_direct_hash).
213 	 * Returns: The hash value of proposal
214 	 */
215 	public uint hash()
216 	{
217 		// guint gtk_source_completion_proposal_hash (GtkSourceCompletionProposal *proposal);
218 		return gtk_source_completion_proposal_hash(getSourceCompletionProposalTStruct());
219 	}
220 	
221 	/**
222 	 * Get whether two proposal objects are the same. This is used to (together
223 	 * with gtk_source_completion_proposal_hash) to match proposals in the
224 	 * completion model. By default, it uses direct equality (g_direct_equal).
225 	 * Params:
226 	 * other = A GtkSourceCompletionProposal
227 	 * Returns: TRUE if proposal and object are the same proposal Signal Details The "changed" signal void user_function (GtkSourceCompletionProposal *proposal, gpointer user_data) : Run Last / Action Emitted when the proposal has changed. The completion popup will react to this by updating the shown information.
228 	 */
229 	public int equal(SourceCompletionProposalIF other)
230 	{
231 		// gboolean gtk_source_completion_proposal_equal  (GtkSourceCompletionProposal *proposal,  GtkSourceCompletionProposal *other);
232 		return gtk_source_completion_proposal_equal(getSourceCompletionProposalTStruct(), (other is null) ? null : other.getSourceCompletionProposalTStruct());
233 	}
234 }