public override void DrawAfterEol (TextEditor textEditor, Cairo.Context g, double y, EndOfLineMetrics metrics)
		{
			EnsureLayoutCreated (editor);
			int errorCounterWidth = 0, eh = 0;
			if (errorCountLayout != null) 
				errorCountLayout.GetPixelSize (out errorCounterWidth, out eh);

			var sx = metrics.TextRenderEndPosition;
			var width = LayoutWidth + errorCounterWidth + editor.LineHeight;
			var drawLayout = layouts[0].Layout;
			int ex = 0 , ey = 0;
			bool customLayout = sx + width > editor.Allocation.Width;
			bool hideText = false;
			bubbleIsReduced = customLayout;
			if (customLayout) {
				width = editor.Allocation.Width - sx;
				string text = layouts[0].Layout.Text;
				drawLayout = new Pango.Layout (editor.PangoContext);
				drawLayout.FontDescription = cache.fontDescription;
				for (int j = text.Length - 4; j > 0; j--) {
					drawLayout.SetText (text.Substring (0, j) + "...");
					drawLayout.GetPixelSize (out ex, out ey);
					if (ex + (errorCountLayout != null ? errorCounterWidth : 0) + editor.LineHeight < width)
						break;
				}
				if (ex + (errorCountLayout != null ? errorCounterWidth : 0) + editor.LineHeight > width) {
					hideText = true;
					drawLayout.SetMarkup ("<span weight='heavy'>···</span>");
					width = Math.Max (17, errorCounterWidth) + editor.LineHeight;
					sx = Math.Min (sx, editor.Allocation.Width - width);
				}
			}
			bubbleDrawX = sx - editor.TextViewMargin.XOffset;
			bubbleDrawY = y;
			bubbleWidth = width;
			g.RoundedRectangle (sx, y + 1, width, editor.LineHeight - 2, editor.LineHeight / 2 - 1);
			g.Color = TagColor.Color;
			g.Fill ();

			if (errorCounterWidth > 0 && errorCountLayout != null) {
				g.RoundedRectangle (sx + width - errorCounterWidth - editor.LineHeight / 2, y + 2, errorCounterWidth, editor.LineHeight - 4, editor.LineHeight / 2 - 3);
				g.Color = CounterColor.Color;
				g.Fill ();

				g.Save ();
				g.Translate (sx + width - errorCounterWidth - editor.LineHeight / 2 + (errorCounterWidth - errorCounterWidth) / 2, y + 1);
				g.Color = CounterColor.SecondColor;
				g.ShowLayout (errorCountLayout);
				g.Restore ();
			}

			if (errorCounterWidth <= 0 || errorCountLayout == null || !hideText) {
				g.Save ();
				g.Translate (sx + editor.LineHeight / 2, y + (editor.LineHeight - layouts [0].Height) / 2 + layouts [0].Height % 2);
				g.Color = TagColor.SecondColor;
				g.ShowLayout (drawLayout);
				g.Restore ();
			}

			if (customLayout)
				drawLayout.Dispose ();

		}
		public override void DrawAfterEol (TextEditor textEditor, Cairo.Context g, double y, EndOfLineMetrics metrics)
		{
			if (!IsVisible)
				return;
			EnsureLayoutCreated (editor);
			int errorCounterWidth = 0, eh = 0;
			if (errorCountLayout != null) {
				errorCountLayout.GetPixelSize (out errorCounterWidth, out eh);
				errorCounterWidth = Math.Max (15, Math.Max (errorCounterWidth + 3, (int)(editor.LineHeight * 3 / 4)));
			}

			var sx = metrics.TextRenderEndPosition;
			var width = LayoutWidth + errorCounterWidth + editor.LineHeight;
			var drawLayout = layouts[0].Layout;
			int ex = 0 , ey = 0;
			bool customLayout = true; //sx + width > editor.Allocation.Width;
			bool hideText = false;
			bubbleIsReduced = customLayout;
			var showErrorCount = errorCounterWidth > 0 && errorCountLayout != null;
			if (customLayout) {
				width = editor.Allocation.Width - sx;
				string text = layouts[0].Layout.Text;
				drawLayout = new Pango.Layout (editor.PangoContext);
				drawLayout.FontDescription = cache.fontDescription;
				var paintWidth = (width - errorCounterWidth - editor.LineHeight + 4);
				var minWidth = Math.Max (17, errorCounterWidth) + editor.LineHeight;
				if (paintWidth < minWidth) {
					hideText = true;
					drawLayout.SetMarkup ("<span weight='heavy'>···</span>");
					width = minWidth;
					showErrorCount = false;
					sx = Math.Min (sx, editor.Allocation.Width - width);
				} else {
					drawLayout.Ellipsize = Pango.EllipsizeMode.End;
					drawLayout.Width = (int)(paintWidth * Pango.Scale.PangoScale);
					drawLayout.SetText (text);
					int w2, h2;
					drawLayout.GetPixelSize (out w2, out h2);
					width = w2 + errorCounterWidth + editor.LineHeight;
				}
			}
			bubbleDrawX = sx - editor.TextViewMargin.XOffset;
			bubbleDrawY = y;
			bubbleWidth = width;

			var bubbleHeight = editor.LineHeight - 1;
			g.RoundedRectangle (sx, y + 1, width, bubbleHeight, editor.LineHeight / 2 - 1);
			g.SetSourceColor (TagColor.Color);
			g.Fill ();

			// Draw error count icon
			if (showErrorCount) {
				var errorCounterHeight = bubbleHeight - 2;
				var errorCounterX = sx + width - errorCounterWidth - 3;
				var errorCounterY = y + 1 + (bubbleHeight - errorCounterHeight) / 2;

				g.RoundedRectangle (
					errorCounterX - 1, 
					errorCounterY - 1, 
					errorCounterWidth + 2, 
					errorCounterHeight + 2, 
					editor.LineHeight / 2 - 3
				);

				g.SetSourceColor (new Cairo.Color (0, 0, 0, 0.081));
				g.Fill ();

				g.RoundedRectangle (
					errorCounterX, 
					errorCounterY, 
					errorCounterWidth, 
					errorCounterHeight, 
					editor.LineHeight / 2 - 3
				);
				using (var lg = new Cairo.LinearGradient (errorCounterX, errorCounterY, errorCounterX, errorCounterY + errorCounterHeight)) {
					lg.AddColorStop (0, CounterColor.Color);
					lg.AddColorStop (1, CounterColor.Color.AddLight (-0.1));
					g.Pattern = lg;
					g.Fill ();
				}

				g.Save ();

				int ew;
				errorCountLayout.GetPixelSize (out ew, out eh);

				g.Translate (
					errorCounterX + (errorCounterWidth - ew) / 2,
					errorCounterY + (errorCounterHeight - eh) / 2
				);
				g.SetSourceColor (CounterColor.SecondColor);
				g.ShowLayout (errorCountLayout);
				g.Restore ();
			}

			// Draw label text
			if (!showErrorCount || !hideText) {
				g.Save ();
				g.Translate (sx + editor.LineHeight / 2, y + (editor.LineHeight - layouts [0].Height) / 2 + 1);

				// draw shadow
				g.SetSourceColor (MessageBubbleCache.ShadowColor);
				g.ShowLayout (drawLayout);
				g.Translate (0, -1);

				g.SetSourceColor (TagColor.SecondColor);
				g.ShowLayout (drawLayout);
				g.Restore ();
			}

			if (customLayout)
				drawLayout.Dispose ();

		}
		void RenderLineNumberIcon (Widget widget, Cairo.Context cr, Gdk.Rectangle cell_area, int markupHeight, int yOffset)
		{
			if (Frame == null)
				return;

			cr.Save ();

			#if CENTER_ROUNDED_RECTANGLE
			cr.Translate (cell_area.X + Padding, (cell_area.Y + (cell_area.Height - RoundedRectangleHeight) / 2.0));
			#else
			cr.Translate (cell_area.X + Padding, cell_area.Y + Padding + yOffset);
			#endif

			cr.Antialias = Cairo.Antialias.Subpixel;

			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.Clip ();

			if (IsUserCode)
				cr.SetSourceRGBA (0.90, 0.60, 0.87, 1.0); // 230, 152, 223
			else
				cr.SetSourceRGBA (0.77, 0.77, 0.77, 1.0); // 197, 197, 197

			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.Fill ();

			cr.SetSourceRGBA (0.0, 0.0, 0.0, 0.11);
			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.LineWidth = 2;
			cr.Stroke ();

			var lineNumber = !string.IsNullOrEmpty (Frame.File) ? Frame.Line : -1;

			using (var layout = PangoUtil.CreateLayout (widget, lineNumber != -1 ? lineNumber.ToString () : "???")) {
				layout.Alignment = Pango.Alignment.Left;
				layout.FontDescription = LineNumberFont;

				int width, height;
				layout.GetPixelSize (out width, out height);

				double y_offset = (RoundedRectangleHeight - height) / 2.0;
				double x_offset = (RoundedRectangleWidth - width) / 2.0;

				// render the text shadow
				cr.Save ();
				cr.SetSourceRGBA (0.0, 0.0, 0.0, 0.34);
				cr.Translate (x_offset, y_offset + 1);
				cr.ShowLayout (layout);
				cr.Restore ();

				cr.SetSourceRGBA (1.0, 1.0, 1.0, 1.0);
				cr.Translate (x_offset, y_offset);
				cr.ShowLayout (layout);
			}

			cr.Restore ();
		}
		public override void DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset)
		{
			this.editor = editor;
			int markerStart = base.Offset;
			int markerEnd = base.EndOffset;

			if (markerEnd < startOffset || markerStart > endOffset)
				return;

			double @from;
			double to;
			var startXPos = metrics.TextRenderStartPosition;
			var endXPos = metrics.TextRenderEndPosition;
			var y = metrics.LineYRenderStartPosition;
			if (markerStart < startOffset && endOffset < markerEnd) {
				@from = startXPos;
				to = endXPos;
			} else {
				int start = startOffset < markerStart ? markerStart : startOffset;
				int end = endOffset < markerEnd ? endOffset : markerEnd;

				uint curIndex = 0, byteIndex = 0;
				TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(start - startOffset), ref curIndex, ref byteIndex);

				int x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;

				@from = startXPos + (int)(x_pos / Pango.Scale.PangoScale);

				TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(end - startOffset), ref curIndex, ref byteIndex);
				x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;

				to = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}

			@from = Math.Max (@from, editor.TextViewMargin.XOffset);
			to = Math.Max (to, editor.TextViewMargin.XOffset);
			if (@from < to) {
				cr.SetSourceColor (background(editor).Color);
				cr.RoundedRectangle (@from + 2.5, y + 0.5, to - @from, editor.LineHeight - 1, 2); // 2.5 to make space for the column guideline

				if (background(editor).HasBorderColor) {
					cr.FillPreserve ();

					cr.SetSourceColor (background(editor).BorderColor);
					cr.Stroke ();
				} else {
					cr.Fill ();
				}
			}
		}
 protected virtual void DrawHoverBackground(Cairo.Context ctx)
 {
     if (BorderPadding <= 0) {
         ctx.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
         ctx.SetSourceColor (CairoExtensions.ParseColor (HoverBackgroundColor));
         ctx.Fill ();
         ctx.MoveTo (Allocation.X, Allocation.Y + 0.5);
         ctx.RelLineTo (Allocation.Width, 0);
         ctx.MoveTo (Allocation.X, Allocation.Y + Allocation.Height - 0.5);
         ctx.RelLineTo (Allocation.Width, 0);
         if (DrawRightBorder) {
             ctx.MoveTo (Allocation.Right + 0.5, Allocation.Y + 0.5);
             ctx.LineTo (Allocation.Right + 0.5, Allocation.Bottom - 0.5);
         }
         if (DrawLeftBorder) {
             ctx.MoveTo (Allocation.Left + 0.5, Allocation.Y + 0.5);
             ctx.LineTo (Allocation.Left + 0.5, Allocation.Bottom - 0.5);
         }
         ctx.LineWidth = 1;
         ctx.SetSourceColor (CairoExtensions.ParseColor (HoverBorderColor));
         ctx.Stroke ();
     }
     else {
         Gdk.Rectangle region = Allocation;
         region.Inflate (-BorderPadding, -BorderPadding);
         ctx.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 3);
         ctx.SetSourceColor (CairoExtensions.ParseColor (HoverBackgroundColor));
         ctx.FillPreserve ();
         ctx.LineWidth = 1;
         ctx.SetSourceColor (CairoExtensions.ParseColor (HoverBorderColor));
         ctx.Stroke ();
     }
 }
		public override void DrawAfterEol (MonoTextEditor textEditor, Cairo.Context g, EndOfLineMetrics metrics)
		{
			if (!IsVisible)
				return;
			EnsureLayoutCreated (editor);
			int errorCounterWidth = 0, eh = 0;
			if (errorCountLayout != null) {
				errorCountLayout.GetPixelSize (out errorCounterWidth, out eh);
				errorCounterWidth = Math.Max (15, Math.Max (errorCounterWidth + 3, (int)(editor.LineHeight * 3 / 4)));
			}

			var sx = metrics.TextRenderEndPosition;
			var width = LayoutWidth + errorCounterWidth + editor.LineHeight;
			var drawLayout = layouts[0].Layout;
			var y = metrics.LineYRenderStartPosition;
			bool customLayout = true; //sx + width > editor.Allocation.Width;
			bool hideText = false;
			bubbleIsReduced = customLayout;
			var showErrorCount = errorCounterWidth > 0 && errorCountLayout != null;
			double roundingRadius = editor.LineHeight / 2 - 1;

			if (customLayout) {
				width = editor.Allocation.Width - sx;
				string text = layouts[0].Layout.Text;
				drawLayout = new Pango.Layout (editor.PangoContext);
				drawLayout.FontDescription = cache.fontDescription;
				var paintWidth = (width - errorCounterWidth - editor.LineHeight + 4);
				var minWidth = Math.Max (25, errorCounterWidth) * editor.Options.Zoom;
				if (paintWidth < minWidth) {
					hideText = true;
					showErrorCount = false;
//					drawLayout.SetMarkup ("<span weight='heavy'>···</span>");
					width = minWidth;
					//roundingRadius = 10 * editor.Options.Zoom;
					sx = Math.Min (sx, editor.Allocation.Width - width);
				} else {
					drawLayout.Ellipsize = Pango.EllipsizeMode.End;
					drawLayout.Width = (int)(paintWidth * Pango.Scale.PangoScale);
					drawLayout.SetText (text);
					int w2, h2;
					drawLayout.GetPixelSize (out w2, out h2);
					width = w2 + errorCounterWidth + editor.LineHeight - 2;
				}
			}

			bubbleDrawX = sx - editor.TextViewMargin.XOffset;
			bubbleDrawY = y + 2;
			bubbleWidth = width;
			var bubbleHeight = editor.LineHeight;

			g.RoundedRectangle (sx, y, width, bubbleHeight, roundingRadius);
			g.SetSourceColor (TagColor.Color);
			g.Fill ();

			// Draw error count icon
			if (showErrorCount) {
				var errorCounterHeight = bubbleHeight - 2;
				var errorCounterX = sx + width - errorCounterWidth - 1;
				var errorCounterY = Math.Round (y + (bubbleHeight - errorCounterHeight) / 2);

				g.RoundedRectangle (
					errorCounterX, 
					errorCounterY, 
					errorCounterWidth, 
					errorCounterHeight, 
					editor.LineHeight / 2 - 2
				);

				using (var lg = new Cairo.LinearGradient (errorCounterX, errorCounterY, errorCounterX, errorCounterY + errorCounterHeight)) {
					lg.AddColorStop (0, CounterColor.Color);
					lg.AddColorStop (1, CounterColor.Color.AddLight (-0.1));
					g.SetSource (lg);
					g.Fill ();
				}

				g.Save ();

				int ew;
				errorCountLayout.GetPixelSize (out ew, out eh);

				var tx = Math.Round (errorCounterX + (2 + errorCounterWidth - ew) / 2);
				var ty = Math.Round (errorCounterY + (-1 + errorCounterHeight - eh) / 2);

				g.Translate (tx, ty);
				g.SetSourceColor (CounterColor.SecondColor);
				g.ShowLayout (errorCountLayout);
				g.Restore ();
			}

			if (hideText) {
				// Draw dots
				double radius = 2 * editor.Options.Zoom;
				double spacing = 1 * editor.Options.Zoom;

				sx += 1 * editor.Options.Zoom + Math.Ceiling((bubbleWidth - 3 * (radius * 2) - 2 * spacing) / 2);

				for (int i = 0; i < 3; i++) {
					g.Arc (sx, y + bubbleHeight / 2, radius, 0, Math.PI * 2);
					g.SetSourceColor (TagColor.SecondColor);
					g.Fill ();
					sx += radius * 2 + spacing;
				}
			} else {
				// Draw label text
				var tx = Math.Round (sx + editor.LineHeight / 2);
				var ty = Math.Round (y + (editor.LineHeight - layouts [0].Height) / 2) - 1;

				g.Save ();
				g.Translate (tx, ty);

				g.SetSourceColor (TagColor.SecondColor);
				g.ShowLayout (drawLayout);
				g.Restore ();
			}

			if (customLayout)
				drawLayout.Dispose ();
		}
		void RenderBackground (Cairo.Context context, Gdk.Rectangle region)
		{
			region.Inflate (-Padding, -Padding);
			context.RenderOuterShadow (new Gdk.Rectangle (region.X + 10, region.Y + 15, region.Width - 20, region.Height - 15), Padding, 3, .25);

			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 5);
			using (var lg = new LinearGradient (0, region.Y, 0, region.Bottom)) {
				lg.AddColorStop (0, new Cairo.Color (.36, .53, .73));
				lg.AddColorStop (1, new Cairo.Color (.21, .37, .54));

				context.SetSource (lg);
				context.FillPreserve ();
			}

			context.LineWidth = 1;
			context.SetSourceRGB (.29, .47, .67);
			context.Stroke ();
		}
		void RenderButton (Cairo.Context context, Gdk.Point corner, double opacity, bool hovered)
		{
			Gdk.Rectangle region = new Gdk.Rectangle (corner.X,
			                                          corner.Y,
			                                          ButtonSize.Width, ButtonSize.Height);



			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 3);
			using (var lg = new LinearGradient (0, region.Top, 0, region.Bottom)) {
				if (hovered) {
					lg.AddColorStop (0, new Cairo.Color (.15, .76, .09, opacity));
					lg.AddColorStop (1, new Cairo.Color (.41, .91, .46, opacity));
				} else {
					lg.AddColorStop (0, new Cairo.Color (.41, .91, .46, opacity));
					lg.AddColorStop (1, new Cairo.Color (.15, .76, .09, opacity));
				}

				context.SetSource (lg);
				context.FillPreserve ();
			}

			context.SetSourceRGBA (.29, .79, .28, opacity);
			context.LineWidth = 1;
			context.Stroke ();

			region.Inflate (-1, -1);
			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 2);

			using (var lg = new LinearGradient (0, region.Top, 0, region.Bottom)) {
				lg.AddColorStop (0, new Cairo.Color (1, 1, 1, .74 * opacity));
				lg.AddColorStop (0.1, new Cairo.Color (1, 1, 1, 0));
				lg.AddColorStop (0.9, new Cairo.Color (0, 0, 0, 0));
				lg.AddColorStop (1, new Cairo.Color (0, 0, 0, .34 * opacity));

				context.SetSource (lg);
				context.Stroke ();
			}

			using (var layout = ButtonLayout (PangoContext)) {
				int w, h;
				layout.GetPixelSize (out w, out h);

				RenderShadowedText (context, new Gdk.Point (corner.X + ButtonSize.Width / 2 - w / 2, corner.Y + ButtonSize.Height / 2 - h / 2 - 1), opacity, layout);
			}
		}
			public override bool DrawBackground (TextEditor editor, Cairo.Context cr, double y, LineMetrics metrics)
			{
				if (metrics.SelectionStart >= 0 || editor.CurrentMode is TextLinkEditMode || editor.TextViewMargin.SearchResultMatchCount > 0)
					return false;
				foreach (var usage in Usages) {
					int markerStart = usage.TextSegment.Offset;
					int markerEnd = usage.TextSegment.EndOffset;
					
					if (markerEnd < metrics.TextStartOffset || markerStart > metrics.TextEndOffset) 
						return false; 
					
					double @from;
					double to;
					
					if (markerStart < metrics.TextStartOffset && metrics.TextEndOffset < markerEnd) {
						@from = metrics.TextRenderStartPosition;
						to = metrics.TextRenderEndPosition;
					} else {
						int start = metrics.TextStartOffset < markerStart ? markerStart : metrics.TextStartOffset;
						int end = metrics.TextEndOffset < markerEnd ? metrics.TextEndOffset : markerEnd;
						
						uint curIndex = 0, byteIndex = 0;
						TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(start - metrics.TextStartOffset), ref curIndex, ref byteIndex);
						
						int x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;
						
						@from = metrics.TextRenderStartPosition + (int)(x_pos / Pango.Scale.PangoScale);
						
						TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(end - metrics.TextStartOffset), ref curIndex, ref byteIndex);
						x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;
			
						to = metrics.TextRenderStartPosition + (int)(x_pos / Pango.Scale.PangoScale);
					}
		
					@from = System.Math.Max (@from, editor.TextViewMargin.XOffset);
					to = System.Math.Max (to, editor.TextViewMargin.XOffset);
					if (@from < to) {
						Mono.TextEditor.Highlighting.AmbientColor colorStyle;
						if ((usage.UsageType & ReferenceUsageType.Write) == ReferenceUsageType.Write) {
							colorStyle = editor.ColorStyle.ChangingUsagesRectangle;
						} else {
							colorStyle = editor.ColorStyle.UsagesRectangle;
						}

						using (var lg = new LinearGradient (@from + 1, y + 1, to , y + editor.LineHeight)) {
							lg.AddColorStop (0, colorStyle.Color);
							lg.AddColorStop (1, colorStyle.SecondColor);
							cr.SetSource (lg);
							cr.RoundedRectangle (@from + 0.5, y + 1.5, to - @from - 1, editor.LineHeight - 2, editor.LineHeight / 4);
							cr.FillPreserve ();
						}
						
						cr.SetSourceColor (colorStyle.BorderColor);
						cr.Stroke ();
					}
				}
				return true;
			}
		void RenderBackground (Cairo.Context context, Gdk.Rectangle region)
		{
			region.Inflate (-Padding, -Padding);
			context.RenderOuterShadow (new Gdk.Rectangle (region.X + 10, region.Y + 15, region.Width - 20, region.Height - 15), Padding, 3, .25);

			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 5);
			using (var lg = new LinearGradient (0, region.Y, 0, region.Bottom)) {
				lg.AddColorStop (0, new Cairo.Color (.36, .53, .73));
				lg.AddColorStop (1, new Cairo.Color (.21, .37, .54));

				context.Pattern = lg;
				context.FillPreserve ();
			}

			context.Save ();
			context.Translate (IconPosition.X, IconPosition.Y);
			context.Scale (0.75, 0.75);
			Gdk.CairoHelper.SetSourcePixbuf (context, starburst, -starburst.Width / 2, -starburst.Height / 2);
			context.FillPreserve ();
			context.Restore ();

			context.LineWidth = 1;
			context.Color = new Cairo.Color (.29, .47, .67);
			context.Stroke ();

		}
