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 public static GType getType() 84 { 85 return gtk_misc_get_type(); 86 } 87 88 /** 89 * Gets the X and Y alignment of the widget within its allocation. 90 * See gtk_misc_set_alignment(). 91 * 92 * Deprecated: Use #GtkWidget alignment and margin properties. 93 * 94 * Params: 95 * xalign = location to store X alignment of @misc, or %NULL 96 * yalign = location to store Y alignment of @misc, or %NULL 97 */ 98 public void getAlignment(out float xalign, out float yalign) 99 { 100 gtk_misc_get_alignment(gtkMisc, &xalign, &yalign); 101 } 102 103 /** 104 * Gets the padding in the X and Y directions of the widget. 105 * See gtk_misc_set_padding(). 106 * 107 * Deprecated: Use #GtkWidget alignment and margin properties. 108 * 109 * Params: 110 * xpad = location to store padding in the X 111 * direction, or %NULL 112 * ypad = location to store padding in the Y 113 * direction, or %NULL 114 */ 115 public void getPadding(out int xpad, out int ypad) 116 { 117 gtk_misc_get_padding(gtkMisc, &xpad, &ypad); 118 } 119 120 /** 121 * Sets the alignment of the widget. 122 * 123 * Deprecated: Use #GtkWidget's alignment (#GtkWidget:halign and #GtkWidget:valign) and margin properties or #GtkLabel's #GtkLabel:xalign and #GtkLabel:yalign properties. 124 * 125 * Params: 126 * xalign = the horizontal alignment, from 0 (left) to 1 (right). 127 * yalign = the vertical alignment, from 0 (top) to 1 (bottom). 128 */ 129 public void setAlignment(float xalign, float yalign) 130 { 131 gtk_misc_set_alignment(gtkMisc, xalign, yalign); 132 } 133 134 /** 135 * Sets the amount of space to add around the widget. 136 * 137 * Deprecated: Use #GtkWidget alignment and margin properties. 138 * 139 * Params: 140 * xpad = the amount of space to add on the left and right of the widget, 141 * in pixels. 142 * ypad = the amount of space to add on the top and bottom of the widget, 143 * in pixels. 144 */ 145 public void setPadding(int xpad, int ypad) 146 { 147 gtk_misc_set_padding(gtkMisc, xpad, ypad); 148 } 149 }