예제 #1
0
		/// <summary>Draws a button.</summary>
		public void DrawButton (Context cr, Rectangle bodyAllocation, ButtonState state, double roundSize, double lineWidth, double arrowSize, double arrowPadding, bool drawSeparator, BaseButton widget)
		{
			double lineWidth05 = lineWidth / 2;
			double lineWidth15 = lineWidth05 * 3;
			
			bool upLeft = true, upRight = true, downRight = true, downLeft = true;
			switch(widget.GroupStyle)
			{
				case GroupStyle.Left:
					upRight = downRight = false;
					break;
				case GroupStyle.Center:
					upLeft = downLeft = upRight = downRight = false;
					break;
				case GroupStyle.Right:
					upLeft = downLeft = false;
					break;
			}
			
			cr.LineWidth = lineWidth;
			
			if(state == ButtonState.Pressed || state == ButtonState.Hover)
			{
				LinearGradient bodyPattern, innerBorderPattern;
				Color borderColor;
				
				if(state == ButtonState.Pressed)
				{
					bodyPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X, bodyAllocation.Y + bodyAllocation.Height);
					bodyPattern.AddColorStopRgb (0.0, new Color (0.996, 0.847, 0.667));
					bodyPattern.AddColorStopRgb (0.37, new Color (0.984, 0.710, 0.396));
					bodyPattern.AddColorStopRgb (0.43, new Color (0.980, 0.616, 0.204));
					bodyPattern.AddColorStopRgb (1.0, new Color (0.992, 0.933, 0.667));
					
					innerBorderPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X + bodyAllocation.Width, bodyAllocation.Y + bodyAllocation.Height);
					innerBorderPattern.AddColorStop (0.0, new Color (0.876, 0.718, 0.533, 1));
					innerBorderPattern.AddColorStop (1.0, new Color (0.876, 0.718, 0.533, 0));
					
					borderColor = new Color (0.671, 0.631, 0.549);
				}
				else
				{
					bodyPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X, bodyAllocation.Y + bodyAllocation.Height);
					bodyPattern.AddColorStopRgb (0.0, new Color (1, 0.996, 0.890));
					bodyPattern.AddColorStopRgb (0.37, new Color (1, 0.906, 0.592));
					bodyPattern.AddColorStopRgb (0.43, new Color (1, 0.843, 0.314));
					bodyPattern.AddColorStopRgb (1.0, new Color (1, 0.906, 0.588));
					
					innerBorderPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X + bodyAllocation.Width, bodyAllocation.Y + bodyAllocation.Height);
					innerBorderPattern.AddColorStop (0.0, new Color (1, 1, 0.969, 1));
					innerBorderPattern.AddColorStop (1.0, new Color (1, 1, 0.969, 0));
					
					borderColor = new Color (0.824, 0.753, 0.553);
				}
				
				double x0 = bodyAllocation.X + lineWidth05, y0 = bodyAllocation.Y + lineWidth05;
				double x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth05, y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth05;
				
				if(upLeft) cr.MoveTo (x0 + roundSize, y0);
				else cr.MoveTo (x0, y0);
				if(upRight) cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
				else cr.LineTo (x1, y0);
				if(downRight) cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
				else cr.LineTo (x1, y1);
				if(downLeft) cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
				else cr.LineTo (x0, y1);
				if(upLeft) cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
				else cr.LineTo (x0, y0);
				
				cr.Pattern = bodyPattern;
				cr.Fill ();
				
				x0 = bodyAllocation.X + lineWidth15; y0 = bodyAllocation.Y + lineWidth15;
				x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth15; y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth15;
				
				double roundSizeMinusLineWidth = roundSize - lineWidth;
				
				if(widget.GroupStyle != GroupStyle.Left) x0 -= lineWidth;
				
				if(upLeft) cr.MoveTo (x0 + roundSizeMinusLineWidth, y0);
				else cr.MoveTo (x0, y0);
				if(upRight) cr.Arc (x1 - roundSizeMinusLineWidth, y0 + roundSizeMinusLineWidth, roundSizeMinusLineWidth, 1.5*Math.PI, 0);
				else cr.LineTo (x1, y0);
				if(downRight) cr.Arc (x1 - roundSizeMinusLineWidth, y1 - roundSizeMinusLineWidth, roundSizeMinusLineWidth, 0, 0.5*Math.PI);
				else cr.LineTo (x1, y1);
				if(downLeft) cr.Arc (x0 + roundSizeMinusLineWidth, y1 - roundSizeMinusLineWidth, roundSizeMinusLineWidth, 0.5*Math.PI, Math.PI);
				else cr.LineTo (x0, y1);
				if(upLeft) cr.Arc (x0 + roundSizeMinusLineWidth, y0 + roundSizeMinusLineWidth, roundSizeMinusLineWidth, Math.PI, 1.5*Math.PI);
				else cr.LineTo (x0, y0);
				
				if(widget.GroupStyle != GroupStyle.Left) x0 += lineWidth;
				
				cr.Pattern = innerBorderPattern;
				cr.Stroke ();
				
				x0 = bodyAllocation.X + lineWidth05; y0 = bodyAllocation.Y + lineWidth05;
				x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth05; y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth05;
				
				if(upLeft) cr.MoveTo (x0 + roundSize, y0);
				else cr.MoveTo (x0, y0);
				if(upRight) cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
				else cr.LineTo (x1, y0);
				if(downRight) cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
				else cr.LineTo (x1, y1);
				if(downLeft) cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
				else cr.LineTo (x0, y1);
				if(widget.GroupStyle == GroupStyle.Left)
				{
					if(upLeft) cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
					else cr.LineTo (x0, y0);
				}
				
				cr.Color = borderColor;
				cr.Stroke ();
			}
			else if(widget.DrawBackground)
			{
				LinearGradient bodyPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X, bodyAllocation.Y + bodyAllocation.Height);
				bodyPattern.AddColorStop (0.0, new Color (1, 1, 1, 0.7));
				bodyPattern.AddColorStop (0.37, new Color (1, 1, 1, 0.2));
				bodyPattern.AddColorStop (0.43, new Color (1, 1, 1, 0.2));
				bodyPattern.AddColorStop (1.0, new Color (1, 1, 1, 0.7));
				
				double x0 = bodyAllocation.X + lineWidth05, y0 = bodyAllocation.Y + lineWidth05;
				double x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth05, y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth05;
				
				if(upLeft) cr.MoveTo (x0 + roundSize, y0);
				else cr.MoveTo (x0, y0);
				if(upRight) cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
				else cr.LineTo (x1, y0);
				if(downRight) cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
				else cr.LineTo (x1, y1);
				if(downLeft) cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
				else cr.LineTo (x0, y1);
				if(upLeft) cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
				else cr.LineTo (x0, y0);
				
				cr.Pattern = bodyPattern;
				cr.Fill ();
				
				if(widget.GroupStyle != GroupStyle.Left)
				{
					if(downLeft) cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
					else cr.MoveTo (x0, y1);
					if(upLeft) cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
					else cr.LineTo (x0, y0);
					
					cr.Color = new Color (1, 1, 1, 0.8);
					cr.Stroke ();
				}
				
				if(upLeft) cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
				else cr.MoveTo (x0, y0);
				if(upRight) cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
				else cr.LineTo (x1, y0);
				if(downRight) cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
				else cr.LineTo (x1, y1);
				if(downLeft) cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
				else cr.LineTo (x0, y1);
				if(widget.GroupStyle == GroupStyle.Left)
				{
					if(upLeft) cr.LineTo (x0, y0 + roundSize);
					else cr.LineTo (x0, y0);
				}
				
				cr.Color = new Color (0, 0, 0, 0.2);
				cr.Stroke ();
			}
			
			if(arrowSize > 0)
			{
				double x, y;
				
				switch(widget.ImagePosition)
				{
					case Gtk.PositionType.Bottom:
					case Gtk.PositionType.Top:
						x = bodyAllocation.X + (bodyAllocation.Width - arrowSize) / 2.0;
						y = bodyAllocation.Y + bodyAllocation.Height - 2 * lineWidth - arrowSize - 2 * arrowPadding;
						
						if(drawSeparator)
						{
							double left = bodyAllocation.X + 2 * lineWidth, right = bodyAllocation.X + bodyAllocation.Width - 2 * lineWidth;
							
							cr.MoveTo (left, y - lineWidth / 2);
							cr.LineTo (right, y - lineWidth / 2);
							cr.Color = new Color (0, 0, 0, 0.1);
							cr.Stroke ();
							
							cr.MoveTo (left, y + lineWidth / 2);
							cr.LineTo (right, y + lineWidth / 2);
							cr.Color = new Color (1, 1, 1, 0.6);
							cr.Stroke ();
						}
						
						y += arrowPadding;
						break;
					default:
						x = bodyAllocation.X + bodyAllocation.Width - 2 * lineWidth - arrowSize - 2 * arrowPadding;
						y = bodyAllocation.Y + (bodyAllocation.Height - arrowSize) / 2.0;
						
						if(drawSeparator)
						{
							double top = bodyAllocation.Y + 2 * lineWidth, bottom = bodyAllocation.Y + bodyAllocation.Height - 2 * lineWidth;
							cr.MoveTo (x - lineWidth / 2, top);
							cr.LineTo (x - lineWidth / 2, bottom);
							cr.Color = new Color (0, 0, 0, 0.1);
							cr.Stroke ();
							
							cr.MoveTo (x + lineWidth / 2, top);
							cr.LineTo (x + lineWidth / 2, bottom);
							cr.Color = new Color (1, 1, 1, 0.6);
							cr.Stroke ();
						}
						
						x += arrowPadding;
						break;
				}
				
				y += arrowSize / 4.0 + lineWidth / 2.0;
				cr.MoveTo (x, y);
				cr.LineTo (x + arrowSize, y);
				cr.LineTo (x + arrowSize / 2.0, y + arrowSize / 2.0);
				cr.LineTo (x, y);
				cr.Color = new Color (0, 0, 0);
				cr.Fill ();
			}
		}
