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.SourceCompletionItem; 26 27 private import gdkpixbuf.Pixbuf; 28 private import gio.IconIF; 29 private import glib.ConstructionException; 30 private import glib.Str; 31 private import gobject.ObjectG; 32 private import gsv.SourceCompletionProposalIF; 33 private import gsv.SourceCompletionProposalT; 34 private import gsvc.gsv; 35 public import gsvc.gsvtypes; 36 37 38 /** */ 39 public class SourceCompletionItem : ObjectG, SourceCompletionProposalIF 40 { 41 /** the main Gtk struct */ 42 protected GtkSourceCompletionItem* gtkSourceCompletionItem; 43 44 /** Get the main Gtk struct */ 45 public GtkSourceCompletionItem* getSourceCompletionItemStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gtkSourceCompletionItem; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gtkSourceCompletionItem; 56 } 57 58 protected override void setStruct(GObject* obj) 59 { 60 gtkSourceCompletionItem = cast(GtkSourceCompletionItem*)obj; 61 super.setStruct(obj); 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GtkSourceCompletionItem* gtkSourceCompletionItem, bool ownedRef = false) 68 { 69 this.gtkSourceCompletionItem = gtkSourceCompletionItem; 70 super(cast(GObject*)gtkSourceCompletionItem, ownedRef); 71 } 72 73 // add the SourceCompletionProposal capabilities 74 mixin SourceCompletionProposalT!(GtkSourceCompletionItem); 75 76 /** 77 * Create a new GtkSourceCompletionItem with label label, icon icon and 78 * extra information info. Both icon and info can be NULL in which case 79 * there will be no icon shown and no extra information available. 80 * Params: 81 * label = The item label. 82 * text = The item text. 83 * icon = The item icon. [allow-none] 84 * info = The item extra information. [allow-none] 85 * markup = If true label will be treated as markup. using gtk_source_completion_item_new_with_markup. 86 * Throws: ConstructionException GTK+ fails to create the object. 87 */ 88 public this (string label, string text, Pixbuf icon, string info, bool markup = false) 89 { 90 GtkSourceCompletionItem* p; 91 92 if ( markup ) 93 { 94 p = gtk_source_completion_item_new_with_markup(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info)); 95 } 96 else 97 { 98 p = gtk_source_completion_item_new(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info)); 99 } 100 101 if(p is null) 102 { 103 throw new ConstructionException("null returned by gtk_source_completion_item_new(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info))"); 104 } 105 this(p, true); 106 } 107 108 /** 109 */ 110 111 /** */ 112 public static GType getType() 113 { 114 return gtk_source_completion_item_get_type(); 115 } 116 117 /** 118 * Creates a new #GtkSourceCompletionItem from a stock item. If @label is %NULL, 119 * the stock label will be used. 120 * 121 * Deprecated: Use gtk_source_completion_item_new2() instead. 122 * 123 * Params: 124 * label = The item label. 125 * text = The item text. 126 * stock = The stock icon. 127 * info = The item extra information. 128 * 129 * Returns: a new #GtkSourceCompletionItem. 130 * 131 * Throws: ConstructionException GTK+ fails to create the object. 132 */ 133 public this(string label, string text, string stock, string info) 134 { 135 auto p = gtk_source_completion_item_new_from_stock(Str.toStringz(label), Str.toStringz(text), Str.toStringz(stock), Str.toStringz(info)); 136 137 if(p is null) 138 { 139 throw new ConstructionException("null returned by new_from_stock"); 140 } 141 142 this(cast(GtkSourceCompletionItem*) p, true); 143 } 144 145 /** 146 * Creates a new #GtkSourceCompletionItem. The desired properties need to be set 147 * afterwards. 148 * 149 * Returns: a new #GtkSourceCompletionItem. 150 * 151 * Since: 3.24 152 * 153 * Throws: ConstructionException GTK+ fails to create the object. 154 */ 155 public this() 156 { 157 auto p = gtk_source_completion_item_new2(); 158 159 if(p is null) 160 { 161 throw new ConstructionException("null returned by new2"); 162 } 163 164 this(cast(GtkSourceCompletionItem*) p, true); 165 } 166 167 /** */ 168 public void setGicon(IconIF gicon) 169 { 170 gtk_source_completion_item_set_gicon(gtkSourceCompletionItem, (gicon is null) ? null : gicon.getIconStruct()); 171 } 172 173 /** */ 174 public void setIcon(Pixbuf icon) 175 { 176 gtk_source_completion_item_set_icon(gtkSourceCompletionItem, (icon is null) ? null : icon.getPixbufStruct()); 177 } 178 179 /** */ 180 public void setIconName(string iconName) 181 { 182 gtk_source_completion_item_set_icon_name(gtkSourceCompletionItem, Str.toStringz(iconName)); 183 } 184 185 /** */ 186 public void setInfo(string info) 187 { 188 gtk_source_completion_item_set_info(gtkSourceCompletionItem, Str.toStringz(info)); 189 } 190 191 /** */ 192 public void setLabel(string label) 193 { 194 gtk_source_completion_item_set_label(gtkSourceCompletionItem, Str.toStringz(label)); 195 } 196 197 /** */ 198 public void setMarkup(string markup) 199 { 200 gtk_source_completion_item_set_markup(gtkSourceCompletionItem, Str.toStringz(markup)); 201 } 202 203 /** */ 204 public void setText(string text) 205 { 206 gtk_source_completion_item_set_text(gtkSourceCompletionItem, Str.toStringz(text)); 207 } 208 }