Exemple #1
0
        /// <summary>
        /// This method is called when the drawable has to draw itself
        /// to a Gdk.Drawable object.
        /// </summary>
        public void Render(
            Drawable dest,
            GC gc,
            DrawableState state)
        {
            // Check for single frame image
            if (tile.Count == 1)
            {
                drawable.Render(dest, gc, state);
                return;
            }

            // Render ourselves
            Pixbuf pixbuf = GetPixbuf(state);

            dest.DrawPixbuf(
                gc,
                pixbuf,
                0,
                0,
                state.X,
                state.Y,
                pixbuf.Width,
                pixbuf.Height,
                RgbDither.None,
                0,
                0);
        }
Exemple #2
0
 public RendererHelper(Gdk.GC gc, Drawable drawable, Widget widget, Gdk.Rectangle exposeArea)
 {
     this.gc         = gc;
     this.drawable   = drawable;
     this.exposeArea = exposeArea;
     this.widget     = widget;
 }
Exemple #3
0
	protected override void RenderExtra()
	{
		if (bpr <= 0)
			return;

		Gdk.GC backEvenGC = drawer.GetBackgroundGC(Drawer.RowType.Even, Drawer.HighlightType.Normal);
		// draw the area background
		backPixmap.DrawRectangle(backEvenGC, true, x, y, width, height);

		int nrows = height / drawer.Height;
		long bleft = nrows * bpr;
		int rfull = 0;
		int blast = 0;

		if (bleft + areaGroup.Offset > areaGroup.Buffer.Size)
			bleft = areaGroup.Buffer.Size - areaGroup.Offset + 1; 

		// calculate number of full rows
		// and number of bytes in last (non-full)
		rfull = (int)(bleft / bpr);
		blast = (int)(bleft % bpr);

		if (blast > 0)
			rfull++;

		for (int i = 0; i < rfull; i++)
			RenderRowNormal(i, 0, bpr, true);
	}
            protected void OnRealized(object o, EventArgs args)
            {
                int x, y;
                int w, h;

                GdkWindow.GetOrigin(out x, out y);
                GdkWindow.GetSize(out w, out h);

                textTop     = y + image.Height - 30;
                scrollStart = -(image.Height - textTop);
                scroll      = scrollStart;

                layout = new Pango.Layout(this.PangoContext);
                // FIXME: this seems wrong but works
                layout.Width     = w * (int)Pango.Scale.PangoScale;
                layout.Wrap      = Pango.WrapMode.Word;
                layout.Alignment = Pango.Alignment.Center;
                FontDescription fd = FontDescription.FromString("Tahoma 10");

                layout.FontDescription = fd;
                layout.SetMarkup(CreditText);

                backGc            = new Gdk.GC(GdkWindow);
                backGc.RgbBgColor = bgColor;
            }
Exemple #5
0
        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

              ExposeEvent += delegate {sliceData.Draw(Renderer);};
              Realized += delegate
            {
              var gc = new Gdk.GC(GdkWindow);
              Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
              Draw(drawable);
            };
              SizeAllocated += delegate {Draw(drawable);};

              Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
            EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
            EventMask.LeaveNotifyMask;

              ButtonPressEvent += (o, args) =>
            {
              var c = new IntCoordinate((int) args.Event.X, (int) args.Event.Y);
              Func.GetActualFunc(c).OnButtonPress(o, args);
            };

              MotionNotifyEvent += (o, args) =>
            {
              GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

              Func = new SelectFunc(sliceData, this);
        }
            protected override bool OnExposeEvent(EventExpose evnt)
            {
                if (evnt.Window == this.GdkWindow)
                {
                    return(true);
                }
                bool flag = base.OnExposeEvent(evnt);

                if (this.text_gc == null)
                {
                    this.text_gc = new Gdk.GC((Drawable)evnt.Window);
                    this.text_gc.Copy(this.Style.TextGC(StateType.Normal));
                    this.text_gc.RgbFgColor = SearchEntry.FramelessEntry.ColorBlend(this.parent.Style.Base(StateType.Normal), this.parent.Style.Text(StateType.Normal));
                }
                if (this.Text.Length > 0 || this.HasFocus || this.parent.EmptyMessage == null)
                {
                    return(flag);
                }
                if (this.layout == null)
                {
                    this.layout = new Pango.Layout(this.PangoContext);
                    this.layout.FontDescription = this.PangoContext.FontDescription.Copy();
                }
                this.layout.SetMarkup(this.parent.EmptyMessage);
                int width;
                int height;

                this.layout.GetPixelSize(out width, out height);
                evnt.Window.DrawLayout(this.text_gc, 2, (this.SizeRequest().Height - height) / 2, this.layout);
                return(flag);
            }
