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