Esempio n. 1
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Context g = Gdk.CairoHelper.Create(evnt.Window);

            g.Antialias = Antialias.None;
            int winh;
            int winw;

            evnt.Window.GetSize(out winw, out winh);
            Cairo.Distance d = new Cairo.Distance(winw, winh);
            //this.BasicDrawTest (g);
            this.DrawUnits(g, d);
            this.DrawMapGrid(g, d);
            this.DrawMouse(g, d);
            ((IDisposable)g).Dispose();
            return(true);
        }
Esempio n. 2
0
 protected override bool OnExposeEvent(Gdk.EventExpose evnt)
 {
     using (var context = Gdk.CairoHelper.Create(evnt.Window))
     {
         int alpha = blossom.Count + tick;
         for (int i = 0; i < blossom.Count; i++)
         {
             var petal = blossom[i];
             context.Color = new Cairo.Color(0, 0, 0, 0.1 + (alpha % blossom.Count) / (double)blossom.Count);
             context.MoveTo(petal.Start);
             context.LineTo(petal.End);
             context.Stroke();
             alpha--;
         }
     }
     return(base.OnExposeEvent(evnt));
 }
Esempio n. 3
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            bool ret = base.OnExposeEvent(evnt);

            if (evnt.Window != GdkWindow)
            {
                return(ret);
            }

            Gtk.Style.PaintHandle(Style, GdkWindow, State, ShadowType.In, evnt.Area, this, "entry", 0, 0, Allocation.Width, Allocation.Height, Orientation);

            //(Style, GdkWindow, StateType.Normal, ShadowType.In,
            //evnt.Area, this, "entry", 0, y_mid - y_offset, Allocation.Width,
            //Height + (y_offset * 2));

            return(ret);
        }
Esempio n. 4
0
            protected override void OnDrawContent(Gdk.EventExpose evnt, Cairo.Context g)
            {
                g.Rectangle(0, 0, Allocation.Width, Allocation.Height);
                g.SetSourceColor(marker.TooltipColor);
                g.Fill();

                using (var drawingLayout = new Pango.Layout(this.PangoContext)) {
                    drawingLayout.FontDescription = cache.tooltipFontDescription;

                    double y = verticalTextBorder;
                    var    showBulletedList = marker.Errors.Count > 1;

                    foreach (var msg in marker.Errors)
                    {
                        var icon = msg.IsError ? errorPixbuf : warningPixbuf;
                        int w, h;

                        if (!showBulletedList)
                        {
                            drawingLayout.Width = maxTextWidth;
                        }

                        drawingLayout.SetText(msg.FullErrorMessage);
                        drawingLayout.GetPixelSize(out w, out h);

                        if (showBulletedList)
                        {
                            g.Save();

                            g.Translate(textBorder, y + verticalTextSpace / 2 + Math.Max(0, (h - icon.Height) / 2));
                            g.DrawImage(this, icon, 0, 0);
                            g.Restore();
                        }

                        g.Save();

                        g.Translate(showBulletedList ? textBorder + iconTextSpacing + icon.Width: textBorder, y + verticalTextSpace / 2);
                        g.SetSourceColor(marker.TagColor2);
                        g.ShowLayout(drawingLayout);

                        g.Restore();

                        y += h + verticalTextSpace;
                    }
                }
            }
Esempio n. 5
0
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            if (null != tablePreviewBuf)
            {
                tablePreviewBuf.RenderToDrawable(
                    base.GdkWindow,
                    base.Style.BackgroundGC(Gtk.StateType.Normal),
                    0, 0, 0, 0, -1, -1,
                    Gdk.RgbDither.Normal, 0, 0);

                return(true);
            }
            else
            {
                return(base.OnExposeEvent(ev));
            }
        }
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            bool r = base.OnExposeEvent(ev);

            if (dropPosition != -1)
            {
                if (this.Orientation == Gtk.Orientation.Horizontal)
                {
                    GdkWindow.DrawRectangle(this.Style.BlackGC, true, dropPosition, Allocation.Y, 3, Allocation.Height);
                }
                else
                {
                    GdkWindow.DrawRectangle(this.Style.BlackGC, true, Allocation.X, dropPosition, Allocation.Width, 3);
                }
            }
            return(r);
        }