Exemple #7
0
        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

            ExposeEvent += delegate { sliceData.Draw(Renderer); };
            Realized    += delegate
            {
                var gc = new Gdk.GC(GdkWindow);
                Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
                Draw(drawable);
            };
            SizeAllocated += delegate { Draw(drawable); };

            Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
                     EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
                     EventMask.LeaveNotifyMask;

            ButtonPressEvent += (o, args) =>
            {
                var c = new IntCoordinate((int)args.Event.X, (int)args.Event.Y);
                Func.GetActualFunc(c).OnButtonPress(o, args);
            };

            MotionNotifyEvent += (o, args) =>
            {
                GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

            Func = new SelectFunc(sliceData, this);
        }
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            int w, h;

            this.GdkWindow.GetSize(out w, out h);

            if (fill == BoxFill.Box)
            {
                this.GdkWindow.DrawRectangle(this.Style.WhiteGC, true, 0, 0, w, h);
                this.GdkWindow.DrawRectangle(this.Style.BlackGC, false, 0, 0, w - 1, h - 1);
            }
            else if (fill == BoxFill.HLine)
            {
                Gdk.GC gc = new Gdk.GC(this.GdkWindow);
                gc.SetDashes(0, new sbyte[] { 1, 1 }, 2);
                gc.SetLineAttributes(SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
                gc.Foreground = this.Style.Black;
                this.GdkWindow.DrawLine(gc, 0, h / 2, w, h / 2);
                gc.Foreground = this.Style.White;
                this.GdkWindow.DrawLine(gc, 1, h / 2, w, h / 2);
            }
            else
            {
                Gdk.GC gc = new Gdk.GC(this.GdkWindow);
                gc.SetDashes(0, new sbyte[] { 1, 1 }, 2);
                gc.SetLineAttributes(SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
                gc.Foreground = this.Style.Black;
                this.GdkWindow.DrawLine(gc, w / 2, 0, w / 2, h);
                gc.Foreground = this.Style.White;
                this.GdkWindow.DrawLine(gc, w / 2, 1, w / 2, h);
            }

            return(true);
        }
        public void drag(object obj, DragBeginArgs args)
        {
            TreeModel model;
            var       paths = this.Selection.GetSelectedRows(out model);

            if (paths.Length > 0)
            {
                var icons  = paths.Select(x => this.CreateRowDragIcon(x));
                int height = (icons.Select(x => PixmapSizeGetHelper(x).Item2).Sum() - 2 * icons.Count()) + 2;
                int width  = icons.Select(x => PixmapSizeGetHelper(x).Item1).Max();
                var final  = new Pixmap(this.GdkWindow, width, height);
                var gc     = new Gdk.GC(final);
                gc.Copy(this.Style.ForegroundGC(StateType.Normal));
                gc.Colormap = this.GdkWindow.Colormap;

                int count_y = 1;
                var size    = PixmapSizeGetHelper(icons.First());
                foreach (Pixmap icon in icons)
                {
                    size = PixmapSizeGetHelper(icon);
                    final.DrawDrawable(gc, icon, 1, 1, 1, count_y, size.Item1 - 2, size.Item2 - 2);
                    count_y += (size.Item2 - 2);
                }

                Gtk.Drag.SetIconPixmap(args.Context, GdkWindow.Colormap, final, null, 0, 0);
            }
        }
Exemple #10
0
        public override void DrawLine(Color c, Point p1, Point p2)
        {
            Gdk.GC g = new Gdk.GC(window);

            g.RgbFgColor = GdkColor(c);
            window.DrawLine(g, (int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y);
        }
Exemple #11
0
        static void RenderPlaceholderText_internal(Gtk.Widget widget, Gtk.ExposeEventArgs args, string placeHolderText, ref Pango.Layout layout, float xalign, float yalign, int xpad, int ypad)
        {
            if (layout == null)
            {
                layout = new Pango.Layout(widget.PangoContext);
                layout.FontDescription = widget.PangoContext.FontDescription.Copy();
            }

            int wh, ww;

            args.Event.Window.GetSize(out ww, out wh);

            int width, height;

            layout.SetText(placeHolderText);
            layout.GetPixelSize(out width, out height);

            int x = xpad + (int)((ww - width) * xalign);
            int y = ypad + (int)((wh - height) * yalign);

            using (var gc = new Gdk.GC(args.Event.Window)) {
                gc.Copy(widget.Style.TextGC(Gtk.StateType.Normal));
                Xwt.Drawing.Color color_a = widget.Style.Base(Gtk.StateType.Normal).ToXwtValue();
                Xwt.Drawing.Color color_b = widget.Style.Text(Gtk.StateType.Normal).ToXwtValue();
                gc.RgbFgColor = color_b.BlendWith(color_a, 0.5).ToGtkValue();

                args.Event.Window.DrawLayout(gc, x, y, layout);
            }
        }
Exemple #12
0
 public override void DrawPoint(Color c, Point p)
 {
     Gdk.GC g = new Gdk.GC(window);
     g.RgbFgColor = GdkColor(c);
     g.RgbBgColor = GdkColor(c);
     window.DrawRectangle(g, true, (int)p.X, (int)p.Y, 2, 2);
 }
Exemple #13
0
        void HandleEventMinimizehandleExposeEvent(object o, ExposeEventArgs args)
        {
            if (!this.Visible)
            {
                return;
            }
            Gdk.GC     button = new Gdk.GC(eventMinimize.GdkWindow);
            Gdk.Pixmap pixmap_mask;
            Pixmap     pixmap;

            Gdk.Pixbuf pixbuf = null;
            if (this.MinimizeHover)
            {
                pixbuf = Images.Windows_MinimizeButton_Hover;
            }
            else
            {
                pixbuf = Images.Windows_MinimizeButton;
            }
            pixbuf.RenderPixmapAndMask(out pixmap, out pixmap_mask, 255);

            button.Fill = Gdk.Fill.Tiled;
            button.Tile = pixmap;

            this.eventMinimize.GdkWindow.DrawRectangle(button, true, 0, 0, eventMinimize.WidthRequest, eventMinimize.HeightRequest);
        }
        protected override bool OnExposeEvent(EventExpose evnt)
        {
            Gdk.GC gc = Style.DarkGC(State);
            evnt.Window.DrawLine(gc, Allocation.X, Allocation.Top, Allocation.X, Allocation.Bottom);
            if (vScrollBar.Visible && hScrollBar.Visible)
            {
                evnt.Window.DrawLine(gc, Allocation.Right, Allocation.Top, Allocation.Right, Allocation.Y + Allocation.Height / 2);
            }
            else
            {
                evnt.Window.DrawLine(gc, Allocation.Right, Allocation.Top, Allocation.Right, Allocation.Bottom);
            }
            evnt.Window.DrawLine(gc, Allocation.Left, Allocation.Y, Allocation.Right, Allocation.Y);
            if (vScrollBar.Visible && hScrollBar.Visible)
            {
                evnt.Window.DrawLine(gc, Allocation.Left, Allocation.Bottom, Allocation.Left + Allocation.Width / 2, Allocation.Bottom);
            }
            else
            {
                evnt.Window.DrawLine(gc, Allocation.Left, Allocation.Bottom, Allocation.Right, Allocation.Bottom);
            }

/*			if (vScrollBar.Visible && hScrollBar.Visible) {
 *                              int vwidth = vScrollBar.Requisition.Width;
 *                              int hheight = hScrollBar.Requisition.Height;
 *
 *                              evnt.Window.DrawRectangle (Style.BackgroundGC (State), true,
 *                                                         Allocation.Right - vwidth,
 *                                                         Allocation.Bottom - hheight,
 *                                                         vwidth, hheight);
 *                      }*/
            return(base.OnExposeEvent(evnt));
        }
    protected void DrawBoxes()
    {
        if (!Paused)
        {
            return;
        }

        if (GtkSelection.Selection.Count() > 0)
        {
            var dest  = worldImage.GdkWindow;
            var gc    = new Gdk.GC(dest);
            var boxes = GtkSelection.Selection.BoundingBoxes();

            for (int i = 0; i < boxes.Count; i++)
            {
                if (i == GtkSelection.Selected - 1 || ShowColonies.Active)
                {
                    var box = boxes[i];

                    var w = Math.Abs(box.X1 - box.X0);
                    var h = Math.Abs(box.Y1 - box.Y0);

                    gc.RgbFgColor = i != GtkSelection.Selected - 1 ? GtkSelection.SelectedColor : Colonies[i].ArtificialLife.ColonyColor;
                    gc.SetLineAttributes(GtkSelection.MarkerSize, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);

                    GtkSelection.DrawBox(gc, dest, box.X0, box.Y0, box.X1, box.Y1, w, h, false);
                }
            }
        }
    }
Exemple #16
0
 public override void DrawGridIntersect(Color c, Point p)
 {
     Gdk.GC g = new Gdk.GC(window);
     g.RgbFgColor = GdkColor(c);
     window.DrawLine(g, (int)p.X, (int)(p.Y - 1), (int)p.X, (int)(p.Y + 1));
     window.DrawLine(g, (int)(p.X - 1), (int)p.Y, (int)(p.X + 1), (int)p.Y);
 }
Exemple #17
0
        private void ExposeIt()
        {
            Gdk.GC gc = new Gdk.GC(this.GdkWindow);
            int    w, h;

            this.GdkWindow.GetSize(out w, out h);

            Gdk.Pixmap pixmap_mask;
            Pixmap     pixmap;

            Gdk.Pixbuf pixbuf = Images.DialogBackground;
            pixbuf.RenderPixmapAndMask(out pixmap, out pixmap_mask, 255);
            gc.Fill = Gdk.Fill.Tiled;
            gc.Tile = pixmap;
            this.GdkWindow.DrawRectangle(gc, true, 0, 0, Images.DialogBackground.Width, h - 41);

            if (Poster != null)
            {
                Rectangle posterBounds = new Rectangle((Poster.Width - 272) / 2, 10, Poster.Width, Poster.Height);
                using (Cairo.Context cr = Gdk.CairoHelper.Create(this.GdkWindow))
                {
                    cr.SetSourceRGB(.7, .7, .7);
                    cr.Rectangle(posterBounds.X - 2, posterBounds.Y - 2, posterBounds.Width + 4, posterBounds.Height + 4);
                    cr.Fill();
                }
                this.GdkWindow.DrawPixbuf(gc, Poster, 0, 0, posterBounds.X, posterBounds.Y, posterBounds.Width, posterBounds.Height, RgbDither.Normal, 0, 0);
            }
        }
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            if (textGC == null)
            {
                textGC   = editor.ColorStyle.Default.CreateFgGC(ev.Window);
                textBgGC = editor.ColorStyle.Default.CreateBgGC(ev.Window);
                foldGC   = editor.ColorStyle.FoldLine.CreateFgGC(ev.Window);
                foldBgGC = editor.ColorStyle.FoldLine.CreateBgGC(ev.Window);
            }

            ev.Window.DrawRectangle(textBgGC, true, ev.Area);
            ev.Window.DrawLayout(textGC, 1, 1, layout);
            ev.Window.DrawRectangle(textBgGC, false, 1, 1, this.Allocation.Width - 3, this.Allocation.Height - 3);
            ev.Window.DrawRectangle(foldGC, false, 0, 0, this.Allocation.Width - 1, this.Allocation.Height - 1);

            if (!HideCodeSegmentPreviewInformString)
            {
                informLayout.SetText(CodeSegmentPreviewInformString);
                int w, h;
                informLayout.GetPixelSize(out w, out h);
                PreviewInformStringHeight = h;
                ev.Window.DrawRectangle(foldBgGC, true, Allocation.Width - w - 3, Allocation.Height - h, w + 2, h - 1);
                ev.Window.DrawLayout(foldGC, Allocation.Width - w - 3, Allocation.Height - h, informLayout);
            }
            return(true);
        }
Exemple #19
0
 protected override bool OnExposeEvent(Gdk.EventExpose args)
 {
     Gdk.GC gc = new Gdk.GC(GdkWindow);
     gc.ClipRectangle = Allocation;
     GdkWindow.DrawLayout(gc, padding, padding, layout);
     return(true);
 }
Exemple #20
0
    public static void Draw(Gdk.GC gc, Window dest, int X0, int Y0, int X1, int Y1)
    {
        if (gc == null || dest == null)
        {
            return;
        }

        var w = Math.Abs(X1 - X0);
        var h = Math.Abs(Y1 - Y0);

        if (w > 2 && h > 2)
        {
            gc.RgbFgColor = SelectedColor;

            gc.SetLineAttributes(MarkerSize, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);

            if (Selection.EllipseMode)
            {
                DrawEllipse(gc, dest, X0, Y0, X1, Y1, w, h);
            }
            else
            {
                DrawBox(gc, dest, X0, Y0, X1, Y1, w, h);
            }
        }
    }
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            Gdk.GC gc = new Gdk.GC(window);

            int width = cell_area.Width / blockEvent.BlockCount;

            for (int i = 0; i < blockEvent.BlockCount; i++)
            {
                if (blockEvent.AllBlocksReceived)
                {
                    gc.RgbFgColor = new Gdk.Color(179, 139, 83);                     // Brown
                }
                else if (blockEvent[i].Written)
                {
                    gc.RgbFgColor = new Gdk.Color(145, 246, 145);                     // Green
                }
                else if (blockEvent[i].Received)
                {
                    gc.RgbFgColor = new Gdk.Color(232, 176, 6);                     // Gold
                }
                else if (blockEvent[i].Requested)
                {
                    gc.RgbFgColor = new Gdk.Color(112, 180, 224);                     // Blue
                }
                else
                {
                    gc.RgbFgColor = new Gdk.Color(248, 227, 212);                     // Pink
                }
                Gdk.Rectangle rect = new Gdk.Rectangle(background_area.X + (width * i), background_area.Y + 1, width, background_area.Height - 2 * 1);
                window.DrawRectangle(gc, true, rect);
            }
        }
        protected override void Render(Drawable window, Widget widget, Gdk.Rectangle backgroundArea, Gdk.Rectangle cellArea, Gdk.Rectangle exposeArea, CellRendererState flags)
        {
            Gdk.GC gc = widget.Style.TextGC(StateType.Normal);

            var rendererHelper = new RendererHelper(gc, window, widget, exposeArea);

            var MARGIN = 40;
            var STEP   = exposeArea.Width / 2;
            var x      = MARGIN;

            rendererHelper.Label(
                "ASSET",
                x,
                20,
                Constants.Fonts.LogText,
                STEP,
                Constants.Colors.LogHeader
                );

            x += STEP;

            rendererHelper.Label(
                "VALUE",
                x,
                20,
                Constants.Fonts.LogText,
                STEP,
                Constants.Colors.LogHeader
                );
        }
        //level must be declared prior to calling this
        public void drawTileset()
        {
            _tilesetCache = new Gdk.Pixbuf(_editLevel.tilesetPath);

            Pixmap pMap, mask;
            _tilesetCache.RenderPixmapAndMask (out pMap, out mask, 0);

            int imgWidth = _tilesetCache.Width,
            imgHeight = _tilesetCache.Height;

            _tilesetEventBox.SetSizeRequest (imgWidth, imgHeight);
            tilesetDrawPane.SetSizeRequest (imgWidth, imgHeight);

            if (_tilesetGrid) {
                //get the context we're drawing in
                Gdk.GC gc = new Gdk.GC (levelDrawPane.GdkWindow);

                //draw the grid
                for (int x = 0; x < imgWidth; x += _editLevel._tileWidth)
                    pMap.DrawLine (gc, x, 0, x, imgHeight);
                for (int y = 0; y < imgHeight; y += _editLevel._tileHeight)
                    pMap.DrawLine (gc, 0, y, imgWidth, y);
            }

            tilesetDrawPane.SetFromPixmap (pMap, mask);

            //----------------------
        }
