protected override bool OnExposeEvent(EventExpose evnt) { base.OnExposeEvent(evnt); using (var e = CairoHelper.Create(evnt.Window)) { Render(e); } return(true); }
protected override bool OnExposeEvent(EventExpose args) { Context g = CairoHelper.Create(GdkWindow); DrawShape(g, Allocation.Width, Allocation.Height); //base.OnExposeEvent (args); g.Dispose(); return(false); }
protected override bool OnExposeEvent(EventExpose evnt) { using (var context = Gdk.CairoHelper.Create(evnt.Window)) { DrawBackground(context, Allocation, 15, State); var icon = GetIcon(); context.DrawImage(this, icon, Allocation.X + Math.Max(0, (Allocation.Width - icon.Width) / 2), Allocation.Y + Math.Max(0, (Allocation.Height - icon.Height) / 2)); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { using (Cairo.Context c = Gdk.CairoHelper.Create(evnt.Window)) { var area = LocalAllocation; //evnt.Area Draw(evnt.Window, c, area, StateType.Selected); } return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { if (this.Image == null) { return(true); } int x1 = this.Parent.Allocation.X; int y1 = this.Parent.Allocation.Y; int num1 = this.Parent.Allocation.X + this.Parent.Allocation.Width - 1; int y2 = this.Parent.Allocation.Y; int num2 = this.Parent.Allocation.X + this.Parent.Allocation.Width - 1; int num3 = this.Parent.Allocation.Y + this.Parent.Allocation.Height - 1; int x2 = this.Parent.Allocation.X; int num4 = this.Parent.Allocation.Y + this.Parent.Allocation.Height - 1; bool flag = false; if (this.FocusShowBackGround) { flag = true; } else if (this.IsShowCustomStyle.HasValue) { if (this.IsShowCustomStyle.Value) { flag = true; } else { this.Parent.GdkWindow.DrawRectangle(new GC((Drawable)this.Parent.GdkWindow) { RgbFgColor = this.FocusBackGroundColor }, true, new Rectangle(x1, y1, this.Parent.Allocation.Width, this.Parent.Allocation.Height)); GC gc = new GC((Drawable)this.Parent.GdkWindow); gc.RgbFgColor = this.FocusBorderColor; this.Parent.GdkWindow.DrawLine(gc, x1, y1, num1, y2); this.Parent.GdkWindow.DrawLine(gc, num1, y2, num2, num3); this.Parent.GdkWindow.DrawLine(gc, num2, num3, x2, num4); this.Parent.GdkWindow.DrawLine(gc, x2, num4, x1, y1); } } else { this.Parent.GdkWindow.DrawRectangle(new GC((Drawable)this.Parent.GdkWindow) { RgbFgColor = this.BackGroundColor }, true, new Rectangle(x1, y1, this.Parent.Allocation.Width, this.Parent.Allocation.Height)); } if (flag) { this.Parent.GdkWindow.DrawRectangle(new GC((Drawable)this.Parent.GdkWindow) { RgbFgColor = this.ClickBackGroundColor }, true, new Rectangle(x1, y1, this.Parent.Allocation.Width, this.Parent.Allocation.Height)); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { if (DoNotRenderNullModel && Model == null) { return(true); } var damage = new Rectangle(); foreach (Rectangle rect in evnt.Region.GetRectangles()) { damage = damage.Union(rect); } cairo_context = CairoHelper.Create(evnt.Window); cell_context.Layout = PangoLayout; cell_context.Context = cairo_context; // FIXME: legacy list foo if (ViewLayout == null) { OnMeasure(); } Theme.DrawFrameBackground(cairo_context, Allocation, true); // FIXME: ViewLayout will never be null in the future but we'll need // to deterministically render a header somehow... if (header_visible && ViewLayout == null && column_controller != null) { PaintHeader(damage); } if (Model != null) { // FIXME: ViewLayout will never be null in // the future, PaintList will go away if (ViewLayout == null) { PaintList(damage); } else { PaintView((Rect)damage); } } Theme.DrawFrameBorder(cairo_context, Allocation); PaintDraggingColumn(damage); CairoExtensions.DisposeContext(cairo_context); return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { using (var cr = CairoHelper.Create(evnt.Window)) { cr.Color = (Mono.TextEditor.HslColor)Style.Dark(StateType.Normal); cr.Rectangle(0, 0, Allocation.Width, Allocation.Height); cr.Fill(); } return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { base.OnExposeEvent(evnt); int winWidth, winHeight; this.GetSize(out winWidth, out winHeight); this.GdkWindow.DrawRectangle(this.Style.ForegroundGC(StateType.Insensitive), false, 0, 0, winWidth - 1, winHeight - 1); return(false); }
protected override bool OnExposeEvent(EventExpose evnt) { if (canvas != null) { GdkWindow.DrawDrawable(Style.BackgroundGC(State), canvas, 0, 0, widget_alloc.X, widget_alloc.Y, widget_alloc.Width, widget_alloc.Height); return(true); } return(base.OnExposeEvent(evnt)); }
protected virtual void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args) { EventExpose evnt = args.Event; drawingarea.GdkWindow.DrawDrawable(drawingarea.Style.ForegroundGCs[(int)drawingarea.State], pixmap, evnt.Area.X, evnt.Area.Y, evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height); }
protected override void OnExpose(object o, ExposeEventArgs args) { Gdk.GC gc1; Gdk.Color color = new Gdk.Color(); EventExpose eventExpose = args.Event; Gdk.Window window = eventExpose.Window; gc1 = new Gdk.GC(window); color.Red = 0; color.Green = 0; color.Blue = 0; gc1.RgbFgColor = color; color.Red = 65535; color.Green = 65535; color.Blue = 65535; gc1.RgbBgColor = color; window.DrawLine(gc1, 20, 20, 350, 399); using (Graphics g = args.Window){ Pen p = new Pen(Color.Black, 1.0f); foreach (object[] row in store) { string a = row[0] + ""; string[] ps = a.Split(new Char [] { ' ' }); switch (ps[0].ToLower().ToCharArray()[0]) { case 's': { CurrentPoint.x = Single.Parse(ps[1]); CurrentPoint.y = Single.Parse(ps[2]); break; } case 'l': { drawLineTo(new Point(Single.Parse(ps[1]), Single.Parse(ps[2])), g); break; } case 'c': { drawBezier(new Point(Single.Parse(ps[1]), Single.Parse(ps[2])), new Point(Single.Parse(ps[3]), Single.Parse(ps[4])), new Point(Single.Parse(ps[5]), Single.Parse(ps[6])), g); break; } } } } }
protected override bool OnExposeEvent(EventExpose args) { bool ret = base.OnExposeEvent(args); foreach (Rectangle area in args.Region.GetRectangles()) { DrawSelection(area); } return(ret); }
protected override bool OnExposeEvent(EventExpose evnt) { if (IsDrawable) { Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow); cr.Operator = Cairo.Operator.Source; cr.Paint(); (cr as IDisposable).Dispose(); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { if (pb == null) { return(true); } double sf = 1.0; // pixbuf scale factor // if any image dimension > widget area => calc downscale factor if ((pb.Width > evnt.Area.Width) || (pb.Height > evnt.Area.Height)) { double sfWidth = (double)evnt.Area.Width / pb.Width; double sfHeight = (double)evnt.Area.Height / pb.Height; sf = Math.Min(sfWidth, sfHeight); } // adjust selection area size to that of the pixbuf int width = (int)(pb.Width * sf); int height = (int)(pb.Height * sf); // center in the widget area double x = Math.Floor(evnt.Area.X + (evnt.Area.Width / 2.0) - (width / 2.0)); double y = Math.Floor(evnt.Area.Y + (evnt.Area.Height / 2.0) - (height / 2.0)); using (Context cr = Gdk.CairoHelper.Create(evnt.Window)) { cr.MoveTo(x, y); if (RoundedCorners && !isIcon && (width > MIN_LEN_FOR_CORNERS) && (height > MIN_LEN_FOR_CORNERS)) { cr.Arc(x + width - RADIUS, y + RADIUS, RADIUS, Math.PI * 1.5, Math.PI * 2); cr.Arc(x + width - RADIUS, y + height - RADIUS, RADIUS, 0, Math.PI * .5); cr.Arc(x + RADIUS, y + height - RADIUS, RADIUS, Math.PI * .5, Math.PI); cr.Arc(x + RADIUS, y + RADIUS, RADIUS, Math.PI, Math.PI * 1.5); cr.Clip(); cr.NewPath(); } // set pixbuf source downscale if (sf < 1.0) { cr.Scale(sf, sf); } // set pixbuf source CairoHelper.SetSourcePixbuf(cr, pb, Math.Floor(x / sf), Math.Floor(y / sf)); // paint pixbuf source cr.Paint(); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { if (Visible) { DrawTimeNodes(evnt.Window); //We don't need the draw the Sections Names if we also draw the TimeNode name //DrawSectionName(); DrawTimeNodesName(); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { if (image != null) { var alloc = Allocation; alloc.Inflate(-Xpad, -Ypad); using (var ctx = CairoHelper.Create(evnt.Window)) { // FIXME: Use the ImageView canvas var context = new CairoContext(ctx); var width = WidthRequest > 0 ? WidthRequest : image.Width; var height = HeightRequest > 0 ? HeightRequest : image.Height; var point = new Point(alloc.X, alloc.Y); // If the image is smaller than the allocated size, center it without scalling it if (alloc.Width > width && alloc.Height > height) { point.X += (alloc.Width - width) / 2; point.Y += (alloc.Height - height) / 2; } // Otherwise use the whole allocated space and let DrawImage scale correctly to keep DAR else { width = alloc.Width; height = alloc.Height; } App.Current.DrawingToolkit.Context = context; Point center = new Point(point.X + width / 2, point.Y + height / 2); double radius = Math.Min(height, width) / 2; // Apply shadow if (HasShadow) { App.Current.DrawingToolkit.FillColor = ShadowColor; App.Current.DrawingToolkit.LineWidth = 0; App.Current.DrawingToolkit.DrawCircle(new Point(center.X + 1, center.Y + 1), radius); } // Give shape to the image if (Circular) { App.Current.DrawingToolkit.ClipCircle(center, radius); } // Draw image var alpha = IsParentUnsensitive ? 0.4f : 1f; App.Current.DrawingToolkit.FillColor = MaskColor; App.Current.DrawingToolkit.DrawImage(point, width, height, image, ScaleMode.AspectFit, MaskColor != null, alpha); } } return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { var ret = base.OnExposeEvent(evnt); if (image.Pixbuf == null) { using (var cr = CairoHelper.Create(evnt.Window)) { cr.Rectangle(evnt.Region.Clipbox.X, evnt.Region.Clipbox.Y, evnt.Region.Clipbox.Width, evnt.Region.Clipbox.Height); cr.Clip(); var imgAlloc = image.Allocation; cr.Translate(imgAlloc.X, imgAlloc.Y); using (var layout = new Pango.Layout(PangoContext)) { layout.SetText(string.Format("({0}x{1})", RecommendedSize.Width, RecommendedSize.Height)); layout.Width = (int)(imgAlloc.Width * Pango.Scale.PangoScale); layout.Wrap = Pango.WrapMode.WordChar; layout.Alignment = Pango.Alignment.Center; int pw, ph; layout.GetPixelSize(out pw, out ph); cr.MoveTo(0, (imgAlloc.Height - ph) / 2); cr.Color = new Cairo.Color(0.5, 0.5, 0.5); cr.ShowLayout(layout); } CairoExtensions.RoundedRectangle(cr, 5, 5, imgAlloc.Width - 10, imgAlloc.Height - 10, 5); cr.LineWidth = 3; cr.Color = new Cairo.Color(0.8, 0.8, 0.8); cr.SetDash(new double[] { 12, 2 }, 0); cr.Stroke(); } } else if (RecommendedSize != Size.Empty && imageSize != RecommendedSize) { using (var cr = CairoHelper.Create(evnt.Window)) { cr.Rectangle(evnt.Region.Clipbox.X, evnt.Region.Clipbox.Y, evnt.Region.Clipbox.Width, evnt.Region.Clipbox.Height); cr.Clip(); var imgAlloc = image.Allocation; cr.Translate(imgAlloc.X + displaySize.Width - WarningIcon.Width - 3, imgAlloc.Y + displaySize.Height - WarningIcon.Height); CairoHelper.SetSourcePixbuf(cr, WarningIcon, 0, 0); cr.Rectangle(0, 0, WarningIcon.Width, WarningIcon.Height); cr.Fill(); } } return(ret); }
protected override bool OnExposeEvent(EventExpose args) { base.OnExposeEvent(args); Context context = CairoHelper.Create(args.Window); IPaintbrush pb = new GtkPaintbrush(this, context); CanvasModel.Paint(pb); (context.Target as IDisposable).Dispose(); (context as IDisposable).Dispose(); return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { GdkWindow.Background = new Gdk.Color(0, 0, 0); GdkWindow.Clear(); if (mImage != null && _RenderedPicture != null) { Rectangle r = CurrentImagePosition; GdkWindow.DrawPixbuf(new Gdk.GC(GdkWindow), _RenderedPicture, 0, 0, r.X, r.Y, r.Width, r.Height, RgbDither.None, 0, 0); // If panning, draw panning scheme if (mPanInProgress) { int size_divider = 10; Rectangle screen_rect = new Rectangle( Allocation.Width / 2 - Allocation.Width / size_divider / 2, Allocation.Height / 2 - Allocation.Height / size_divider / 2, Allocation.Width / size_divider, Allocation.Height / size_divider); Rectangle picture_rect = new Rectangle( Allocation.Width / 2 - Allocation.Width / size_divider / 2 + mImageCenterX / size_divider - _RenderedPicture.Width / size_divider / 2, Allocation.Height / 2 - Allocation.Height / size_divider / 2 + mImageCenterY / size_divider - _RenderedPicture.Height / size_divider / 2, _RenderedPicture.Width / size_divider, _RenderedPicture.Height / size_divider ); using (Gdk.GC gc = new Gdk.GC(GdkWindow)) { gc.Function = Gdk.Function.Xor; gc.RgbFgColor = new Gdk.Color(255, 255, 0); GdkWindow.DrawRectangle(gc, false, screen_rect); gc.RgbFgColor = new Gdk.Color(255, 255, 255); GdkWindow.DrawRectangle(gc, false, picture_rect); gc.Function = Gdk.Function.Clear; } } //this.SetSizeRequest(_RenderedPicture.Width, _RenderedPicture.Height); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { Cairo.Context cairo; using (cairo = Gdk.CairoHelper.Create(GdkWindow)) { cairo.Rectangle(evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height); cairo.SetSourceRGBA(1.0, 1.0, 1.0, 0.0); cairo.Operator = Cairo.Operator.Source; cairo.Paint(); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { Gdk.GC gc = Style.DarkGC(State); evnt.Window.DrawLine(gc, Allocation.X, Allocation.Top, Allocation.X, Allocation.Bottom); evnt.Window.DrawLine(gc, Allocation.Right, Allocation.Top, Allocation.Right, Allocation.Bottom); evnt.Window.DrawLine(gc, Allocation.Left, Allocation.Y, Allocation.Right, Allocation.Y); evnt.Window.DrawLine(gc, Allocation.Left, Allocation.Bottom, Allocation.Right, Allocation.Bottom); return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { bool res = base.OnExposeEvent(evnt); cell.Initialize(this, em, property, obj); Gdk.Rectangle rect = Allocation; rect.Inflate(-3, 0); // Add some margin cell.Render(this.GdkWindow, rect, StateType.Normal); return(res); }
protected override bool OnExposeEvent(EventExpose evnt) { using (var context = Gdk.CairoHelper.Create(evnt.Window)) { DrawBackground(context, Allocation, 15, State); var icon = GetIcon(); icon.Show( context, Allocation.X + (icon.Width - Allocation.Width) / 2, Allocation.Y + (icon.Height - Allocation.Height) / 2 ); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose ev) { if (!IsRealized) { return(false); } Gdk.GC context = new Gdk.GC(GdkWindow); context.RgbFgColor = Color; GdkWindow.DrawRectangle(context, true, ev.Area); return(true); }
protected override bool OnExposeEvent(EventExpose evnt) { int w, h; GetSize(out w, out h); using (var ctx = CairoHelper.Create(evnt.Window)) { ctx.SetSourceColor(new Cairo.Color(0.17, 0.55, 0.79)); ctx.Rectangle(Allocation.ToCairoRect()); ctx.Fill(); } return(true); }
// Expose callback for the drawing area private void ExposeEventCallback(object o, ExposeEventArgs args) { EventExpose eventExpose = args.Event; Gdk.Window window = eventExpose.Window; Rectangle area = eventExpose.Area; window.DrawRectangle(drawingArea.Style.BackgroundGC(StateType.Normal), true, area.X, area.Y, area.Width, area.Height); args.RetVal = true; }
protected override bool OnExposeEvent(EventExpose evnt) { using (Context context = CairoHelper.Create(base.GdkWindow)) { System.Drawing.Color color = System.Drawing.Color.FromArgb(255, 255, 255, 255); context.SetSourceRGBA((double)color.R / 255.0, (double)color.G / 255.0, (double)color.B / 255.0, 1.0); context.Rectangle(0.0, 0.0, 92.0, 52.0); context.Fill(); context.Stroke(); context.SetSourceRGBA(0.0, 0.0, 0.0, 1.0); context.SetFontSize(15.0); context.Antialias = Antialias.None; context.LineWidth = 1.0; context.MoveTo(5.0, 5.0); context.LineTo(5.0, this.currentHeight); context.MoveTo(5.0, 5.0); context.LineTo(this.currentWidth, 5.0); context.MoveTo(this.currentWidth, 5.0); context.LineTo(this.currentWidth, this.currentHeight); context.MoveTo(5.0, this.currentHeight); context.LineTo(this.currentWidth, this.currentHeight); context.Stroke(); System.Drawing.Color color2 = System.Drawing.Color.FromArgb(255, 100, 100, 100); context.SetSourceRGBA((double)color2.R / 255.0, (double)color2.G / 255.0, (double)color2.B / 255.0, 1.0); context.Rectangle(this.currentWidth / 2.0, this.currentHeight / 2.0, 6.0, 6.0); context.Fill(); context.Stroke(); context.Restore(); if (this.status) { this.currentWidth += 4.0; this.currentHeight += 2.0; } else { this.currentWidth -= 4.0; this.currentHeight -= 2.0; } if (this.currentHeight >= (double)(evnt.Area.Height - 5)) { this.status = false; } if (this.currentHeight < 30.0) { this.status = true; } base.GrabFocus(); context.Dispose(); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { if (this.windowWidth < 0 && this.windowHeight < 0) { this.GdkWindow.GetSize(out this.windowWidth, out this.windowHeight); } using (var context = CairoHelper.Create(this.GdkWindow)) { this.Draw(context); } return(base.OnExposeEvent(evnt)); }
protected override bool OnExposeEvent(EventExpose evnt) { bool res = base.OnExposeEvent(evnt); cell.Initialize(this, em, property, obj); Gdk.Rectangle rect = Allocation; rect.Inflate(-3, 0); // Add some margin using (Cairo.Context ctx = Gdk.CairoHelper.Create(this.GdkWindow)) { cell.Render(this.GdkWindow, ctx, rect, StateType.Normal); } return(res); }
protected override bool OnExposeEvent(EventExpose evnt) { var win = evnt.Window; int width, height; win.GetSize(out width, out height); using (var cairo = Gdk.CairoHelper.Create(win)) using (var gc = new Gdk.GC(win)) using (var la = new Pango.Layout(PangoContext)) { int index; if (!mTracker.Hovered || !CalculateIndexAtPosition(mTracker.MousePosition.X, out index)) { index = ActiveIndex; } // else { if (HoveredIndex != index) { HoveredIndex = index; if (Active) { CurrentTab = HoveredIndex; if (SelectTab != null) { SelectTab(this, new SelectTabEventArgs(HoveredIndex, false)); } } } } DrawRectangle(cairo, 0, 0, width, height, Style.Mid(StateType.Normal).ToCairo(), true); RecalcTabSize(la, index); DrawTabs(la, win, gc, cairo, index); TooltipText = string.Empty; if (index >= 0 && index < mTabs.Count()) { var t = mTabs.ElementAt(index); if (t.CurrentWidth != t.IdealWidth) { TooltipText = mTabs.ElementAt(index).Label; } } } return(true); }