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 glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gsv.SourceCompletionProposalIF; 31 private import gsv.SourceCompletionProposalT; 32 private import gsvc.gsv; 33 public import gsvc.gsvtypes; 34 35 36 /** */ 37 public class SourceCompletionItem : ObjectG, SourceCompletionProposalIF 38 { 39 /** the main Gtk struct */ 40 protected GtkSourceCompletionItem* gtkSourceCompletionItem; 41 42 /** Get the main Gtk struct */ 43 public GtkSourceCompletionItem* getSourceCompletionItemStruct() 44 { 45 return gtkSourceCompletionItem; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)gtkSourceCompletionItem; 52 } 53 54 protected override void setStruct(GObject* obj) 55 { 56 gtkSourceCompletionItem = cast(GtkSourceCompletionItem*)obj; 57 super.setStruct(obj); 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkSourceCompletionItem* gtkSourceCompletionItem, bool ownedRef = false) 64 { 65 this.gtkSourceCompletionItem = gtkSourceCompletionItem; 66 super(cast(GObject*)gtkSourceCompletionItem, ownedRef); 67 } 68 69 // add the SourceCompletionProposal capabilities 70 mixin SourceCompletionProposalT!(GtkSourceCompletionItem); 71 72 /** 73 * Create a new GtkSourceCompletionItem with label label, icon icon and 74 * extra information info. Both icon and info can be NULL in which case 75 * there will be no icon shown and no extra information available. 76 * Params: 77 * label = The item label. 78 * text = The item text. 79 * icon = The item icon. [allow-none] 80 * info = The item extra information. [allow-none] 81 * markup = If true label will be treated as markup. using gtk_source_completion_item_new_with_markup. 82 * Throws: ConstructionException GTK+ fails to create the object. 83 */ 84 public this (string label, string text, Pixbuf icon, string info, bool markup = false) 85 { 86 GtkSourceCompletionItem* p; 87 88 if ( markup ) 89 { 90 p = gtk_source_completion_item_new_with_markup(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info)); 91 } 92 else 93 { 94 p = gtk_source_completion_item_new(Str.toStringz(label), Str.toStringz(text), (icon is null) ? null : icon.getPixbufStruct(), Str.toStringz(info)); 95 } 96 97 if(p is null) 98 { 99 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))"); 100 } 101 this(p, true); 102 } 103 104 /** 105 */ 106 107 /** */ 108 public static GType getType() 109 { 110 return gtk_source_completion_item_get_type(); 111 } 112 113 /** 114 * Creates a new #GtkSourceCompletionItem from a stock item. If @label is %NULL, 115 * the stock label will be used. 116 * 117 * Deprecated: Use gtk_source_completion_item_new() instead. 118 * 119 * Params: 120 * label = The item label. 121 * text = The item text. 122 * stock = The stock icon. 123 * info = The item extra information. 124 * 125 * Return: a new #GtkSourceCompletionItem. 126 * 127 * Throws: ConstructionException GTK+ fails to create the object. 128 */ 129 public this(string label, string text, string stock, string info) 130 { 131 auto p = gtk_source_completion_item_new_from_stock(Str.toStringz(label), Str.toStringz(text), Str.toStringz(stock), Str.toStringz(info)); 132 133 if(p is null) 134 { 135 throw new ConstructionException("null returned by new_from_stock"); 136 } 137 138 this(cast(GtkSourceCompletionItem*) p, true); 139 } 140 }