Exemple #24
0
        void DrawingArea_ExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            Rectangle area   = args.Event.Area;
            var       window = args.Event.Window;

            window.DrawRectangle(drawingArea.Style.WhiteGC, true, area);

            if (chipHistory.Count < 2)
            {
                return;
            }

            Gdk.GC gc_chips = new Gdk.GC(window);
            gc_chips.SetLineAttributes(2, LineStyle.Solid, CapStyle.Butt, JoinStyle.Bevel);

            Gdk.GC gc_red = new Gdk.GC(window);
            gc_red.RgbFgColor = new Color(255, 50, 50);

            Gdk.GC gc_blue = new Gdk.GC(window);
            gc_blue.RgbFgColor = new Color(128, 128, 255);

            int skip_count = chipHistory.Count - area.Width / 5;

            if (skip_count < 0)
            {
                skip_count = 0;
            }

            //Draw_Graph(area, window, 1, 2, false, estimateHistory.Skip(skip_count).Select(t => t.Item1), gc_red);
            Draw_Graph(area, window, 1, 2, false, estimateHistory.Skip(skip_count).Select(t => t.Item2), gc_blue);

            Draw_Graph(area, window, 5000, 60000, true, chipHistory.Skip(skip_count).Select(c => (double)c), gc_chips);

            Draw_Graph(area, window, 1, 2, false, correlationHistory.Skip(skip_count).Select(y => y + 1), gc_red);
        }
Exemple #25
0
        /// <summary>
        /// Triggered when the drawing area is exposed.
        /// </summary>
        private void OnExposed(
            object sender,
            ExposeEventArgs args)
        {
            // Check for a sort
            if (sortNext)
            {
                sprites.Sort();
                sortNext = false;
            }

            // Clear out the entire graphics area with black (just
            // because we can). This also erases the prior rendering.
            Rectangle region = args.Event.Area;
            GC        gc     = new GC(pixmap);

            gc.ClipRectangle = region;

            // Render ourselves
            viewport.Render(pixmap, region);

            // This performs the actual drawing
            args.Event.Window.DrawDrawable(
                Style.BlackGC,
                pixmap,
                region.X,
                region.Y,
                region.X,
                region.Y,
                region.Width,
                region.Height);
            args.RetVal = false;
            exposeCount++;
        }
Exemple #26
0
        void DrawCursor(ChartCursor cursor)
        {
            Gdk.GC gc = new Gdk.GC(GdkWindow);
            gc.RgbFgColor = cursor.Color;

            int x, y;

            GetPoint(cursor.Value, cursor.Value, out x, out y);

            if (cursor.Dimension == AxisDimension.X)
            {
                int     cy = top - AreaBorderWidth - 1;
                Point[] ps = new Point [4];
                ps [0] = new Point(x, cy);
                ps [1] = new Point(x + (cursor.HandleSize / 2), cy - cursor.HandleSize + 1);
                ps [2] = new Point(x - (cursor.HandleSize / 2), cy - cursor.HandleSize + 1);
                ps [3] = ps [0];
                GdkWindow.DrawPolygon(gc, false, ps);
                if (activeCursor == cursor)
                {
                    GdkWindow.DrawPolygon(gc, true, ps);
                }
                GdkWindow.DrawLine(gc, x, top, x, top + height);
            }
            else
            {
                throw new NotSupportedException();
            }
        }
        public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
        {
            int one_width = (int) textArea.TextView.GetWidth ('w');

            using (Gdk.GC gc = new Gdk.GC (wnd)) {
            using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) {
                ly.FontDescription = FontContainer.DefaultFont;
                ly.Width = drawingPosition.Width;
                ly.Alignment = Pango.Alignment.Right;

                HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");

                gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
                gc.RgbFgColor = TextArea.Style.White;
                wnd.DrawRectangle (gc, true, drawingPosition);

                gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
                gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
                wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height);

                //FIXME: This doesnt allow different fonts and what not
                int fontHeight = TextArea.TextView.FontHeight;

                for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) {
                    int ypos = drawingPosition.Y + fontHeight * y  - textArea.TextView.VisibleLineDrawingRemainder;

                    int curLine = y + textArea.TextView.FirstVisibleLine;
                    if (curLine < textArea.Document.TotalNumberOfLines) {
                        ly.SetText ((curLine + 1).ToString ());
                        wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly);
                    }
                }
            }}
        }
 public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size, int sz)
 {
     Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
     if ((res != null))
     {
         return(res);
     }
     else
     {
         try {
             return(Gtk.IconTheme.Default.LoadIcon(name, sz, 0));
         }
         catch (System.Exception) {
             if ((name != "gtk-missing-image"))
             {
                 return(Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size, sz));
             }
             else
             {
                 Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
                 Gdk.GC     gc   = new Gdk.GC(pmap);
                 gc.RgbFgColor = new Gdk.Color(255, 255, 255);
                 pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
                 gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                 pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
                 gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
                 gc.RgbFgColor = new Gdk.Color(255, 0, 0);
                 pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4)));
                 pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)));
                 return(Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz));
             }
         }
     }
 }
