Editor/Tool/ArchWallForms.cs

An interface and static accessor for UI property forms related to architectural walls and wall modifiers in the editor. It declares methods for drawing wall controls and modifier controls, and provides a static helper that resolves an implementation via ArchRoles and forwards calls to it.

using System;

namespace Sunless.Architecture;

// The property forms for a wall and for a wall modifier, owned by the module that generates them. Core asks because
// the building designer edits a shell's default treatment and the bool tool details a wall it is about to carve -
// neither of which is a reason for either to hold a wall's own controls.
public interface IArchWallForms
{
	void Wall( ToolSidebarWidget panel, ArchKit kit, IArchWallTreatment wall, Action refresh, Action changed, bool sizes, bool openings );

	void ModKinds( ToolSidebarWidget panel, ArchWallMod chosen, Action<ArchWallMod> adopt );

	void ModSides( ToolSidebarWidget panel, ArchWallSide chosen, bool drafting, Action<ArchWallSide> adopt );

	void ModSizes( ToolSidebarWidget panel, ArchWallModPart modifier, Action changed, bool station );

	void ModFill( ToolSidebarWidget panel, ArchWallModPart modifier, Action changed );
}

public static class ArchWallForms
{
	static IArchWallForms Load() => ArchRoles.One<IArchWallForms>();

	public static void Wall( ToolSidebarWidget panel, ArchKit kit, IArchWallTreatment wall, Action refresh, Action changed, bool sizes = true, bool openings = true )
		=> Load()?.Wall( panel, kit, wall, refresh, changed, sizes, openings );

	public static void ModKinds( ToolSidebarWidget panel, ArchWallMod chosen, Action<ArchWallMod> adopt )
		=> Load()?.ModKinds( panel, chosen, adopt );

	public static void ModSides( ToolSidebarWidget panel, ArchWallSide chosen, bool drafting, Action<ArchWallSide> adopt )
		=> Load()?.ModSides( panel, chosen, drafting, adopt );

	public static void ModSizes( ToolSidebarWidget panel, ArchWallModPart modifier, Action changed, bool station = true )
		=> Load()?.ModSizes( panel, modifier, changed, station );

	public static void ModFill( ToolSidebarWidget panel, ArchWallModPart modifier, Action changed )
		=> Load()?.ModFill( panel, modifier, changed );
}