コード例 #1
0
 public AnchoredRectangle(Vector2 position, int width, int height, AnchorToArgs anchoring)
 {
     Width    = width;
     Height   = height;
     Position = position;
     if (anchoring != null)
     {
         AnchorTo(anchoring);
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public void AnchorTo(AnchorToArgs args)
 {
     AnchorTo(args.AnchorTo, args.PositionType, args.OffsetX, args.OffsetY, args.AnchorType);
 }
コード例 #4
0
 public AnchoredRectangle(Rectangle bounds, AnchorToArgs args) : this(new Vector2(bounds.X, bounds.Y), bounds.Width, bounds.Height, args)
 {
 }