Example #11
0
		public override bool DrawBackground (TextEditor editor, Cairo.Context cr, double y, LineMetrics metrics)
		{
			// check, if a message bubble is active in that line.
			if (LineSegment != null && LineSegment.Markers.Any (m => m != this && (m is IExtendingTextLineMarker)))
				return false;

			var sidePadding = 4;
			var rounding = editor.LineHeight / 2 - 1;

			var d = metrics.TextRenderEndPosition - metrics.TextRenderStartPosition;
			if (d > 0) {
				cr.LineWidth = 1;
				cr.RoundedRectangle (metrics.TextRenderStartPosition, Math.Floor (y) + 0.5, d + sidePadding, metrics.LineHeight - 1, rounding);
				cr.SetSourceColor (BackgroundColor); 
				cr.FillPreserve ();
				cr.SetSourceColor (BorderColor); 
				cr.Stroke ();
			}

			return base.DrawBackground (editor, cr, y, metrics);
		}
		protected override void OnRender (Cairo.Context context)
		{
			context.RoundedRectangle (0.5, 0.5, Width - 1, Height - 1, Rounding);
			if (Relief) {
				using (var lg = new Cairo.LinearGradient (0, 0, 0, Height)) {
					CreateGradient (lg, State, Opacity);
					context.Pattern = lg;
					context.FillPreserve ();
				}
				
				context.LineWidth = 1;
				context.Color = new Cairo.Color (0.8, 0.8, 0.8, Opacity);
				context.StrokePreserve ();
			}
			context.Clip ();
			base.OnRender (context);
		}
		protected override void OnLayoutOutline (Cairo.Context context)
		{
			context.RoundedRectangle (0, 0, Width, Height, Height / 2);
		}
		void DrawOutline (Cairo.Context context, Gdk.Rectangle region, double opacity)
		{
			int rounding = (region.Height - 2) / 2;
			context.RoundedRectangle (region.X + 0.5, region.Y + 1.5, region.Width - 1, region.Height - 2, rounding);
			using (var lg = new Cairo.LinearGradient (0, region.Y, 0, region.Bottom)) {
				lg.AddColorStop (0, CairoExtensions.ParseColor ("f2f2f2", opacity));
				lg.AddColorStop (1, CairoExtensions.ParseColor ("e7e7e7", opacity));
				context.Pattern = lg;
				context.LineWidth = 1;
				context.Stroke ();
			}
			
			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 2, rounding);
			using (var lg = new Cairo.LinearGradient (0, region.Y, 0, region.Bottom)) {
				lg.AddColorStop (0, CairoExtensions.ParseColor ("c7c7c7", opacity));
				lg.AddColorStop (1, CairoExtensions.ParseColor ("bcbcbc", opacity));
				context.Pattern = lg;
				context.LineWidth = 1;
				context.Stroke ();
			}
		}
		void ClipBackground (Cairo.Context context, Gdk.Rectangle region)
		{
			int rounding = (region.Height - 2) / 2;
			context.RoundedRectangle (region.X, region.Y + 2, region.Width, region.Height - 4, rounding);
			context.Clip ();
		}