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.ConstraintGuide; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import gtk.ConstraintTargetIF; 32 private import gtk.ConstraintTargetT; 33 private import gtk.c.functions; 34 public import gtk.c.types; 35 36 37 /** 38 * A `GtkConstraintGuide` is an invisible layout element in a 39 * `GtkConstraintLayout`. 40 * 41 * The `GtkConstraintLayout` treats guides like widgets. They 42 * can be used as the source or target of a `GtkConstraint`. 43 * 44 * Guides have a minimum, maximum and natural size. Depending 45 * on the constraints that are applied, they can act like a 46 * guideline that widgets can be aligned to, or like *flexible 47 * space*. 48 * 49 * Unlike a `GtkWidget`, a `GtkConstraintGuide` will not be drawn. 50 */ 51 public class ConstraintGuide : ObjectG, ConstraintTargetIF 52 { 53 /** the main Gtk struct */ 54 protected GtkConstraintGuide* gtkConstraintGuide; 55 56 /** Get the main Gtk struct */ 57 public GtkConstraintGuide* getConstraintGuideStruct(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkConstraintGuide; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkConstraintGuide; 68 } 69 70 /** 71 * Sets our main struct and passes it to the parent class. 72 */ 73 public this (GtkConstraintGuide* gtkConstraintGuide, bool ownedRef = false) 74 { 75 this.gtkConstraintGuide = gtkConstraintGuide; 76 super(cast(GObject*)gtkConstraintGuide, ownedRef); 77 } 78 79 // add the ConstraintTarget capabilities 80 mixin ConstraintTargetT!(GtkConstraintGuide); 81 82 83 /** */ 84 public static GType getType() 85 { 86 return gtk_constraint_guide_get_type(); 87 } 88 89 /** 90 * Creates a new `GtkConstraintGuide` object. 91 * 92 * Returns: a new `GtkConstraintGuide` object. 93 * 94 * Throws: ConstructionException GTK+ fails to create the object. 95 */ 96 public this() 97 { 98 auto __p = gtk_constraint_guide_new(); 99 100 if(__p is null) 101 { 102 throw new ConstructionException("null returned by new"); 103 } 104 105 this(cast(GtkConstraintGuide*) __p, true); 106 } 107 108 /** 109 * Gets the maximum size of @guide. 110 * 111 * Params: 112 * width = return location for the maximum width, 113 * or %NULL 114 * height = return location for the maximum height, 115 * or %NULL 116 */ 117 public void getMaxSize(int* width, int* height) 118 { 119 gtk_constraint_guide_get_max_size(gtkConstraintGuide, width, height); 120 } 121 122 /** 123 * Gets the minimum size of @guide. 124 * 125 * Params: 126 * width = return location for the minimum width, 127 * or %NULL 128 * height = return location for the minimum height, 129 * or %NULL 130 */ 131 public void getMinSize(int* width, int* height) 132 { 133 gtk_constraint_guide_get_min_size(gtkConstraintGuide, width, height); 134 } 135 136 /** 137 * Retrieves the name set using gtk_constraint_guide_set_name(). 138 * 139 * Returns: the name of the guide 140 */ 141 public string getName() 142 { 143 return Str.toString(gtk_constraint_guide_get_name(gtkConstraintGuide)); 144 } 145 146 /** 147 * Gets the natural size of @guide. 148 * 149 * Params: 150 * width = return location for the natural width, 151 * or %NULL 152 * height = return location for the natural height, 153 * or %NULL 154 */ 155 public void getNatSize(int* width, int* height) 156 { 157 gtk_constraint_guide_get_nat_size(gtkConstraintGuide, width, height); 158 } 159 160 /** 161 * Retrieves the strength set using gtk_constraint_guide_set_strength(). 162 * 163 * Returns: the strength of the constraint on the natural size 164 */ 165 public GtkConstraintStrength getStrength() 166 { 167 return gtk_constraint_guide_get_strength(gtkConstraintGuide); 168 } 169 170 /** 171 * Sets the maximum size of @guide. 172 * 173 * If @guide is attached to a `GtkConstraintLayout`, 174 * the constraints will be updated to reflect the new size. 175 * 176 * Params: 177 * width = the new maximum width, or -1 to not change it 178 * height = the new maximum height, or -1 to not change it 179 */ 180 public void setMaxSize(int width, int height) 181 { 182 gtk_constraint_guide_set_max_size(gtkConstraintGuide, width, height); 183 } 184 185 /** 186 * Sets the minimum size of @guide. 187 * 188 * If @guide is attached to a `GtkConstraintLayout`, 189 * the constraints will be updated to reflect the new size. 190 * 191 * Params: 192 * width = the new minimum width, or -1 to not change it 193 * height = the new minimum height, or -1 to not change it 194 */ 195 public void setMinSize(int width, int height) 196 { 197 gtk_constraint_guide_set_min_size(gtkConstraintGuide, width, height); 198 } 199 200 /** 201 * Sets a name for the given `GtkConstraintGuide`. 202 * 203 * The name is useful for debugging purposes. 204 * 205 * Params: 206 * name = a name for the @guide 207 */ 208 public void setName(string name) 209 { 210 gtk_constraint_guide_set_name(gtkConstraintGuide, Str.toStringz(name)); 211 } 212 213 /** 214 * Sets the natural size of @guide. 215 * 216 * If @guide is attached to a `GtkConstraintLayout`, 217 * the constraints will be updated to reflect the new size. 218 * 219 * Params: 220 * width = the new natural width, or -1 to not change it 221 * height = the new natural height, or -1 to not change it 222 */ 223 public void setNatSize(int width, int height) 224 { 225 gtk_constraint_guide_set_nat_size(gtkConstraintGuide, width, height); 226 } 227 228 /** 229 * Sets the strength of the constraint on the natural size of the 230 * given `GtkConstraintGuide`. 231 * 232 * Params: 233 * strength = the strength of the constraint 234 */ 235 public void setStrength(GtkConstraintStrength strength) 236 { 237 gtk_constraint_guide_set_strength(gtkConstraintGuide, strength); 238 } 239 }