1 /** 2 Simple button used to represent a link to some resource. 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.linkbutton; 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.basebutton; 25 import godot.control; 26 import godot.canvasitem; 27 import godot.node; 28 /** 29 Simple button used to represent a link to some resource. 30 31 This kind of button is primarily used when the interaction with the button causes a context change (like linking to a web page). 32 See also $(D BaseButton) which contains common properties and methods associated with this node. 33 */ 34 @GodotBaseClass struct LinkButton 35 { 36 package(godot) enum string _GODOT_internal_name = "LinkButton"; 37 public: 38 @nogc nothrow: 39 union { /** */ godot_object _godot_object; /** */ BaseButton _GODOT_base; } 40 alias _GODOT_base this; 41 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 42 package(godot) __gshared bool _classBindingInitialized = false; 43 package(godot) static struct GDNativeClassBinding 44 { 45 __gshared: 46 @GodotName("get_text") GodotMethod!(String) getText; 47 @GodotName("get_underline_mode") GodotMethod!(LinkButton.UnderlineMode) getUnderlineMode; 48 @GodotName("set_text") GodotMethod!(void, String) setText; 49 @GodotName("set_underline_mode") GodotMethod!(void, long) setUnderlineMode; 50 } 51 /// 52 pragma(inline, true) bool opEquals(in LinkButton 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 LinkButton. 64 /// Note: use `memnew!LinkButton` instead. 65 static LinkButton _new() 66 { 67 static godot_class_constructor constructor; 68 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("LinkButton"); 69 if(constructor is null) return typeof(this).init; 70 return cast(LinkButton)(constructor()); 71 } 72 @disable new(size_t s); 73 /// 74 enum UnderlineMode : int 75 { 76 /** 77 The LinkButton will always show an underline at the bottom of its text. 78 */ 79 underlineModeAlways = 0, 80 /** 81 The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it. 82 */ 83 underlineModeOnHover = 1, 84 /** 85 The LinkButton will never show an underline at the bottom of its text. 86 */ 87 underlineModeNever = 2, 88 } 89 /// 90 enum Constants : int 91 { 92 underlineModeAlways = 0, 93 underlineModeOnHover = 1, 94 underlineModeNever = 2, 95 } 96 /** 97 98 */ 99 String getText() const 100 { 101 checkClassBinding!(typeof(this))(); 102 return ptrcall!(String)(GDNativeClassBinding.getText, _godot_object); 103 } 104 /** 105 106 */ 107 LinkButton.UnderlineMode getUnderlineMode() const 108 { 109 checkClassBinding!(typeof(this))(); 110 return ptrcall!(LinkButton.UnderlineMode)(GDNativeClassBinding.getUnderlineMode, _godot_object); 111 } 112 /** 113 114 */ 115 void setText(in String text) 116 { 117 checkClassBinding!(typeof(this))(); 118 ptrcall!(void)(GDNativeClassBinding.setText, _godot_object, text); 119 } 120 /** 121 122 */ 123 void setUnderlineMode(in long underline_mode) 124 { 125 checkClassBinding!(typeof(this))(); 126 ptrcall!(void)(GDNativeClassBinding.setUnderlineMode, _godot_object, underline_mode); 127 } 128 /** 129 The button's text that will be displayed inside the button's area. 130 */ 131 @property String text() 132 { 133 return getText(); 134 } 135 /// ditto 136 @property void text(String v) 137 { 138 setText(v); 139 } 140 /** 141 Determines when to show the underline. See $(D underlinemode) for options. 142 */ 143 @property LinkButton.UnderlineMode underline() 144 { 145 return getUnderlineMode(); 146 } 147 /// ditto 148 @property void underline(long v) 149 { 150 setUnderlineMode(v); 151 } 152 }