Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 /// <summary>Node has begun to be dragged.</summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event data.</param>
 private void OnDragBegin(object sender, DragBeginArgs e)
 {
     try
     {
         if (textRender.Editable) // If the node to be dragged is open for editing (renaming), close it now.
         {
             textRender.StopEditing(true);
         }
         DragStartArgs args = new DragStartArgs();
         args.NodePath = SelectedNode; // FullPath(e.Item as TreeNode);
         if (DragStarted != null)
         {
             DragStarted(this, args);
             if (args.DragObject != null)
             {
                 sourcePathOfItemBeingDragged = args.NodePath;
                 dragSourceHandle             = GCHandle.Alloc(args.DragObject);
             }
         }
     }
     catch (Exception err)
     {
         ShowError(err);
     }
 }
Ejemplo n.º 3
0
 private void DragGesture_DragBegin(object o, DragBeginArgs args)
 {
     DisplayOffset = Offset;
     //DragGesture.GetStartPoint(out double x, out double y);
     //Console.WriteLine($"Drag start ({x}, {y}), DispOffset: ({DisplayOffset.X}, {DisplayOffset.Y}), Offset: ({Offset.X}, {Offset.Y})");
     DrawingArea.QueueDraw();
 }
Ejemplo n.º 4
0
 void Widget_DragBegin(object sender, DragBeginArgs args)
 {
     if (!isDragging)
     {
         DesignerSupport.Service.ToolboxService.DragSelectedItem(widget, args.Context);
         isDragging = true;
     }
 }
Ejemplo n.º 5
0
        void HandleDragBegin(object o, DragBeginArgs args)
        {
            // Set the drag icon, otherwise it will be a whole page cell rendering,
            // which can be quite large and obscure the drop points
            bool single = SelectedItems.Length == 1;

            Gtk.Drag.SetIconStock(args.Context, single ? Stock.Dnd : Stock.DndMultiple, 0, 0);
        }
Ejemplo n.º 6
0
        void Treeview1_DragBegin(object o, DragBeginArgs args)
        {
            List <string> ids;

            GetSelectedTreePath(out siters, out ids);

            if (siters.Contains(GetBaseIter()))
            {
                siters = new List <TreeIter>();
            }
        }
Ejemplo n.º 7
0
    private void OnDragBegin(object o, DragBeginArgs args)
    {
        if (SelectedObjectNr > -1)
        {
            draggedID     = SelectedObjectNr;
            draggedBadguy = badguys[SelectedObjectNr];
            Gtk.Drag.SetIconWidget(args.Context, SpriteViewWidget.CreateWindow(badguySprites[draggedBadguy]), -15, -15);

            dragging = true;
        }
        //update heigth
        SetSizeRequest(-1, ROW_HEIGHT * ((badguys.Count - 1) / TILES_PER_ROW + 1));
        LogManager.Log(LogLevel.Debug, "Dragstart of " + draggedBadguy);
    }
