Bless.Gui.Areas.Plugins.GroupedArea.CalcWidth C# (CSharp) Method

CalcWidth() public method

public CalcWidth ( int n, bool force ) : int
n int
force bool
return int
	public override int CalcWidth(int n, bool force)
	{
		if (n == 0)
			return 0;
		if (fixedBpr > 0 && n > fixedBpr && !force) // must adhere to fixed length
			return -1;
		if (n % grouping != 0 && !force) // can't break the grouping
			return -1;

		int ngroups = n / grouping;
		int groupWidth = grouping * dpb * drawer.Width;

		return ngroups*groupWidth + (ngroups - 1)*drawer.Width;
	}