1 /**
2 Object that holds the project-independent editor settings.
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.editorsettings;
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.resource;
23 import godot.reference;
24 /**
25 Object that holds the project-independent editor settings.
26 
27 These settings are generally visible in the Editor Settings menu.
28 Accessing the settings is done by using the regular $(D GodotObject) API, such as:
29 
30 
31 settings.set(prop,value)
32 settings.get(prop)
33 list_of_settings = settings.get_property_list()
34 
35 
36 */
37 @GodotBaseClass struct EditorSettings
38 {
39 	enum string _GODOT_internal_name = "EditorSettings";
40 public:
41 @nogc nothrow:
42 	union { godot_object _godot_object; Resource _GODOT_base; }
43 	alias _GODOT_base this;
44 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
45 	package(godot) __gshared bool _classBindingInitialized = false;
46 	package(godot) static struct _classBinding
47 	{
48 		__gshared:
49 		@GodotName("has_setting") GodotMethod!(bool, String) hasSetting;
50 		@GodotName("set_setting") GodotMethod!(void, String, Variant) setSetting;
51 		@GodotName("get_setting") GodotMethod!(Variant, String) getSetting;
52 		@GodotName("erase") GodotMethod!(void, String) erase;
53 		@GodotName("set_initial_value") GodotMethod!(void, String, Variant, bool) setInitialValue;
54 		@GodotName("property_can_revert") GodotMethod!(bool, String) propertyCanRevert;
55 		@GodotName("property_get_revert") GodotMethod!(Variant, String) propertyGetRevert;
56 		@GodotName("add_property_info") GodotMethod!(void, Dictionary) addPropertyInfo;
57 		@GodotName("get_settings_dir") GodotMethod!(String) getSettingsDir;
58 		@GodotName("get_project_settings_dir") GodotMethod!(String) getProjectSettingsDir;
59 		@GodotName("set_project_metadata") GodotMethod!(void, String, String, Variant) setProjectMetadata;
60 		@GodotName("get_project_metadata") GodotMethod!(Variant, String, String, Variant) getProjectMetadata;
61 		@GodotName("set_favorites") GodotMethod!(void, PoolStringArray) setFavorites;
62 		@GodotName("get_favorites") GodotMethod!(PoolStringArray) getFavorites;
63 		@GodotName("set_recent_dirs") GodotMethod!(void, PoolStringArray) setRecentDirs;
64 		@GodotName("get_recent_dirs") GodotMethod!(PoolStringArray) getRecentDirs;
65 	}
66 	bool opEquals(in EditorSettings other) const { return _godot_object.ptr is other._godot_object.ptr; }
67 	EditorSettings opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
68 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
69 	mixin baseCasts;
70 	static EditorSettings _new()
71 	{
72 		static godot_class_constructor constructor;
73 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorSettings");
74 		if(constructor is null) return typeof(this).init;
75 		return cast(EditorSettings)(constructor());
76 	}
77 	@disable new(size_t s);
78 	/**
79 	
80 	*/
81 	bool hasSetting(StringArg0)(in StringArg0 name) const
82 	{
83 		checkClassBinding!(typeof(this))();
84 		return ptrcall!(bool)(_classBinding.hasSetting, _godot_object, name);
85 	}
86 	/**
87 	
88 	*/
89 	void setSetting(StringArg0, VariantArg1)(in StringArg0 name, in VariantArg1 value)
90 	{
91 		checkClassBinding!(typeof(this))();
92 		ptrcall!(void)(_classBinding.setSetting, _godot_object, name, value);
93 	}
94 	/**
95 	
96 	*/
97 	Variant getSetting(StringArg0)(in StringArg0 name) const
98 	{
99 		checkClassBinding!(typeof(this))();
100 		return ptrcall!(Variant)(_classBinding.getSetting, _godot_object, name);
101 	}
102 	/**
103 	Erase a given setting (pass full property path).
104 	*/
105 	void erase(StringArg0)(in StringArg0 property)
106 	{
107 		checkClassBinding!(typeof(this))();
108 		ptrcall!(void)(_classBinding.erase, _godot_object, property);
109 	}
110 	/**
111 	
112 	*/
113 	void setInitialValue(StringArg0, VariantArg1)(in StringArg0 name, in VariantArg1 value, in bool update_current)
114 	{
115 		checkClassBinding!(typeof(this))();
116 		ptrcall!(void)(_classBinding.setInitialValue, _godot_object, name, value, update_current);
117 	}
118 	/**
119 	
120 	*/
121 	bool propertyCanRevert(StringArg0)(in StringArg0 name)
122 	{
123 		checkClassBinding!(typeof(this))();
124 		return ptrcall!(bool)(_classBinding.propertyCanRevert, _godot_object, name);
125 	}
126 	/**
127 	
128 	*/
129 	Variant propertyGetRevert(StringArg0)(in StringArg0 name)
130 	{
131 		checkClassBinding!(typeof(this))();
132 		return ptrcall!(Variant)(_classBinding.propertyGetRevert, _godot_object, name);
133 	}
134 	/**
135 	Add a custom property info to a property. The dictionary must contain: name:$(D String)(the name of the property) and type:$(D long)(see TYPE_* in $(D @GlobalScope)), and optionally hint:$(D long)(see PROPERTY_HINT_* in $(D @GlobalScope)), hint_string:$(D String).
136 	Example:
137 	
138 	
139 	editor_settings.set("category/property_name", 0)
140 	
141 	var property_info = {
142 	    "name": "category/property_name",
143 	    "type": TYPE_INT,
144 	    "hint": PROPERTY_HINT_ENUM,
145 	    "hint_string": "one,two,three"
146 	}
147 	
148 	editor_settings.add_property_info(property_info)
149 	
150 	
151 	*/
152 	void addPropertyInfo(in Dictionary info)
153 	{
154 		checkClassBinding!(typeof(this))();
155 		ptrcall!(void)(_classBinding.addPropertyInfo, _godot_object, info);
156 	}
157 	/**
158 	Get the global settings path for the engine. Inside this path you can find some standard paths such as:
159 	settings/tmp - used for temporary storage of files
160 	settings/templates - where export templates are located
161 	*/
162 	String getSettingsDir() const
163 	{
164 		checkClassBinding!(typeof(this))();
165 		return ptrcall!(String)(_classBinding.getSettingsDir, _godot_object);
166 	}
167 	/**
168 	Get the specific project settings path. Projects all have a unique sub-directory inside the settings path where project specific settings are saved.
169 	*/
170 	String getProjectSettingsDir() const
171 	{
172 		checkClassBinding!(typeof(this))();
173 		return ptrcall!(String)(_classBinding.getProjectSettingsDir, _godot_object);
174 	}
175 	/**
176 	
177 	*/
178 	void setProjectMetadata(StringArg0, StringArg1, VariantArg2)(in StringArg0 section, in StringArg1 key, in VariantArg2 data)
179 	{
180 		checkClassBinding!(typeof(this))();
181 		ptrcall!(void)(_classBinding.setProjectMetadata, _godot_object, section, key, data);
182 	}
183 	/**
184 	
185 	*/
186 	Variant getProjectMetadata(StringArg0, StringArg1, VariantArg2)(in StringArg0 section, in StringArg1 key, in VariantArg2 _default = Variant.nil) const
187 	{
188 		checkClassBinding!(typeof(this))();
189 		return ptrcall!(Variant)(_classBinding.getProjectMetadata, _godot_object, section, key, _default);
190 	}
191 	/**
192 	Set the list of favorite files and directories for this project.
193 	*/
194 	void setFavorites(in PoolStringArray dirs)
195 	{
196 		checkClassBinding!(typeof(this))();
197 		ptrcall!(void)(_classBinding.setFavorites, _godot_object, dirs);
198 	}
199 	/**
200 	Get the list of favorite files and directories for this project.
201 	*/
202 	PoolStringArray getFavorites() const
203 	{
204 		checkClassBinding!(typeof(this))();
205 		return ptrcall!(PoolStringArray)(_classBinding.getFavorites, _godot_object);
206 	}
207 	/**
208 	Set the list of recently visited folders in the file dialog for this project.
209 	*/
210 	void setRecentDirs(in PoolStringArray dirs)
211 	{
212 		checkClassBinding!(typeof(this))();
213 		ptrcall!(void)(_classBinding.setRecentDirs, _godot_object, dirs);
214 	}
215 	/**
216 	Get the list of recently visited folders in the file dialog for this project.
217 	*/
218 	PoolStringArray getRecentDirs() const
219 	{
220 		checkClassBinding!(typeof(this))();
221 		return ptrcall!(PoolStringArray)(_classBinding.getRecentDirs, _godot_object);
222 	}
223 }