예제 #1
0
        public void ShowButtons()
        {
            windowPanel.RemoveAllChildren();
            for (var i = 0; i < _toolButtons.Count; i++)
            {
                var but = _toolButtons[i];
                but.Top.Set(-but.Height.Pixels / 2, 0.5f);
                but.Left.Set(TOOLBAR_ICON_PADDING_LEFT + i * TOOLBAR_ICON_MARGIN_LEFT, 0f);
                windowPanel.Append(but);
            }
            var estimatedWidth = TOOLBAR_ICON_PADDING_LEFT * 2 + _toolButtons.Count * TOOLBAR_ICON_MARGIN_LEFT;

            if (estimatedWidth < TOOLBAR_INIT_WIDTH)
            {
                estimatedWidth = TOOLBAR_INIT_WIDTH;
            }
            windowPanel.Left.Set(Main.screenWidth / 2 - estimatedWidth / 2, 0f);
            windowPanel.Width.Set(estimatedWidth, 0f);
        }