コード例 #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));
     }
 }
コード例 #2
0
        public static void Copy(Gtk.Widget widget, Gtk.SelectionData seldata, bool copyAsText)
        {
            XmlDocument doc = Export(widget);

            if (doc == null)
            {
                return;
            }

            if (copyAsText)
            {
                seldata.Text = doc.OuterXml;
            }
            else
            {
                seldata.Set(ApplicationXGladeAtom, 8, System.Text.Encoding.UTF8.GetBytes(doc.OuterXml));
            }
        }
コード例 #3
0
        public static void Copy(Gtk.Widget widget, Gtk.SelectionData seldata, bool copyAsText)
        {
            XmlElement elem = ExportWidget(widget);

            if (elem == null)
            {
                return;
            }

            if (copyAsText)
            {
                seldata.Text = elem.OuterXml;
            }
            else
            {
                seldata.Set(ApplicationXSteticAtom, 8, System.Text.Encoding.UTF8.GetBytes(elem.OuterXml));
            }
        }
コード例 #4
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));
     }
 }
コード例 #5
0
        protected override void OnDragDataGet(Gdk.DragContext context, Gtk.SelectionData selection_data, uint info, uint time_)
        {
            Console.WriteLine("getting data?");
            //TrackListModel model=_view.GetSource().TrackModel;
            CS_TrackListModel model = (CS_TrackListModel)this.Model;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            List <CueSheetEntry>      l  = new List <CueSheetEntry>();

            foreach (TrackInfo track in model.SelectedItems)
            {
                CueSheetEntry e = (CueSheetEntry)track;
                l.Add(e);
                Console.WriteLine("id=" + e.id());
                //string id=e.id ();
                //sb.Append (id);
                //sb.Append ("#@#");
            }
            byte [] data = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
            selection_data.Set(context.Targets[0], 8, data, data.Length);
            Console.WriteLine(sb.ToString());
            //context.Data.Add ("tracks",sb.ToString ());
            DragData = l;
        }
コード例 #6
0
ファイル: DragDropList.cs プロジェクト: f-spot/f-spot-xplat
 public void AssignToSelection(Gtk.SelectionData selectionData, Gdk.Atom target)
 {
     byte [] data = this;
     selectionData.Set(target, 8, data, data.Length);
 }