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