1 /** 2 Texture Based 3x3 scale style. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.styleboxtexture; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.stylebox; 24 import godot.texture; 25 import godot.resource; 26 import godot.reference; 27 /** 28 Texture Based 3x3 scale style. 29 30 This stylebox performs a 3x3 scaling of a texture, where only the center cell is fully stretched. This allows for the easy creation of bordered styles. 31 */ 32 @GodotBaseClass struct StyleBoxTexture 33 { 34 enum string _GODOT_internal_name = "StyleBoxTexture"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; StyleBox _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct _classBinding 42 { 43 __gshared: 44 @GodotName("set_texture") GodotMethod!(void, Texture) setTexture; 45 @GodotName("get_texture") GodotMethod!(Texture) getTexture; 46 @GodotName("set_normal_map") GodotMethod!(void, Texture) setNormalMap; 47 @GodotName("get_normal_map") GodotMethod!(Texture) getNormalMap; 48 @GodotName("set_margin_size") GodotMethod!(void, long, double) setMarginSize; 49 @GodotName("get_margin_size") GodotMethod!(double, long) getMarginSize; 50 @GodotName("set_expand_margin_size") GodotMethod!(void, long, double) setExpandMarginSize; 51 @GodotName("set_expand_margin_all") GodotMethod!(void, double) setExpandMarginAll; 52 @GodotName("set_expand_margin_individual") GodotMethod!(void, double, double, double, double) setExpandMarginIndividual; 53 @GodotName("get_expand_margin_size") GodotMethod!(double, long) getExpandMarginSize; 54 @GodotName("set_region_rect") GodotMethod!(void, Rect2) setRegionRect; 55 @GodotName("get_region_rect") GodotMethod!(Rect2) getRegionRect; 56 @GodotName("set_draw_center") GodotMethod!(void, bool) setDrawCenter; 57 @GodotName("is_draw_center_enabled") GodotMethod!(bool) isDrawCenterEnabled; 58 @GodotName("set_modulate") GodotMethod!(void, Color) setModulate; 59 @GodotName("get_modulate") GodotMethod!(Color) getModulate; 60 @GodotName("set_h_axis_stretch_mode") GodotMethod!(void, long) setHAxisStretchMode; 61 @GodotName("get_h_axis_stretch_mode") GodotMethod!(StyleBoxTexture.AxisStretchMode) getHAxisStretchMode; 62 @GodotName("set_v_axis_stretch_mode") GodotMethod!(void, long) setVAxisStretchMode; 63 @GodotName("get_v_axis_stretch_mode") GodotMethod!(StyleBoxTexture.AxisStretchMode) getVAxisStretchMode; 64 } 65 bool opEquals(in StyleBoxTexture other) const { return _godot_object.ptr is other._godot_object.ptr; } 66 StyleBoxTexture opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 67 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 68 mixin baseCasts; 69 static StyleBoxTexture _new() 70 { 71 static godot_class_constructor constructor; 72 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("StyleBoxTexture"); 73 if(constructor is null) return typeof(this).init; 74 return cast(StyleBoxTexture)(constructor()); 75 } 76 @disable new(size_t s); 77 /// 78 enum AxisStretchMode : int 79 { 80 /** 81 82 */ 83 axisStretchModeStretch = 0, 84 /** 85 86 */ 87 axisStretchModeTile = 1, 88 /** 89 90 */ 91 axisStretchModeTileFit = 2, 92 } 93 /// 94 enum Constants : int 95 { 96 axisStretchModeStretch = 0, 97 axisStretchModeTile = 1, 98 axisStretchModeTileFit = 2, 99 } 100 /** 101 102 */ 103 void setTexture(Texture texture) 104 { 105 checkClassBinding!(typeof(this))(); 106 ptrcall!(void)(_classBinding.setTexture, _godot_object, texture); 107 } 108 /** 109 110 */ 111 Ref!Texture getTexture() const 112 { 113 checkClassBinding!(typeof(this))(); 114 return ptrcall!(Texture)(_classBinding.getTexture, _godot_object); 115 } 116 /** 117 118 */ 119 void setNormalMap(Texture normal_map) 120 { 121 checkClassBinding!(typeof(this))(); 122 ptrcall!(void)(_classBinding.setNormalMap, _godot_object, normal_map); 123 } 124 /** 125 126 */ 127 Ref!Texture getNormalMap() const 128 { 129 checkClassBinding!(typeof(this))(); 130 return ptrcall!(Texture)(_classBinding.getNormalMap, _godot_object); 131 } 132 /** 133 134 */ 135 void setMarginSize(in long margin, in double size) 136 { 137 checkClassBinding!(typeof(this))(); 138 ptrcall!(void)(_classBinding.setMarginSize, _godot_object, margin, size); 139 } 140 /** 141 142 */ 143 double getMarginSize(in long margin) const 144 { 145 checkClassBinding!(typeof(this))(); 146 return ptrcall!(double)(_classBinding.getMarginSize, _godot_object, margin); 147 } 148 /** 149 150 */ 151 void setExpandMarginSize(in long margin, in double size) 152 { 153 checkClassBinding!(typeof(this))(); 154 ptrcall!(void)(_classBinding.setExpandMarginSize, _godot_object, margin, size); 155 } 156 /** 157 158 */ 159 void setExpandMarginAll(in double size) 160 { 161 checkClassBinding!(typeof(this))(); 162 ptrcall!(void)(_classBinding.setExpandMarginAll, _godot_object, size); 163 } 164 /** 165 166 */ 167 void setExpandMarginIndividual(in double size_left, in double size_top, in double size_right, in double size_bottom) 168 { 169 checkClassBinding!(typeof(this))(); 170 ptrcall!(void)(_classBinding.setExpandMarginIndividual, _godot_object, size_left, size_top, size_right, size_bottom); 171 } 172 /** 173 174 */ 175 double getExpandMarginSize(in long margin) const 176 { 177 checkClassBinding!(typeof(this))(); 178 return ptrcall!(double)(_classBinding.getExpandMarginSize, _godot_object, margin); 179 } 180 /** 181 182 */ 183 void setRegionRect(in Rect2 region) 184 { 185 checkClassBinding!(typeof(this))(); 186 ptrcall!(void)(_classBinding.setRegionRect, _godot_object, region); 187 } 188 /** 189 190 */ 191 Rect2 getRegionRect() const 192 { 193 checkClassBinding!(typeof(this))(); 194 return ptrcall!(Rect2)(_classBinding.getRegionRect, _godot_object); 195 } 196 /** 197 198 */ 199 void setDrawCenter(in bool enable) 200 { 201 checkClassBinding!(typeof(this))(); 202 ptrcall!(void)(_classBinding.setDrawCenter, _godot_object, enable); 203 } 204 /** 205 206 */ 207 bool isDrawCenterEnabled() const 208 { 209 checkClassBinding!(typeof(this))(); 210 return ptrcall!(bool)(_classBinding.isDrawCenterEnabled, _godot_object); 211 } 212 /** 213 214 */ 215 void setModulate(in Color color) 216 { 217 checkClassBinding!(typeof(this))(); 218 ptrcall!(void)(_classBinding.setModulate, _godot_object, color); 219 } 220 /** 221 222 */ 223 Color getModulate() const 224 { 225 checkClassBinding!(typeof(this))(); 226 return ptrcall!(Color)(_classBinding.getModulate, _godot_object); 227 } 228 /** 229 230 */ 231 void setHAxisStretchMode(in long mode) 232 { 233 checkClassBinding!(typeof(this))(); 234 ptrcall!(void)(_classBinding.setHAxisStretchMode, _godot_object, mode); 235 } 236 /** 237 238 */ 239 StyleBoxTexture.AxisStretchMode getHAxisStretchMode() const 240 { 241 checkClassBinding!(typeof(this))(); 242 return ptrcall!(StyleBoxTexture.AxisStretchMode)(_classBinding.getHAxisStretchMode, _godot_object); 243 } 244 /** 245 246 */ 247 void setVAxisStretchMode(in long mode) 248 { 249 checkClassBinding!(typeof(this))(); 250 ptrcall!(void)(_classBinding.setVAxisStretchMode, _godot_object, mode); 251 } 252 /** 253 254 */ 255 StyleBoxTexture.AxisStretchMode getVAxisStretchMode() const 256 { 257 checkClassBinding!(typeof(this))(); 258 return ptrcall!(StyleBoxTexture.AxisStretchMode)(_classBinding.getVAxisStretchMode, _godot_object); 259 } 260 /** 261 262 */ 263 @property Texture texture() 264 { 265 return getTexture(); 266 } 267 /// ditto 268 @property void texture(Texture v) 269 { 270 setTexture(v); 271 } 272 /** 273 274 */ 275 @property Texture normalMap() 276 { 277 return getNormalMap(); 278 } 279 /// ditto 280 @property void normalMap(Texture v) 281 { 282 setNormalMap(v); 283 } 284 /** 285 286 */ 287 @property Rect2 regionRect() 288 { 289 return getRegionRect(); 290 } 291 /// ditto 292 @property void regionRect(Rect2 v) 293 { 294 setRegionRect(v); 295 } 296 /** 297 298 */ 299 @property double marginLeft() 300 { 301 return getMarginSize(0); 302 } 303 /// ditto 304 @property void marginLeft(double v) 305 { 306 setMarginSize(0, v); 307 } 308 /** 309 310 */ 311 @property double marginRight() 312 { 313 return getMarginSize(2); 314 } 315 /// ditto 316 @property void marginRight(double v) 317 { 318 setMarginSize(2, v); 319 } 320 /** 321 322 */ 323 @property double marginTop() 324 { 325 return getMarginSize(1); 326 } 327 /// ditto 328 @property void marginTop(double v) 329 { 330 setMarginSize(1, v); 331 } 332 /** 333 334 */ 335 @property double marginBottom() 336 { 337 return getMarginSize(3); 338 } 339 /// ditto 340 @property void marginBottom(double v) 341 { 342 setMarginSize(3, v); 343 } 344 /** 345 346 */ 347 @property double expandMarginLeft() 348 { 349 return getExpandMarginSize(0); 350 } 351 /// ditto 352 @property void expandMarginLeft(double v) 353 { 354 setExpandMarginSize(0, v); 355 } 356 /** 357 358 */ 359 @property double expandMarginRight() 360 { 361 return getExpandMarginSize(2); 362 } 363 /// ditto 364 @property void expandMarginRight(double v) 365 { 366 setExpandMarginSize(2, v); 367 } 368 /** 369 370 */ 371 @property double expandMarginTop() 372 { 373 return getExpandMarginSize(1); 374 } 375 /// ditto 376 @property void expandMarginTop(double v) 377 { 378 setExpandMarginSize(1, v); 379 } 380 /** 381 382 */ 383 @property double expandMarginBottom() 384 { 385 return getExpandMarginSize(3); 386 } 387 /// ditto 388 @property void expandMarginBottom(double v) 389 { 390 setExpandMarginSize(3, v); 391 } 392 /** 393 394 */ 395 @property StyleBoxTexture.AxisStretchMode axisStretchHorizontal() 396 { 397 return getHAxisStretchMode(); 398 } 399 /// ditto 400 @property void axisStretchHorizontal(long v) 401 { 402 setHAxisStretchMode(v); 403 } 404 /** 405 406 */ 407 @property StyleBoxTexture.AxisStretchMode axisStretchVertical() 408 { 409 return getVAxisStretchMode(); 410 } 411 /// ditto 412 @property void axisStretchVertical(long v) 413 { 414 setVAxisStretchMode(v); 415 } 416 /** 417 418 */ 419 @property Color modulateColor() 420 { 421 return getModulate(); 422 } 423 /// ditto 424 @property void modulateColor(Color v) 425 { 426 setModulate(v); 427 } 428 /** 429 430 */ 431 @property bool drawCenter() 432 { 433 return isDrawCenterEnabled(); 434 } 435 /// ditto 436 @property void drawCenter(bool v) 437 { 438 setDrawCenter(v); 439 } 440 }