Exemple #29
0
        private static void Draw()
        {
            _drawing = true;

            Gdk.GC gc = new Gdk.GC(_pixmap);
            _pixmap.DrawRectangle(gc, true, 0, 0, Globals.WIDTH, Globals.HEIGHT);



            #region Draw Grid
            Cairo.Context g = Gdk.CairoHelper.Create(_pixmap);
            g.Color = new Cairo.Color(.8, .8, .8);
            for (int i = 1; i < 8; i++)
            {
                g.MoveTo(i * Globals.WIDTH / 8, 0);
                g.LineTo(i * Globals.WIDTH / 8, Globals.HEIGHT);
                g.Stroke();
            }
            for (int j = 1; j < 7; j++)
            {
                g.MoveTo(0, j * Globals.HEIGHT / 7);
                g.LineTo(Globals.WIDTH, j * Globals.HEIGHT / 7);
                g.Stroke();
            }
            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
            #endregion Draw Grid



            Game.State.Draw(_pixmap);

            _drawing = false;
        }
Exemple #30
0
 void OnRealized(object o, EventArgs args)
 {
     _width  = WidthRequest;
     _height = HeightRequest;
     _pixmap = new Pixmap(GdkWindow, _width, _height, -1);
     _gc     = new Gdk.GC(GdkWindow);
 }
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            if (textGC == null)
            {
                var plainText = SyntaxHighlightingService.GetColor(editor.EditorTheme, EditorThemeColors.Foreground);
                textGC = plainText.CreateGC(ev.Window);

                plainText = SyntaxHighlightingService.GetColor(editor.EditorTheme, EditorThemeColors.Background);
                textBgGC  = plainText.CreateGC(ev.Window);

                var collapsedText = SyntaxHighlightingService.GetColor(editor.EditorTheme, EditorThemeColors.CollapsedText);
                foldGC = collapsedText.CreateGC(ev.Window);

                collapsedText = SyntaxHighlightingService.GetColor(editor.EditorTheme, EditorThemeColors.Background);
                foldBgGC      = collapsedText.CreateGC(ev.Window);
            }

            ev.Window.DrawRectangle(textBgGC, true, ev.Area);
            ev.Window.DrawLayout(textGC, 5, 4, layout);
            ev.Window.DrawRectangle(textBgGC, false, 1, 1, this.Allocation.Width - 3, this.Allocation.Height - 3);
            ev.Window.DrawRectangle(foldGC, false, 0, 0, this.Allocation.Width - 1, this.Allocation.Height - 1);

            if (!HideCodeSegmentPreviewInformString)
            {
                informLayout.SetText(CodeSegmentPreviewInformString);
                int w, h;
                informLayout.GetPixelSize(out w, out h);
                PreviewInformStringHeight = h;
                ev.Window.DrawRectangle(foldBgGC, true, Allocation.Width - w - 3, Allocation.Height - h, w + 2, h - 1);
                ev.Window.DrawLayout(foldGC, Allocation.Width - w - 4, Allocation.Height - h - 3, informLayout);
            }
            return(true);
        }
Exemple #32
0
        public static Gtk.Image GetCircle(Color circleColor, byte alpha, int radius)
        {
            Pixmap color = new Pixmap(MainWindow.main.GdkWindow, radius * 2, radius * 2);
            Pixmap mask  = new Pixmap(MainWindow.main.GdkWindow, radius * 2, radius * 2);

            Gdk.GC background = new Gdk.GC(color)
            {
                RgbFgColor = circleColor
            };
            Gdk.GC visible = new Gdk.GC(mask)
            {
                RgbFgColor = new Color(alpha, alpha, alpha)
            };
            Gdk.GC invisible = new Gdk.GC(mask)
            {
                RgbFgColor = new Color(0, 0, 0)
            };

            color.DrawRectangle(background, true, new Rectangle(0, 0, radius * 2, radius * 2));
            mask.DrawRectangle(invisible, true, new Rectangle(0, 0, radius * 2, radius * 2));

            mask.DrawArc(visible, true, 0, 0, radius * 2, radius * 2, 0, FULL_CIRCLE);

            if (PlatformDetection.os == OS.Linux)
            {
                mask = Bitmapize(mask, 128);
            }

            return(new Gtk.Image(color, mask));
        }
Exemple #33
0
        public static Pixmap Bitmapize(Pixmap pixmap, int threshold)
        {
            pixmap.GetSize(out int width, out int height);
            Gdk.Image image  = pixmap.GetImage(0, 0, width, height);
            Pixmap    bitmap = new Pixmap(null, width, height, 1);

            Gdk.GC bitSetter = new Gdk.GC(bitmap)
            {
                Function = Gdk.Function.Set
            };
            Gdk.GC bitClearer = new Gdk.GC(bitmap)
            {
                Function = Gdk.Function.Clear
            };
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    if (BitConverter.GetBytes(image.GetPixel(x, y))[0] >= threshold)
                    {
                        bitmap.DrawPoint(bitSetter, x, y);
                    }
                    else
                    {
                        bitmap.DrawPoint(bitClearer, x, y);
                    }
                }
            }
            return(bitmap);
        }
        public TileRenderer(Gtk.Image draw, int pixelWidth, int pixelHeight)
        {
            _renderTo = draw;
            _tileCache = "null";
            _levelPMap = new Pixmap(_renderTo.GdkWindow, pixelWidth, pixelHeight);

            _graphicsContext = new Gdk.GC(_renderTo.GdkWindow);
        }
Exemple #35
0
        public static Gdk.GC GetDarkenedGC(Gdk.Window window,
						    Gdk.Color color,
						    int darken_count)
        {
            DarkenColor (ref color, darken_count);
            Gdk.GC gc = new Gdk.GC (window);
            gc.RgbFgColor = color;
            return gc;
        }
        public Gdk.GC CreateGC(Gdk.Color foregroundColor)
        {
            var gc = new Gdk.GC(GdkWindow);
            gc.RgbFgColor = foregroundColor;
            gc.RgbBgColor = new Gdk.Color(255, 255, 255);
            gc.Background = new Gdk.Color(255, 255, 255);
            gc.SetLineAttributes(1, LineStyle.OnOffDash, CapStyle.Projecting, JoinStyle.Round);

            return gc;
        }
        protected virtual void drawStatsArea(object o, Gtk.ExposeEventArgs args)
        {
            Gdk.GC red = new Gdk.GC (statsArea.GdkWindow);
            red.RgbFgColor = new Gdk.Color (255, 0, 0);
            Gdk.GC blue = new Gdk.GC (statsArea.GdkWindow);
            blue.RgbFgColor = new Gdk.Color (0, 0, 255);

            statsArea.GdkWindow.DrawPoints(blue, speedPoints);
            statsArea.GdkWindow.DrawPoints(red, accelPoints);
        }
        public static void drawWidgetRect(Widget w, Pixbuf widgetBuffer, int offsetX, int offsetY, int drawX, int drawY, int drawW, int drawH)
        {
            Gdk.GC gc = new Gdk.GC(w.GdkWindow);
            w.GdkWindow.DrawPixbuf (gc, widgetBuffer, 0, 0, offsetX, offsetY, -1, -1, Gdk.RgbDither.None, 0, 0);
            w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX, drawY + offsetY, drawW, drawH));

            //set colour to white
            gc.RgbFgColor = new Color (255, 255, 255);

            w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX + 1, drawY + offsetY + 1, drawW, drawH));
        }
Exemple #39
0
        protected virtual void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            int width, height;
            this.DrawingArea.GdkWindow.GetSize(out width, out height);

            using(Gdk.GC g = new Gdk.GC(DrawingArea.GdkWindow))
            {
                g.SetLineAttributes(2, LineStyle.Solid, CapStyle.Round, JoinStyle.Miter);
                DrawingArea.GdkWindow.DrawRectangle(g, false, new Rectangle(0, 0, width, height));
            }
        }
        public PreviewRenderer(Preview preview, Gdk.GC gc, Dimensions dimensions)
        {
            _window = preview.GdkWindow;
              _gc = gc;
              _width = dimensions.Width - 1;
              _height = dimensions.Height - 1;

              var colormap = Colormap.System;
              _inactive = new Gdk.Color(0xff, 0, 0);
              _active = new Gdk.Color(0, 0xff, 0);
              colormap.AllocColor(ref _inactive, true, true);
              colormap.AllocColor(ref _active, true, true);
        }
		public PlaceholderWindow (DockFrame frame): base (Gtk.WindowType.Popup)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = (Gtk.Window) frame.Toplevel;
			TypeHint = WindowTypeHint.Utility;
			
			// Create the mask for the arrow
			
			Realize ();
			redgc = new Gdk.GC (GdkWindow);
	   		redgc.RgbFgColor = frame.Style.Background (StateType.Selected);
		}
