예제 #1
0
        private static void RenderUpCurve(StateButton sender, DrawingContext context, Brush iconBrush, Brush backgroundBrush)
        {
            Rect iconRect      = sender.IconRect;
            Pen  iconPen       = new Pen(iconBrush, iconRect.Height * iconCurveThicknessFactor);
            Pen  backgroundPen = new Pen(backgroundBrush, iconRect.Height * iconCurveThicknessFactor * 2);

            double startX    = GetCurveX(iconCurveMinValueFactor);
            double endX      = GetCurveX(1 - iconCurveMinValueFactor);
            double xPerPixel = (endX - startX) / (iconRect.Width * (1 - iconArrowWidthFactor / 2));

            Point previousPoint = new Point(iconRect.X, iconRect.Y + iconRect.Height);

            for (double xPixel = 0, xValue = startX; xValue <= endX; xValue += xPerPixel, xPixel++)
            {
                double yValue = (GetCurveValue(xValue) - iconCurveMinValueFactor) /
                                (1 - 2 * iconCurveMinValueFactor) * iconRect.Height + iconRect.Y;

                Point currentPoint = new Point(xPixel + iconRect.X, sender.ActualHeight - yValue);
                context.DrawLine(backgroundPen, previousPoint, currentPoint);
                context.DrawLine(iconPen, previousPoint, currentPoint);
                previousPoint = currentPoint;
            }
        }
        private static Geometry GetOneGeomerty(StateButton sender)
        {
            Rect iconRect = sender.IconRect;

            double diagonalStrokeWidth  = iconRect.Width * iconOneDiagonalStrokeWidthFactor;
            double diagonalStrokeHeight = iconRect.Height * iconOneDiagonalStrokeHeightFactor;

            double thickness       = iconRect.Width * iconOneStrokeThicknessFactor;
            double thicknessFactor = thickness * Math.Sqrt(1 / (Math.Pow(diagonalStrokeWidth, 2) + Math.Pow(diagonalStrokeHeight, 2)));

            double diagonalShortWidth  = diagonalStrokeWidth * thicknessFactor;
            double diagonalShortHeight = diagonalStrokeHeight * thicknessFactor;

            double diagonalLongWidth  = thickness + diagonalStrokeWidth;
            double diagonalLongHeight = diagonalStrokeHeight + diagonalShortHeight;

            double diagonalMiddleWidth  = diagonalStrokeWidth - diagonalShortHeight;
            double diagonalMiddleHeight = diagonalLongHeight / diagonalLongWidth * diagonalMiddleWidth;

            Vector vDiagonalShort  = new Vector(diagonalShortHeight, diagonalShortWidth);
            Vector vDiagonalMiddle = new Vector(diagonalMiddleWidth, -diagonalMiddleHeight);
            Vector vDiagonalLong   = new Vector(-diagonalLongWidth, diagonalLongHeight);

            Vector vVerticalLong    = new Vector(0, iconRect.Height * iconOneVerticalStrokeHeightFactor);
            Vector vHorizontalShort = new Vector(-thickness, 0);

            Point pCornerSpire = new Point(iconRect.X + iconRect.Width * (1 - iconOneOffsetWidthFactor),
                                           iconRect.Y + iconRect.Height * iconOneOffsetHeightFactor);
            Point pMiddleTop    = Point.Add(pCornerSpire, vDiagonalLong);
            Point pMiddleBottom = Point.Add(pMiddleTop, vDiagonalShort);
            Point pCornerInner  = Point.Add(pMiddleBottom, vDiagonalMiddle);
            Point pBottomRight  = Point.Add(pCornerSpire, vVerticalLong);
            Point pBottomLeft   = Point.Add(pBottomRight, vHorizontalShort);

            return(new PathGeometry(StateButton.GetFigures(pCornerSpire, pMiddleTop, pMiddleBottom, pCornerInner, pBottomLeft, pBottomRight)));
        }
 private static void RenderShowIcon(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderIcon(sender, context, Brushes.MediumPurple);
 }
예제 #4
0
 public virtual void RenderMouseOut(StateButton sender, DrawingContext context)
 {
     noMouseOn?.Invoke(sender, context);
 }
예제 #5
0
 public void RemoveParent(StateButton parent)
 {
     parents.Remove(parent);
 }
예제 #6
0
 public void AddParent(StateButton parent)
 {
     parents.Add(parent);
 }
예제 #7
0
 public virtual void RenderMouseClick(StateButton sender, DrawingContext context)
 {
     mouseClick?.Invoke(sender, context);
 }
        private static IEnumerable <PathFigure> GetHighlightIconFigures(StateButton sender)
        {
            yield return(GetBeginBracketFigure(sender));

            yield return(GetEndBracketFigure(sender));
        }
예제 #9
0
 private static void RenderShuffleComplete(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderShuffleIcon(sender, context, Brushes.Purple, backgroundBrush);
 }
예제 #10
0
 private static void RenderShuffleOneTime(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderShuffleIcon(sender, context, Brushes.Black, backgroundBrush);
 }
예제 #11
0
 private static void RenderShuffleOff(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderShuffleIcon(sender, context, Brushes.LightGray, backgroundBrush);
 }
예제 #12
0
 private static void RenderLoopCurrent(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderLoopCurrentIcon(sender, context, Brushes.Black, backgroundBrush);
 }
예제 #13
0
 private static void RenderLoopAll(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderLoopOffAndAllIcon(sender, context, Brushes.Black, backgroundBrush);
 }
 private static void RenderHideIcon(StateButton sender, DrawingContext context, Brush backgroundBrush)
 {
     RenderIcon(sender, context, Brushes.Gray);
 }
예제 #15
0
 private static void RenderShuffleIcon(StateButton sender, DrawingContext context, Brush iconBrush, Brush backgroundBrush)
 {
     RenderDownCurve(sender, context, iconBrush);
     RenderUpCurve(sender, context, iconBrush, backgroundBrush);
     RenderArrow(sender, context, iconBrush);
 }
        public override void RenderMouseClick(StateButton sender, DrawingContext context)
        {
            RenderBackground(sender, context, backgroundBrushClick);

            renderIcon(sender, context, backgroundBrushClick);
        }
        private static IEnumerable <PathFigure> GetMediaIconFigures(StateButton sender)
        {
            yield return(GetVerticalStrokeBeginFigure(sender));

            yield return(GetVerticalStrokeEndFigure(sender));
        }