Esempio n. 7
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if (State == StateType.Selected)
            {
                Gtk.Style.PaintFlatBox(Style, evnt.Window, State, ShadowType.None, evnt.Area,
                                       this, "cell_odd", Allocation.X, Allocation.Y,
                                       Allocation.Width, Allocation.Height - (last ? 0 : 1));
            }

            if (!last)
            {
                Gtk.Style.PaintHline(Style, evnt.Window, StateType.Normal, evnt.Area, this, null,
                                     Allocation.X, Allocation.Right, Allocation.Bottom - 1);
            }

            return(base.OnExposeEvent(evnt));
        }
Esempio n. 8
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if (calendarItem != null)
            {
                int           triangleSize    = 25;
                Gdk.Rectangle targetRectangle = this.Allocation;
                evnt.Window.DrawRectangle(Style.BackgroundGC(State), true, targetRectangle);
                Style.PaintLayout(Style, evnt.Window, State, true, targetRectangle, this, null, targetRectangle.X, targetRectangle.Y, PangoText);

                //Верхний правый треугольник
                if (calendarItem.TagColor != "" && calendarItem.id > 0)
                {
                    Gdk.Color col = new Gdk.Color();
                    Gdk.Color.Parse(calendarItem.TagColor, ref col);
                    Gdk.GC TagGC = new Gdk.GC(evnt.Window);
                    TagGC.RgbFgColor = col;

                    Gdk.Point[] triangle = new Gdk.Point[]
                    {
                        new Gdk.Point(targetRectangle.X + targetRectangle.Width, targetRectangle.Top),
                        new Gdk.Point(targetRectangle.X + targetRectangle.Width - triangleSize, targetRectangle.Top),
                        new Gdk.Point(targetRectangle.X + targetRectangle.Width, targetRectangle.Top + triangleSize)
                    };
                    evnt.Window.DrawPolygon(TagGC, true, triangle);

                    if (calendarItem.Tag != "")
                    {
                        Pango.Rectangle logicExt, inkExt;
                        PangoTag.GetPixelExtents(out inkExt, out logicExt);
                        evnt.Window.DrawLayout(Style.WhiteGC, targetRectangle.Right - triangleSize * 5 / 16 - logicExt.Width / 2, targetRectangle.Top + triangleSize * 5 / 16 - logicExt.Height / 2, PangoTag);
                    }
                }

                if (calendarItem.MessageCount > 0)
                {
                    Pango.Rectangle logicExt, inkExt;
                    PangoMessages.GetPixelExtents(out inkExt, out logicExt);
                    var messagebox = new Gdk.Rectangle(targetRectangle.Right - logicExt.Width, targetRectangle.Bottom - logicExt.Height, logicExt.Height, logicExt.Width);
                    evnt.Window.DrawLayoutWithColors(Style.BlackGC, targetRectangle.Right - logicExt.Width + 1, targetRectangle.Bottom - logicExt.Height + 1, PangoMessages, ColorUtil.Create("Cornsilk"), ColorUtil.Create("Gray"));
                }

                return(true);
            }

            return(base.OnExposeEvent(evnt));
        }
            protected override bool OnExposeEvent(Gdk.EventExpose evnt)
            {
                using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                    const int triangleWidth  = 8;
                    const int triangleHeight = 4;

                    cr.SetSourceColor(SyntaxHighlightingService.GetColor(DefaultSourceEditorOptions.Instance.GetEditorTheme(), EditorThemeColors.LineNumbers));
                    var topPosition = Allocation.Height / 2 - triangleHeight / 2;

                    cr.MoveTo(Allocation.Width / 2 + triangleWidth / 2, topPosition);
                    cr.LineTo(Allocation.Width / 2 - triangleWidth / 2, topPosition);
                    cr.LineTo(Allocation.Width / 2, topPosition + triangleHeight);
                    cr.LineTo(Allocation.Width / 2 + triangleWidth / 2, topPosition);
                    cr.Fill();
                }
                return(true);
            }