Exemple #42
0
        protected void OnDrawVolumeExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            Gdk.Color back = Style.Background(StateType.Normal);
            Gdk.Color fore = Style.Foreground(StateType.Normal);

            Drawable draw = args.Event.Window;

            int width;
            int height;
            draw.GetSize(out width, out height);

            Gdk.GC gc = new Gdk.GC(draw);

            gc.Foreground = back;
            gc.Background = back;
            draw.DrawRectangle(gc, true, 0, 0, width, height);

            //Color lightSlateGray = new Color(119,136,153);

            //gc.Colormap.AllocColor(ref lightSlateGray, false, true);

            int outside = height * 8 / 10;
            int middle = height * 6 / 10;
            int inside = height * 4 / 10;

            int startOut = 24;
            int startMiddle = 30;
            int startInside = 36;

            int endOut = width - 24;
            int endMiddle = width - 30;
            int endInside = width - 36;

            gc.Foreground = fore;
            gc.Foreground = fore;
            gc.SetLineAttributes(outside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startOut, height / 2, endOut, height / 2);

            gc.Foreground = back;
            gc.Background = back;
            gc.SetLineAttributes(middle, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startMiddle, height / 2, endMiddle, height / 2);

            int endX = (endInside - startInside) * Percentage / 100 + startInside;
            gc.Foreground = fore;
            gc.Foreground = fore;
            gc.SetLineAttributes(inside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startInside, height / 2, endX, height / 2);

            gc.Dispose();
        }
        public static void DrawGrid(Gdk.Drawable wnd, int Size)
        {
            int Width, Height;
            var gc = new Gdk.GC (wnd);

            Gdk.Color line_color = new Gdk.Color (0, 255, 255);
            gc.RgbFgColor = line_color;

            wnd.GetSize (out Width, out Height);
            for (int i = 0; i < Width; i += Size)
                wnd.DrawLine (gc, i, 0, i, Height);
            for (int i = 0; i < Height; i += Size)
                wnd.DrawLine (gc, 0, i, Width, i);
        }
		internal protected override void OptionsChanged ()
		{
			DisposeGCs ();
			backgroundGC = new Gdk.GC (editor.GdkWindow);
			backgroundGC.RgbFgColor = editor.ColorStyle.IconBarBg;
			
			separatorGC = new Gdk.GC (editor.GdkWindow);
			separatorGC.RgbFgColor = editor.ColorStyle.IconBarSeperator;
			
			layout.FontDescription = editor.Options.Font;
			layout.SetText ("!");
			int tmp;
			layout.GetPixelSize (out tmp, out this.marginWidth);
			marginWidth *= 12;
			marginWidth /= 10;
		}
Exemple #45
0
        // From MonoDevelop:
        // https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/gtk-gui/generated.cs
        private static Pixbuf CreateMissingImage(int size)
        {
            var pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, size, size);
            var gc = new Gdk.GC (pmap);

            gc.RgbFgColor = new Gdk.Color (255, 255, 255);
            pmap.DrawRectangle (gc, true, 0, 0, size, size);
            gc.RgbFgColor = new Gdk.Color (0, 0, 0);
            pmap.DrawRectangle (gc, false, 0, 0, (size - 1), (size - 1));

            gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
            gc.RgbFgColor = new Gdk.Color (255, 0, 0);
            pmap.DrawLine (gc, (size / 4), (size / 4), ((size - 1) - (size / 4)), ((size - 1) - (size / 4)));
            pmap.DrawLine (gc, ((size - 1) - (size / 4)), (size / 4), (size / 4), ((size - 1) - (size / 4)));

            return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, size, size);
        }
        public ArrowWindow(DockToolbarFrame frame, Direction dir)
            : base(Gtk.WindowType.Popup)
        {
            SkipTaskbarHint = true;
            Decorated = false;
            TransientFor = frame.TopWindow;

            direction = dir;
            arrow = CreateArrow ();
            if (direction == Direction.Up || direction == Direction.Down) {
                 width = PointerWidth;
                 height = LineLength + PointerLength + 1;
            } else {
                 height = PointerWidth;
                 width = LineLength + PointerLength + 1;
            }

            // Create the mask for the arrow

            Gdk.Color black, white;
            black = new Gdk.Color (0, 0, 0);
            black.Pixel = 1;
            white = new Gdk.Color (255, 255, 255);
            white.Pixel = 0;

            Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
            Gdk.GC gc = new Gdk.GC (pm);
            gc.Background = white;
            gc.Foreground = white;
            pm.DrawRectangle (gc, true, 0, 0, width, height);

            gc.Foreground = black;
            pm.DrawPolygon (gc, false, arrow);
            pm.DrawPolygon (gc, true, arrow);

            this.ShapeCombineMask (pm, 0, 0);

            Realize ();

            redgc = new Gdk.GC (GdkWindow);
               		redgc.RgbFgColor = new Gdk.Color (255, 0, 0);

            Resize (width, height);
        }
		void CreateShape (int width, int height)
		{
			Gdk.Color black, white;
			black = new Gdk.Color (0, 0, 0);
			black.Pixel = 1;
			white = new Gdk.Color (255, 255, 255);
			white.Pixel = 0;
			
			Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
			Gdk.GC gc = new Gdk.GC (pm);
			gc.Background = white;
			gc.Foreground = white;
			pm.DrawRectangle (gc, true, 0, 0, width, height);
			
			gc.Foreground = black;
			pm.DrawRectangle (gc, false, 0, 0, width - 1, height - 1);
			pm.DrawRectangle (gc, false, 1, 1, width - 3, height - 3);
			
			this.ShapeCombineMask (pm, 0, 0);
		}
Exemple #48
0
        public void Draw(Drawable draw, Gdk.Color back)
        {
            Gdk.GC gc = new Gdk.GC(draw);

            try {

                int width;
                int height;
                draw.GetSize(out width, out height);

                int xPoint = (width * Volume) / 100;
                int yTop = height * Volume / 100;

                List<Point> points = new List<Point>();
                points.Add(new Point(0,0));
                points.Add(new Point(xPoint, yTop));
                points.Add(new Point(xPoint, height));
                points.Add(new Point(0,height));
                points.Add(new Point(0,0));

                gc.Foreground = back;
                gc.Background = back;
                draw.DrawPolygon(gc, true, points.ToArray());
                draw.DrawRectangle(gc, true, xPoint, 0, width, height);

                points.Clear();
                points.Add(new Point(0,0));
                points.Add(new Point(xPoint, yTop));
                points.Add(new Point(xPoint, 0));
                points.Add(new Point(0,0));
                gc.Foreground = new Gdk.Color(0,128,0);
                gc.Background = new Gdk.Color(0,128,0);
                draw.DrawPolygon(gc, true, points.ToArray());

            } catch (Exception ex) {
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.StackTrace);
            }

            gc.Dispose();
        }
        protected void OnDrawWeatherExposeEvent(object o, ExposeEventArgs args)
        {
            Gdk.Color back = Style.Background(StateType.Normal);
            Gdk.Color fore = Style.Foreground(StateType.Normal);

            Drawable draw = drawWeather.GdkWindow;
            Gdk.GC gc = new Gdk.GC(draw);

            try {
                gc.Foreground = back;
                gc.Background = back;

                int width;
                int height;
                draw.GetSize(out width, out height);
                draw.DrawRectangle(gc, true, 0, 0, width, height);

                gc.Foreground = fore;

                String text = "";
                if (Weather.Forecasts.Count > SelectedForecast) {
                    WeatherService.WeatherPeriod info = Weather.Forecasts[SelectedForecast];
                    text = info.Title + " - " + info.Forecast + "\n";
                }

                Pango.FontDescription font = Pango.FontDescription.FromString("Serif 14");
                Pango.Layout layout = drawWeather.CreatePangoLayout(text);
                layout.FontDescription = font;
                layout.Width = Pango.Units.FromPixels(width);
                draw.DrawLayoutWithColors(gc, 0, 0, layout, fore, back);
                layout.Dispose();

            } catch (Exception ex) {
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.StackTrace);
            }

            gc.Dispose();
        }
