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 = GtkOffscreenWindow.html 27 * outPack = gtk 28 * outFile = OffscreenWindow 29 * strct = GtkOffscreenWindow 30 * realStrct= 31 * ctorStrct= 32 * clss = OffscreenWindow 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_offscreen_window_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gdk.Pixmap 47 * - gdk.Pixbuf 48 * - gtk.Widget 49 * structWrap: 50 * - GdkPixbuf* -> Pixbuf 51 * - GdkPixmap* -> Pixmap 52 * - GtkWidget* -> Widget 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.OffscreenWindow; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 67 private import gdk.Pixmap; 68 private import gdk.Pixbuf; 69 private import gtk.Widget; 70 71 72 73 private import gtk.Window; 74 75 /** 76 * Description 77 * GtkOffscreenWindow is strictly intended to be used for obtaining 78 * snapshots of widgets that are not part of a normal widget hierarchy. 79 * It differs from gtk_widget_get_snapshot() in that the widget you 80 * want to get a snapshot of need not be displayed on the user's screen 81 * as a part of a widget hierarchy. However, since GtkOffscreenWindow 82 * is a toplevel widget you cannot obtain snapshots of a full window 83 * with it since you cannot pack a toplevel widget in another toplevel. 84 * The idea is to take a widget and manually set the state of it, 85 * add it to a GtkOffscreenWindow and then retrieve the snapshot 86 * as a GdkPixmap or GdkPixbuf. 87 * GtkOffscreenWindow derives from GtkWindow only as an implementation 88 * detail. Applications should not use any API specific to GtkWindow 89 * to operate on this object. It should be treated as a GtkBin that 90 * has no parent widget. 91 * When contained offscreen widgets are redrawn, GtkOffscreenWindow 92 * will emit a "damage-event" signal. 93 */ 94 public class OffscreenWindow : Window 95 { 96 97 /** the main Gtk struct */ 98 protected GtkOffscreenWindow* gtkOffscreenWindow; 99 100 101 public GtkOffscreenWindow* getOffscreenWindowStruct() 102 { 103 return gtkOffscreenWindow; 104 } 105 106 107 /** the main Gtk struct as a void* */ 108 protected override void* getStruct() 109 { 110 return cast(void*)gtkOffscreenWindow; 111 } 112 113 /** 114 * Sets our main struct and passes it to the parent class 115 */ 116 public this (GtkOffscreenWindow* gtkOffscreenWindow) 117 { 118 super(cast(GtkWindow*)gtkOffscreenWindow); 119 this.gtkOffscreenWindow = gtkOffscreenWindow; 120 } 121 122 protected override void setStruct(GObject* obj) 123 { 124 super.setStruct(obj); 125 gtkOffscreenWindow = cast(GtkOffscreenWindow*)obj; 126 } 127 128 /** 129 */ 130 131 /** 132 * Creates a toplevel container widget that is used to retrieve 133 * snapshots of widgets without showing them on the screen. For 134 * widgets that are on the screen and part of a normal widget 135 * hierarchy, gtk_widget_get_snapshot() can be used instead. 136 * Since 2.20 137 * Throws: ConstructionException GTK+ fails to create the object. 138 */ 139 public this () 140 { 141 // GtkWidget * gtk_offscreen_window_new (void); 142 auto p = gtk_offscreen_window_new(); 143 if(p is null) 144 { 145 throw new ConstructionException("null returned by gtk_offscreen_window_new()"); 146 } 147 this(cast(GtkOffscreenWindow*) p); 148 } 149 150 /** 151 * Retrieves a snapshot of the contained widget in the form of 152 * a GdkPixmap. If you need to keep this around over window 153 * resizes then you should add a reference to it. 154 * Since 2.20 155 * Returns: A GdkPixmap pointer to the offscreen pixmap, or NULL. [transfer none] 156 */ 157 public Pixmap getPixmap() 158 { 159 // GdkPixmap * gtk_offscreen_window_get_pixmap (GtkOffscreenWindow *offscreen); 160 auto p = gtk_offscreen_window_get_pixmap(gtkOffscreenWindow); 161 162 if(p is null) 163 { 164 return null; 165 } 166 167 return ObjectG.getDObject!(Pixmap)(cast(GdkPixmap*) p); 168 } 169 170 /** 171 * Retrieves a snapshot of the contained widget in the form of 172 * a GdkPixbuf. This is a new pixbuf with a reference count of 1, 173 * and the application should unreference it once it is no longer 174 * needed. 175 * Since 2.20 176 * Returns: A GdkPixbuf pointer, or NULL. [transfer full] 177 */ 178 public Pixbuf getPixbuf() 179 { 180 // GdkPixbuf * gtk_offscreen_window_get_pixbuf (GtkOffscreenWindow *offscreen); 181 auto p = gtk_offscreen_window_get_pixbuf(gtkOffscreenWindow); 182 183 if(p is null) 184 { 185 return null; 186 } 187 188 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 189 } 190 }