Esempio n. 10
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            var alloc = new Gdk.Rectangle(alignment.Allocation.X, box.Allocation.Y, alignment.Allocation.Width, box.Allocation.Height);

            if (hasFrame && (!roundedShape || (roundedShape && !customRoundedShapeDrawing)))
            {
                Style.PaintShadow(entry.Style, GdkWindow, StateType.Normal, ShadowType.In,
                                  evnt.Area, entry, "entry", alloc.X, alloc.Y, alloc.Width, alloc.Height);

/*				using (var ctx = Gdk.CairoHelper.Create (GdkWindow)) {
 *                                      ctx.LineWidth = 1;
 *                                      ctx.Rectangle (alloc.X + 0.5, alloc.Y + 0.5, alloc.Width - 1, alloc.Height - 1);
 *                                      ctx.Color = new Cairo.Color (1,0,0);
 *                                      ctx.Stroke ();
 *                              }*/
            }
            else if (!roundedShape)
            {
                using (var ctx = Gdk.CairoHelper.Create(GdkWindow)) {
                    CairoExtensions.RoundedRectangle(ctx, alloc.X + 0.5, alloc.Y + 0.5, alloc.Width - 1, alloc.Height - 1, 4);
                    ctx.Color = entry.Style.Base(Gtk.StateType.Normal).ToCairoColor();
                    ctx.Fill();
                }
            }
            else
            {
                using (var ctx = Gdk.CairoHelper.Create(GdkWindow)) {
                    RoundBorder(ctx, alloc.X + 0.5, alloc.Y + 0.5, alloc.Width - 1, alloc.Height - 1);
                    ctx.Color = entry.Style.Base(Gtk.StateType.Normal).ToCairoColor();
                    ctx.Fill();
                }
            }

            PropagateExpose(Child, evnt);

            if (hasFrame && roundedShape && customRoundedShapeDrawing)
            {
                using (var ctx = Gdk.CairoHelper.Create(GdkWindow)) {
                    RoundBorder(ctx, alloc.X + 0.5, alloc.Y + 0.5, alloc.Width - 1, alloc.Height - 1);
                    ctx.Color     = Styles.WidgetBorderColor;
                    ctx.LineWidth = 1;
                    ctx.Stroke();
                }
            }
            return(true);
        }
Esempio n. 11
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if (!IsDrawable)
            {
                return(false);
            }

            Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window);

            try {
                Gdk.Color color = Style.Background(StateType.Normal);
                theme.DrawFrame(cr, Allocation, CairoExtensions.GdkColorToCairoColor(color));
                return(base.OnExposeEvent(evnt));
            } finally {
                CairoExtensions.DisposeContext(cr);
            }
        }
Esempio n. 12
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Gdk.Color c = Style.Background(State);
#if CAIRO_1_2_5
            Context cr = Gdk.CairoHelper.Create(GdkWindow);
#else
            Context cr = CairoUtils.CreateContext(GdkWindow);
#endif

            ShapeSurface(cr, new Cairo.Color(c.Red / (double)ushort.MaxValue,
                                             c.Blue / (double)ushort.MaxValue,
                                             c.Green / (double)ushort.MaxValue,
                                             0.8));

            ((IDisposable)cr).Dispose();
            return(base.OnExposeEvent(args));
        }
        void TheExposeEvent(object o, ExposeEventArgs args)
        {
            Gdk.EventExpose expose = args.Args[0] as Gdk.EventExpose;
            Gdk.Window      win    = expose.Window;

            Gdk.GC gc = new Gdk.GC(this.GdkWindow);
            gc.RgbFgColor = new Gdk.Color(150, 150, 150);

            var gripper = GripperPositions();
            int dy      = 8;

            foreach (var g in gripper)
            {
                int x = g.Value;
                win.DrawLine(gc, x + 2, dy, x + 2, TotalHeight - dy + 1);
            }
        }
Esempio n. 14
0
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            base.OnExposeEvent(ev);

            using (Context g = Gdk.CairoHelper.Create(GdkWindow)) {
                // Draw Primary / Secondary Area

                g.FillRectangle(secondary_rect, PintaCore.Palette.SecondaryColor);

                g.DrawRectangle(new Rectangle(secondary_rect.X + 1, secondary_rect.Y + 1, secondary_rect.Width - 2, secondary_rect.Height - 2), new Color(1, 1, 1), 1);
                g.DrawRectangle(secondary_rect, new Color(0, 0, 0), 1);

                g.FillRectangle(primary_rect, PintaCore.Palette.PrimaryColor);
                g.DrawRectangle(new Rectangle(primary_rect.X + 1, primary_rect.Y + 1, primary_rect.Width - 2, primary_rect.Height - 2), new Color(1, 1, 1), 1);
                g.DrawRectangle(primary_rect, new Color(0, 0, 0), 1);

                g.DrawPixbuf(swap_icon, swap_rect.Location());
                g.DrawPixbuf(reset_icon, reset_rect.Location());

                // Draw color swatches

                int startI = primarySecondaryAreaSize;
                int startJ = swatchAreaMargin;

                int paletteIndex = 0;
                for (int jRow = 0; jRow < jRows; jRow++)
                {
                    for (int iRow = 0; iRow < iRows; iRow++)
                    {
                        if (paletteIndex >= palette.Count)
                        {
                            break;
                        }

                        int x = (orientation == OrientationEnum.Horizontal) ? startI + iRow * swatchSize : startJ + jRow * swatchSize;
                        int y = (orientation == OrientationEnum.Horizontal) ? startJ + jRow * swatchSize : startI + iRow * swatchSize;

                        g.FillRectangle(new Rectangle(x, y, swatchSize, swatchSize), palette[paletteIndex]);

                        paletteIndex++;
                    }
                }
            }

            return(true);
        }
