Esempio n. 1
0
        internal static void SetDataObjectImpl(object data, bool copy)
        {
            var converter = new XplatUI.ObjectToClipboard(ConvertToClipboardData);

            var clipboard_handle = XplatUI.ClipboardOpen(false);

            XplatUI.ClipboardStore(clipboard_handle, null, 0, null, copy);              // Empty clipboard

            if (data is IDataObject idata)
            {
                XplatUI.ClipboardStore(clipboard_handle, idata, DataFormats.GetFormat(IDataObjectFormat).Id, converter, copy);
            }
            else if (data is string text)
            {
                var tdata = new DataObject(DataFormats.UnicodeText, text);
                XplatUI.ClipboardStore(clipboard_handle, tdata, DataFormats.GetFormat(IDataObjectFormat).Id, converter, copy);
            }
            else
            {
                var format = DataFormats.Format.Find(data.GetType().FullName);
                var id     = (format != null) && (format.Name != DataFormats.StringFormat) ? format.Id : -1;
                XplatUI.ClipboardStore(clipboard_handle, data, id, converter, copy);
            }

            XplatUI.ClipboardClose(clipboard_handle);
        }
Esempio n. 2
0
 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter)
 {
                 #if DriverDebug
     Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
                 #endif
     driver.ClipboardStore(handle, obj, type, converter);
 }
Esempio n. 3
0
        internal static void SetDataObjectImpl(object data, bool copy)
        {
            IntPtr clipboard_handle;

            XplatUI.ObjectToClipboard converter;
            int native_format;

            DataFormats.Format item_format;

            converter = new XplatUI.ObjectToClipboard(ConvertToClipboardData);

            clipboard_handle = XplatUI.ClipboardOpen(false);
            XplatUI.ClipboardStore(clipboard_handle, null, 0, null);    // Empty clipboard

            native_format = -1;

            if (data is IDataObject)
            {
                string[] formats;

                IDataObject data_object = data as IDataObject;
                formats = data_object.GetFormats();
                for (int i = 0; i < formats.Length; i++)
                {
                    item_format = DataFormats.GetFormat(formats[i]);
                    if ((item_format != null) && (item_format.Name != DataFormats.StringFormat))
                    {
                        native_format = item_format.Id;
                    }

                    object obj = data_object.GetData(formats [i]);

                    // this is used only by custom formats
                    if (IsDataSerializable(obj))
                    {
                        item_format.is_serializable = true;
                    }

                    XplatUI.ClipboardStore(clipboard_handle, obj, native_format, converter);
                }
            }
            else
            {
                item_format = DataFormats.Format.Find(data.GetType().FullName);
                if ((item_format != null) && (item_format.Name != DataFormats.StringFormat))
                {
                    native_format = item_format.Id;
                }

                XplatUI.ClipboardStore(clipboard_handle, data, native_format, converter);
            }
            XplatUI.ClipboardClose(clipboard_handle);
        }
Esempio n. 4
0
 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter, bool copy)
 {
     DriverDebug("ClipboardStore ({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), obj, type, converter, copy);
     driver.ClipboardStore(handle, obj, type, converter, copy);
 }
Esempio n. 5
0
 internal override void ClipboardStore(IntPtr handle, object obj, int id, XplatUI.ObjectToClipboard converter, bool copy)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter)
 {
     display.ClipboardStore(handle, obj, type, converter);
 }
		internal static void SetDataObjectImpl(object data, bool copy) {
			IntPtr			clipboard_handle;
			XplatUI.ObjectToClipboard converter;
			int			native_format;
			DataFormats.Format	item_format;

			converter = new XplatUI.ObjectToClipboard(ConvertToClipboardData);

			clipboard_handle = XplatUI.ClipboardOpen(false);
			XplatUI.ClipboardStore(clipboard_handle, null, 0, null);	// Empty clipboard

			native_format = -1;

			if (data is IDataObject) {
				string[] formats;

				IDataObject data_object = data as IDataObject;
				formats = data_object.GetFormats();
				for (int i = 0; i < formats.Length; i++) {
					item_format = DataFormats.GetFormat(formats[i]);
					if ((item_format != null) && (item_format.Name != DataFormats.StringFormat)) {
						native_format = item_format.Id;
					}

					object obj = data_object.GetData (formats [i]);

					// this is used only by custom formats
					if (IsDataSerializable (obj))
						item_format.is_serializable = true;

					XplatUI.ClipboardStore(clipboard_handle, obj, native_format, converter);
				}
			} else {
				item_format = DataFormats.Format.Find(data.GetType().FullName);
				if ((item_format != null) && (item_format.Name != DataFormats.StringFormat)) {
					native_format = item_format.Id;
				}

				XplatUI.ClipboardStore(clipboard_handle, data, native_format, converter);
			}
			XplatUI.ClipboardClose(clipboard_handle);
		}
Esempio n. 8
0
 internal abstract void ClipboardStore(IntPtr handle, object obj, int id, XplatUI.ObjectToClipboard converter, bool copy);