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 = GtkAspectFrame.html 27 * outPack = gtk 28 * outFile = AspectFrame 29 * strct = GtkAspectFrame 30 * realStrct= 31 * ctorStrct= 32 * clss = AspectFrame 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_aspect_frame_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * structWrap: 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gtk.AspectFrame; 55 56 public import gtkc.gtktypes; 57 58 private import gtkc.gtk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 63 private import glib.Str; 64 65 66 67 private import gtk.Frame; 68 69 /** 70 * Description 71 * The GtkAspectFrame is useful when you want 72 * pack a widget so that it can resize but always retains 73 * the same aspect ratio. For instance, one might be 74 * drawing a small preview of a larger image. GtkAspectFrame 75 * derives from GtkFrame, so it can draw a label and 76 * a frame around the child. The frame will be 77 * "shrink-wrapped" to the size of the child. 78 */ 79 public class AspectFrame : Frame 80 { 81 82 /** the main Gtk struct */ 83 protected GtkAspectFrame* gtkAspectFrame; 84 85 86 public GtkAspectFrame* getAspectFrameStruct() 87 { 88 return gtkAspectFrame; 89 } 90 91 92 /** the main Gtk struct as a void* */ 93 protected override void* getStruct() 94 { 95 return cast(void*)gtkAspectFrame; 96 } 97 98 /** 99 * Sets our main struct and passes it to the parent class 100 */ 101 public this (GtkAspectFrame* gtkAspectFrame) 102 { 103 super(cast(GtkFrame*)gtkAspectFrame); 104 this.gtkAspectFrame = gtkAspectFrame; 105 } 106 107 protected override void setStruct(GObject* obj) 108 { 109 super.setStruct(obj); 110 gtkAspectFrame = cast(GtkAspectFrame*)obj; 111 } 112 113 /** 114 */ 115 116 /** 117 * Create a new GtkAspectFrame. 118 * Params: 119 * label = Label text. 120 * xalign = Horizontal alignment of the child within the allocation of 121 * the GtkAspectFrame. This ranges from 0.0 (left aligned) 122 * to 1.0 (right aligned) 123 * yalign = Vertical alignment of the child within the allocation of 124 * the GtkAspectFrame. This ranges from 0.0 (left aligned) 125 * to 1.0 (right aligned) 126 * ratio = The desired aspect ratio. 127 * obeyChild = If TRUE, ratio is ignored, and the aspect 128 * ratio is taken from the requistion of the child. 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this (string label, float xalign, float yalign, float ratio, int obeyChild) 132 { 133 // GtkWidget * gtk_aspect_frame_new (const gchar *label, gfloat xalign, gfloat yalign, gfloat ratio, gboolean obey_child); 134 auto p = gtk_aspect_frame_new(Str.toStringz(label), xalign, yalign, ratio, obeyChild); 135 if(p is null) 136 { 137 throw new ConstructionException("null returned by gtk_aspect_frame_new(Str.toStringz(label), xalign, yalign, ratio, obeyChild)"); 138 } 139 this(cast(GtkAspectFrame*) p); 140 } 141 142 /** 143 * Set parameters for an existing GtkAspectFrame. 144 * Params: 145 * xalign = Horizontal alignment of the child within the allocation of 146 * the GtkAspectFrame. This ranges from 0.0 (left aligned) 147 * to 1.0 (right aligned) 148 * yalign = Vertical alignment of the child within the allocation of 149 * the GtkAspectFrame. This ranges from 0.0 (left aligned) 150 * to 1.0 (right aligned) 151 * ratio = The desired aspect ratio. 152 * obeyChild = If TRUE, ratio is ignored, and the aspect 153 * ratio is taken from the requistion of the child. 154 */ 155 public void set(float xalign, float yalign, float ratio, int obeyChild) 156 { 157 // void gtk_aspect_frame_set (GtkAspectFrame *aspect_frame, gfloat xalign, gfloat yalign, gfloat ratio, gboolean obey_child); 158 gtk_aspect_frame_set(gtkAspectFrame, xalign, yalign, ratio, obeyChild); 159 } 160 }