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