protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.Color); for (int i = 0; i < Control.items.Count; i++) { Rect rect = new Rect(area.X, -Control.scrollbar.Value + area.Y + i * Control.Font.Size, area.W, Control.Font.Size); Rect tmp; if (renderer.SetSubRectDrawableArea(ref area, ref rect, out tmp)) { Color c = (i == Control.selectedIndex ? Control.SelectedColor : (i % 2 == 0 ? Control.Color : Control.StripeColor)); renderer.DrawRect(ref rect, c); renderer.DrawString(Control.Font, Control.items[i].ToString(), ref rect, Control.TextColor, TextAlignment.Left); } } if (Control.items.Count * Control.Font.Size > Control.size.Y) { Rect scrollRect = new Rect(area.X + Control.scrollbar.X, area.Y, Control.scrollbar.Width, area.H); if (renderer.SetSubRectDrawableArea(ref area, ref scrollRect, out scrollRect)) { Control.scrollbar.Draw(ref scrollRect, renderer); } } }
protected internal override void Draw(ref Rect area, IGUIRenderer batch) { batch.DrawRect(ref area, Control.BackgroundColor); Rect _contentRect = new Rect(area.X + Control.padding.X, area.Y + Control.padding.Y, area.W - Control.padding.X - Control.padding.W, area.H - Control.padding.H - Control.padding.Y); if (batch.SetSubRectDrawableArea(ref area, ref _contentRect, out _contentRect)) { batch.DrawMarkedString(Control.Font, Control.editText, ref _contentRect, Control.TextColor, Control.SelectedColor, TextAlignment.Left); } }
protected internal override sealed void Draw(ref Rect area, IGUIRenderer renderer) { this.DrawContent(ref area, renderer); if (this.vScrollbar.Visible) { Rect scrollArea = new Rect(area.X + this.vScrollbar.X, area.Y, this.vScrollbar.Width, this.vScrollbar.Height); if (renderer.SetSubRectDrawableArea(ref area, ref scrollArea, out scrollArea)) { this.vScrollbar.Draw(ref scrollArea, renderer); } } if (this.hScrollbar.Visible) { Rect scrollArea = new Rect(area.X, area.Y + this.hScrollbar.Y, this.hScrollbar.Width, this.hScrollbar.Height); if (renderer.SetSubRectDrawableArea(ref area, ref scrollArea, out scrollArea)) { this.hScrollbar.Draw(ref scrollArea, renderer); } } }
protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.BackgroundColor); Rect _contentRect = Control.ContentArea; _contentRect.Displace(area.TopLeft); if (renderer.SetSubRectDrawableArea(ref area, ref _contentRect, out _contentRect)) { Vector2 offset = new Vector2(Control.HScrollBar.Value, Control.VScrollBar.Value); renderer.DrawMarkedMultiLineString(Control.Font, Control.editText, ref _contentRect, ref offset, Control.TextColor, Control.SelectedColor); } }
protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.BackgroundColor); Rect _contentRect = new Rect(area.X + Control.padding.X, area.Y + Control.padding.Y, area.W - Control.padding.X - Control.padding.W, area.H - Control.padding.H); if (renderer.SetSubRectDrawableArea(ref area, ref _contentRect, out _contentRect)) { if (Control.editText.Length > 0) { Vector2 offset = new Vector2(Control.HScrollBar.Value, Control.VScrollBar.Value); renderer.DrawMultiLineString(Control.Font, Control.Text, ref _contentRect, Control.TextColor, ref offset); } } }
protected internal override void DrawContent(ref Rect drawableArea, IGUIRenderer renderer) { Vector2 _offset = drawableArea.TopLeft + this.Bounds.TopLeft - this.ScrollOffset; foreach (var control in this.controls) { if (!control.Visible) { continue; } Rect bounds = control.Bounds; bounds.Displace(_offset); if (renderer.SetSubRectDrawableArea(ref drawableArea, ref bounds, out bounds)) { control.Draw(ref bounds, renderer); } } }
protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.BackgroundColor); Rect _contentRect = new Rect(area.X + Control.padding.X, area.Y + Control.padding.Y, area.W - Control.padding.X - Control.padding.W, area.H - Control.padding.H); if (renderer.SetSubRectDrawableArea(ref area, ref _contentRect, out _contentRect)) { if (Control.editText.Length > 0) { renderer.DrawString(Control.Font, Control.Text, ref _contentRect, Control.TextColor, TextAlignment.Left); } else { renderer.DrawString(Control.Font, Control.Hint, ref _contentRect, Control.HintColor, TextAlignment.Left); } } }
protected internal override sealed void Draw(ref Rect area, IGUIRenderer renderer) { this.DrawContent(ref area, renderer); if (this.vScrollbar.Visible) { Rect scrollArea = new Rect(area.X + this.vScrollbar.X, area.Y, this.vScrollbar.Width, this.vScrollbar.Height); if(renderer.SetSubRectDrawableArea(ref area, ref scrollArea, out scrollArea)) this.vScrollbar.Draw(ref scrollArea, renderer); } if (this.hScrollbar.Visible) { Rect scrollArea = new Rect(area.X, area.Y + this.hScrollbar.Y, this.hScrollbar.Width, this.hScrollbar.Height); if (renderer.SetSubRectDrawableArea(ref area, ref scrollArea, out scrollArea)) this.hScrollbar.Draw(ref scrollArea, renderer); } }