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 gobject.ObjectG; 29 private import gtk.Widget; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * `GtkAspectFrame` preserves the aspect ratio of its child. 36 * 37 * The frame can respect the aspect ratio of the child widget, 38 * or use its own aspect ratio. 39 * 40 * # CSS nodes 41 * 42 * `GtkAspectFrame` uses a CSS node with name `frame`. 43 */ 44 public class AspectFrame : Widget 45 { 46 /** the main Gtk struct */ 47 protected GtkAspectFrame* gtkAspectFrame; 48 49 /** Get the main Gtk struct */ 50 public GtkAspectFrame* getAspectFrameStruct(bool transferOwnership = false) 51 { 52 if (transferOwnership) 53 ownedRef = false; 54 return gtkAspectFrame; 55 } 56 57 /** the main Gtk struct as a void* */ 58 protected override void* getStruct() 59 { 60 return cast(void*)gtkAspectFrame; 61 } 62 63 /** 64 * Sets our main struct and passes it to the parent class. 65 */ 66 public this (GtkAspectFrame* gtkAspectFrame, bool ownedRef = false) 67 { 68 this.gtkAspectFrame = gtkAspectFrame; 69 super(cast(GtkWidget*)gtkAspectFrame, ownedRef); 70 } 71 72 73 /** */ 74 public static GType getType() 75 { 76 return gtk_aspect_frame_get_type(); 77 } 78 79 /** 80 * Create a new `GtkAspectFrame`. 81 * 82 * Params: 83 * xalign = Horizontal alignment of the child within the parent. 84 * Ranges from 0.0 (left aligned) to 1.0 (right aligned) 85 * yalign = Vertical alignment of the child within the parent. 86 * Ranges from 0.0 (top aligned) to 1.0 (bottom aligned) 87 * ratio = The desired aspect ratio. 88 * obeyChild = If %TRUE, @ratio is ignored, and the aspect 89 * ratio is taken from the requistion of the child. 90 * 91 * Returns: the new `GtkAspectFrame`. 92 * 93 * Throws: ConstructionException GTK+ fails to create the object. 94 */ 95 public this(float xalign, float yalign, float ratio, bool obeyChild) 96 { 97 auto __p = gtk_aspect_frame_new(xalign, yalign, ratio, obeyChild); 98 99 if(__p is null) 100 { 101 throw new ConstructionException("null returned by new"); 102 } 103 104 this(cast(GtkAspectFrame*) __p); 105 } 106 107 /** 108 * Gets the child widget of @self. 109 * 110 * Returns: the child widget of self@ 111 */ 112 public Widget getChild() 113 { 114 auto __p = gtk_aspect_frame_get_child(gtkAspectFrame); 115 116 if(__p is null) 117 { 118 return null; 119 } 120 121 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 122 } 123 124 /** 125 * Returns whether the child's size request should override 126 * the set aspect ratio of the `GtkAspectFrame`. 127 * 128 * Returns: whether to obey the child's size request 129 */ 130 public bool getObeyChild() 131 { 132 return gtk_aspect_frame_get_obey_child(gtkAspectFrame) != 0; 133 } 134 135 /** 136 * Returns the desired aspect ratio of the child. 137 * 138 * Returns: the desired aspect ratio 139 */ 140 public float getRatio() 141 { 142 return gtk_aspect_frame_get_ratio(gtkAspectFrame); 143 } 144 145 /** 146 * Returns the horizontal alignment of the child within the 147 * allocation of the `GtkAspectFrame`. 148 * 149 * Returns: the horizontal alignment 150 */ 151 public float getXalign() 152 { 153 return gtk_aspect_frame_get_xalign(gtkAspectFrame); 154 } 155 156 /** 157 * Returns the vertical alignment of the child within the 158 * allocation of the `GtkAspectFrame`. 159 * 160 * Returns: the vertical alignment 161 */ 162 public float getYalign() 163 { 164 return gtk_aspect_frame_get_yalign(gtkAspectFrame); 165 } 166 167 /** 168 * Sets the child widget of @self. 169 * 170 * Params: 171 * child = the child widget 172 */ 173 public void setChild(Widget child) 174 { 175 gtk_aspect_frame_set_child(gtkAspectFrame, (child is null) ? null : child.getWidgetStruct()); 176 } 177 178 /** 179 * Sets whether the aspect ratio of the child's size 180 * request should override the set aspect ratio of 181 * the `GtkAspectFrame`. 182 * 183 * Params: 184 * obeyChild = If %TRUE, @ratio is ignored, and the aspect 185 * ratio is taken from the requistion of the child. 186 */ 187 public void setObeyChild(bool obeyChild) 188 { 189 gtk_aspect_frame_set_obey_child(gtkAspectFrame, obeyChild); 190 } 191 192 /** 193 * Sets the desired aspect ratio of the child. 194 * 195 * Params: 196 * ratio = aspect ratio of the child 197 */ 198 public void setRatio(float ratio) 199 { 200 gtk_aspect_frame_set_ratio(gtkAspectFrame, ratio); 201 } 202 203 /** 204 * Sets the horizontal alignment of the child within the allocation 205 * of the `GtkAspectFrame`. 206 * 207 * Params: 208 * xalign = horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned) 209 */ 210 public void setXalign(float xalign) 211 { 212 gtk_aspect_frame_set_xalign(gtkAspectFrame, xalign); 213 } 214 215 /** 216 * Sets the vertical alignment of the child within the allocation 217 * of the `GtkAspectFrame`. 218 * 219 * Params: 220 * yalign = horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned) 221 */ 222 public void setYalign(float yalign) 223 { 224 gtk_aspect_frame_set_yalign(gtkAspectFrame, yalign); 225 } 226 }