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 = GtkMisc.html 27 * outPack = gtk 28 * outFile = Misc 29 * strct = GtkMisc 30 * realStrct= 31 * ctorStrct= 32 * clss = Misc 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_misc_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * module aliases: 48 * local aliases: 49 * overrides: 50 */ 51 52 module gtk.Misc; 53 54 public import gtkc.gtktypes; 55 56 private import gtkc.gtk; 57 private import glib.ConstructionException; 58 private import gobject.ObjectG; 59 60 61 62 63 64 private import gtk.Widget; 65 66 /** 67 * The GtkMisc widget is an abstract widget which is not useful itself, but 68 * is used to derive subclasses which have alignment and padding attributes. 69 * 70 * The horizontal and vertical padding attributes allows extra space to be 71 * added around the widget. 72 * 73 * The horizontal and vertical alignment attributes enable the widget to be 74 * positioned within its allocated area. Note that if the widget is added to 75 * a container in such a way that it expands automatically to fill its 76 * allocated area, the alignment settings will not alter the widgets position. 77 * 78 * Note 79 * 80 * Note that the desired effect can in most cases be achieved by using the 81 * "halign", "valign" and "margin" properties 82 * on the child widget, so GtkMisc should not be used in new code. 83 */ 84 public class Misc : Widget 85 { 86 87 /** the main Gtk struct */ 88 protected GtkMisc* gtkMisc; 89 90 91 public GtkMisc* getMiscStruct() 92 { 93 return gtkMisc; 94 } 95 96 97 /** the main Gtk struct as a void* */ 98 protected override void* getStruct() 99 { 100 return cast(void*)gtkMisc; 101 } 102 103 /** 104 * Sets our main struct and passes it to the parent class 105 */ 106 public this (GtkMisc* gtkMisc) 107 { 108 super(cast(GtkWidget*)gtkMisc); 109 this.gtkMisc = gtkMisc; 110 } 111 112 protected override void setStruct(GObject* obj) 113 { 114 super.setStruct(obj); 115 gtkMisc = cast(GtkMisc*)obj; 116 } 117 118 /** 119 */ 120 121 /** 122 * Sets the alignment of the widget. 123 * Params: 124 * xalign = the horizontal alignment, from 0 (left) to 1 (right). 125 * yalign = the vertical alignment, from 0 (top) to 1 (bottom). 126 */ 127 public void setAlignment(float xalign, float yalign) 128 { 129 // void gtk_misc_set_alignment (GtkMisc *misc, gfloat xalign, gfloat yalign); 130 gtk_misc_set_alignment(gtkMisc, xalign, yalign); 131 } 132 133 /** 134 * Sets the amount of space to add around the widget. 135 * Params: 136 * xpad = the amount of space to add on the left and right of the widget, 137 * in pixels. 138 * ypad = the amount of space to add on the top and bottom of the widget, 139 * in pixels. 140 */ 141 public void setPadding(int xpad, int ypad) 142 { 143 // void gtk_misc_set_padding (GtkMisc *misc, gint xpad, gint ypad); 144 gtk_misc_set_padding(gtkMisc, xpad, ypad); 145 } 146 147 /** 148 * Gets the X and Y alignment of the widget within its allocation. 149 * See gtk_misc_set_alignment(). 150 * Params: 151 * xalign = location to store X alignment of misc, or NULL. [out][allow-none] 152 * yalign = location to store Y alignment of misc, or NULL. [out][allow-none] 153 */ 154 public void getAlignment(out float xalign, out float yalign) 155 { 156 // void gtk_misc_get_alignment (GtkMisc *misc, gfloat *xalign, gfloat *yalign); 157 gtk_misc_get_alignment(gtkMisc, &xalign, &yalign); 158 } 159 160 /** 161 * Gets the padding in the X and Y directions of the widget. 162 * See gtk_misc_set_padding(). 163 * Params: 164 * xpad = location to store padding in the X 165 * direction, or NULL. [out][allow-none] 166 * ypad = location to store padding in the Y 167 * direction, or NULL. [out][allow-none] 168 */ 169 public void getPadding(out int xpad, out int ypad) 170 { 171 // void gtk_misc_get_padding (GtkMisc *misc, gint *xpad, gint *ypad); 172 gtk_misc_get_padding(gtkMisc, &xpad, &ypad); 173 } 174 }