Esempio n. 15
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            // draw background fill before child widget so child appears on top
            // use Cairo drawing API (Gtk+ uses it internally as well)
            using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                // Gtk deprecated warning: cr.Color = this.color;
                // available on Linux GTK# but not yet on Windows (gtk-sharp-2.12.26.msi): cr.SetSourceColor (this.color);
                // Windows: warning CS0618: 'Cairo.Context.Color' is obsolete: 'Use SetSourceRGBA method'
                // solution for now, Gtk# Context method SetSourceColor (Color) does this anyway: NativeMethods.cairo_set_source_rgba (handle, color.R, color.G, color.B, color.A);
                cr.SetSourceRGBA(this.color.R, this.color.G, this.color.B, this.color.A);
                cr.Rectangle(this.Allocation.Left, this.Allocation.Top, this.Allocation.Width, this.Allocation.Height);
                cr.Fill();
            }

            // display child
            return(base.OnExposeEvent(evnt));
        }
Esempio n. 16
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            RenderWindow.DrawRectangle(Style.BlackGC, true,
                                       new Gdk.Rectangle(0, 0, Allocation.Width, Allocation.Height));

            if (RenderWindow == null || !RenderWindow.IsVisible)
            {
                return(true);
            }

            if (!is_idle && ServiceManager.PlayerEngine.VideoDisplayContextType != VideoDisplayContextType.Unsupported)
            {
                ExposeVideo(evnt);
            }

            return(true);
        }
Esempio n. 17
0
        public static bool OnExposeEvent(Gtk.Container aContainer, Gdk.EventExpose ev)
        {
            if (aContainer == null)
            {
                return(true);
            }
            int x      = aContainer.Allocation.Left;
            int y      = aContainer.Allocation.Top;
            int width  = aContainer.Allocation.Width;
            int height = aContainer.Allocation.Height;

            Widget e = GetEntryStyle(aContainer);

            Gtk.Style s  = aContainer.Style;
            StateType st = aContainer.State;

            if (e != null)
            {
                s  = e.Style;
                st = e.State;
            }
            if (GetContainerFocus(aContainer) == true)
            {
                if ((e == null) || (e.HasFocus == false))
                {
                    st = StateType.Selected;
                }
                Gtk.Style.PaintFlatBox(s, aContainer.GdkWindow, st, Gtk.ShadowType.In,
                                       aContainer.Allocation, aContainer, "entry_bg", x, y, width, height);
                Gtk.Style.PaintFocus(s, aContainer.GdkWindow, st,
                                     ev.Area, aContainer, "entry", x, y, width, height);
                Gtk.Style.PaintShadow(s, aContainer.GdkWindow, st, Gtk.ShadowType.In,
                                      ev.Area, aContainer, "entry", x, y, width, height);
            }
            else
            {
                Gtk.Style.PaintFlatBox(s, aContainer.GdkWindow, st, Gtk.ShadowType.In,
                                       aContainer.Allocation, aContainer, "entry_bg", x, y, width, height);
                Gtk.Style.PaintShadow(s, aContainer.GdkWindow, st, Gtk.ShadowType.In,
                                      ev.Area, aContainer, "entry", x, y, width, height);
            }
            e = null;
            s = null;

            return(true);
        }
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            int w, h;

            this.GdkWindow.GetSize(out w, out h);
            Gdk.Rectangle clip = new Gdk.Rectangle(0, 0, w, h);
            Gtk.Style.PaintBox(this.Style, this.GdkWindow, Gtk.StateType.Normal, Gtk.ShadowType.Out, clip, this, "menu", 0, 0, w, h);

            bool r = base.OnExposeEvent(ev);

            if (dropPosition != -1)
            {
                GdkWindow.DrawRectangle(this.Style.BlackGC, true, 0, dropPosition - 1, w - 2, 3);
            }

            return(r);
        }