Ejemplo n.º 8
0
        /// <summary>Node has begun to be dragged.</summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void OnDragBegin(object sender, DragBeginArgs e)
        {
            DragStartArgs args = new DragStartArgs();

            args.NodePath = SelectedValue;
            if (DragStarted != null)
            {
                DragStarted(this, args);
                if (args.DragObject != null)
                {
                    dragSourceHandle = GCHandle.Alloc(args.DragObject);
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Emitted on the drag source when drag is started
        /// </summary>
        void HandleDragBegin(object o, DragBeginArgs args)
        {
            Owner.CursorTracker.RequestHighResolution(this);
            InternalDragActive = true;
            Keyboard.Grab(Owner.GdkWindow, true, Gtk.Global.CurrentEventTime);
            drag_canceled = false;

            if (proxy_window != null)
            {
                EnableDragTo();
                proxy_window = null;
            }

            Gdk.Pixbuf pbuf;
            drag_item = Owner.HoveredItem;
            original_item_pos.Clear();

            // If we are in Reposition Mode or over a non-draggable item
            // dont drag it!
            if (drag_item is INonPersistedItem || RepositionMode)
            {
                drag_item = null;
            }

            if (drag_item != null)
            {
                foreach (AbstractDockItem adi in ProviderForItem(drag_item).Items)
                {
                    original_item_pos [adi] = adi.Position;
                }

                using (DockySurface surface = new DockySurface((int)(1.2 * Owner.ZoomedIconSize), (int)(1.2 * Owner.ZoomedIconSize))) {
                    pbuf = Owner.HoveredItem.IconSurface(surface, (int)(1.2 * Owner.ZoomedIconSize), Owner.IconSize, 0).LoadToPixbuf();
                }
            }
            else
            {
                pbuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 1, 1);
            }

            Gtk.Drag.SetIconPixbuf(args.Context, pbuf, pbuf.Width / 2, pbuf.Height / 2);
            pbuf.Dispose();

            // Set up a cursor tracker so we can move the window on the fly
            if (RepositionMode)
            {
                Owner.CursorTracker.CursorPositionChanged += HandleCursorPositionChanged;
            }
        }
Ejemplo n.º 10
0
        void HandleDragBegin(object sender, DragBeginArgs args)
        {
            Gtk.Drag.SetIconPixbuf(args.Context, image.Pixbuf, 0, 0);

            focusedLiterals.Add(this);

            // Hide the tag and any separators that only exist because of it
            container.Visible = false;
            hiddenWidgets.Add(container);
            foreach (Widget w in LogicWidget.Box.HangersOn(this))
            {
                hiddenWidgets.Add(w);
                w.Visible = false;
            }
        }
Ejemplo n.º 11
0
        /// <summary>Node has begun to be dragged.</summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void OnDragBegin(object sender, DragBeginArgs e)
        {
            DragStartArgs args = new DragStartArgs();

            args.NodePath = SelectedNode; // FullPath(e.Item as TreeNode);
            if (DragStarted != null)
            {
                DragStarted(this, args);
                if (args.DragObject != null)
                {
                    sourcePathOfItemBeingDragged = args.NodePath;
                    dragSourceHandle             = GCHandle.Alloc(args.DragObject);
                }
            }
        }
Ejemplo n.º 12
0
    private void OnDragBegin(object o, DragBeginArgs args)
    {
        //TODO: set dragged icon here

        if (SelectedObjectNr > -1)
        {
            draggedID     = SelectedObjectNr;
            draggedBadguy = badguys[SelectedObjectNr];

            dragging = true;
        }
        //update heigth
        SetSizeRequest(-1, ROW_HEIGHT * ((badguys.Count - 1) / TILES_PER_ROW + 1));
        LogManager.Log(LogLevel.Debug, "Dragstart of " + draggedBadguy);
    }
Ejemplo n.º 13
0
        void HandleDragBegin(object sender, DragBeginArgs args)
        {
            Tag [] tags  = TagHighlight;
            int    len   = tags.Length;
            int    size  = 32;
            int    csize = size / 2 + len * size / 2 + 2;

            Pixbuf container = new Pixbuf(Gdk.Colorspace.Rgb, true, 8, csize, csize);

            container.Fill(0x00000000);

            bool use_icon = false;;

            while (len-- > 0)
            {
                Pixbuf thumbnail = tags[len].Icon;

                if (thumbnail != null)
                {
                    Pixbuf small = thumbnail.ScaleToMaxSize(size, size);

                    int x = len * (size / 2) + (size - small.Width) / 2;
                    int y = len * (size / 2) + (size - small.Height) / 2;

                    small.Composite(container, x, y, small.Width, small.Height, x, y, 1.0, 1.0, Gdk.InterpType.Nearest, 0xff);
                    small.Dispose();

                    use_icon = true;
                }
            }

            if (use_icon)
            {
                Gtk.Drag.SetIconPixbuf(args.Context, container, 0, 0);
            }

            container.Dispose();
        }
Ejemplo n.º 14
0
        protected void Drag_Begin(object o, DragBeginArgs args)
        {
            string name;

            if (o is EventBox)
            {
                name = (o as EventBox).Name;
            }
            else
            {
                name = (o as Button).Image.Name;
            }

            switch (name)
            {
            case "Table2Chair": Gtk.Drag.SetIconPixbuf(args.Context, table2Chair.ScaleSimple(size, size, InterpType.Bilinear), -5, -5); break;

            case "Table4Chair": Gtk.Drag.SetIconPixbuf(args.Context, table4Chair.ScaleSimple(size, size, InterpType.Bilinear), -5, -5); break;

            case "Table6Chair": Gtk.Drag.SetIconPixbuf(args.Context, table6Chair.ScaleSimple(size, size, InterpType.Bilinear), -5, -5); break;

            case "Table8Chair": Gtk.Drag.SetIconPixbuf(args.Context, table8Chair.ScaleSimple(size, size, InterpType.Bilinear), -5, -5); break;
            }
        }
Ejemplo n.º 15
0
 void HandleBugsListDragBegin(object o, DragBeginArgs args)
 {
     draggedBugs = GetSelection();
 }
Ejemplo n.º 16
0
		protected void HandleDragBegin(object o, DragBeginArgs args)
		{
			Gdk.Pixbuf dragpic = GetDragPixbuf();
			Gtk.Drag.SetIconPixbuf (args.Context, dragpic, 0, 0);
			StoreBuffer();
		}
Ejemplo n.º 17
0
 protected void OnDrawingTrackDragBegin(object o, DragBeginArgs args)
 {
 }
Ejemplo n.º 18
0
 protected void HandleDragBegin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf dragpic = GetDragPixbuf();
     Gtk.Drag.SetIconPixbuf(args.Context, dragpic, 0, 0);
     StoreBuffer();
 }
Ejemplo n.º 19
0
 private void OnDragBegin(object o, DragBeginArgs args)
 {
     Gtk.Drag.SetIconWidget(args.Context, SpriteViewWidget.CreateWindow(gameObjectSprites[SelectedObjectNr]), -15, -15);
     LogManager.Log(LogLevel.Debug, "Dragstart");
 }
Ejemplo n.º 20
0
 private void OnDragBegin(object sender, DragBeginArgs args)
 {
     drag_buffer = getSelectedIndexes();
 }
Ejemplo n.º 21
0
 private void DragGestureCreate_DragBegin(object o, DragBeginArgs args)
 {
     DragGestureCreate.GetStartPoint(out double x, out double y);
     CurrentTool?.GestureStart(this, new Vector2d(x, y));
 }
Ejemplo n.º 22
0
 void OnSearchDragBegin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource("text-x-generic.png");
     Gtk.Drag.SetIconPixbuf(args.Context, pb, 0, 0);
 }