예제 #2
0
		protected override void PaintWidget (Cairo.Context ctx, int w, int h) {
			ctx.SetFill (0.0d, 0.0d, 0.0d);
			ctx.Rectangle (0.0d, Offset, w, h - Offset);
			ctx.Fill ();
			ctx.SetFill (BlueprintStyle.BluePrint);
			ctx.Rectangle (0.0d, 0.0d, w, Offset);
			ctx.Fill ();
			double wr = w - 2.0d * Offset;
			double ew = wr / (max - min + 1 + shaft * (max - min));
			this.flapWidth = ew;
			double xc = Offset;
			for (int i = min; i <= max; i++) {
				if (i != current) {
					ctx.Rectangle (xc, Offset, ew, h - 2.0d * Offset);
				}
				xc += (1.0d + shaft) * ew;
			}
			ctx.FillPreserve ();
			LinearGradient p = new LinearGradient (0.0d, Offset, 0.0d, Offset + 10.0d);
			double fctr = 0.5d;
			for (double y = 0.0d; y <= 1.0d; y += 0.1d) {
				p.AddColorStopRgb (y, new Color (fctr * BlueprintStyle.BluePrintShadow.R, fctr * BlueprintStyle.BluePrintShadow.G, fctr * BlueprintStyle.BluePrintShadow.B));
				fctr += 0.05d;
			}
			ctx.SetFill (p);
			ctx.Fill ();
			ctx.Rectangle (Offset + (1.0d + shaft) * ew * (current - min), Offset, ew, h - 2.0d * Offset);
			ctx.SetFill (BlueprintStyle.BluePrint);
			ctx.Fill ();
			xc = Offset;
			ctx.SetFill (BlueprintStyle.HardWhite);
			ctx.MoveTo (0.0d, Offset);
			ctx.LineTo (Offset, Offset);
			for (int i = min; i <= max; i++) {
				ctx.LineTo (xc, h - Offset);
				ctx.LineTo (xc + ew, h - Offset);
				ctx.LineTo (xc + ew, Offset);
				xc += (1.0d + shaft) * ew;
				if (i < max) {
					ctx.LineTo (xc, Offset);
				}
			}
			ctx.LineTo (w - Offset, Offset);
			ctx.LineTo (w, Offset);
			ctx.MoveTo (Offset, Offset);
			ctx.LineTo (Offset + (1.0d + shaft) * ew * (current - min), Offset);
			ctx.MoveTo (w - Offset, Offset);
			ctx.LineTo (w - Offset + (1.0d + shaft) * ew * (current - max), Offset);
			ctx.Stroke ();
			xc = Offset + 0.5d * ew;
			IEnumerable<string> namei = this.names.Skip (this.min);
			IEnumerator<string> enume = namei.GetEnumerator ();
			for (int i = min; i <= max && enume.MoveNext (); i++) {
				string name = enume.Current;
				if (name != null) {
					#if PANGO
					Pango.Layout pglay = Pango.CairoHelper.CreateLayout (ctx);
					pglay.SetText (name);
					Pango.Rectangle ra, rb;
					pglay.GetExtents (out ra, out rb);
					double tew = rb.Width / 1024.0d;
					double teh = rb.Height / 1024.0d;
					#else
					TextExtents te = ctx.TextExtents (name);
					double tew = te.Width;
					double teh = te.Height;
					#endif
					ctx.MoveTo (xc - 0.5d * tew, 0.5d * (h + teh));
					ctx.ShowText (name);
					xc += (1.0d + shaft) * ew;
				}
			}
		}
