1 /** 2 Grid container used to arrange Control-derived children in a grid like layout. 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.gridcontainer; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.container; 25 import godot.control; 26 import godot.canvasitem; 27 import godot.node; 28 /** 29 Grid container used to arrange Control-derived children in a grid like layout. 30 31 GridContainer will arrange its Control-derived children in a grid like structure, the grid columns are specified using the $(D columns) property and the number of rows will be equal to the number of children in the container divided by the number of columns. For example, if the container has 5 children, and 2 columns, there will be 3 rows in the container. 32 Notice that grid layout will preserve the columns and rows for every size of the container, and that empty columns will be expanded automatically. 33 $(B Note:) GridContainer only works with child nodes inheriting from Control. It won't rearrange child nodes inheriting from Node2D. 34 */ 35 @GodotBaseClass struct GridContainer 36 { 37 package(godot) enum string _GODOT_internal_name = "GridContainer"; 38 public: 39 @nogc nothrow: 40 union { /** */ godot_object _godot_object; /** */ Container _GODOT_base; } 41 alias _GODOT_base this; 42 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 43 package(godot) __gshared bool _classBindingInitialized = false; 44 package(godot) static struct GDNativeClassBinding 45 { 46 __gshared: 47 @GodotName("get_columns") GodotMethod!(long) getColumns; 48 @GodotName("set_columns") GodotMethod!(void, long) setColumns; 49 } 50 /// 51 pragma(inline, true) bool opEquals(in GridContainer other) const 52 { return _godot_object.ptr is other._godot_object.ptr; } 53 /// 54 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 55 { _godot_object.ptr = n; return null; } 56 /// 57 pragma(inline, true) bool opEquals(typeof(null) n) const 58 { return _godot_object.ptr is n; } 59 /// 60 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 61 mixin baseCasts; 62 /// Construct a new instance of GridContainer. 63 /// Note: use `memnew!GridContainer` instead. 64 static GridContainer _new() 65 { 66 static godot_class_constructor constructor; 67 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("GridContainer"); 68 if(constructor is null) return typeof(this).init; 69 return cast(GridContainer)(constructor()); 70 } 71 @disable new(size_t s); 72 /** 73 74 */ 75 long getColumns() const 76 { 77 checkClassBinding!(typeof(this))(); 78 return ptrcall!(long)(GDNativeClassBinding.getColumns, _godot_object); 79 } 80 /** 81 82 */ 83 void setColumns(in long columns) 84 { 85 checkClassBinding!(typeof(this))(); 86 ptrcall!(void)(GDNativeClassBinding.setColumns, _godot_object, columns); 87 } 88 /** 89 The number of columns in the $(D GridContainer). If modified, $(D GridContainer) reorders its Control-derived children to accommodate the new layout. 90 */ 91 @property long columns() 92 { 93 return getColumns(); 94 } 95 /// ditto 96 @property void columns(long v) 97 { 98 setColumns(v); 99 } 100 }