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 gtk.CellRendererPixbuf; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.CellRenderer; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 public import gtkc.gtktypes; 33 34 35 /** 36 * A #GtkCellRendererPixbuf can be used to render an image in a cell. It allows 37 * to render either a given #GdkPixbuf (set via the 38 * #GtkCellRendererPixbuf:pixbuf property) or a named icon (set via the 39 * #GtkCellRendererPixbuf:icon-name property). 40 * 41 * To support the tree view, #GtkCellRendererPixbuf also supports rendering two 42 * alternative pixbufs, when the #GtkCellRenderer:is-expander property is %TRUE. 43 * If the #GtkCellRenderer:is-expanded property is %TRUE and the 44 * #GtkCellRendererPixbuf:pixbuf-expander-open property is set to a pixbuf, it 45 * renders that pixbuf, if the #GtkCellRenderer:is-expanded property is %FALSE 46 * and the #GtkCellRendererPixbuf:pixbuf-expander-closed property is set to a 47 * pixbuf, it renders that one. 48 */ 49 public class CellRendererPixbuf : CellRenderer 50 { 51 /** the main Gtk struct */ 52 protected GtkCellRendererPixbuf* gtkCellRendererPixbuf; 53 54 /** Get the main Gtk struct */ 55 public GtkCellRendererPixbuf* getCellRendererPixbufStruct(bool transferOwnership = false) 56 { 57 if (transferOwnership) 58 ownedRef = false; 59 return gtkCellRendererPixbuf; 60 } 61 62 /** the main Gtk struct as a void* */ 63 protected override void* getStruct() 64 { 65 return cast(void*)gtkCellRendererPixbuf; 66 } 67 68 protected override void setStruct(GObject* obj) 69 { 70 gtkCellRendererPixbuf = cast(GtkCellRendererPixbuf*)obj; 71 super.setStruct(obj); 72 } 73 74 /** 75 * Sets our main struct and passes it to the parent class. 76 */ 77 public this (GtkCellRendererPixbuf* gtkCellRendererPixbuf, bool ownedRef = false) 78 { 79 this.gtkCellRendererPixbuf = gtkCellRendererPixbuf; 80 super(cast(GtkCellRenderer*)gtkCellRendererPixbuf, ownedRef); 81 } 82 83 84 /** */ 85 public static GType getType() 86 { 87 return gtk_cell_renderer_pixbuf_get_type(); 88 } 89 90 /** 91 * Creates a new #GtkCellRendererPixbuf. Adjust rendering 92 * parameters using object properties. Object properties can be set 93 * globally (with g_object_set()). Also, with #GtkTreeViewColumn, you 94 * can bind a property to a value in a #GtkTreeModel. For example, you 95 * can bind the “pixbuf” property on the cell renderer to a pixbuf value 96 * in the model, thus rendering a different image in each row of the 97 * #GtkTreeView. 98 * 99 * Returns: the new cell renderer 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this() 104 { 105 auto p = gtk_cell_renderer_pixbuf_new(); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(GtkCellRendererPixbuf*) p); 113 } 114 }