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  * The proposal interface represents a completion item in the completion window.
76  * It provides information on how to display the completion item and what action
77  * should be taken when the completion item is activated.
78  */
79 public template SourceCompletionProposalT(TStruct)
80 {
81 	
82 	/** the main Gtk struct */
83 	protected GtkSourceCompletionProposal* gtkSourceCompletionProposal;
84 	
85 	
86 	public GtkSourceCompletionProposal* getSourceCompletionProposalTStruct()
87 	{
88 		return cast(GtkSourceCompletionProposal*)getStruct();
89 	}
90 	
91 	
92 	/**
93 	 */
94 	int[string] connectedSignals;
95 	
96 	void delegate(SourceCompletionProposalIF)[] _onChangedListeners;
97 	void delegate(SourceCompletionProposalIF)[] onChangedListeners()
98 	{
99 		return  _onChangedListeners;
100 	}
101 	/**
102 	 * Emitted when the proposal has changed. The completion popup
103 	 * will react to this by updating the shown information.
104 	 */
105 	void addOnChanged(void delegate(SourceCompletionProposalIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
106 	{
107 		if ( !("changed" in connectedSignals) )
108 		{
109 			Signals.connectData(
110 			getStruct(),
111 			"changed",
112 			cast(GCallback)&callBackChanged,
113 			cast(void*)cast(SourceCompletionProposalIF)this,
114 			null,
115 			connectFlags);
116 			connectedSignals["changed"] = 1;
117 		}
118 		_onChangedListeners ~= dlg;
119 	}
120 	extern(C) static void callBackChanged(GtkSourceCompletionProposal* proposalStruct, SourceCompletionProposalIF _sourceCompletionProposalIF)
121 	{
122 		foreach ( void delegate(SourceCompletionProposalIF) dlg ; _sourceCompletionProposalIF.onChangedListeners )
123 		{
124 			dlg(_sourceCompletionProposalIF);
125 		}
126 	}
127 	
128 	
129 	/**
130 	 * Gets the label of proposal. The label is shown in the list of proposals as
131 	 * plain text. If you need any markup (such as bold or italic text), you have
132 	 * to implement gtk_source_completion_proposal_get_markup(). The returned string
133 	 * must be freed with g_free().
134 	 * Returns: a new string containing the label of proposal.
135 	 */
136 	public string getLabel()
137 	{
138 		// gchar * gtk_source_completion_proposal_get_label  (GtkSourceCompletionProposal *proposal);
139 		return Str.toString(gtk_source_completion_proposal_get_label(getSourceCompletionProposalTStruct()));
140 	}
141 	
142 	/**
143 	 * Gets the label of proposal with markup. The label is shown in the list of
144 	 * proposals and may contain markup. This will be used instead of
145 	 * gtk_source_completion_proposal_get_label() if implemented. The returned string
146 	 * must be freed with g_free().
147 	 * Returns: a new string containing the label of proposal with markup.
148 	 */
149 	public string getMarkup()
150 	{
151 		// gchar * gtk_source_completion_proposal_get_markup  (GtkSourceCompletionProposal *proposal);
152 		return Str.toString(gtk_source_completion_proposal_get_markup(getSourceCompletionProposalTStruct()));
153 	}
154 	
155 	/**
156 	 * Gets the text of proposal. The text that is inserted into
157 	 * the text buffer when the proposal is activated by the default activation.
158 	 * You are free to implement a custom activation handler in the provider and
159 	 * not implement this function. For more information, see
160 	 * gtk_source_completion_provider_activate_proposal(). The returned string must
161 	 * be freed with g_free().
162 	 * Returns: a new string containing the text of proposal.
163 	 */
164 	public string getText()
165 	{
166 		// gchar * gtk_source_completion_proposal_get_text  (GtkSourceCompletionProposal *proposal);
167 		return Str.toString(gtk_source_completion_proposal_get_text(getSourceCompletionProposalTStruct()));
168 	}
169 	
170 	/**
171 	 * Gets the icon of proposal.
172 	 * Returns: The icon of proposal. [transfer none]
173 	 */
174 	public Pixbuf getIcon()
175 	{
176 		// GdkPixbuf * gtk_source_completion_proposal_get_icon  (GtkSourceCompletionProposal *proposal);
177 		auto p = gtk_source_completion_proposal_get_icon(getSourceCompletionProposalTStruct());
178 		
179 		if(p is null)
180 		{
181 			return null;
182 		}
183 		
184 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
185 	}
186 	
187 	/**
188 	 * Gets extra information associated to the proposal. This information will be
189 	 * used to present the user with extra, detailed information about the
190 	 * selected proposal. The returned string must be freed with g_free().
191 	 * Returns: a new string containing extra information of proposal or NULL if no extra information is associated to proposal.
192 	 */
193 	public string getInfo()
194 	{
195 		// gchar * gtk_source_completion_proposal_get_info  (GtkSourceCompletionProposal *proposal);
196 		return Str.toString(gtk_source_completion_proposal_get_info(getSourceCompletionProposalTStruct()));
197 	}
198 	
199 	/**
200 	 * Emits the "changed" signal on proposal. This should be called by
201 	 * implementations whenever the name, icon or info of the proposal has
202 	 * changed.
203 	 */
204 	public void changed()
205 	{
206 		// void gtk_source_completion_proposal_changed  (GtkSourceCompletionProposal *proposal);
207 		gtk_source_completion_proposal_changed(getSourceCompletionProposalTStruct());
208 	}
209 	
210 	/**
211 	 * Get the hash value of proposal. This is used to (together with
212 	 * gtk_source_completion_proposal_equal()) to match proposals in the completion
213 	 * model. By default, it uses a direct hash (g_direct_hash()).
214 	 * Returns: The hash value of proposal.
215 	 */
216 	public uint hash()
217 	{
218 		// guint gtk_source_completion_proposal_hash (GtkSourceCompletionProposal *proposal);
219 		return gtk_source_completion_proposal_hash(getSourceCompletionProposalTStruct());
220 	}
221 	
222 	/**
223 	 * Get whether two proposal objects are the same. This is used to (together
224 	 * with gtk_source_completion_proposal_hash()) to match proposals in the
225 	 * completion model. By default, it uses direct equality (g_direct_equal()).
226 	 * Params:
227 	 * other = a GtkSourceCompletionProposal.
228 	 * Returns: TRUE if proposal and object are the same proposal Signal Details The "changed" signal void user_function (GtkSourceCompletionProposal *proposal, gpointer user_data) : Action Emitted when the proposal has changed. The completion popup will react to this by updating the shown information.
229 	 */
230 	public int equal(SourceCompletionProposalIF other)
231 	{
232 		// gboolean gtk_source_completion_proposal_equal  (GtkSourceCompletionProposal *proposal,  GtkSourceCompletionProposal *other);
233 		return gtk_source_completion_proposal_equal(getSourceCompletionProposalTStruct(), (other is null) ? null : other.getSourceCompletionProposalTStruct());
234 	}
235 }