Exemple #50
0
        public override void Draw(TextEditor editor, Gdk.Drawable win,Pango.Layout layout, bool selected, int startOffset, int endOffset, int y, int startXPos, int endXPos)
        {
            int markerStart = LineSegment.Offset + System.Math.Max (StartCol, 0);
                  int markerEnd   = LineSegment.Offset + (EndCol < 0? LineSegment.Length : EndCol);
                  if (markerEnd < startOffset || markerStart > endOffset)
                        return;

                  int from;
                  int to;

                  if (markerStart < startOffset && endOffset < markerEnd) {
                        from = startXPos;
                        to   = endXPos;
                  } else {
                        int start = startOffset < markerStart ? markerStart : startOffset;
                        int end   = endOffset < markerEnd ? endOffset : markerEnd;
                        from = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, start - startOffset));
                        to   = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, end - startOffset));
                  }
                  from = System.Math.Max (from, editor.TextViewMargin.XOffset);
                  to   = System.Math.Max (to, editor.TextViewMargin.XOffset);
                  if (from >= to) {
                        return;
                  }

                  using (Gdk.GC gc = new Gdk.GC (win)) {
                       // gc.RgbFgColor = ColorName == null ? Color : editor.ColorStyle.GetColorFromDefinition (ColorName);
                        int drawY    = y + editor.LineHeight - 1;

                        win.DrawLine (gc, from, drawY, to, drawY);
            if(@from<to){
                //gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.BackgroundColor;
                //win.DrawRectangle (gc, true, @from + 1, y + 1, to - @from - 1, editor.LineHeight - 2);
                gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.Color;
                win.DrawRectangle (gc, false, @from, y, to - @from, editor.LineHeight - 1);
            }

                  }
        }
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            Gdk.GC gc = new Gdk.GC(window);

            int width = cell_area.Width / blockEvent.BlockCount;

            for (int i = 0; i < blockEvent.BlockCount; i++) {
                if(blockEvent.AllBlocksReceived)
                    gc.RgbFgColor = new Gdk.Color(179, 139, 83); // Brown
                else if (blockEvent[i].Written)
                    gc.RgbFgColor = new Gdk.Color(145, 246, 145); // Green
                else if (blockEvent[i].Received)
                    gc.RgbFgColor = new Gdk.Color(232, 176, 6); // Gold
                else if (blockEvent[i].Requested)
                    gc.RgbFgColor = new Gdk.Color(112, 180, 224); // Blue
                else
                    gc.RgbFgColor = new Gdk.Color(248, 227, 212); // Pink

                Gdk.Rectangle rect = new Gdk.Rectangle(background_area.X + (width * i), background_area.Y + 1, width, background_area.Height - 2 * 1);
                window.DrawRectangle(gc,true,rect);
            }
        }
Exemple #52
0
   private void RenderBubbles(Gdk.Window win, Gdk.Rectangle size,
 out Pixbuf pbactive, out Pixbuf pbinactive,
 out Gdk.Pixmap pbpm)
   {
       int pmHeight, pmWidth;
          Gdk.Pixmap daPixmap;
          Gdk.Pixmap daOtherPixmap;
          pmHeight = size.Height - (wbsize * 2);
          pmWidth = size.Width - (wbsize * 2);
          Gdk.GC gc = new Gdk.GC(win);
          Gdk.Pixmap pm = new Pixmap(win, size.Width, size.Height, -1);
          gc.RgbFgColor = new Gdk.Color(255, 255, 255);
          pm.DrawRectangle(gc, true, 0, 0, size.Width, size.Height);
          gc.RgbFgColor = new Gdk.Color(249, 253, 202);
          Gdk.Point[] roundedSquare = CalculateRect(wbsize, wbsize,
         pmWidth, pmHeight);
          pm.DrawPolygon(gc, true, roundedSquare);
          Gdk.Point[] roundedborder = CalculateRect(wbsize, wbsize,
       pmWidth - 1, pmHeight - 1);
          gc.RgbFgColor = new Gdk.Color(0, 0, 0);
          pm.DrawPolygon(gc, false, roundedborder);
          Gdk.Point[] balloonptr = CalcPointerMoveWindow( size.Width,
        size.Height );
          gc.RgbFgColor = new Gdk.Color(249, 253, 202);
          pm.DrawPolygon(gc, true, balloonptr);
          gc.RgbFgColor = new Gdk.Color(0, 0, 0);
          pm.DrawLine(gc, balloonptr[0].X, balloonptr[0].Y-1, balloonptr[1].X,
          balloonptr[1].Y);
          pm.DrawLine(gc, balloonptr[1].X, balloonptr[1].Y, balloonptr[2].X,
          balloonptr[2].Y-1);
          Gdk.Pixbuf pb = new Pixbuf(Gdk.Colorspace.Rgb, false,
         8, size.Width, size.Height);
          pb = Pixbuf.FromDrawable( pm, pm.Colormap, 0, 0, 0, 0,
         size.Width, size.Height);
          pb = pb.AddAlpha(true, 255, 255,255);
          RenderPixmapAndMask(pb, out daPixmap, out daOtherPixmap, 2);
          pbactive = pb;
          pbpm = daOtherPixmap;
          gc.RgbFgColor = new Gdk.Color(255, 255, 255);
          pm.DrawRectangle(gc, true, 0, 0, size.Width, size.Height);
          gc.RgbFgColor = new Gdk.Color(0, 0, 0);
          pm.DrawPolygon(gc, false, roundedborder);
          gc.RgbFgColor = new Gdk.Color(255, 255, 255);
          pm.DrawPolygon(gc, true, balloonptr);
          gc.RgbFgColor = new Gdk.Color(0, 0, 0);
          pm.DrawLine(gc, balloonptr[0].X, balloonptr[0].Y-1, balloonptr[1].X,
          balloonptr[1].Y);
          pm.DrawLine(gc, balloonptr[1].X, balloonptr[1].Y, balloonptr[2].X,
          balloonptr[2].Y - 1);
          pb = Pixbuf.FromDrawable( pm,
         pm.Colormap, 0, 0, 0, 0, size.Width, size.Height);
          pbinactive = pb;
   }
		protected void OnRealized (object o, EventArgs args)
		{
			int x, y;
			int w, h;
			GdkWindow.GetOrigin (out x, out y);
			GdkWindow.GetSize (out w, out h);

			textTop = y + image.Height - 30;
			scrollStart = -(image.Height - textTop);
			scroll = scrollStart;

			layout = new Pango.Layout (this.PangoContext);
			// FIXME: this seems wrong but works
			layout.Width = w * (int)Pango.Scale.PangoScale;
			layout.Wrap = Pango.WrapMode.Word;
			layout.Alignment = Pango.Alignment.Center;
			FontDescription fd = FontDescription.FromString ("Tahoma 10");
			layout.FontDescription = fd;
			layout.SetMarkup (CreditText);

			backGc = new Gdk.GC (GdkWindow);
			backGc.RgbBgColor = new Gdk.Color (49, 49, 74);
		}
Exemple #54
0
			protected override bool OnExposeEvent (Gdk.EventExpose e)
			{
				using (Cairo.Context cr = Gdk.CairoHelper.Create (e.Window)) {
					cr.LineWidth = Math.Max (1.0, widget.Editor.Options.Zoom);
					
					cr.Rectangle (leftSpacer, 0, Allocation.Width, Allocation.Height);
					cr.Color = new Cairo.Color (0.95, 0.95, 0.95);
					cr.Fill ();
					
					int startLine = widget.Editor.YToLine ((int)widget.Editor.VAdjustment.Value);
					double startY = widget.Editor.LineToY (startLine);
					while (startLine > 1 && startLine < annotations.Count && annotations[startLine - 1] != null && annotations[startLine] != null && annotations[startLine - 1].Revision == annotations[startLine].Revision) {
						startLine--;
						startY -= widget.Editor.GetLineHeight (widget.Editor.Document.GetLine (startLine));
					}
					double curY = startY - widget.Editor.VAdjustment.Value;
					int line = startLine;
					while (curY < Allocation.Bottom) {
						double curStart = curY;
//						widget.JumpOverFoldings (ref line);
						int lineStart = line;
						int w = 0, w2 = 0, h = 16;
						Annotation ann = line <= annotations.Count ? annotations[line - 1] : null;
						if (ann != null) {
							do {
								widget.JumpOverFoldings (ref line);
								line++;
							} while (line + 1 <= annotations.Count && annotations[line - 1] != null && annotations[line - 1].Revision == ann.Revision);
							double nextY = widget.editor.LineToY (line) - widget.editor.VAdjustment.Value;
							if (highlightAnnotation != null && highlightAnnotation.Revision == ann.Revision && curStart <= highlightPositon && highlightPositon < nextY) {
								cr.Rectangle (leftSpacer, curStart + cr.LineWidth, Allocation.Width - leftSpacer, nextY - curStart - cr.LineWidth);
								cr.Color = new Cairo.Color (1, 1, 1);
								cr.Fill ();
							}
							layout.SetText (ann.Author);
							layout.GetPixelSize (out w, out h);
							e.Window.DrawLayout (Style.BlackGC, leftSpacer + margin, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);
							
							
							layout.SetText (TruncRevision (ann.Revision));
							layout.GetPixelSize (out w2, out h);
							e.Window.DrawLayout (Style.BlackGC, Allocation.Width - w2 - margin, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);

							if (ann.HasDate) {
								string dateTime = ann.Date.ToShortDateString ();
								int middle = w + (Allocation.Width - margin * 2 - leftSpacer - w - w2) / 2;
								layout.SetText (dateTime);
								layout.GetPixelSize (out w, out h);
								e.Window.DrawLayout (Style.BlackGC, leftSpacer + margin + middle - w / 2, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);
							}
							curY = nextY;
						} else {
							curY += widget.Editor.GetLineHeight (line);
							line++;
							widget.JumpOverFoldings (ref line);
						}
						
						if (ann != null && line - lineStart > 1) {
							string msg = GetCommitMessage (lineStart);
							if (!string.IsNullOrEmpty (msg)) {
								msg = FormatMessage (msg);
								layout.SetText (msg);
								layout.Width = (int)(Allocation.Width * Pango.Scale.PangoScale);
								using (var gc = new Gdk.GC (e.Window)) {
									gc.RgbFgColor = Style.Dark (State);
									gc.ClipRectangle = new Rectangle (0, (int)curStart, Allocation.Width, (int)(curY - curStart));
									e.Window.DrawLayout (gc, (int)(leftSpacer + margin), (int)(curStart + h), layout);
								}
							}
						}
						
						cr.Rectangle (0, curStart, leftSpacer, curY - curStart);
						
						if (ann != null && ann != locallyModified && !string.IsNullOrEmpty (ann.Author)) {
							double a;
							
							if (ann != null && (maxDate - minDate).TotalHours > 0) {
								a = 1 - (ann.Date  - minDate).TotalHours / (maxDate - minDate).TotalHours;
							} else {
								a = 1;
							}
							HslColor color = new Cairo.Color (0.90, 0.90, 1);
							color.L = 0.4 + a / 2;
							color.S = 1 - a / 2;
							cr.Color = color;
						} else {
							cr.Color = ann != null ? new Cairo.Color (1, 1, 0) : new Cairo.Color (0.95, 0.95, 0.95);
						}
						cr.Fill ();

						if (ann != null) {
							cr.MoveTo (0, curY + 0.5);
							cr.LineTo (Allocation.Width, curY + 0.5);
							cr.Color = new Cairo.Color (0.6, 0.6, 0.6);
							cr.Stroke ();
						}
					}
				}
				return true;
			}
