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.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.basebutton; 24 import godot.control; 25 import godot.canvasitem; 26 import godot.node; 27 /** 28 Simple button used to represent a link to some resource. 29 30 This kind of buttons are primarily used when the interaction with the button causes a context change (like linking to a web page). 31 */ 32 @GodotBaseClass struct LinkButton 33 { 34 enum string _GODOT_internal_name = "LinkButton"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; BaseButton _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("set_text") GodotMethod!(void, String) setText; 45 @GodotName("get_text") GodotMethod!(String) getText; 46 @GodotName("set_underline_mode") GodotMethod!(void, long) setUnderlineMode; 47 @GodotName("get_underline_mode") GodotMethod!(LinkButton.UnderlineMode) getUnderlineMode; 48 } 49 bool opEquals(in LinkButton other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 LinkButton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static LinkButton _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("LinkButton"); 57 if(constructor is null) return typeof(this).init; 58 return cast(LinkButton)(constructor()); 59 } 60 @disable new(size_t s); 61 /// 62 enum UnderlineMode : int 63 { 64 /** 65 The LinkButton will always show an underline at the bottom of its text 66 */ 67 underlineModeAlways = 0, 68 /** 69 The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it. 70 */ 71 underlineModeOnHover = 1, 72 /** 73 The LinkButton will never show an underline at the bottom of its text. 74 */ 75 underlineModeNever = 2, 76 } 77 /// 78 enum Constants : int 79 { 80 underlineModeAlways = 0, 81 underlineModeOnHover = 1, 82 underlineModeNever = 2, 83 } 84 /** 85 86 */ 87 void setText(StringArg0)(in StringArg0 text) 88 { 89 checkClassBinding!(typeof(this))(); 90 ptrcall!(void)(_classBinding.setText, _godot_object, text); 91 } 92 /** 93 94 */ 95 String getText() const 96 { 97 checkClassBinding!(typeof(this))(); 98 return ptrcall!(String)(_classBinding.getText, _godot_object); 99 } 100 /** 101 102 */ 103 void setUnderlineMode(in long underline_mode) 104 { 105 checkClassBinding!(typeof(this))(); 106 ptrcall!(void)(_classBinding.setUnderlineMode, _godot_object, underline_mode); 107 } 108 /** 109 110 */ 111 LinkButton.UnderlineMode getUnderlineMode() const 112 { 113 checkClassBinding!(typeof(this))(); 114 return ptrcall!(LinkButton.UnderlineMode)(_classBinding.getUnderlineMode, _godot_object); 115 } 116 /** 117 118 */ 119 @property String text() 120 { 121 return getText(); 122 } 123 /// ditto 124 @property void text(String v) 125 { 126 setText(v); 127 } 128 /** 129 130 */ 131 @property LinkButton.UnderlineMode underline() 132 { 133 return getUnderlineMode(); 134 } 135 /// ditto 136 @property void underline(long v) 137 { 138 setUnderlineMode(v); 139 } 140 }