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.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.range; 24 import godot.control; 25 import godot.canvasitem; 26 import godot.node; 27 import godot.inputevent; 28 /** 29 Base class for scroll bars. 30 31 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. 32 */ 33 @GodotBaseClass struct ScrollBar 34 { 35 package(godot) enum string _GODOT_internal_name = "ScrollBar"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ Range _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("_drag_node_exit") GodotMethod!(void) _dragNodeExit; 46 @GodotName("_drag_node_input") GodotMethod!(void, InputEvent) _dragNodeInput; 47 @GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 48 @GodotName("get_custom_step") GodotMethod!(double) getCustomStep; 49 @GodotName("set_custom_step") GodotMethod!(void, double) setCustomStep; 50 } 51 /// 52 pragma(inline, true) bool opEquals(in ScrollBar other) const 53 { return _godot_object.ptr is other._godot_object.ptr; } 54 /// 55 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 56 { _godot_object.ptr = n; return null; } 57 /// 58 pragma(inline, true) bool opEquals(typeof(null) n) const 59 { return _godot_object.ptr is n; } 60 /// 61 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 62 mixin baseCasts; 63 /// Construct a new instance of ScrollBar. 64 /// Note: use `memnew!ScrollBar` instead. 65 static ScrollBar _new() 66 { 67 static godot_class_constructor constructor; 68 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ScrollBar"); 69 if(constructor is null) return typeof(this).init; 70 return cast(ScrollBar)(constructor()); 71 } 72 @disable new(size_t s); 73 /** 74 75 */ 76 void _dragNodeExit() 77 { 78 Array _GODOT_args = Array.make(); 79 String _GODOT_method_name = String("_drag_node_exit"); 80 this.callv(_GODOT_method_name, _GODOT_args); 81 } 82 /** 83 84 */ 85 void _dragNodeInput(InputEvent arg0) 86 { 87 Array _GODOT_args = Array.make(); 88 _GODOT_args.append(arg0); 89 String _GODOT_method_name = String("_drag_node_input"); 90 this.callv(_GODOT_method_name, _GODOT_args); 91 } 92 /** 93 94 */ 95 void _guiInput(InputEvent arg0) 96 { 97 Array _GODOT_args = Array.make(); 98 _GODOT_args.append(arg0); 99 String _GODOT_method_name = String("_gui_input"); 100 this.callv(_GODOT_method_name, _GODOT_args); 101 } 102 /** 103 104 */ 105 double getCustomStep() const 106 { 107 checkClassBinding!(typeof(this))(); 108 return ptrcall!(double)(GDNativeClassBinding.getCustomStep, _godot_object); 109 } 110 /** 111 112 */ 113 void setCustomStep(in double step) 114 { 115 checkClassBinding!(typeof(this))(); 116 ptrcall!(void)(GDNativeClassBinding.setCustomStep, _godot_object, step); 117 } 118 /** 119 Overrides the step used when clicking increment and decrement buttons or when using arrow keys when the $(D ScrollBar) is focused. 120 */ 121 @property double customStep() 122 { 123 return getCustomStep(); 124 } 125 /// ditto 126 @property void customStep(double v) 127 { 128 setCustomStep(v); 129 } 130 }