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.AspectFrame; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Frame; 31 private import gtk.Widget; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 public import gtkc.gtktypes; 35 36 37 /** 38 * The #GtkAspectFrame is useful when you want 39 * pack a widget so that it can resize but always retains 40 * the same aspect ratio. For instance, one might be 41 * drawing a small preview of a larger image. #GtkAspectFrame 42 * derives from #GtkFrame, so it can draw a label and 43 * a frame around the child. The frame will be 44 * “shrink-wrapped” to the size of the child. 45 * 46 * # CSS nodes 47 * 48 * GtkAspectFrame uses a CSS node with name frame. 49 */ 50 public class AspectFrame : Frame 51 { 52 /** the main Gtk struct */ 53 protected GtkAspectFrame* gtkAspectFrame; 54 55 /** Get the main Gtk struct */ 56 public GtkAspectFrame* getAspectFrameStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gtkAspectFrame; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected override void* getStruct() 65 { 66 return cast(void*)gtkAspectFrame; 67 } 68 69 protected override void setStruct(GObject* obj) 70 { 71 gtkAspectFrame = cast(GtkAspectFrame*)obj; 72 super.setStruct(obj); 73 } 74 75 /** 76 * Sets our main struct and passes it to the parent class. 77 */ 78 public this (GtkAspectFrame* gtkAspectFrame, bool ownedRef = false) 79 { 80 this.gtkAspectFrame = gtkAspectFrame; 81 super(cast(GtkFrame*)gtkAspectFrame, ownedRef); 82 } 83 84 85 /** */ 86 public static GType getType() 87 { 88 return gtk_aspect_frame_get_type(); 89 } 90 91 /** 92 * Create a new #GtkAspectFrame. 93 * 94 * Params: 95 * label = Label text. 96 * xalign = Horizontal alignment of the child within the allocation of 97 * the #GtkAspectFrame. This ranges from 0.0 (left aligned) 98 * to 1.0 (right aligned) 99 * yalign = Vertical alignment of the child within the allocation of 100 * the #GtkAspectFrame. This ranges from 0.0 (top aligned) 101 * to 1.0 (bottom aligned) 102 * ratio = The desired aspect ratio. 103 * obeyChild = If %TRUE, @ratio is ignored, and the aspect 104 * ratio is taken from the requistion of the child. 105 * 106 * Returns: the new #GtkAspectFrame. 107 * 108 * Throws: ConstructionException GTK+ fails to create the object. 109 */ 110 public this(string label, float xalign, float yalign, float ratio, bool obeyChild) 111 { 112 auto p = gtk_aspect_frame_new(Str.toStringz(label), xalign, yalign, ratio, obeyChild); 113 114 if(p is null) 115 { 116 throw new ConstructionException("null returned by new"); 117 } 118 119 this(cast(GtkAspectFrame*) p); 120 } 121 122 /** 123 * Set parameters for an existing #GtkAspectFrame. 124 * 125 * Params: 126 * xalign = Horizontal alignment of the child within the allocation of 127 * the #GtkAspectFrame. This ranges from 0.0 (left aligned) 128 * to 1.0 (right aligned) 129 * yalign = Vertical alignment of the child within the allocation of 130 * the #GtkAspectFrame. This ranges from 0.0 (top aligned) 131 * to 1.0 (bottom aligned) 132 * ratio = The desired aspect ratio. 133 * obeyChild = If %TRUE, @ratio is ignored, and the aspect 134 * ratio is taken from the requistion of the child. 135 */ 136 public void set(float xalign, float yalign, float ratio, bool obeyChild) 137 { 138 gtk_aspect_frame_set(gtkAspectFrame, xalign, yalign, ratio, obeyChild); 139 } 140 }