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