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 = GtkLayout.html 27 * outPack = gtk 28 * outFile = Layout 29 * strct = GtkLayout 30 * realStrct= 31 * ctorStrct= 32 * clss = Layout 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - ScrollableIF 40 * prefixes: 41 * - gtk_layout_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * - gtk_layout_get_hadjustment 46 * - gtk_layout_get_vadjustment 47 * - gtk_layout_set_hadjustment 48 * - gtk_layout_set_vadjustment 49 * omit signals: 50 * imports: 51 * - gdk.Window 52 * - gtk.Adjustment 53 * - gtk.Widget 54 * - gtk.ScrollableIF 55 * - gtk.ScrollableT 56 * structWrap: 57 * - GdkWindow* -> Window 58 * - GtkAdjustment* -> Adjustment 59 * - GtkWidget* -> Widget 60 * module aliases: 61 * local aliases: 62 * overrides: 63 */ 64 65 module gtk.Layout; 66 67 public import gtkc.gtktypes; 68 69 private import gtkc.gtk; 70 private import glib.ConstructionException; 71 private import gobject.ObjectG; 72 73 private import gdk.Window; 74 private import gtk.Adjustment; 75 private import gtk.Widget; 76 private import gtk.ScrollableIF; 77 private import gtk.ScrollableT; 78 79 80 private import gtk.Container; 81 82 /** 83 * GtkLayout is similar to GtkDrawingArea in that it's a "blank slate" 84 * and doesn't do anything but paint a blank background by default. It's 85 * different in that it supports scrolling natively (you can add it to a 86 * GtkScrolledWindow), and it can contain child widgets, since it's a 87 * GtkContainer. However if you're just going to draw, a GtkDrawingArea 88 * is a better choice since it has lower overhead. 89 * 90 * When handling expose events on a GtkLayout, you must draw to 91 * GTK_LAYOUT (layout)->bin_window, rather than to 92 * GTK_WIDGET (layout)->window, as you would for a drawing 93 * area. 94 */ 95 public class Layout : Container, ScrollableIF 96 { 97 98 /** the main Gtk struct */ 99 protected GtkLayout* gtkLayout; 100 101 102 /** Get the main Gtk struct */ 103 public GtkLayout* getLayoutStruct() 104 { 105 return gtkLayout; 106 } 107 108 109 /** the main Gtk struct as a void* */ 110 protected override void* getStruct() 111 { 112 return cast(void*)gtkLayout; 113 } 114 115 /** 116 * Sets our main struct and passes it to the parent class 117 */ 118 public this (GtkLayout* gtkLayout) 119 { 120 super(cast(GtkContainer*)gtkLayout); 121 this.gtkLayout = gtkLayout; 122 } 123 124 protected override void setStruct(GObject* obj) 125 { 126 super.setStruct(obj); 127 gtkLayout = cast(GtkLayout*)obj; 128 } 129 130 // add the Scrollable capabilities 131 mixin ScrollableT!(GtkLayout); 132 133 /** 134 */ 135 136 /** 137 * Creates a new GtkLayout. Unless you have a specific adjustment 138 * you'd like the layout to use for scrolling, pass NULL for 139 * hadjustment and vadjustment. 140 * Params: 141 * hadjustment = horizontal scroll adjustment, or NULL. [allow-none] 142 * vadjustment = vertical scroll adjustment, or NULL. [allow-none] 143 * Throws: ConstructionException GTK+ fails to create the object. 144 */ 145 public this (Adjustment hadjustment, Adjustment vadjustment) 146 { 147 // GtkWidget * gtk_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); 148 auto p = gtk_layout_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 149 if(p is null) 150 { 151 throw new ConstructionException("null returned by gtk_layout_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct())"); 152 } 153 this(cast(GtkLayout*) p); 154 } 155 156 /** 157 * Adds child_widget to layout, at position (x,y). 158 * layout becomes the new parent container of child_widget. 159 * Params: 160 * childWidget = child widget 161 * x = X position of child widget 162 * y = Y position of child widget 163 */ 164 public void put(Widget childWidget, int x, int y) 165 { 166 // void gtk_layout_put (GtkLayout *layout, GtkWidget *child_widget, gint x, gint y); 167 gtk_layout_put(gtkLayout, (childWidget is null) ? null : childWidget.getWidgetStruct(), x, y); 168 } 169 170 /** 171 * Moves a current child of layout to a new position. 172 * Params: 173 * childWidget = a current child of layout 174 * x = X position to move to 175 * y = Y position to move to 176 */ 177 public void move(Widget childWidget, int x, int y) 178 { 179 // void gtk_layout_move (GtkLayout *layout, GtkWidget *child_widget, gint x, gint y); 180 gtk_layout_move(gtkLayout, (childWidget is null) ? null : childWidget.getWidgetStruct(), x, y); 181 } 182 183 /** 184 * Sets the size of the scrollable area of the layout. 185 * Params: 186 * width = width of entire scrollable area 187 * height = height of entire scrollable area 188 */ 189 public void setSize(uint width, uint height) 190 { 191 // void gtk_layout_set_size (GtkLayout *layout, guint width, guint height); 192 gtk_layout_set_size(gtkLayout, width, height); 193 } 194 195 /** 196 * Gets the size that has been set on the layout, and that determines 197 * the total extents of the layout's scrollbar area. See 198 * gtk_layout_set_size(). 199 * Params: 200 * width = location to store the width set on 201 * layout, or NULL. [out][allow-none] 202 * height = location to store the height set on 203 * layout, or NULL. [out][allow-none] 204 */ 205 public void getSize(out uint width, out uint height) 206 { 207 // void gtk_layout_get_size (GtkLayout *layout, guint *width, guint *height); 208 gtk_layout_get_size(gtkLayout, &width, &height); 209 } 210 211 /** 212 * Retrieve the bin window of the layout used for drawing operations. 213 * Since 2.14 214 * Returns: a GdkWindow. [transfer none] 215 */ 216 public Window getBinWindow() 217 { 218 // GdkWindow * gtk_layout_get_bin_window (GtkLayout *layout); 219 auto p = gtk_layout_get_bin_window(gtkLayout); 220 221 if(p is null) 222 { 223 return null; 224 } 225 226 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 227 } 228 }