예제 #3
0
 protected override bool OnExposeEvent(Gdk.EventExpose ev)
 {
     base.OnExposeEvent(ev);
     // Insert drawing code here.
     Context ctx = Gdk.CairoHelper.Create(this.GdkWindow);
     ctx.FillRule = FillRule.EvenOdd;
     int w, h;
     this.GdkWindow.GetSize(out w, out h);
     ctx.Color = new Color(0.0d, 0.0d, 0.0d);
     ctx.Rectangle(0.0d, Offset, w, h-Offset);
     ctx.Fill();
     ctx.Color = BlueprintStyle.BluePrint;
     ctx.Rectangle(0.0d, 0.0d, w, Offset);
     ctx.Fill();
     double wr = w-2.0d*Offset;
     double ew = wr/(max-min+1+shaft*(max-min));
     this.flapWidth = ew;
     double xc = Offset;
     for(int i = min; i <= max; i++) {
         if(i != current) {
             ctx.Rectangle(xc, Offset, ew, h-2.0d*Offset);
         }
         xc += (1.0d+shaft)*ew;
     }
     ctx.FillPreserve();
     LinearGradient p = new LinearGradient(0.0d, Offset, 0.0d, Offset+10.0d);
     double fctr = 0.5d;
     for(double y = 0.0d; y <= 1.0d; y += 0.1d) {
         p.AddColorStopRgb(y, new Color(fctr*BlueprintStyle.BluePrintShadow.R, fctr*BlueprintStyle.BluePrintShadow.G, fctr*BlueprintStyle.BluePrintShadow.B));
         fctr += 0.05d;
     }
     ctx.Pattern = p;
     ctx.Fill();
     ctx.Rectangle(Offset+(1.0d+shaft)*ew*(current-min), Offset, ew, h-2.0d*Offset);
     ctx.Color = BlueprintStyle.BluePrint;
     ctx.Fill();
     xc = Offset;
     ctx.Color = BlueprintStyle.HardWhite;
     ctx.MoveTo(0.0d, Offset);
     ctx.LineTo(Offset, Offset);
     for(int i = min; i <= max; i++) {
         ctx.LineTo(xc, h-Offset);
         ctx.LineTo(xc+ew, h-Offset);
         ctx.LineTo(xc+ew, Offset);
         xc += (1.0d+shaft)*ew;
         if(i < max) {
             ctx.LineTo(xc, Offset);
         }
     }
     ctx.LineTo(w-Offset, Offset);
     ctx.LineTo(w, Offset);
     ctx.MoveTo(Offset, Offset);
     ctx.LineTo(Offset+(1.0d+shaft)*ew*(current-min), Offset);
     ctx.MoveTo(w-Offset, Offset);
     ctx.LineTo(w-Offset+(1.0d+shaft)*ew*(current-max), Offset);
     ctx.Stroke();
     xc = Offset+0.5d*ew;
     for(int i = min; i <= max; i++) {
         TextExtents te = ctx.TextExtents(i.ToString());
         ctx.MoveTo(xc-0.5d*te.Width, 0.5d*(h+te.Height));
         ctx.ShowText(i.ToString());
         xc += (1.0d+shaft)*ew;
     }
     ((IDisposable)ctx.Target).Dispose();
     ((IDisposable)ctx).Dispose();
     return true;
 }
