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