public override void Draw() { var rb = RenderBounds; leftButtonRect = new Rectangle(rb.X, rb.Y, ArrowWidth, rb.Height); rightButtonRect = new Rectangle(rb.Right - ArrowWidth, rb.Y, ArrowWidth, rb.Height); var leftDisabled = ListOffset >= 0; var leftHover = Ui.MouseOverWidget == this && leftButtonRect.Contains(Viewport.LastMousePos); var rightDisabled = ListOffset <= Bounds.Width - rightButtonRect.Width - leftButtonRect.Width - ContentWidth; var rightHover = Ui.MouseOverWidget == this && rightButtonRect.Contains(Viewport.LastMousePos); WidgetUtils.DrawPanel("panel-black", rb); ButtonWidget.DrawBackground("button", leftButtonRect, leftDisabled, leftPressed, leftHover, false); ButtonWidget.DrawBackground("button", rightButtonRect, rightDisabled, rightPressed, rightHover, false); WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", leftPressed || leftDisabled ? "left_pressed" : "left_arrow"), new float2(leftButtonRect.Left + 2, leftButtonRect.Top + 2)); WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", rightPressed || rightDisabled ? "right_pressed" : "right_arrow"), new float2(rightButtonRect.Left + 2, rightButtonRect.Top + 2)); // Draw tab buttons Game.Renderer.EnableScissor(leftButtonRect.Right, rb.Y + 1, rightButtonRect.Left - leftButtonRect.Right - 1, rb.Height); var origin = new int2(leftButtonRect.Right - 1 + (int)ListOffset, leftButtonRect.Y); SpriteFont font = Game.Renderer.Fonts["TinyBold"]; ContentWidth = 0; foreach (var tab in Groups[queueGroup].Tabs) { var rect = new Rectangle(origin.X + ContentWidth, origin.Y, TabWidth, rb.Height); var hover = !leftHover && !rightHover && Ui.MouseOverWidget == this && rect.Contains(Viewport.LastMousePos); var baseName = tab.Queue == CurrentQueue ? "button-toggled" : "button"; ButtonWidget.DrawBackground(baseName, rect, false, false, hover, false); ContentWidth += TabWidth - 1; int2 textSize = font.Measure(tab.Name); int2 position = new int2(rect.X + (rect.Width - textSize.X) / 2, rect.Y + (rect.Height - textSize.Y) / 2); font.DrawTextWithContrast(tab.Name, position, tab.Queue.CurrentDone ? Color.Gold : Color.White, Color.Black, 1); } Game.Renderer.DisableScissor(); }
public override void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover) { var baseName = IsToggled() ? "button-toggled" : "button"; ButtonWidget.DrawBackground(baseName, rect, disabled, pressed, hover); }