1 /** 2 Button that pops out a $(D ColorPicker). 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.colorpickerbutton; 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.button; 25 import godot.basebutton; 26 import godot.control; 27 import godot.colorpicker; 28 import godot.popuppanel; 29 /** 30 Button that pops out a $(D ColorPicker). 31 32 Encapsulates a $(D ColorPicker) making it accessible by pressing a button. Pressing the button will toggle the $(D ColorPicker) visibility. 33 See also $(D BaseButton) which contains common properties and methods associated with this node. 34 */ 35 @GodotBaseClass struct ColorPickerButton 36 { 37 package(godot) enum string _GODOT_internal_name = "ColorPickerButton"; 38 public: 39 @nogc nothrow: 40 union { /** */ godot_object _godot_object; /** */ Button _GODOT_base; } 41 alias _GODOT_base this; 42 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 43 package(godot) __gshared bool _classBindingInitialized = false; 44 package(godot) static struct GDNativeClassBinding 45 { 46 __gshared: 47 @GodotName("_color_changed") GodotMethod!(void, Color) _colorChanged; 48 @GodotName("_modal_closed") GodotMethod!(void) _modalClosed; 49 @GodotName("get_pick_color") GodotMethod!(Color) getPickColor; 50 @GodotName("get_picker") GodotMethod!(ColorPicker) getPicker; 51 @GodotName("get_popup") GodotMethod!(PopupPanel) getPopup; 52 @GodotName("is_editing_alpha") GodotMethod!(bool) isEditingAlpha; 53 @GodotName("set_edit_alpha") GodotMethod!(void, bool) setEditAlpha; 54 @GodotName("set_pick_color") GodotMethod!(void, Color) setPickColor; 55 } 56 /// 57 pragma(inline, true) bool opEquals(in ColorPickerButton other) const 58 { return _godot_object.ptr is other._godot_object.ptr; } 59 /// 60 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 61 { _godot_object.ptr = n; return null; } 62 /// 63 pragma(inline, true) bool opEquals(typeof(null) n) const 64 { return _godot_object.ptr is n; } 65 /// 66 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 67 mixin baseCasts; 68 /// Construct a new instance of ColorPickerButton. 69 /// Note: use `memnew!ColorPickerButton` instead. 70 static ColorPickerButton _new() 71 { 72 static godot_class_constructor constructor; 73 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ColorPickerButton"); 74 if(constructor is null) return typeof(this).init; 75 return cast(ColorPickerButton)(constructor()); 76 } 77 @disable new(size_t s); 78 /** 79 80 */ 81 void _colorChanged(in Color arg0) 82 { 83 Array _GODOT_args = Array.make(); 84 _GODOT_args.append(arg0); 85 String _GODOT_method_name = String("_color_changed"); 86 this.callv(_GODOT_method_name, _GODOT_args); 87 } 88 /** 89 90 */ 91 void _modalClosed() 92 { 93 Array _GODOT_args = Array.make(); 94 String _GODOT_method_name = String("_modal_closed"); 95 this.callv(_GODOT_method_name, _GODOT_args); 96 } 97 /** 98 99 */ 100 Color getPickColor() const 101 { 102 checkClassBinding!(typeof(this))(); 103 return ptrcall!(Color)(GDNativeClassBinding.getPickColor, _godot_object); 104 } 105 /** 106 Returns the $(D ColorPicker) that this node toggles. 107 */ 108 ColorPicker getPicker() 109 { 110 checkClassBinding!(typeof(this))(); 111 return ptrcall!(ColorPicker)(GDNativeClassBinding.getPicker, _godot_object); 112 } 113 /** 114 Returns the control's $(D PopupPanel) which allows you to connect to popup signals. This allows you to handle events when the ColorPicker is shown or hidden. 115 */ 116 PopupPanel getPopup() 117 { 118 checkClassBinding!(typeof(this))(); 119 return ptrcall!(PopupPanel)(GDNativeClassBinding.getPopup, _godot_object); 120 } 121 /** 122 123 */ 124 bool isEditingAlpha() const 125 { 126 checkClassBinding!(typeof(this))(); 127 return ptrcall!(bool)(GDNativeClassBinding.isEditingAlpha, _godot_object); 128 } 129 /** 130 131 */ 132 void setEditAlpha(in bool show) 133 { 134 checkClassBinding!(typeof(this))(); 135 ptrcall!(void)(GDNativeClassBinding.setEditAlpha, _godot_object, show); 136 } 137 /** 138 139 */ 140 void setPickColor(in Color color) 141 { 142 checkClassBinding!(typeof(this))(); 143 ptrcall!(void)(GDNativeClassBinding.setPickColor, _godot_object, color); 144 } 145 /** 146 The currently selected color. 147 */ 148 @property Color color() 149 { 150 return getPickColor(); 151 } 152 /// ditto 153 @property void color(Color v) 154 { 155 setPickColor(v); 156 } 157 /** 158 If `true`, the alpha channel in the displayed $(D ColorPicker) will be visible. 159 */ 160 @property bool editAlpha() 161 { 162 return isEditingAlpha(); 163 } 164 /// ditto 165 @property void editAlpha(bool v) 166 { 167 setEditAlpha(v); 168 } 169 }