Exemple #55
0
        void ExposeIt()
        {
            if(!this.Visible)
                return;

            Gdk.GC gc = new Gdk.GC(this.GdkWindow);
            int w, h;
            this.GdkWindow.GetSize(out w, out h);
            /*
            Gdk.Pixmap pixmap_mask;
            Pixmap pixmap;
            Gdk.Pixbuf pixbuf = Images.LeftPaneBackground;
            pixbuf.RenderPixmapAndMask( out pixmap, out pixmap_mask, 255);
            gc.Fill = Gdk.Fill.Tiled;
            gc.Tile = pixmap;
            this.GdkWindow.DrawRectangle (gc, true, 0, 0, 260, h);
            */
            int posterW, posterH, posterX;
            if(Poster != null)
            {
                posterW = Poster.Width;
                posterH = Poster.Height;
                //Poster.RenderPixmapAndMask(out pixmap, out pixmap_mask, 255);
            }
            else
            {
                posterW = Images.NoPosterPixbuf.Width;
                posterH = Images.NoPosterPixbuf.Height;
                //Images.NoPosterPixbuf.RenderPixmapAndMask(out pixmap, out pixmap_mask, 255);
            }
            posterX = (260 - posterW) / 2;
            using(Cairo.Context cr =  Gdk.CairoHelper.Create(this.GdkWindow))
            {
                cr.SetSourceRGB(.87, .894, .9215);
                cr.Rectangle(0, 0, 259, h);
                cr.Fill();
                cr.Rectangle(posterX - 2, 98, posterW + 4, posterH + 4);
                cr.SetSourceRGB(.7, .7, .7);
                cr.Fill();
                cr.Rectangle(258, 0, 1, h);
                cr.Fill();
            }
            this.GdkWindow.DrawPixbuf(gc, Poster ?? Images.NoPosterPixbuf, 0, 0, posterX, 100, posterW, posterH, RgbDither.Normal, 0, 0);

            image1.HeightRequest = posterH + 20;
        }
		protected override bool OnExposeEvent (Gdk.EventExpose ev)
		{
			int w, h;
			this.GdkWindow.GetSize (out w, out h);
			
			if (fill == BoxFill.Box) {
				this.GdkWindow.DrawRectangle (this.Style.WhiteGC, true, 0, 0, w, h);
				this.GdkWindow.DrawRectangle (this.Style.BlackGC, false, 0, 0, w-1, h-1);
			} else if (fill == BoxFill.HLine) {
				using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) {
					gc.SetDashes (0, new sbyte [] { 1, 1 }, 2);
					gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
					gc.Foreground = this.Style.Black;
					this.GdkWindow.DrawLine (gc, 0, h / 2, w, h / 2);
					gc.Foreground = this.Style.White;
					this.GdkWindow.DrawLine (gc, 1, h/2, w, h/2);
				}
			} else {
				using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) {
					gc.SetDashes (0, new sbyte [] { 1, 1 }, 2);
					gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
					gc.Foreground = this.Style.Black;
					this.GdkWindow.DrawLine (gc, w / 2, 0, w / 2, h);
					gc.Foreground = this.Style.White;
					this.GdkWindow.DrawLine (gc, w / 2, 1, w/2, h);
				}
			}
			
			return true;
		}