Esempio n. 19
0
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            base.OnExposeEvent(ev);

            if (pages == null)
            {
                return(false);
            }

            int width  = (int)(report.PageWidthPoints * Scale);
            int height = (int)(report.PageHeightPoints * Scale);

            Cairo.Rectangle rep_r = new Cairo.Rectangle(1, 1, width - 1, height - 1);

            int widgetWidth, widgetHeight;

            ev.Window.GetSize(out widgetWidth, out widgetHeight);

            using (Context g = Gdk.CairoHelper.Create(this.GdkWindow))
                using (ImageSurface rep_s = new ImageSurface(Format.Argb32, width, height))
                    using (Context rep_g = new Context(rep_s))
                        using (ImageSurface shadow_s = rep_s.Clone())
                            using (Context shadow_g = new Context(shadow_s))
                            {
                                g.Translate(((widgetWidth - width) / 2) - rep_padding, 0);
                                shadow_g.Pattern = new SolidPattern(new Color(0.6, 0.6, 0.6));
                                shadow_g.Paint();
                                g.SetSourceSurface(shadow_s, shadow_padding, shadow_padding);
                                g.Paint();

                                rep_g.Pattern = new SolidPattern(new Color(1, 1, 1));
                                rep_g.Paint();

                                rep_g.DrawRectangle(rep_r, new Color(0.1, 0.1, 0.1), 1);

                                using (var render = new RenderCairo(rep_g, Scale))
                                {
                                    render.RunPage(pages);
                                }

                                g.SetSourceSurface(rep_s, rep_padding, rep_padding);
                                g.Paint();
                            }
            return(true);
        }
Esempio n. 20
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Gdk.Drawable win = args.Window;

            int width, height;

            layout.GetPixelSize(out width, out height);

//			if (DrawRightBorder)
//				arrowXPos -= 2;

            var state = window != null? StateType.Active : State;

            //HACK: paint the button background as if it were bigger, but it stays clipped to the real area,
            // so we get the content but not the border. This might break with crazy themes.
            //FIXME: we can't use the style's actual internal padding because GTK# hasn't wrapped GtkBorder AFAICT
            // (default-border, inner-border, default-outside-border, etc - see http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c)
            const int padding = 0;

            Style.PaintBox(Style, args.Window, state, ShadowType.None, args.Area, this, "button",
                           Allocation.X - padding, Allocation.Y - padding, Allocation.Width + padding * 2, Allocation.Height + padding * 2);

            int xPos = Allocation.Left + 4;

            if (Pixbuf != null)
            {
                win.DrawPixbuf(this.Style.BaseGC(StateType.Normal), Pixbuf, 0, 0, xPos + pixbufSpacing, Allocation.Y + (Allocation.Height - Pixbuf.Height) / 2, Pixbuf.Width, Pixbuf.Height, Gdk.RgbDither.None, 0, 0);
                xPos += Pixbuf.Width + pixbufSpacing * 2;
            }
            int arrowHeight = height - 4;
            int arrowWidth  = arrowHeight + 3;
            int arrowXPos   = this.Allocation.X + this.Allocation.Width - arrowWidth;
            //constrain the text area so it doesn't get rendered under the arrows
            var textArea = new Gdk.Rectangle(xPos, Allocation.Y + ySpacing, arrowXPos - xPos - 2, Allocation.Height - ySpacing);

            Style.PaintLayout(Style, win, state, true, textArea, this, "", textArea.X, textArea.Y, layout);

            state = Sensitive ? StateType.Normal : StateType.Insensitive;

            Gtk.Style.PaintVline(this.Style, win, state, args.Area, this, "", Allocation.Y + 3, Allocation.Bottom - 4, arrowXPos - 4);
            Gtk.Style.PaintArrow(this.Style, win, state, ShadowType.None, args.Area, this, "", ArrowType.Down, true, arrowXPos, Allocation.Y, Allocation.Height / 2, Allocation.Height);
