예제 #1
0
 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));
 }
예제 #2
0
        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);
        }
예제 #3
0
        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());
        }
예제 #4
0
 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));
 }
예제 #5
0
 internal override object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter)
 {
     return(display.ClipboardRetrieve(handle, type, converter));
 }
예제 #7
0
		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;
		}
예제 #8
0
 internal abstract object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter);