internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) { #if DriverDebug Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter); #endif return(driver.ClipboardRetrieve(handle, type, converter)); }
internal static IDataObject GetDataObject(bool primary_selection) { DataObject clipboard; IntPtr clipboard_handle; int[] native_formats; DataFormats.Format item_format; object managed_clipboard_item; XplatUI.ClipboardToObject converter; converter = new XplatUI.ClipboardToObject(ConvertFromClipboardData); clipboard_handle = XplatUI.ClipboardOpen(primary_selection); native_formats = XplatUI.ClipboardAvailableFormats(clipboard_handle); if (native_formats == null) { return(null); // Clipboard empty } // Build the IDataObject clipboard = new DataObject(); for (int i = 0; i < native_formats.Length; i++) { // We might get a format we don't understand or know item_format = DataFormats.GetFormat(native_formats[i]); if (item_format != null) { managed_clipboard_item = XplatUI.ClipboardRetrieve(clipboard_handle, native_formats[i], converter); if (managed_clipboard_item != null) { clipboard.SetData(item_format.Name, managed_clipboard_item); // We don't handle 'bitmap' since it involves handles, so we'll equate it to dib if (item_format.Name == DataFormats.Dib) { clipboard.SetData(DataFormats.Bitmap, managed_clipboard_item); } } } } XplatUI.ClipboardClose(clipboard_handle); return(clipboard); }
internal static IDataObject GetDataObject(bool primary_selection) { IDataObject data = null; var clipboard_handle = XplatUI.ClipboardOpen(primary_selection); var formats = XplatUI.ClipboardAvailableFormats(clipboard_handle); if (formats != null) { var format = DataFormats.GetFormat(IDataObjectFormat).Id; var converter = new XplatUI.ClipboardToObject(ConvertFromClipboardData); if (XplatUI.ClipboardRetrieve(clipboard_handle, format, converter) is IDataObject idata) { data = idata; } } XplatUI.ClipboardClose(clipboard_handle); return(data ?? new DataObject()); }
internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) { DriverDebug("ClipboardRetrieve ({0:X}, type, {1}): Called", handle.ToInt32(), converter); return(driver.ClipboardRetrieve(handle, type, converter)); }
internal override object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter) { throw new NotImplementedException(); }
internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) { return(display.ClipboardRetrieve(handle, type, converter)); }
internal static IDataObject GetDataObject (bool primary_selection) { DataObject clipboard; IntPtr clipboard_handle; int[] native_formats; DataFormats.Format item_format; object managed_clipboard_item; XplatUI.ClipboardToObject converter; converter = new XplatUI.ClipboardToObject (ConvertFromClipboardData); clipboard_handle = XplatUI.ClipboardOpen (primary_selection); native_formats = XplatUI.ClipboardAvailableFormats (clipboard_handle); if (native_formats == null) { return null; // Clipboard empty } // Build the IDataObject clipboard = new DataObject (); for (int i = 0; i < native_formats.Length; i++) { // We might get a format we don't understand or know item_format = DataFormats.GetFormat (native_formats[i]); if (item_format != null) { managed_clipboard_item = XplatUI.ClipboardRetrieve (clipboard_handle, native_formats[i], converter); if (managed_clipboard_item != null) { clipboard.SetData (item_format.Name, managed_clipboard_item); // We don't handle 'bitmap' since it involves handles, so we'll equate it to dib if (item_format.Name == DataFormats.Dib) { clipboard.SetData (DataFormats.Bitmap, managed_clipboard_item); } } } } XplatUI.ClipboardClose (clipboard_handle); return clipboard; }
internal abstract object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter);