public AnchoredRectangle(Vector2 position, int width, int height, AnchorToArgs anchoring) { Width = width; Height = height; Position = position; if (anchoring != null) { AnchorTo(anchoring); } }
public Panel(string title, ControlStyle style, bool scrolls = false, bool moves = false) : base() { if (style == null) { throw new NotSupportedException("A style must be provided for this panel."); } if (moves) { EnableDragging = true; } Style = style; Width = Style.TextureDefault.Width; Height = Style.TextureDefault.Height; if (!string.IsNullOrEmpty(title)) { label = new Label(title, Style.FontStyle); label.AnchorTo(this, PositionType.Inside_Top_Center, 0, 6, AnchorType.Bounds); } render = new ControlRenderer(this); AnchorToArgs arg = new AnchorToArgs(this, PositionType.Inside_Top_Left, 0, 0, AnchorType.Bounds); ContentManager = new ContentManager(KVM.Graphics, new AnchoredRectangle(Rectangle.Empty, arg)); if (scrolls) { if (Style.ScrollerStyle == null) { throw new NotSupportedException("ControlStyle must contain ScrollerStyle to enable scrolling."); } Scrolls = true; scroller = new Scroller(this); _contentsRenderer = new RenderInScissor(KVM.Graphics); } }
public void AnchorTo(AnchorToArgs args) { AnchorTo(args.AnchorTo, args.PositionType, args.OffsetX, args.OffsetY, args.AnchorType); }
public AnchoredRectangle(Rectangle bounds, AnchorToArgs args) : this(new Vector2(bounds.X, bounds.Y), bounds.Width, bounds.Height, args) { }