Beispiel #1
0
		void DrawBackground (DockySurface surface)
		{
			// This method is just annoying enough to turn into a loop that its hardly worth it
			
			DockySurface[] slices = GetSlices (surface);
			int middle = surface.Width / 2;
			
			// left to right
			int left = 0;
			int right = surface.Width;
			int leftMiddle = left + SliceSize;
			int rightMiddle = right - SliceSize;
			int leftTailMiddle = middle - (TailWidth / 2) - tailOffset;
			int rightTailMiddle = middle + (TailWidth / 2) - tailOffset;
			
			// keep the tail on the menu
			if (leftTailMiddle < SliceSize) {
				leftTailMiddle = SliceSize;
				rightTailMiddle = leftTailMiddle + TailWidth;
			}
			if (rightTailMiddle > right - SliceSize) {
				rightTailMiddle = right - SliceSize;
				leftTailMiddle = rightTailMiddle - TailWidth;
			}
			
			// top to bottom
			int top = 0;
			int bottom = surface.Height;
			int topMiddle = top + SliceSize;
			int bottomMiddle = bottom - (SliceSize + TailHeight);
			
			int yTop = top;
			int yBottom = topMiddle - top;
			int xLeft = left;
			int xRight = leftMiddle;
			surface.DrawSlice (slices[(int) Slice.TopLeft], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = leftMiddle;
			xRight = rightMiddle;
			surface.DrawSlice (slices[(int) Slice.Top], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = rightMiddle;
			xRight = right;
			surface.DrawSlice (slices[(int) Slice.TopRight], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = left;
			xRight = leftMiddle;
			yTop = topMiddle;
			yBottom = bottomMiddle;
			surface.DrawSlice (slices[(int) Slice.Left], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = leftMiddle;
			xRight = rightMiddle;
			surface.DrawSlice (slices[(int) Slice.Center], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = rightMiddle;
			xRight = right;
			surface.DrawSlice (slices[(int) Slice.Right], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = left;
			xRight = leftMiddle;
			yTop = bottomMiddle;
			yBottom = bottom;
			surface.DrawSlice (slices[(int) Slice.BottomLeft], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = leftMiddle;
			xRight = leftTailMiddle;
			surface.DrawSlice (slices[(int) Slice.TailLeft], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = leftTailMiddle;
			xRight = rightTailMiddle;
			surface.DrawSlice (slices[(int) Slice.Tail], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = rightTailMiddle;
			xRight = rightMiddle;
			surface.DrawSlice (slices[(int) Slice.TailRight], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
			
			xLeft = rightMiddle;
			xRight = right;
			surface.DrawSlice (slices[(int) Slice.BottomRight], new Gdk.Rectangle (
					xLeft, 
					yTop, 
					xRight - xLeft, 
					yBottom - yTop));
		}
		void DrawBackground (DockySurface surface)
		{
			DockySurface[] slices = GetSlices (surface);
			
			surface.DrawSlice (slices[0], new Gdk.Rectangle (0, 0, AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight));
			surface.DrawSlice (slices[1], new Gdk.Rectangle (AbstractDockItem.HoverTextHeight / 2, 0, Math.Max (0, surface.Width - AbstractDockItem.HoverTextHeight), AbstractDockItem.HoverTextHeight));
			surface.DrawSlice (slices[2], new Gdk.Rectangle (surface.Width - AbstractDockItem.HoverTextHeight / 2, 0, AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight));
		}