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.Misc; 26 27 private import gtk.Widget; 28 private import gtkc.gtk; 29 public import gtkc.gtktypes; 30 31 32 /** 33 * The #GtkMisc widget is an abstract widget which is not useful itself, but 34 * is used to derive subclasses which have alignment and padding attributes. 35 * 36 * The horizontal and vertical padding attributes allows extra space to be 37 * added around the widget. 38 * 39 * The horizontal and vertical alignment attributes enable the widget to be 40 * positioned within its allocated area. Note that if the widget is added to 41 * a container in such a way that it expands automatically to fill its 42 * allocated area, the alignment settings will not alter the widget's position. 43 * 44 * Note that the desired effect can in most cases be achieved by using the 45 * #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties 46 * on the child widget, so GtkMisc should not be used in new code. To reflect 47 * this fact, all #GtkMisc API has been deprecated. 48 */ 49 public class Misc : Widget 50 { 51 /** the main Gtk struct */ 52 protected GtkMisc* gtkMisc; 53 54 /** Get the main Gtk struct */ 55 public GtkMisc* getMiscStruct() 56 { 57 return gtkMisc; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gtkMisc; 64 } 65 66 protected override void setStruct(GObject* obj) 67 { 68 gtkMisc = cast(GtkMisc*)obj; 69 super.setStruct(obj); 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GtkMisc* gtkMisc, bool ownedRef = false) 76 { 77 this.gtkMisc = gtkMisc; 78 super(cast(GtkWidget*)gtkMisc, ownedRef); 79 } 80 81 /** 82 */ 83 84 public static GType getType() 85 { 86 return gtk_misc_get_type(); 87 } 88 89 /** 90 * Gets the X and Y alignment of the widget within its allocation. 91 * See gtk_misc_set_alignment(). 92 * 93 * Deprecated: Use #GtkWidget alignment and margin properties. 94 * 95 * Params: 96 * xalign = location to store X alignment of @misc, or %NULL 97 * yalign = location to store Y alignment of @misc, or %NULL 98 */ 99 public void getAlignment(out float xalign, out float yalign) 100 { 101 gtk_misc_get_alignment(gtkMisc, &xalign, &yalign); 102 } 103 104 /** 105 * Gets the padding in the X and Y directions of the widget. 106 * See gtk_misc_set_padding(). 107 * 108 * Deprecated: Use #GtkWidget alignment and margin properties. 109 * 110 * Params: 111 * xpad = location to store padding in the X 112 * direction, or %NULL 113 * ypad = location to store padding in the Y 114 * direction, or %NULL 115 */ 116 public void getPadding(out int xpad, out int ypad) 117 { 118 gtk_misc_get_padding(gtkMisc, &xpad, &ypad); 119 } 120 121 /** 122 * Sets the alignment of the widget. 123 * 124 * Deprecated: Use #GtkWidget's alignment (#GtkWidget:halign and #GtkWidget:valign) and margin properties or #GtkLabel's #GtkLabel:xalign and #GtkLabel:yalign properties. 125 * 126 * Params: 127 * xalign = the horizontal alignment, from 0 (left) to 1 (right). 128 * yalign = the vertical alignment, from 0 (top) to 1 (bottom). 129 */ 130 public void setAlignment(float xalign, float yalign) 131 { 132 gtk_misc_set_alignment(gtkMisc, xalign, yalign); 133 } 134 135 /** 136 * Sets the amount of space to add around the widget. 137 * 138 * Deprecated: Use #GtkWidget alignment and margin properties. 139 * 140 * Params: 141 * xpad = the amount of space to add on the left and right of the widget, 142 * in pixels. 143 * ypad = the amount of space to add on the top and bottom of the widget, 144 * in pixels. 145 */ 146 public void setPadding(int xpad, int ypad) 147 { 148 gtk_misc_set_padding(gtkMisc, xpad, ypad); 149 } 150 }