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.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.button;
24 import godot.colorpicker;
25 import godot.popuppanel;
26 import godot.basebutton;
27 import godot.control;
28 import godot.canvasitem;
29 import godot.node;
30 /**
31 Button that pops out a $(D ColorPicker).
32 
33 Encapsulates a $(D ColorPicker) making it accessible by pressing a button. Pressing the button will toggle the $(D ColorPicker) visibility.
34 */
35 @GodotBaseClass struct ColorPickerButton
36 {
37 	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 _classBinding
45 	{
46 		__gshared:
47 		@GodotName("set_pick_color") GodotMethod!(void, Color) setPickColor;
48 		@GodotName("get_pick_color") GodotMethod!(Color) getPickColor;
49 		@GodotName("get_picker") GodotMethod!(ColorPicker) getPicker;
50 		@GodotName("get_popup") GodotMethod!(PopupPanel) getPopup;
51 		@GodotName("set_edit_alpha") GodotMethod!(void, bool) setEditAlpha;
52 		@GodotName("is_editing_alpha") GodotMethod!(bool) isEditingAlpha;
53 		@GodotName("_color_changed") GodotMethod!(void, Color) _colorChanged;
54 		@GodotName("_modal_closed") GodotMethod!(void) _modalClosed;
55 	}
56 	bool opEquals(in ColorPickerButton other) const { return _godot_object.ptr is other._godot_object.ptr; }
57 	ColorPickerButton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
58 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
59 	mixin baseCasts;
60 	static ColorPickerButton _new()
61 	{
62 		static godot_class_constructor constructor;
63 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ColorPickerButton");
64 		if(constructor is null) return typeof(this).init;
65 		return cast(ColorPickerButton)(constructor());
66 	}
67 	@disable new(size_t s);
68 	/**
69 	
70 	*/
71 	void setPickColor(in Color color)
72 	{
73 		checkClassBinding!(typeof(this))();
74 		ptrcall!(void)(_classBinding.setPickColor, _godot_object, color);
75 	}
76 	/**
77 	
78 	*/
79 	Color getPickColor() const
80 	{
81 		checkClassBinding!(typeof(this))();
82 		return ptrcall!(Color)(_classBinding.getPickColor, _godot_object);
83 	}
84 	/**
85 	Returns the $(D ColorPicker) that this node toggles.
86 	*/
87 	ColorPicker getPicker()
88 	{
89 		checkClassBinding!(typeof(this))();
90 		return ptrcall!(ColorPicker)(_classBinding.getPicker, _godot_object);
91 	}
92 	/**
93 	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.
94 	*/
95 	PopupPanel getPopup()
96 	{
97 		checkClassBinding!(typeof(this))();
98 		return ptrcall!(PopupPanel)(_classBinding.getPopup, _godot_object);
99 	}
100 	/**
101 	
102 	*/
103 	void setEditAlpha(in bool show)
104 	{
105 		checkClassBinding!(typeof(this))();
106 		ptrcall!(void)(_classBinding.setEditAlpha, _godot_object, show);
107 	}
108 	/**
109 	
110 	*/
111 	bool isEditingAlpha() const
112 	{
113 		checkClassBinding!(typeof(this))();
114 		return ptrcall!(bool)(_classBinding.isEditingAlpha, _godot_object);
115 	}
116 	/**
117 	
118 	*/
119 	void _colorChanged(in Color arg0)
120 	{
121 		Array _GODOT_args = Array.empty_array;
122 		_GODOT_args.append(arg0);
123 		String _GODOT_method_name = String("_color_changed");
124 		this.callv(_GODOT_method_name, _GODOT_args);
125 	}
126 	/**
127 	
128 	*/
129 	void _modalClosed()
130 	{
131 		Array _GODOT_args = Array.empty_array;
132 		String _GODOT_method_name = String("_modal_closed");
133 		this.callv(_GODOT_method_name, _GODOT_args);
134 	}
135 	/**
136 	The currently selected color.
137 	*/
138 	@property Color color()
139 	{
140 		return getPickColor();
141 	}
142 	/// ditto
143 	@property void color(Color v)
144 	{
145 		setPickColor(v);
146 	}
147 	/**
148 	If `true` the alpha channel in the displayed $(D ColorPicker) will be visible. Default value: `true`.
149 	*/
150 	@property bool editAlpha()
151 	{
152 		return isEditingAlpha();
153 	}
154 	/// ditto
155 	@property void editAlpha(bool v)
156 	{
157 		setEditAlpha(v);
158 	}
159 }