예제 #4
0
파일: GraphGenerator.cs 프로젝트: dfr0/moon
		public static void GenerateGraph (List <ResultDbEntry> resultList, string filename)
		{
			// FIXME Exception if more than 50 results...

			ImageSurface surface = new ImageSurface (Format.Rgb24, 103, 52);
			Context context = new Context (surface);

			// Fill with grad
			LinearGradient grad = new LinearGradient (0.0, 0.0, 0.0, 52.0);
			grad.AddColorStopRgb (0.0, new Color  (1.0, 1.0, 1.0));
			grad.AddColorStopRgb (1.0, new Color  (0.8, 0.8, 0.9));
			context.Pattern = grad;
			context.Paint ();

			// Frame
			context.SetSourceRGB (0, 0, 0);
			context.LineWidth = 1.0;
			context.Rectangle (0.5, 0.5, 102.0, 51.0);
			context.Stroke ();

			long denominator = (long) (FindBiggestResult (resultList) * 1.2);

			context.LineWidth = 1.5;

			// FIXME Reverse to copy
			resultList.Reverse ();

			double x = 100.5 - ((resultList.Count - 1) * 2.0);
			bool hasPrevResult = false;
			long prevResult = 0;

			foreach (ResultDbEntry entry in resultList) {

				if (entry.Failure) {
					x += 2.0;
					continue;
				}

				double sz = ((double) entry.Time / denominator) * 50.0;

				if (hasPrevResult && UtilFu.GetValueDifference (prevResult, entry.Time) > 0.1)
					context.SetSourceRGB (1.0, 0.0, 0.0);
				else if (hasPrevResult && UtilFu.GetValueDifference (prevResult, entry.Time) < -0.1)
					context.SetSourceRGB (0.0, 1.0, 0.0);
				else
					context.SetSourceRGB (0.4, 0.4, 0.4);
 
				context.MoveTo (x, 51);
				context.LineTo (x, 51 - sz);
				context.Stroke ();

				x += 2.0;

				hasPrevResult = true;
				prevResult = entry.Time;
			}

			surface.WriteToPng (filename);

			resultList.Reverse ();
			((IDisposable) context).Dispose ();
			((IDisposable) surface).Dispose ();
		}
