Example #1
0
 public void RequestRichText(Gtk.TextBuffer buffer, RichTextReceivedFunc cb)
 {
     if (rt_rcvd_marshaler == null)
     {
         rt_rcvd_marshaler = new RichTextReceivedFuncNative(RichTextReceivedCallback);
     }
     gtk_clipboard_request_rich_text(Handle, buffer == null ? IntPtr.Zero : buffer.Handle, rt_rcvd_marshaler, (IntPtr)GCHandle.Alloc(cb));
 }
Example #2
0
 void RichTextReceivedCallback(IntPtr clipboard_ptr, IntPtr format_ptr, IntPtr text_ptr, UIntPtr length, IntPtr data)
 {
     try {
         Gtk.Clipboard clipboard = GLib.Object.GetObject(clipboard_ptr) as Gtk.Clipboard;
         Gdk.Atom      format    = format_ptr == IntPtr.Zero ? null : (Gdk.Atom)GLib.Opaque.GetOpaque(format_ptr, typeof(Gdk.Atom), false);
         int           sz        = (int)(uint)length;
         byte[]        text      = new byte [sz];
         Marshal.Copy(text, 0, text_ptr, sz);
         GCHandle             gch = (GCHandle)data;
         RichTextReceivedFunc cb  = gch.Target as RichTextReceivedFunc;
         cb(clipboard, format, text);
         gch.Free();
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Example #3
0
 public void RequestRichText(Gtk.TextBuffer buffer, RichTextReceivedFunc cb)
 {
     if (rt_rcvd_marshaler == null)
         rt_rcvd_marshaler = new RichTextReceivedFuncNative (RichTextReceivedCallback);
     gtk_clipboard_request_rich_text (Handle, buffer == null ? IntPtr.Zero : buffer.Handle, rt_rcvd_marshaler, (IntPtr) GCHandle.Alloc (cb));
 }