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