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 gdk.CairoContext; 26 27 private import cairo.Context; 28 private import gdk.DrawContext; 29 private import gdk.c.functions; 30 public import gdk.c.types; 31 32 33 /** 34 * `GdkCairoContext` is an object representing the platform-specific 35 * draw context. 36 * 37 * `GdkCairoContext`s are created for a surface using 38 * [method@Gdk.Surface.create_cairo_context], and the context can then be used 39 * to draw on that surface. 40 */ 41 public class CairoContext : DrawContext 42 { 43 /** the main Gtk struct */ 44 protected GdkCairoContext* gdkCairoContext; 45 46 /** Get the main Gtk struct */ 47 public GdkCairoContext* getCairoContextStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gdkCairoContext; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected override void* getStruct() 56 { 57 return cast(void*)gdkCairoContext; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GdkCairoContext* gdkCairoContext, bool ownedRef = false) 64 { 65 this.gdkCairoContext = gdkCairoContext; 66 super(cast(GdkDrawContext*)gdkCairoContext, ownedRef); 67 } 68 69 70 /** */ 71 public static GType getType() 72 { 73 return gdk_cairo_context_get_type(); 74 } 75 76 /** 77 * Retrieves a Cairo context to be used to draw on the `GdkSurface` 78 * of @context. 79 * 80 * A call to [method@Gdk.DrawContext.begin_frame] with this 81 * @context must have been done or this function will return %NULL. 82 * 83 * The returned context is guaranteed to be valid until 84 * [method@Gdk.DrawContext.end_frame] is called. 85 * 86 * Returns: a Cairo context to be used 87 * to draw the contents of the `GdkSurface`. %NULL is returned 88 * when @context is not drawing. 89 */ 90 public Context cairoCreate() 91 { 92 auto __p = gdk_cairo_context_cairo_create(gdkCairoContext); 93 94 if(__p is null) 95 { 96 return null; 97 } 98 99 return new Context(cast(cairo_t*) __p); 100 } 101 }