//			if (DrawRightBorder)
//				win.DrawLine (this.Style.DarkGC (StateType.Normal), Allocation.X + Allocation.Width - 1, Allocation.Y, Allocation.X + Allocation.Width - 1, Allocation.Y + Allocation.Height);
            return(false);
        }
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            int  bar_width  = (int)((double)Allocation.Width * buffering_progress);
            bool render_bar = false;

            if (bar_width > 0 && IsBuffering)
            {
                bar_width -= 2 * Style.XThickness;
                render_bar = true;

                Gtk.Style.PaintBox(Style, GdkWindow, StateType.Normal, ShadowType.In, evnt.Area, this, null,
                                   Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);

                if (bar_width > 0)
                {
                    Gtk.Style.PaintBox(Style, GdkWindow, StateType.Selected, ShadowType.EtchedOut,
                                       evnt.Area, this, "bar",
                                       Allocation.X + Style.XThickness, Allocation.Y + Style.YThickness,
                                       bar_width, Allocation.Height - 2 * Style.YThickness);
                }
            }

            int width, height;

            layout.GetPixelSize(out width, out height);

            int x = Allocation.X + ((Allocation.Width - width) / 2);
            int y = Allocation.Y + ((Allocation.Height - height) / 2);

            Gdk.Rectangle rect = evnt.Area;

            if (render_bar)
            {
                width = bar_width + Style.XThickness;
                rect  = new Gdk.Rectangle(evnt.Area.X, evnt.Area.Y, width, evnt.Area.Height);
                Gtk.Style.PaintLayout(Style, GdkWindow, StateType.Selected, true, rect, this, null, x, y, layout);

                rect.X    += rect.Width;
                rect.Width = evnt.Area.Width - rect.Width;
            }

            Gtk.Style.PaintLayout(Style, GdkWindow, StateType.Normal, false, rect, this, null, x, y, layout);

            return(true);
        }
Esempio n. 22
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            var rect = Allocation;

            if (rect.Width > 0 && rect.Height > 0)
            {
                var         area  = evnt.Area;
                SKColorType ctype = SKColorType.Bgra8888;
                using (Cairo.Context cr = Gdk.CairoHelper.Create(base.GdkWindow))
                {
                    if (cr == null)
                    {
                        Console.WriteLine("Cairo Context is null");
                    }
                    using (var bitmap = new SKBitmap(rect.Width, rect.Height, ctype, SKAlphaType.Premul))
                    {
                        if (bitmap == null)
                        {
                            Console.WriteLine("Bitmap is null");
                        }
                        IntPtr len;
                        using (var skSurface = SKSurface.Create(bitmap.Info.Width, bitmap.Info.Height, ctype, SKAlphaType.Premul, bitmap.GetPixels(out len), bitmap.Info.RowBytes))
                        {
                            if (skSurface == null)
                            {
                                Console.WriteLine("skSurface is null");
                            }
                            if (PaintSurface != null)
                            {
                                PaintSurface.Invoke(skSurface);
                            }
                            skSurface.Canvas.Flush();
                            using (Cairo.Surface surface = new Cairo.ImageSurface(bitmap.GetPixels(out len), Cairo.Format.Argb32, bitmap.Width, bitmap.Height, bitmap.Width * 4))
                            {
                                surface.MarkDirty();
                                cr.SetSourceSurface(surface, 0, 0);
                                cr.Paint();
                            }
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 23
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            bool ret = base.OnExposeEvent(evnt);

            if (HasResizeGrip)
            {
                Gdk.Rectangle rect = GetGripRect();
                int           w    = rect.Width - Style.Xthickness;
                int           h    = Allocation.Height - Style.YThickness;
                if (h < 18 - Style.YThickness)
                {
                    h = 18 - Style.YThickness;
                }
                Gdk.WindowEdge edge = Direction == TextDirection.Ltr ? Gdk.WindowEdge.SouthEast : Gdk.WindowEdge.SouthWest;
                Gtk.Style.PaintResizeGrip(Style, GdkWindow, State, evnt.Area, this, "statusbar", edge, rect.X, rect.Y, w, h);
            }
            return(ret);
        }
Esempio n. 24
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            base.OnExposeEvent(evnt);

            Cairo.Context context = Gdk.CairoHelper.Create(GdkWindow);
            context.Save();
            context.Translate(transformX, transformY);
            context.Scale(scale, scale);

            if (shape != null)
            {
                shape.Draw(context, scale);
            }

            ((IDisposable)context).Dispose();

            return(true);
        }
Esempio n. 25
0
        private void InteractiveExpose(Widget widget, Gdk.EventExpose evnt)
        {
            widget.GdkWindow.DrawRectangle(Parent.Style.BackgroundGC(StateType.Normal),
                                           true, 0, 0, widget.Allocation.Width, widget.Allocation.Height);

            int x      = Parent.Allocation.X - widget.Allocation.X;
            int y      = Parent.Allocation.Y - widget.Allocation.Y;
            int width  = Parent.Allocation.Width;
            int height = Parent.Allocation.Height;

            Gtk.Style.PaintBox(Style, widget.GdkWindow, StateType.Normal, ShadowType.Out,
                               evnt.Area, widget, "menu", x, y, width, height);

            if (SelectedWidget == widget && ((EventBox)widget).Child is Button)
            {
                ButtonExpose((EventBox)widget, evnt);
            }
        }
Esempio n. 26
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            using (Cairo.Context context = Gdk.CairoHelper.Create(evnt.Window)) {
                if (secondaryOpacity < 1.0f)
                {
                    RenderIcon(context, primarySurface, 1.0f - (float)Math.Pow(secondaryOpacity, 3.0f));
                }

                if (secondaryOpacity > 0.0f)
                {
                    RenderIcon(context, secondarySurface, secondaryOpacity);
                }

                context.Dispose();
            }

            return(false);
        }
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if (VisualStyle.TabStyle == DockTabStyle.Normal)
            {
                Gdk.GC gc = new Gdk.GC(GdkWindow);
                gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value;
                evnt.Window.DrawRectangle(gc, true, Allocation);
                gc.Dispose();
            }
            bool result = base.OnExposeEvent(evnt);

            Gdk.Color?col = VisualStyle.PadBackgroundColor;
            if (col.HasValue)
            {
                DrawFocus(evnt.Window, Color.FromArgb(255, col.Value.Red / 256, col.Value.Green / 256, col.Value.Blue / 256));
            }
            return(result);
        }
