Esempio n. 1
0
        public void Start(Point mousePoint, OnElementResizingDelegate onElementResizingDelegate)
        {
            isResizing = false;

            if (resizeCtrl == null)
            {
                return;
            }

            this.onElementResizingDelegate = onElementResizingDelegate;

            resizeCtrl.OwnerElement.Invalidate();

            CornerPosition corPos = resizeCtrl.HitTestCorner(mousePoint);

            if (corPos != CornerPosition.Nothing)
            {
                //Events
                ElementEventArgs eventResizeArg = new ElementEventArgs(resizeCtrl.OwnerElement);
                onElementResizingDelegate(eventResizeArg);

                resizeCtrl.Start(mousePoint, corPos);

                UpdateResizeCorner();

                isResizing = true;
            }
        }
Esempio n. 2
0
 override public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(Context,(ushort)xCenter);
     BasicTypeSerializer.Put(Context,(ushort)yCenter);
     BasicTypeSerializer.Put(Context,(ushort)radius);
     BasicTypeSerializer.Put(Context,(ushort)position);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Esempio n. 3
0
 override public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(Context, (ushort)xCenter);
     BasicTypeSerializer.Put(Context, (ushort)yCenter);
     BasicTypeSerializer.Put(Context, (ushort)radius);
     BasicTypeSerializer.Put(Context, (ushort)position);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
Esempio n. 4
0
 public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, ushort color) {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(SendContext,(ushort)xCenter);
     BasicTypeSerializer.Put(SendContext,(ushort)yCenter);
     BasicTypeSerializer.Put(SendContext,(ushort)radius);
     BasicTypeSerializer.Put(SendContext,(ushort)position);
     BasicTypeSerializer.Put(SendContext,(ushort)color);
     SendContext.CheckHighWatermark();
 }