Exemple #57
0
		protected override bool OnExposeEvent (Gdk.EventExpose args)
		{
			Gdk.GC gc = new Gdk.GC (GdkWindow);
			gc.ClipRectangle = Allocation;
			GdkWindow.DrawLayout (gc, padding, padding, layout);
			return true;
		}
		protected override void Render (Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			if (isDisposed)
				return;
			if (diffMode) {
				
				if (path.Equals (selctedPath)) {
					selectedLine = -1;
					selctedPath = null;
				}
				
				int w, maxy;
				window.GetSize (out w, out maxy);
				if (DrawLeft) {
					cell_area.Width += cell_area.X - leftSpace;
					cell_area.X = leftSpace;
				}
				var treeview = widget as FileTreeView;
				var p = treeview != null? treeview.CursorLocation : null;
				
				cell_area.Width -= RightPadding;
				
				window.DrawRectangle (widget.Style.BaseGC (Gtk.StateType.Normal), true, cell_area.X, cell_area.Y, cell_area.Width - 1, cell_area.Height);
				
				Gdk.GC normalGC = widget.Style.TextGC (StateType.Normal);
				Gdk.GC removedGC = new Gdk.GC (window);
				removedGC.Copy (normalGC);
				removedGC.RgbFgColor = baseRemoveColor.AddLight (-0.3);
				Gdk.GC addedGC = new Gdk.GC (window);
				addedGC.Copy (normalGC);
				addedGC.RgbFgColor = baseAddColor.AddLight (-0.3);
				Gdk.GC infoGC = new Gdk.GC (window);
				infoGC.Copy (normalGC);
				infoGC.RgbFgColor = widget.Style.Text (StateType.Normal).AddLight (0.2);
				
				Cairo.Context ctx = CairoHelper.Create (window);
				Gdk.Color bgColor = new Gdk.Color (0,0,0);
				
				
				// Rendering is done in two steps:
				// 1) Get a list of blocks to render
				// 2) render the blocks
				
				int y = cell_area.Y + 2;
				
				// cline keeps track of the current source code line (the one to jump to when double clicking)
				int cline = 1;
				bool inHeader = true;
				BlockInfo currentBlock = null;
				
				List<BlockInfo> blocks = new List<BlockInfo> ();
				
				for (int n=0; n<lines.Length; n++, y += lineHeight) {
					
					string line = lines [n];
					if (line.Length == 0) {
						currentBlock = null;
						y -= lineHeight;
						continue;
					}
					
					char tag = line [0];
	
					if (line.StartsWith ("---") || line.StartsWith ("+++")) {
						// Ignore this part of the header.
						currentBlock = null;
						y -= lineHeight;
						continue;
					}
					if (tag == '@') {
						int l = ParseCurrentLine (line);
						if (l != -1) cline = l - 1;
						inHeader = false;
					} else if (tag != '-' && !inHeader)
						cline++;
					
					BlockType type;
					bool hasBg = false;
					switch (tag) {
						case '-': type = BlockType.Removed; break;
						case '+': type = BlockType.Added; break;
						case '@': type = BlockType.Info; break;
						default: type = BlockType.Unchanged; break;
					}

					if (currentBlock == null || type != currentBlock.Type) {
						if (y > maxy)
							break;
					
						// Starting a new block. Mark section ends between a change block and a normal code block
						if (currentBlock != null && IsChangeBlock (currentBlock.Type) && !IsChangeBlock (type))
							currentBlock.SectionEnd = true;
						
						currentBlock = new BlockInfo () {
							YStart = y,
							FirstLine = n,
							Type = type,
							SourceLineStart = cline,
							SectionStart = (blocks.Count == 0 || !IsChangeBlock (blocks[blocks.Count - 1].Type)) && IsChangeBlock (type)
						};
						blocks.Add (currentBlock);
					}
					// Include the line in the current block
					currentBlock.YEnd = y + lineHeight;
					currentBlock.LastLine = n;
				}

				// Now render the blocks

				// The y position of the highlighted line
				int selectedLineRowTop = -1;

				BlockInfo lastCodeSegmentStart = null;
				BlockInfo lastCodeSegmentEnd = null;
				
				foreach (BlockInfo block in blocks)
				{
					if (block.Type == BlockType.Info) {
						// Finished drawing the content of a code segment. Now draw the segment border and label.
						if (lastCodeSegmentStart != null)
							DrawCodeSegmentBorder (infoGC, ctx, cell_area.X, cell_area.Width, lastCodeSegmentStart, lastCodeSegmentEnd, lines, widget, window);
						lastCodeSegmentStart = block;
					}
					
					lastCodeSegmentEnd = block;
					
					if (block.YEnd < 0)
						continue;
					
					// Draw the block background
					DrawBlockBg (ctx, cell_area.X + 1, cell_area.Width - 2, block);
					
					// Get all text for the current block
					StringBuilder sb = new StringBuilder ();
					for (int n=block.FirstLine; n <= block.LastLine; n++) {
						string s = ProcessLine (lines [n]);
						if (sb.Length > 0)
							sb.Append ('\n');
						if (block.Type != BlockType.Info && s.Length > 0)
							sb.Append (s, 1, s.Length - 1);
						else
							sb.Append (s);
					}
					
					// Draw a special background for the selected line
					
					if (block.Type != BlockType.Info && p.HasValue && p.Value.X >= cell_area.X && p.Value.X <= cell_area.Right && p.Value.Y >= block.YStart && p.Value.Y <= block.YEnd) {
						int row = (p.Value.Y - block.YStart) / lineHeight;
						double yrow = block.YStart + lineHeight * row + 0.5;
						double xrow = cell_area.X + LeftPaddingBlock + 0.5;
						int wrow = cell_area.Width - 1 - LeftPaddingBlock;
						if (block.Type == BlockType.Added)
							ctx.Color = baseAddColor.AddLight (0.1).ToCairoColor ();
						else if (block.Type == BlockType.Removed)
							ctx.Color = baseRemoveColor.AddLight (0.1).ToCairoColor ();
						else {
							ctx.Color = widget.Style.Base (Gtk.StateType.Prelight).AddLight (0.1).ToCairoColor ();
							xrow -= LeftPaddingBlock;
							wrow += LeftPaddingBlock;
						}
						ctx.Rectangle (xrow, yrow, wrow, lineHeight);
						ctx.Fill ();
						selectedLine = block.SourceLineStart + row;
						selctedPath = path;
						selectedLineRowTop = (int)yrow;
					}
					
					// Draw the line text. Ignore header blocks, since they are drawn as labels in DrawCodeSegmentBorder
					
					if (block.Type != BlockType.Info) {
						layout.SetMarkup ("");
						layout.SetText (sb.ToString ());
						Gdk.GC gc;
						switch (block.Type) {
							case BlockType.Removed: gc = removedGC; break;
							case BlockType.Added: gc = addedGC; break;
							case BlockType.Info: gc = infoGC; break;
							default: gc = normalGC; break;
						}
						window.DrawLayout (gc, cell_area.X + 2 + LeftPaddingBlock, block.YStart, layout);
					}
					
					// Finally draw the change symbol at the left margin
					
					DrawChangeSymbol (ctx, cell_area.X + 1, cell_area.Width - 2, block);
				}
				
				// Finish the drawing of the code segment
				if (lastCodeSegmentStart != null)
					DrawCodeSegmentBorder (infoGC, ctx, cell_area.X, cell_area.Width, lastCodeSegmentStart, lastCodeSegmentEnd, lines, widget, window);
				
				// Draw the source line number at the current selected line. It must be done at the end because it must
				// be drawn over the source code text and segment borders.
				if (selectedLineRowTop != -1)
					DrawLineBox (normalGC, ctx, ((Gtk.TreeView)widget).VisibleRect.Right - 4, selectedLineRowTop, selectedLine, widget, window);
				
				((IDisposable)ctx).Dispose ();
				removedGC.Dispose ();
				addedGC.Dispose ();
				infoGC.Dispose ();
			} else {
				// Rendering a normal text row
				int y = cell_area.Y + (cell_area.Height - height)/2;
				window.DrawLayout (widget.Style.TextGC (GetState(flags)), cell_area.X, y, layout);
			}
		}
		protected override bool OnExposeEvent (Gdk.EventExpose ev)
		{
			if (textGC == null) {
				textGC = editor.ColorStyle.PlainText.CreateFgGC (ev.Window);
				textBgGC = editor.ColorStyle.PlainText.CreateBgGC (ev.Window);
				foldGC = editor.ColorStyle.CollapsedText.CreateFgGC (ev.Window);
				foldBgGC = editor.ColorStyle.CollapsedText.CreateBgGC (ev.Window);
			}
			
			ev.Window.DrawRectangle (textBgGC, true, ev.Area);
			ev.Window.DrawLayout (textGC, 1, 1, layout);
			ev.Window.DrawRectangle (textBgGC, false, 1, 1, this.Allocation.Width - 3, this.Allocation.Height - 3);
			ev.Window.DrawRectangle (foldGC, false, 0, 0, this.Allocation.Width - 1, this.Allocation.Height - 1);
			
			if (!HideCodeSegmentPreviewInformString) {
				informLayout.SetText (CodeSegmentPreviewInformString);
				int w, h;
				informLayout.GetPixelSize (out w, out h); 
				PreviewInformStringHeight = h;
				ev.Window.DrawRectangle (foldBgGC, true, Allocation.Width - w - 3, Allocation.Height - h, w + 2, h - 1);
				ev.Window.DrawLayout (foldGC, Allocation.Width - w - 3, Allocation.Height - h, informLayout);
			}
			return true;
		}
Exemple #60
0
		protected override bool OnExposeEvent (EventExpose evnt)
		{
			if (data == null)
				BuildData ();
			
			hostSpots.Clear ();
			int ytop = padding;
			int markerX = 3;
			int lx = markerX + MarkerWidth + 1;
			int tx = 250;
			int ty = ytop;
			int maxx = lx;
			int maxy = 0;
			
			DateTime initialTime = mainValue.TimeStamp;
			
			Cairo.Context ctx = CairoHelper.Create (GdkWindow);
			
			Gdk.GC gc = new Gdk.GC (GdkWindow);
			gc.RgbFgColor = Style.White;
			GdkWindow.DrawRectangle (gc, true, 0, 0, Allocation.Width, Allocation.Height);
			
			// Draw full time marker
			
			ctx.NewPath ();
			ctx.Rectangle (markerX, ytop + baseTime + 0.5, MarkerWidth/2, ((mainValue.Duration.TotalMilliseconds * scale) / 1000));
			Mono.TextEditor.HslColor hsl = Style.Foreground (Gtk.StateType.Normal);
			hsl.L = 0.8;
			ctx.SetSourceColor (hsl);
			ctx.Fill ();
			
			// Draw values
			
			foreach (CounterValueInfo val in data) {
				DrawValue (ctx, gc, initialTime, ytop, lx, tx, ref ty, ref maxx, ref maxy, 0, val);
			}
			
			if (ty > maxy)
				maxy = ty;
			
			int totalms = (int) mainValue.Duration.TotalMilliseconds;
			int marks = (totalms / 1000) + 1;
			
			ctx.LineWidth = 1;
			gc.RgbFgColor = Style.Foreground (Gtk.StateType.Normal);
			
			for (int n=0; n<=marks; n++) {
				ctx.NewPath ();
				int y = ytop + (int) (n * scale) + baseTime;
				ctx.MoveTo (markerX, y + 0.5);
				ctx.LineTo (markerX + MarkerWidth, y + 0.5);
				ctx.SetSourceColor (Style.Foreground (Gtk.StateType.Normal).ToCairoColor ());
				ctx.Stroke ();
				
				y += 2;
				layout.SetText (n + "s");
				GdkWindow.DrawLayout (gc, markerX + 1, y + 2, layout);
				
				int tw, th;
				layout.GetPixelSize (out tw, out th);
				y += th;
				
				if (y > maxy)
					maxy = y;
			}
			
			((IDisposable)ctx).Dispose ();
			
			maxy += padding;
			maxx += padding;
			
			if (lastHeight != maxy || lastWidth != maxx) {
				lastWidth = maxx;
				lastHeight = maxy;
				SetSizeRequest (maxx, maxy);
			}

			return true;
		}