public void Copy(object obj, EventArgs args) { Gdk.Atom _atom = Gdk.Atom.Intern("CLIPBOARD", false); Gtk.Clipboard _clipBoard = Gtk.Clipboard.Get(_atom); if (pixBuf != null) { _clipBoard.Image = pixBuf; } }
public static void SetPhotosData(this SelectionData selection_data, Photo [] photos, Atom target) { byte [] data = new byte [photos.Length * sizeof (uint)]; int i = 0; foreach (Photo photo in photos) { byte [] bytes = System.BitConverter.GetBytes (photo.Id); foreach (byte b in bytes) { data[i] = b; i++; } } selection_data.Set (target, 8, data, data.Length); }
/// <summary> /// Creates new data item. /// </summary> /// <param name="data">Data.</param> /// <param name="text">Substitute text.</param> public Item(Atom target, byte[] data, string text) { this.IsData = true; this.IsText = true; this.Data = data; this.Text = text ?? string.Empty; this.DataText = System.Text.Encoding.UTF8.GetBytes(this.Text); this.Target = target; StringBuilder sb = new StringBuilder(); sb.Append(text); CreateLabel(sb); if (target.Name == Targets.File) { this.Label = string.Format("{0} {1}", UnicodeCharacters.Closet, sb.ToString()); } else if (target.Name == Targets.Html) { this.Label = string.Format("{0} {1}", UnicodeCharacters.Tag, sb.ToString()); } }
/// <summary> /// Emitted on drop site. /// Set RetVal == cursor is over drop zone /// if (RetVal) Gdk.Drag.Status, unless the decision cannot be made, in which case it may be defered by /// a get data call /// </summary> void HandleDragMotion(object o, DragMotionArgs args) { if (RepositionMode) { return; } ExternalDragActive = !InternalDragActive; Owner.UpdateHoverText(); Owner.SetTooltipVisibility(); if (marker != args.Context.GetHashCode()) { marker = args.Context.GetHashCode(); drag_known = false; } // we own the drag if InternalDragActive is true, lets not be silly if (!drag_known && !InternalDragActive) { drag_known = true; Gdk.Atom atom = Gtk.Drag.DestFindTarget(Owner, args.Context, null); if (atom != null) { Gtk.Drag.GetData(Owner, args.Context, atom, args.Time); drag_data_requested = true; } else { Gdk.Drag.Status(args.Context, DragAction.Private, args.Time); } } else { Gdk.Drag.Status(args.Context, DragAction.Copy, args.Time); } args.RetVal = true; }
public static void SetUriListData(this SelectionData selection_data, UriList uri_list, Atom target) { Byte [] data = Encoding.UTF8.GetBytes (uri_list.ToString ()); selection_data.Set (target, 8, data, data.Length); }
public static void SetTagsData(this SelectionData selection_data, Tag [] tags, Atom target) { byte [] data = new byte [tags.Length * sizeof (uint)]; int i = 0; foreach (Tag tag in tags) { byte [] bytes = System.BitConverter.GetBytes (tag.Id); foreach (byte b in bytes) { data[i] = b; i++; } } selection_data.Set (target, 8, data, data.Length); }
public static void ChangeProperty (Gdk.Window win, Atom property, Atom type, PropMode mode, uint [] data) { gdk_property_change (win.Handle, property.Handle, type.Handle, 32, (int)mode, data, data.Length * 4); }
/// <summary> /// Initializes a new instance of the ClipboardChangedArgs class. /// </summary> /// <param name="clipboard">Atom of clipboard which has been changed.</param> /// <param name="oldValue">Previous clipboard item.</param> /// <param name="newValue">Current clipboard item.</param> public ClipboardChangedArgs(Atom clipboard, Item oldValue, Item newValue) { this.Clipboard = clipboard; this.OldValue = oldValue; this.NewValue = newValue; }
public string GetPropertyString(Atom prop) { Atom propType; int format; int length; byte[] data; if (Gdk.Property.Get(wnd, prop, null, 0, 4000, 0, out propType, out format, out length, out data)) { return System.Text.Encoding.UTF8.GetString(data, 0, length); } return null; }
public bool GetPropertyBinary(Atom prop, out int[] data) { return Gdk.Property.Get(wnd, prop, false, out data); }