Esempio n. 28
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            using (var ctx = Gdk.CairoHelper.Create(this.GdkWindow)) {
                var alloc = Allocation;
                //alloc.Inflate (0, -2);
                ctx.Rectangle(alloc.X, alloc.Y, 1, alloc.Height);

                // FIXME: VV: Remove gradient features
                using (Cairo.LinearGradient gr = new LinearGradient(alloc.X, alloc.Y, alloc.X, alloc.Y + alloc.Height)) {
                    gr.AddColorStop(0, new Cairo.Color(0, 0, 0, 0));
                    gr.AddColorStop(0.5, new Cairo.Color(0, 0, 0, 0.2));
                    gr.AddColorStop(1, new Cairo.Color(0, 0, 0, 0));
                    ctx.SetSource(gr);
                    ctx.Fill();
                }
            }
            return(true);
        }
Esempio n. 29
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Gdk.Window    win  = args.Window;
            Gdk.Rectangle area = args.Area;


            win.DrawRectangle(Style.DarkGC(StateType.Normal), true, area);
            win.DrawRectangle(Style.BlackGC, false, area);
            win.DrawRectangle(Style.MidGC(StateType.Normal), true, 0, 15, 1000, 1000);
            win.DrawLine(Style.BlackGC, 0, 15, 1000, 15);
            //win.DrawLayout(Style.BlackGC,2,2,titleLayout);

            if (!string.IsNullOrEmpty(body))
            {
                win.DrawLayout(Style.BlackGC, 2, 17, GetLayout(body));
            }
            return(true);
        }
Esempio n. 30
0
            protected override bool OnExposeEvent(Gdk.EventExpose evnt)
            {
                using (var ctx = Gdk.CairoHelper.Create(GdkWindow)) {
                    ctx.Rectangle(0, 0, Allocation.Width, Allocation.Height);
                    Cairo.LinearGradient g = new Cairo.LinearGradient(0, 0, 0, Allocation.Height);
                    g.AddColorStop(0, Styles.BreadcrumbBackgroundColor);
                    g.AddColorStop(1, Styles.BreadcrumbGradientEndColor);
                    ctx.Pattern = g;
                    ctx.Fill();

                    ctx.MoveTo(0.5, Allocation.Height - 0.5);
                    ctx.RelLineTo(Allocation.Width, 0);
                    ctx.Color     = Styles.BreadcrumbBottomBorderColor;
                    ctx.LineWidth = 1;
                    ctx.Stroke();
                }
                return(base.OnExposeEvent(evnt));
            }