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