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