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.GridLayout; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.LayoutManager; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * `GtkGridLayout` is a layout manager which arranges child widgets in 36 * rows and columns. 37 * 38 * Children have an "attach point" defined by the horizontal and vertical 39 * index of the cell they occupy; children can span multiple rows or columns. 40 * The layout properties for setting the attach points and spans are set 41 * using the [class@Gtk.GridLayoutChild] associated to each child widget. 42 * 43 * The behaviour of `GtkGridLayout` when several children occupy the same 44 * grid cell is undefined. 45 * 46 * `GtkGridLayout` can be used like a `GtkBoxLayout` if all children are 47 * attached to the same row or column; however, if you only ever need a 48 * single row or column, you should consider using `GtkBoxLayout`. 49 */ 50 public class GridLayout : LayoutManager 51 { 52 /** the main Gtk struct */ 53 protected GtkGridLayout* gtkGridLayout; 54 55 /** Get the main Gtk struct */ 56 public GtkGridLayout* getGridLayoutStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gtkGridLayout; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected override void* getStruct() 65 { 66 return cast(void*)gtkGridLayout; 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GtkGridLayout* gtkGridLayout, bool ownedRef = false) 73 { 74 this.gtkGridLayout = gtkGridLayout; 75 super(cast(GtkLayoutManager*)gtkGridLayout, ownedRef); 76 } 77 78 79 /** */ 80 public static GType getType() 81 { 82 return gtk_grid_layout_get_type(); 83 } 84 85 /** 86 * Creates a new `GtkGridLayout`. 87 * 88 * Returns: the newly created `GtkGridLayout` 89 * 90 * Throws: ConstructionException GTK+ fails to create the object. 91 */ 92 public this() 93 { 94 auto __p = gtk_grid_layout_new(); 95 96 if(__p is null) 97 { 98 throw new ConstructionException("null returned by new"); 99 } 100 101 this(cast(GtkGridLayout*) __p, true); 102 } 103 104 /** 105 * Retrieves the row set with gtk_grid_layout_set_baseline_row(). 106 * 107 * Returns: the global baseline row 108 */ 109 public int getBaselineRow() 110 { 111 return gtk_grid_layout_get_baseline_row(gtkGridLayout); 112 } 113 114 /** 115 * Checks whether all columns of @grid should have the same width. 116 * 117 * Returns: %TRUE if the columns are homogeneous, and %FALSE otherwise 118 */ 119 public bool getColumnHomogeneous() 120 { 121 return gtk_grid_layout_get_column_homogeneous(gtkGridLayout) != 0; 122 } 123 124 /** 125 * Retrieves the spacing set with gtk_grid_layout_set_column_spacing(). 126 * 127 * Returns: the spacing between consecutive columns 128 */ 129 public uint getColumnSpacing() 130 { 131 return gtk_grid_layout_get_column_spacing(gtkGridLayout); 132 } 133 134 /** 135 * Returns the baseline position of @row. 136 * 137 * If no value has been set with 138 * [method@Gtk.GridLayout.set_row_baseline_position], 139 * the default value of %GTK_BASELINE_POSITION_CENTER 140 * is returned. 141 * 142 * Params: 143 * row = a row index 144 * 145 * Returns: the baseline position of @row 146 */ 147 public GtkBaselinePosition getRowBaselinePosition(int row) 148 { 149 return gtk_grid_layout_get_row_baseline_position(gtkGridLayout, row); 150 } 151 152 /** 153 * Checks whether all rows of @grid should have the same height. 154 * 155 * Returns: %TRUE if the rows are homogeneous, and %FALSE otherwise 156 */ 157 public bool getRowHomogeneous() 158 { 159 return gtk_grid_layout_get_row_homogeneous(gtkGridLayout) != 0; 160 } 161 162 /** 163 * Retrieves the spacing set with gtk_grid_layout_set_row_spacing(). 164 * 165 * Returns: the spacing between consecutive rows 166 */ 167 public uint getRowSpacing() 168 { 169 return gtk_grid_layout_get_row_spacing(gtkGridLayout); 170 } 171 172 /** 173 * Sets which row defines the global baseline for the entire grid. 174 * 175 * Each row in the grid can have its own local baseline, but only 176 * one of those is global, meaning it will be the baseline in the 177 * parent of the @grid. 178 * 179 * Params: 180 * row = the row index 181 */ 182 public void setBaselineRow(int row) 183 { 184 gtk_grid_layout_set_baseline_row(gtkGridLayout, row); 185 } 186 187 /** 188 * Sets whether all columns of @grid should have the same width. 189 * 190 * Params: 191 * homogeneous = %TRUE to make columns homogeneous 192 */ 193 public void setColumnHomogeneous(bool homogeneous) 194 { 195 gtk_grid_layout_set_column_homogeneous(gtkGridLayout, homogeneous); 196 } 197 198 /** 199 * Sets the amount of space to insert between consecutive columns. 200 * 201 * Params: 202 * spacing = the amount of space between columns, in pixels 203 */ 204 public void setColumnSpacing(uint spacing) 205 { 206 gtk_grid_layout_set_column_spacing(gtkGridLayout, spacing); 207 } 208 209 /** 210 * Sets how the baseline should be positioned on @row of the 211 * grid, in case that row is assigned more space than is requested. 212 * 213 * Params: 214 * row = a row index 215 * pos = a `GtkBaselinePosition` 216 */ 217 public void setRowBaselinePosition(int row, GtkBaselinePosition pos) 218 { 219 gtk_grid_layout_set_row_baseline_position(gtkGridLayout, row, pos); 220 } 221 222 /** 223 * Sets whether all rows of @grid should have the same height. 224 * 225 * Params: 226 * homogeneous = %TRUE to make rows homogeneous 227 */ 228 public void setRowHomogeneous(bool homogeneous) 229 { 230 gtk_grid_layout_set_row_homogeneous(gtkGridLayout, homogeneous); 231 } 232 233 /** 234 * Sets the amount of space to insert between consecutive rows. 235 * 236 * Params: 237 * spacing = the amount of space between rows, in pixels 238 */ 239 public void setRowSpacing(uint spacing) 240 { 241 gtk_grid_layout_set_row_spacing(gtkGridLayout, spacing); 242 } 243 }