1 /** 2 Input event type for mouse button events. 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.inputeventmousebutton; 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.inputeventmouse; 24 import godot.inputeventwithmodifiers; 25 import godot.inputevent; 26 import godot.resource; 27 import godot.reference; 28 /** 29 Input event type for mouse button events. 30 31 Contains mouse click information. See $(D Node._input). 32 */ 33 @GodotBaseClass struct InputEventMouseButton 34 { 35 enum string _GODOT_internal_name = "InputEventMouseButton"; 36 public: 37 @nogc nothrow: 38 union { godot_object _godot_object; InputEventMouse _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 _classBinding 43 { 44 __gshared: 45 @GodotName("set_factor") GodotMethod!(void, double) setFactor; 46 @GodotName("get_factor") GodotMethod!(double) getFactor; 47 @GodotName("set_button_index") GodotMethod!(void, long) setButtonIndex; 48 @GodotName("get_button_index") GodotMethod!(long) getButtonIndex; 49 @GodotName("set_pressed") GodotMethod!(void, bool) setPressed; 50 @GodotName("set_doubleclick") GodotMethod!(void, bool) setDoubleclick; 51 @GodotName("is_doubleclick") GodotMethod!(bool) isDoubleclick; 52 } 53 bool opEquals(in InputEventMouseButton other) const { return _godot_object.ptr is other._godot_object.ptr; } 54 InputEventMouseButton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 55 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 56 mixin baseCasts; 57 static InputEventMouseButton _new() 58 { 59 static godot_class_constructor constructor; 60 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventMouseButton"); 61 if(constructor is null) return typeof(this).init; 62 return cast(InputEventMouseButton)(constructor()); 63 } 64 @disable new(size_t s); 65 /** 66 67 */ 68 void setFactor(in double factor) 69 { 70 checkClassBinding!(typeof(this))(); 71 ptrcall!(void)(_classBinding.setFactor, _godot_object, factor); 72 } 73 /** 74 75 */ 76 double getFactor() 77 { 78 checkClassBinding!(typeof(this))(); 79 return ptrcall!(double)(_classBinding.getFactor, _godot_object); 80 } 81 /** 82 83 */ 84 void setButtonIndex(in long button_index) 85 { 86 checkClassBinding!(typeof(this))(); 87 ptrcall!(void)(_classBinding.setButtonIndex, _godot_object, button_index); 88 } 89 /** 90 91 */ 92 long getButtonIndex() const 93 { 94 checkClassBinding!(typeof(this))(); 95 return ptrcall!(long)(_classBinding.getButtonIndex, _godot_object); 96 } 97 /** 98 99 */ 100 void setPressed(in bool pressed) 101 { 102 checkClassBinding!(typeof(this))(); 103 ptrcall!(void)(_classBinding.setPressed, _godot_object, pressed); 104 } 105 /** 106 107 */ 108 void setDoubleclick(in bool doubleclick) 109 { 110 checkClassBinding!(typeof(this))(); 111 ptrcall!(void)(_classBinding.setDoubleclick, _godot_object, doubleclick); 112 } 113 /** 114 115 */ 116 bool isDoubleclick() const 117 { 118 checkClassBinding!(typeof(this))(); 119 return ptrcall!(bool)(_classBinding.isDoubleclick, _godot_object); 120 } 121 /** 122 Magnitude. Amount (or delta) of the event. Used for scroll events, indicates scroll amount (vertically or horizontally). Only supported on some platforms, sensitivity varies by platform. May be 0 if not supported. 123 */ 124 @property double factor() 125 { 126 return getFactor(); 127 } 128 /// ditto 129 @property void factor(double v) 130 { 131 setFactor(v); 132 } 133 /** 134 Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in $(D @GlobalScope). 135 */ 136 @property long buttonIndex() 137 { 138 return getButtonIndex(); 139 } 140 /// ditto 141 @property void buttonIndex(long v) 142 { 143 setButtonIndex(v); 144 } 145 /** 146 If `true` the mouse button's state is pressed. If `false` the mouse button's state is released. 147 */ 148 @property bool pressed() 149 { 150 return isPressed(); 151 } 152 /// ditto 153 @property void pressed(bool v) 154 { 155 setPressed(v); 156 } 157 /** 158 If `true` the mouse button's state is a double-click. 159 */ 160 @property bool doubleclick() 161 { 162 return isDoubleclick(); 163 } 164 /// ditto 165 @property void doubleclick(bool v) 166 { 167 setDoubleclick(v); 168 } 169 }