Esempio n. 5
0
        public CornerPiece(CornerPosition position, Color color1, Color color2, Color color3)
        {
            switch (position)
            {
            case CornerPosition.UFR:
                this.u_color = color1;
                this.f_color = color2;
                this.r_color = color3;
                break;

            case CornerPosition.UFL:
                this.u_color = color1;
                this.f_color = color2;
                this.l_color = color3;
                break;

            case CornerPosition.UBR:
                this.u_color = color1;
                this.b_color = color2;
                this.r_color = color3;
                break;

            case CornerPosition.UBL:
                this.u_color = color1;
                this.b_color = color2;
                this.l_color = color3;
                break;

            case CornerPosition.DFR:
                this.d_color = color1;
                this.f_color = color2;
                this.r_color = color3;
                break;

            case CornerPosition.DFL:
                this.d_color = color1;
                this.f_color = color2;
                this.l_color = color3;
                break;

            case CornerPosition.DBR:
                this.d_color = color1;
                this.b_color = color2;
                this.r_color = color3;
                break;

            case CornerPosition.DBL:
                this.d_color = color1;
                this.b_color = color2;
                this.l_color = color3;
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
 void IResizeController.End(Point posEnd)
 {
     if ((El.Size.Height < 0) || (El.Size.Width < 0))
     {
         var urec = El.GetUnsignedRectangle();
         El.Location = urec.Location;
         El.Size     = urec.Size;
     }
     SelCorner  = CornerPosition.Nothing;
     DragOffset = Point.Empty;
 }
Esempio n. 7
0
 void IResizeController.End(Point endPoint)
 {
     if ((Element.Size.Height < 0) || (Element.Size.Width < 0))
     {
         var rectangle = Element.GetUnsignedRectangle();
         Element.Location = rectangle.Location;
         Element.Size     = rectangle.Size;
     }
     SelCorner  = CornerPosition.Nothing;
     DragOffset = Point.Empty;
 }
Esempio n. 8
0
 void IResizeController.End(Point posEnd)
 {
     if ((el.Size.Height < 0) || (el.Size.Width < 0))
     {
         Rectangle urec = el.GetUnsignedRectangle();
         el.Location = urec.Location;
         el.Size     = urec.Size;
     }
     selCorner  = CornerPosition.Nothing;
     dragOffset = Point.Empty;
 }
Esempio n. 9
0
        public Cursor UpdateResizeCornerCursor(Point mousePoint)
        {
            if (resizeCtrl == null || !resizeCtrl.CanResize)
            {
                return(Cursors.Default);
            }

            CornerPosition corPos = resizeCtrl.HitTestCorner(mousePoint);

            switch (corPos)
            {
            case CornerPosition.TopLeft:
                return(Cursors.SizeNWSE);

            case CornerPosition.TopCenter:
                return(Cursors.SizeNS);

            case CornerPosition.TopRight:
                return(Cursors.SizeNESW);

            case CornerPosition.MiddleLeft:
            case CornerPosition.MiddleRight:
                return(Cursors.SizeWE);

            case CornerPosition.BottomLeft:
                return(Cursors.SizeNESW);

            case CornerPosition.BottomCenter:
                return(Cursors.SizeNS);

            case CornerPosition.BottomRight:
                return(Cursors.SizeNWSE);

            default:
                return(Cursors.Default);
            }
        }
		void IResizeController.End(Point posEnd)
		{
			if ((el.Size.Height < 0) || (el.Size.Width < 0))
			{
				Rectangle urec = el.GetUnsignedRectangle();
				el.Location = urec.Location;
				el.Size = urec.Size;
			}
			selCorner = CornerPosition.Nothing;
			dragOffset = Point.Empty;
		}
Esempio n. 11
0
 void IResizeController.Start(Point startPoint, CornerPosition cornerPosition)
 {
     SelCorner    = cornerPosition;
     DragOffset.X = SelectionCorner[(int)SelCorner].Location.X - startPoint.X;
     DragOffset.Y = SelectionCorner[(int)SelCorner].Location.Y - startPoint.Y;
 }
 void IResizeController.End(Point posEnd)
 {
     selCorner  = CornerPosition.Nothing;
     dragOffset = Point.Empty;
 }
 void IResizeController.Start(Point posStart, CornerPosition corner)
 {
     selCorner    = corner;
     dragOffset.X = selectionCorner[0].Location.X - posStart.X;
     dragOffset.Y = selectionCorner[0].Location.Y - posStart.Y;
 }
		void IResizeController.End(Point posEnd)
		{
			selCorner = CornerPosition.Nothing;
			dragOffset = Point.Empty;
		}
Esempio n. 15
0
 public static void SetCornerPos(UIElement element, CornerPosition value) => element.SetValue(CornerPosProperty, value);
Esempio n. 16
0
 private ArcSegment CreateArc(CornerPosition position, double start, double width, double height)
 {
     ArcSegment arc = null;
     switch (position)
     {
         case CornerPosition.TopLeft:
             arc = new ArcSegment
             {
                 Size = new Size(this.CornerRadius.TopLeft, this.CornerRadius.TopLeft),
                 Point = new Point(this.CornerRadius.TopLeft, start),
                 RotationAngle = 0,
                 IsLargeArc = false,
                 SweepDirection = SweepDirection.Clockwise
             };
             break;
         case CornerPosition.TopRight:
             arc = new ArcSegment
             {
                 Size = new Size(this.CornerRadius.TopRight, this.CornerRadius.TopRight),
                 Point = new Point(width, start + this.CornerRadius.TopRight),
                 RotationAngle = 0,
                 IsLargeArc = false,
                 SweepDirection = SweepDirection.Clockwise
             };
             break;
         case CornerPosition.BottomRight:
             arc = new ArcSegment
             {
                 Size = new Size(this.CornerRadius.BottomRight, this.CornerRadius.BottomRight),
                 Point = new Point(width - this.CornerRadius.BottomRight, height),
                 RotationAngle = 0,
                 IsLargeArc = false,
                 SweepDirection = SweepDirection.Clockwise
             };
             break;
         case CornerPosition.BottomLeft:
             arc = new ArcSegment
             {
                 Size = new Size(this.CornerRadius.BottomLeft, this.CornerRadius.BottomLeft),
                 Point = new Point(start, height - this.CornerRadius.BottomLeft),
                 RotationAngle = 0,
                 IsLargeArc = false,
                 SweepDirection = SweepDirection.Clockwise
             };
             break;
     }
     return arc;
 }
Esempio n. 17
0
 public CornerTrigger(CornerPosition position)
 {
     Position = position;
 }
		void IResizeController.Start(Point posStart, CornerPosition corner)
		{
			selCorner = corner;
			dragOffset.X = selectionCorner[(int) selCorner].Location.X - posStart.X;
			dragOffset.Y = selectionCorner[(int) selCorner].Location.Y - posStart.Y;
		}
Esempio n. 19
0
 void IResizeController.Start(Point posStart, CornerPosition corner)
 {
     SelCorner    = corner;
     DragOffset.X = SelectionCorner[(int)SelCorner].Location.X - posStart.X;
     DragOffset.Y = SelectionCorner[(int)SelCorner].Location.Y - posStart.Y;
 }
Esempio n. 20
0
 // Draws a filled rounded corner
 // xCenter: The horizontal center of the circle
 // yCenter: The vertical center of the circle
 // radius: The circle's radius in pixels
 // position: The position of the corner, which affects how it will be rendered
 // color: Color used when drawing
 public virtual void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, BasicColor color)
 {
     var f = 1 - radius;
     var ddF_x = 1;
     var ddF_y = -2 * radius;
     var x = 0;
     var y = radius;
     var xc_px = 0;
     var yc_my = 0;
     var xc_mx = 0;
     var xc_py = 0;
     var yc_mx = 0;
     var xc_my = 0;
     var lcdWidth = _display.Width;
     switch (position) {
         case CornerPosition.TopRight:
         case CornerPosition.TopLeft:
             if (xCenter < lcdWidth) DrawLine(xCenter, yCenter - radius < 0 ? 0 : yCenter - radius, xCenter, yCenter, color);
             break;
         case CornerPosition.BottomRight:
         case CornerPosition.BottomLeft:
             if (xCenter < lcdWidth) DrawLine(xCenter, yCenter - radius < 0 ? 0 : yCenter, xCenter, (yCenter - radius) + (2 * radius), color);
             break;
     }
     while (x < y) {
         if (f >= 0) {
             y--;
             ddF_y += 2;
             f += ddF_y;
         }
         x++;
         ddF_x += 2;
         f += ddF_x;
         xc_px = xCenter + x;
         xc_mx = xCenter - x;
         xc_py = xCenter + y;
         xc_my = xCenter - y;
         yc_mx = yCenter - x;
         yc_my = yCenter - y;
         switch (position) {
             case CornerPosition.TopRight:
                 if ((xc_px < lcdWidth) && (xc_px >= 0)) DrawLine(xc_px, yc_my, xc_px, yCenter, color);
                 if ((xc_py < lcdWidth) && (xc_py >= 0)) DrawLine(xc_py, yc_mx, xc_py, yCenter, color);
                 break;
             case CornerPosition.BottomRight:
                 if ((xc_px < lcdWidth) && (xc_px >= 0)) DrawLine(xc_px, yCenter, xc_px, yc_my + 2 * y, color);
                 if ((xc_py < lcdWidth) && (xc_py >= 0)) DrawLine(xc_py, yCenter, xc_py, yc_mx + 2 * x, color);
                 break;
             case CornerPosition.TopLeft:
                 if ((xc_mx < lcdWidth) && (xc_mx >= 0)) DrawLine(xc_mx, yc_my, xc_mx, yCenter, color);
                 if ((xc_my < lcdWidth) && (xc_my >= 0)) DrawLine(xc_my, yc_mx, xc_my, yCenter, color);
                 break;
             case CornerPosition.BottomLeft:
                 if ((xc_mx < lcdWidth) && (xc_mx >= 0)) DrawLine(xc_mx, yCenter, xc_mx, yc_my + 2 * y, color);
                 if ((xc_my < lcdWidth) && (xc_my >= 0)) DrawLine(xc_my, yCenter, xc_my, yc_mx + 2 * x, color);
                 break;
         }
     }
 }
Esempio n. 21
0
 public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, ushort color)
 {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(SendContext,(ushort)xCenter);
     BasicTypeSerializer.Put(SendContext,(ushort)yCenter);
     BasicTypeSerializer.Put(SendContext,(ushort)radius);
     BasicTypeSerializer.Put(SendContext,(ushort)position);
     BasicTypeSerializer.Put(SendContext,(ushort)color);
     SendContext.CheckHighWatermark();
 }