Example #1
0
 public static void SetSelectionData(Gtk.SelectionData data, string atomType, object val)
 {
     if (val == null)
     {
         return;
     }
     if (val is string)
     {
         data.Text = (string)val;
     }
     else if (val is Xwt.Drawing.Image)
     {
         var bmp = ((Image)val).ToBitmap();
         data.SetPixbuf(((GtkImage)Toolkit.GetBackend(bmp)).Frames[0].Pixbuf);
     }
     else if (val is Uri)
     {
         data.SetUris(new string[] { ((Uri)val).AbsolutePath });
     }
     else
     {
         var at = Gdk.Atom.Intern(atomType, false);
         data.Set(at, 0, TransferDataSource.SerializeValue(val));
     }
 }
Example #2
0
 public static void SetSelectionData(Gtk.SelectionData data, string atomType, object val)
 {
     if (val == null)
     {
         return;
     }
     if (val is string)
     {
         data.Text = (string)val;
     }
     else if (val is Xwt.Drawing.Image)
     {
         data.SetPixbuf((Gdk.Pixbuf)WidgetRegistry.GetBackend(val));
     }
     else
     {
         var at = Gdk.Atom.Intern(atomType, false);
         data.Set(at, 0, TransferDataSource.SerializeValue(val));
     }
 }