예제 #5
0
        internal void DrawApplicationMenuItem(Context cr, Rectangle bodyAllocation, MenuItemState state, double roundSize, double lineWidth, double arrowSize, double arrowPadding, bool drawSeparator, ApplicationMenuItem widget)
        {
            double lineWidth05 = lineWidth / 2;
            double lineWidth15 = lineWidth05 * 3;
            double separatorX = bodyAllocation.X + bodyAllocation.Width - 2 * lineWidth - arrowSize - 2 * arrowPadding;

            cr.LineWidth = lineWidth;

            if(state != MenuItemState.Default)
            {
                LinearGradient bodyPattern, innerBorderPattern;
                Color borderColor;

                bodyPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X, bodyAllocation.Y + bodyAllocation.Height);
                bodyPattern.AddColorStopRgb (0.0, new Color (1, 0.996, 0.890));
                bodyPattern.AddColorStopRgb (0.37, new Color (1, 0.906, 0.592));
                bodyPattern.AddColorStopRgb (0.43, new Color (1, 0.843, 0.314));
                bodyPattern.AddColorStopRgb (1.0, new Color (1, 0.906, 0.588));

                innerBorderPattern = new LinearGradient (bodyAllocation.X, bodyAllocation.Y, bodyAllocation.X + bodyAllocation.Width, bodyAllocation.Y + bodyAllocation.Height);
                innerBorderPattern.AddColorStop (0.0, new Color (1, 1, 0.969, 1));
                innerBorderPattern.AddColorStop (1.0, new Color (1, 1, 0.969, 0));

                borderColor = new Color (0.824, 0.753, 0.553);

                double x0 = bodyAllocation.X + lineWidth05, y0 = bodyAllocation.Y + lineWidth05;
                double x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth05, y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth05;

                cr.MoveTo (x0 + roundSize, y0);
                cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
                cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
                cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
                cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);

                cr.Pattern = bodyPattern;
                cr.Fill ();
                bodyPattern.Destroy ();

                if(state == MenuItemState.HilightAction)
                {
                    cr.Color = new Color (1, 1, 1, 0.7);
                    cr.MoveTo (x0 + roundSize, y0);
                    cr.LineTo (separatorX, y0);
                    cr.LineTo (separatorX, y1);
                    cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);
                    cr.Arc (x0 + roundSize, y0 + roundSize, roundSize, Math.PI, 1.5*Math.PI);
                    cr.Fill ();
                }
                else if(state == MenuItemState.HilightMenu)
                {
                    cr.Color = new Color (1, 1, 1, 0.7);
                    cr.MoveTo (separatorX, y0);
                    cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
                    cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
                    cr.LineTo (separatorX, y1);
                    cr.LineTo (separatorX, y0);
                    cr.Fill ();
                }

                x0 = bodyAllocation.X + lineWidth15; y0 = bodyAllocation.Y + lineWidth15;
                x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth15; y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth15;

                double roundSizeMinusLineWidth = roundSize - lineWidth;

                x0 -= lineWidth;

                cr.MoveTo (x0 + roundSizeMinusLineWidth, y0);
                cr.Arc (x1 - roundSizeMinusLineWidth, y0 + roundSizeMinusLineWidth, roundSizeMinusLineWidth, 1.5*Math.PI, 0);
                cr.Arc (x1 - roundSizeMinusLineWidth, y1 - roundSizeMinusLineWidth, roundSizeMinusLineWidth, 0, 0.5*Math.PI);
                cr.Arc (x0 + roundSizeMinusLineWidth, y1 - roundSizeMinusLineWidth, roundSizeMinusLineWidth, 0.5*Math.PI, Math.PI);
                cr.Arc (x0 + roundSizeMinusLineWidth, y0 + roundSizeMinusLineWidth, roundSizeMinusLineWidth, Math.PI, 1.5*Math.PI);

                x0 += lineWidth;

                cr.Pattern = innerBorderPattern;
                cr.Stroke ();
                innerBorderPattern.Destroy ();

                x0 = bodyAllocation.X + lineWidth05; y0 = bodyAllocation.Y + lineWidth05;
                x1 = bodyAllocation.X + bodyAllocation.Width - lineWidth05; y1 = bodyAllocation.Y + bodyAllocation.Height - lineWidth05;

                cr.MoveTo (x0 + roundSize, y0);
                cr.Arc (x1 - roundSize, y0 + roundSize, roundSize, 1.5*Math.PI, 0);
                cr.Arc (x1 - roundSize, y1 - roundSize, roundSize, 0, 0.5*Math.PI);
                cr.Arc (x0 + roundSize, y1 - roundSize, roundSize, 0.5*Math.PI, Math.PI);

                cr.Color = borderColor;
                cr.Stroke ();
            }

            if(arrowSize > 0)
            {
                double x, y;

                x = separatorX;
                y = bodyAllocation.Y + (bodyAllocation.Height - arrowSize) / 2.0;

                if(drawSeparator)
                {
                    double top = bodyAllocation.Y + 2 * lineWidth, bottom = bodyAllocation.Y + bodyAllocation.Height - 2 * lineWidth;
                    cr.MoveTo (x - lineWidth / 2, top);
                    cr.LineTo (x - lineWidth / 2, bottom);
                    cr.Color = new Color (0, 0, 0, 0.1);
                    cr.Stroke ();

                    cr.MoveTo (x + lineWidth / 2, top);
                    cr.LineTo (x + lineWidth / 2, bottom);
                    cr.Color = new Color (1, 1, 1, 0.6);
                    cr.Stroke ();
                }

                x += arrowSize / 4.0 + lineWidth / 2.0;

                cr.MoveTo (x, y);
                cr.LineTo (x, y + arrowSize);
                cr.LineTo (x + arrowSize / 2.0, y + arrowSize / 2.0);
                cr.LineTo (x, y);
                cr.Color = new Color (0, 0, 0);
                cr.Fill ();
            }
        }