Habanero.Faces.Win.ButtonSizePolicyWin.RecalcButtonSizes C# (CSharp) Method

RecalcButtonSizes() public method

Recalculates the button sizes of the given collection of buttons.
public RecalcButtonSizes ( IControlCollection buttonCollection ) : void
buttonCollection IControlCollection
return void
        public void RecalcButtonSizes(IControlCollection buttonCollection)
        {
            int maxButtonWidth = 0;
            foreach (IButton btn in buttonCollection)
            {
                ILabel lbl = _controlFactory.CreateLabel(btn.Text);
                if (lbl.PreferredWidth + 15 > maxButtonWidth)
                {
                    maxButtonWidth = lbl.PreferredWidth + 15;
                }
            }
            if (maxButtonWidth < Screen.PrimaryScreen.Bounds.Width / 24)
            {
                maxButtonWidth = Screen.PrimaryScreen.Bounds.Width / 24;
            }
            foreach (IButton btn in buttonCollection)
            {
                btn.Width = maxButtonWidth;
            }
        }
    }