Example #1
0
        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);
            }
        }
        private void OnWidgetDestroyed(object sender, EventArgs args)
        {
            if (!IsRealized)
            {
                return;
            }

            canvas = new Pixmap(GdkWindow, widget_alloc.Width, widget_alloc.Height);
            canvas.DrawDrawable(Style.BackgroundGC(State), GdkWindow,
                                widget_alloc.X, widget_alloc.Y, 0, 0, widget_alloc.Width, widget_alloc.Height);

            if (AnimationState != AnimationState.Going)
            {
                WidgetDestroyed(this, args);
            }
        }
Example #3
0
        public void DrawLabel(int position, string label)
        {
            var layout = new Pango.Layout(this.PangoContext);

            layout.FontDescription = FontDescription.FromString("Tahoma 16");
            layout.SetMarkup(label);

            int width, height;

            layout.GetPixelSize(out width, out height);
            if (width != 0 && height != 0)
            {
                _labelPixmap = new Pixmap(GdkWindow, width, height, -1);
                CalculateXandY(position, width, height);
                _labelPixmap.DrawDrawable(_gc, _pixmap, _labelX, _labelY, 0, 0,
                                          width, height);
                _labelPixmap.DrawLayout(_gc, 0, 0, layout);

                QueueDraw();
            }
        }
Example #4
0
        private void OnWidgetDestroyed(object sender, EventArgs args)
        {
            if (!IsRealized)
            {
                return;
            }

            canvas = new Pixmap(GdkWindow, widget_alloc.Width, widget_alloc.Height);
            if (Platform.IsMac)
            {
                //FIXME: quick hack to make less ugly on Mac, because Mac GTK doesn't yet support offscreen drawing
                canvas.DrawRectangle(Style.BackgroundGC(State), true, 0, 0, widget_alloc.Width, widget_alloc.Height);
            }
            else
            {
                canvas.DrawDrawable(Style.BackgroundGC(State), GdkWindow, widget_alloc.X, widget_alloc.Y, 0, 0, widget_alloc.Width, widget_alloc.Height);
            }

            if (AnimationState != AnimationState.Going)
            {
                WidgetDestroyed(this, args);
            }
        }
        private void OnWidgetDestroyed (object sender, EventArgs args)
        {
            if (!IsRealized) {
                return;
            }

            canvas = new Pixmap (GdkWindow, widget_alloc.Width, widget_alloc.Height);
            if (Platform.IsMac) {
                //FIXME: quick hack to make less ugly on Mac, because Mac GTK doesn't yet support offscreen drawing
                canvas.DrawRectangle (Style.BackgroundGC (State), true, 0, 0, widget_alloc.Width, widget_alloc.Height);
            } else {
                canvas.DrawDrawable (Style.BackgroundGC (State), GdkWindow,
                    widget_alloc.X, widget_alloc.Y, 0, 0, widget_alloc.Width, widget_alloc.Height);
            }

            if (AnimationState != AnimationState.Going) {
                WidgetDestroyed (this, args);
            }
        }
Example #6
0
        private void OnWidgetDestroyed (object sender, EventArgs args)
        {
            if (!IsRealized) {
                return;
            }

            canvas = new Pixmap (GdkWindow, widget_alloc.Width, widget_alloc.Height);
            canvas.DrawDrawable (Style.BackgroundGC (State), GdkWindow,
                widget_alloc.X, widget_alloc.Y, 0, 0, widget_alloc.Width, widget_alloc.Height);

            if (AnimationState != AnimationState.Going) {
                WidgetDestroyed (this, args);
            }
        }
Example #7
0
        public void DrawLabel(int position, string label)
        {
            var layout = new Pango.Layout(this.PangoContext);
              layout.FontDescription = FontDescription.FromString ("Tahoma 16");
              layout.SetMarkup(label);

              int width, height;
              layout.GetPixelSize(out width, out height);
              if (width != 0 && height != 0)
            {
              _labelPixmap = new Pixmap(GdkWindow, width, height, -1);
              CalculateXandY(position, width, height);
              _labelPixmap.DrawDrawable(_gc, _pixmap, _labelX, _labelY, 0, 0,
                    width, height);
              _labelPixmap.DrawLayout(_gc, 0, 0, layout);

              QueueDraw();
            }
        }