Пример #1
0
        private ButtonWidget AddTabButton(GUIHost host, LibraryViewTab tabFrame, LibraryView.TabButtonStyle style, string text, int ID)
        {
            var buttonWidget = new ButtonWidget(ID, null)
            {
                Text          = text,
                TextColor     = new Color4(0.71f, 0.71f, 0.71f, 1f),
                TextOverColor = new Color4(1f, 1f, 1f, 1f),
                TextDownColor = new Color4(1f, 1f, 1f, 1f),
                Size          = FontSize.Medium
            };

            buttonWidget.SetCallback(new ButtonCallback(TabButtonCallback));
            buttonWidget.DontMove  = true;
            buttonWidget.ClickType = ButtonType.Checkable;
            buttonWidget.GroupID   = 1;
            buttonWidget.Data      = tabFrame;
            switch (style)
            {
            case LibraryView.TabButtonStyle.Left:
                buttonWidget.Init(host, "guicontrols", 513f, 64f, 575f, sbyte.MaxValue, 513f, 128f, 575f, 191f, 513f, 192f, 575f, byte.MaxValue, 513f, 64f, 575f, sbyte.MaxValue);
                break;

            case LibraryView.TabButtonStyle.Middle:
                buttonWidget.Init(host, "guicontrols", 576f, 64f, 639f, sbyte.MaxValue, 576f, 128f, 639f, 191f, 576f, 192f, 639f, byte.MaxValue, 576f, 64f, 639f, sbyte.MaxValue);
                break;

            case LibraryView.TabButtonStyle.Right:
                buttonWidget.Init(host, "guicontrols", 640f, 64f, 703f, sbyte.MaxValue, 640f, 128f, 703f, 191f, 640f, 192f, 703f, byte.MaxValue, 640f, 64f, 703f, sbyte.MaxValue);
                break;
            }
            buttonWidget.SetGrowableWidth(16, 16, 48);
            tabsFrame.AddChildElement(buttonWidget);
            return(buttonWidget);
        }
Пример #2
0
        public void TabButtonCallback(ButtonWidget button)
        {
            if (!(button.Data is LibraryViewTab))
            {
                return;
            }

            currentTab = (LibraryViewTab)button.Data;
            ScheduleRefresh();
        }