Exemple #1
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     Visual.Render (context, availableSize);
 }
Exemple #2
0
 /// <summary>
 /// Subtract another box from this one horizontally.
 /// </summary>
 public VBox HSub(VBox other)
 {
     return new VBox (Width - other.Width, Height);
 }
Exemple #3
0
            /// <summary>
            /// Draw the stack into the specified context.
            /// </summary>
            protected override void Draw(GraphicsContext context, VBox availableSize)
            {
                var stack = GetSize (context);

                Items.Foreach (visual =>
                {
                    if (availableSize.IsEmpty)
                        return;

                    var inner = visual.GetSize (context);
                    var outer = Direction == VisualDirection.Horizontal ?
                        new VBox (inner.Width, stack.Height) :
                        new VBox (stack.Width, inner.Height);
                    var st = context.Graphics.Save ();
                    context.Graphics.TranslateTransform (DeltaX (outer.Width, inner.Width),
                        DeltaY (outer.Height, inner.Height));
                    visual.Render (context, outer);
                    context.Graphics.Restore (st);

                    if (Direction == VisualDirection.Horizontal)
                    {
                        context.Graphics.TranslateTransform (outer.Width, 0);
                        availableSize = availableSize.HSub (outer);
                    }
                    else
                    {
                        context.Graphics.TranslateTransform (0, outer.Height);
                        availableSize = availableSize.VSub (outer);
                    }
                });
            }
Exemple #4
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     throw new NotImplementedException ();
 }
Exemple #5
0
 /// <summary>
 /// Returns the horizontal intersection with another box. This means that the
 /// width of the result is the minimum of the box widths.
 /// </summary>
 public VBox HMin(VBox other)
 {
     return new VBox (Math.Min (Width, other.Width), Height);
 }
Exemple #6
0
 /// <summary>
 /// Draw the visual into specified context using the available size.
 /// </summary>
 /// <param name="context">The graphics context which used in drawing.</param>
 /// <param name='availableSize'>The available size into which the visual should
 /// fit.</param>
 protected abstract void Draw(GraphicsContext context, VBox availableSize);
Exemple #7
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
 }
Exemple #8
0
 /// <summary>
 /// Subtract another box from this one vertically.
 /// </summary>
 public VBox VSub(VBox other)
 {
     return new VBox (Width, Height - other.Height);
 }
Exemple #9
0
            protected override void Draw(GraphicsContext context, VBox availableSize)
            {
                var box = GetSize (context);

                if (context.FocusedExpr == SExpr)
                {
                    context.Graphics.FillRectangle (Brushes.RoyalBlue, 0, 0, box.Width, box.Height);
                    context = new GraphicsContext (context,
                        new VisualStyle (context.Style, brush: Brushes.White));
                }
                var hitRect = new HitRect (box.AsRectF (context.Graphics.Transform), SExpr);
                GraphicsContext.HitRects = hitRect | GraphicsContext.HitRects;
                SExpr.Depiction.Draw (context, availableSize);
            }
Exemple #10
0
            protected override void Draw(GraphicsContext context, VBox availableSize)
            {
                var box = Visual.GetSize (context);
                base.Draw (context, availableSize);

                switch (Kind)
                {
                    case FrameKind.Rectangle:
                        context.Graphics.DrawRectangle (context.Style.Pen,
                            0, 0, box.Width - 1, box.Height - 1);
                        break;
                    case FrameKind.Ellipse:
                        context.Graphics.DrawEllipse (context.Style.Pen,
                            0, 0, box.Width - 1, box.Height - 1);
                        break;
                    case FrameKind.RoundRectangle:
                        DrawRoundedRectangle(context.Graphics, context.Style.Pen,
                            new RectangleF(0, 0, box.Width - 1, box.Height - 1), 10);
                        break;
                }
            }
Exemple #11
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     base.Draw (context, availableSize);
     var state = context.Graphics.Save ();
     context.Graphics.ResetTransform ();
     context.Graphics.DrawLine (context.Style.Pen, Position, Target.Position);
     context.Graphics.Restore (state);
 }
Exemple #12
0
 private PointF GetAnchorPosition(Matrix matrix, VBox box)
 {
     var anchor = new PointF[1];
     switch (HorizAlign)
     {
         case HAlign.Left:
             anchor[0].X = 0;
             break;
         case HAlign.Center:
             anchor[0].X = box.Width / 2;
             break;
         case HAlign.Right:
             anchor[0].X = box.Width;
             break;
     }
     switch (VertAlign)
     {
         case VAlign.Top:
             anchor[0].Y = 0;
             break;
         case VAlign.Center:
             anchor[0].Y = box.Height / 2;
             break;
         case VAlign.Bottom:
             anchor[0].Y = box.Height;
             break;
     }
     matrix.TransformPoints (anchor);
     return anchor[0];
 }
Exemple #13
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     Position = GetAnchorPosition (context.Graphics.Transform, Visual.GetSize (context));
     base.Draw (context, availableSize);
 }
Exemple #14
0
 /// <summary>
 /// Add another box to vertically to this one.
 /// </summary>
 public VBox VAdd(VBox other)
 {
     return new VBox (Width, Height + other.Height);
 }
Exemple #15
0
 /// <summary>
 /// Draw the label into the specified context.
 /// </summary>
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     context.Graphics.DrawString (Text, context.Style.Font, context.Style.TextBrush,
         new PointF (0, 0));
 }
Exemple #16
0
 /// <summary>
 /// Returns the vertical intersection with another box. This means that the
 /// height of the result is the minimum of the box heights.
 /// </summary>
 public VBox VMin(VBox other)
 {
     return new VBox (Width, Math.Min (Height, other.Height));
 }
Exemple #17
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     var st = context.Graphics.Save ();
     context.Graphics.TranslateTransform (Left, Top);
     base.Draw (context, availableSize);
     context.Graphics.Restore (st);
 }
Exemple #18
0
 /// <summary>
 /// Add another box to horizontally to this one.
 /// </summary>
 public VBox HAdd(VBox other)
 {
     return new VBox (Width + other.Width, Height);
 }
Exemple #19
0
 protected override void Draw(GraphicsContext context, VBox availableSize)
 {
     if (Direction == VisualDirection.Horizontal)
     {
         var y = availableSize.Height / 2;
         context.Graphics.DrawLine (context.Style.Pen, 0, y, availableSize.Width, y);
     }
     else
     {
         var x = availableSize.Width / 2;
         context.Graphics.DrawLine (context.Style.Pen, x, 0, x, availableSize.Height);
     }
 }
Exemple #20
0
 private void CalculateNewSize()
 {
     if (_visual != null)
     {
         _size = _visual.GetSize (new GraphicsContext (Graphics.FromHwnd (Handle)));
         Width = Convert.ToInt32 (_size.Width);
         Height = Convert.ToInt32 (_size.Height);
     }
     Invalidate ();
 }
Exemple #21
0
 public void Render(GraphicsContext context, VBox availableSize)
 {
     Draw (context, availableSize);
 }