1 /** 2 Base class for scroll bars. 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.scrollbar; 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.range; 23 import godot.inputevent; 24 import godot.control; 25 import godot.canvasitem; 26 import godot.node; 27 /** 28 Base class for scroll bars. 29 30 Scrollbars are a $(D Range) based $(D Control), that display a draggable area (the size of the page). Horizontal ($(D HScrollBar)) and Vertical ($(D VScrollBar)) versions are available. 31 */ 32 @GodotBaseClass struct ScrollBar 33 { 34 enum string _GODOT_internal_name = "ScrollBar"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; Range _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("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 45 @GodotName("set_custom_step") GodotMethod!(void, double) setCustomStep; 46 @GodotName("get_custom_step") GodotMethod!(double) getCustomStep; 47 @GodotName("_drag_node_input") GodotMethod!(void, InputEvent) _dragNodeInput; 48 @GodotName("_drag_node_exit") GodotMethod!(void) _dragNodeExit; 49 } 50 bool opEquals(in ScrollBar other) const { return _godot_object.ptr is other._godot_object.ptr; } 51 ScrollBar opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 52 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 53 mixin baseCasts; 54 static ScrollBar _new() 55 { 56 static godot_class_constructor constructor; 57 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ScrollBar"); 58 if(constructor is null) return typeof(this).init; 59 return cast(ScrollBar)(constructor()); 60 } 61 @disable new(size_t s); 62 /** 63 64 */ 65 void _guiInput(InputEvent arg0) 66 { 67 Array _GODOT_args = Array.empty_array; 68 _GODOT_args.append(arg0); 69 String _GODOT_method_name = String("_gui_input"); 70 this.callv(_GODOT_method_name, _GODOT_args); 71 } 72 /** 73 74 */ 75 void setCustomStep(in double step) 76 { 77 checkClassBinding!(typeof(this))(); 78 ptrcall!(void)(_classBinding.setCustomStep, _godot_object, step); 79 } 80 /** 81 82 */ 83 double getCustomStep() const 84 { 85 checkClassBinding!(typeof(this))(); 86 return ptrcall!(double)(_classBinding.getCustomStep, _godot_object); 87 } 88 /** 89 90 */ 91 void _dragNodeInput(InputEvent arg0) 92 { 93 Array _GODOT_args = Array.empty_array; 94 _GODOT_args.append(arg0); 95 String _GODOT_method_name = String("_drag_node_input"); 96 this.callv(_GODOT_method_name, _GODOT_args); 97 } 98 /** 99 100 */ 101 void _dragNodeExit() 102 { 103 Array _GODOT_args = Array.empty_array; 104 String _GODOT_method_name = String("_drag_node_exit"); 105 this.callv(_GODOT_method_name, _GODOT_args); 106 } 107 /** 108 109 */ 110 @property double customStep() 111 { 112 return getCustomStep(); 113 } 114 /// ditto 115 @property void customStep(double v) 116 { 117 setCustomStep(v); 118 } 119 }