Repository: godotengine/godot
File: editor/docks/editor_dock.cpp (C++)

Code before:
	ClassDB::bind_method(D_METHOD("set_dock_shortcut", "shortcut"), &EditorDock::set_dock_shortcut);
	ClassDB::bind_method(D_METHOD("get_dock_shortcut"), &EditorDock::get_dock_shortcut);
	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "dock_shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_dock_shortcut", "get_dock_shortcut");

	ClassDB::bind_method(D_METHOD("set_default_slot", "slot"), &EditorDock::_set_default_slot_bind);
	ClassDB::bind_method(D_METHOD("get_default_slot"), &EditorDock::_get_default_slot_bind);
	ADD_PROPERTY(PropertyInfo(Variant::INT, "default_slot", PROPERTY_HINT_ENUM, "None:-1,Left Side Upper-Left,Left Side Bottom-Left,Left Side Upper-Right,Left Side Bottom-Right,Right Side Upper-Left,Right Side Bottom-Left,Right Side Upper-Right,Right Side Bottom-Right,Bottom"), "set_default_slot", "get_default_slot");

	ClassDB::bind_method(D_METHOD("set_available_layouts", "layouts"), &EditorDock::set_available_layouts);
	ClassDB::bind_method(D_METHOD("get_available_layouts"), &EditorDock::get_available_layouts);
	ADD_PROPERTY(PropertyInfo(Variant::INT, "available_layouts", PROPERTY_HINT_FLAGS, "Vertical:1,Horizontal:2,Floating:3"), "set_available_layouts", "get_available_layouts");

	ADD_SIGNAL(MethodInfo("closed"));

	BIND_BITFIELD_FLAG(DOCK_LAYOUT_VERTICAL);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_HORIZONTAL);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_FLOATING);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_ALL);

	GDVIRTUAL_BIND(_update_layout, "layout");
	GDVIRTUAL_BIND(_save_layout_to_config, "config", "section");
	GDVIRTUAL_BIND(_load_layout_from_config, "config", "section");
}

EditorDock::EditorDock() {
	add_user_signal(MethodInfo("tab_style_changed"));
}

void EditorDock::open() {
	if (!is_open) {
		EditorDockManager::get_singleton()->open_dock(this);
	}
}

void EditorDock::make_visible() {
	EditorDockManager::get_singleton()->focus_dock(this);
}

void EditorDock::close() {
	if (is_open) {
		EditorDockManager::get_singleton()->close_dock(this);
	}
}

void EditorDock::set_title(const String &p_title) {
	if (title == p_title) {
		return;
	}
	title = p_title;
	emit_signal("tab_style_changed");
}

Review comment (bug):
Originally suggested in https://github.com/godotengine/godot/pull/106503#issuecomment-2891907897, but wasn't really discussed.

Note that various docks were disabling it, so these lines need to be removed if we go with this change:
https://github.com/godotengine/godot/blob/dec5a373d97cbadce5e1fabe6095ae9957ff3aa6/editor/debugger/editor_debugger_node.cpp#L73
https://github.com/godotengine/godot/blob/dec5a373d97cbadce5e1fabe6095ae9957ff3aa6/editor/script/find_in_files.cpp#L1304
https://github.com/godotengine/godot/blob/dec5a373d97cbadce5e1fabe6095ae9957ff3aa6/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs#L211


Code after:
	ClassDB::bind_method(D_METHOD("set_dock_shortcut", "shortcut"), &EditorDock::set_dock_shortcut);
	ClassDB::bind_method(D_METHOD("get_dock_shortcut"), &EditorDock::get_dock_shortcut);
	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "dock_shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_dock_shortcut", "get_dock_shortcut");

	ClassDB::bind_method(D_METHOD("set_default_slot", "slot"), &EditorDock::_set_default_slot_bind);
	ClassDB::bind_method(D_METHOD("get_default_slot"), &EditorDock::_get_default_slot_bind);
	ADD_PROPERTY(PropertyInfo(Variant::INT, "default_slot", PROPERTY_HINT_ENUM, "None:-1,Left Side Upper-Left,Left Side Bottom-Left,Left Side Upper-Right,Left Side Bottom-Right,Right Side Upper-Left,Right Side Bottom-Left,Right Side Upper-Right,Right Side Bottom-Right,Bottom"), "set_default_slot", "get_default_slot");

	ClassDB::bind_method(D_METHOD("set_available_layouts", "layouts"), &EditorDock::set_available_layouts);
	ClassDB::bind_method(D_METHOD("get_available_layouts"), &EditorDock::get_available_layouts);
	ADD_PROPERTY(PropertyInfo(Variant::INT, "available_layouts", PROPERTY_HINT_FLAGS, "Vertical:1,Horizontal:2,Floating:3"), "set_available_layouts", "get_available_layouts");

	ADD_SIGNAL(MethodInfo("closed"));

	BIND_BITFIELD_FLAG(DOCK_LAYOUT_VERTICAL);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_HORIZONTAL);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_FLOATING);
	BIND_BITFIELD_FLAG(DOCK_LAYOUT_ALL);

	GDVIRTUAL_BIND(_update_layout, "layout");
	GDVIRTUAL_BIND(_save_layout_to_config, "config", "section");
	GDVIRTUAL_BIND(_load_layout_from_config, "config", "section");
}

EditorDock::EditorDock() {
	add_user_signal(MethodInfo("tab_style_changed"));
}

void EditorDock::open() {
	if (!is_open) {
		EditorDockManager::get_singleton()->open_dock(this, false);
	}
}

void EditorDock::make_visible() {
	EditorDockManager::get_singleton()->focus_dock(this);
}

void EditorDock::close() {
	if (is_open) {
		EditorDockManager::get_singleton()->close_dock(this);
	}
}

void EditorDock::set_title(const String &p_title) {
	if (title == p_title) {
		return;
	}
	title = p_title;
	emit_signal("tab_style_changed");
}