download Clipboard.cs
Language: C#
Copyright: (c) 2005 Novell, Inc. (http://www.novell.com)
LOC: 89
Project Info
mcs
Server: Mono
Type: svn
...Forms\System.Windows.Forms\
   AccessibleEvents.cs
   AccessibleNavigation.cs
   AccessibleObject.cs
   AccessibleRole.cs
   AccessibleSelection.cs
   AccessibleStates.cs
   AmbientProperties.cs
   AnchorStyles.cs
   Appearance.cs
   Application.cs
   ApplicationContext.cs
   ArrangeDirection.cs
   ArrangeStartingPosition.cs
   ArrowDirection.cs
   AsyncMethodData.cs
   AsyncMethodResult.cs
   AutoCompleteMode.cs
   AutoCompleteSource.cs
   AutoScaleMode.cs
   AutoSizeMode.cs
   AutoValidate.cs
   AxHost.cs
   BaseCollection.cs
   BatteryChargeStatus.cs
   Binding.cs
   BindingCompleteContext.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   BindingCompleteState.cs
   BindingContext.cs
   BindingManagerBase.cs
   ...erDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   BindingMemberInfo.cs
   BindingsCollection.cs
   BootMode.cs
   Border3DSide.cs
   Border3DStyle.cs
   BorderStyle.cs
   BoundsSpecified.cs
   Button.cs
   ButtonBase.cs
   ButtonBorderStyle.cs
   ButtonRenderer.cs
   ButtonState.cs
   ...irtualItemsEventArgs.cs
   ...ualItemsEventHandler.cs
   CaptionButton.cs
   CategoryGridEntry.cs
   CharacterCasing.cs
   CheckBox.cs
   CheckBoxRenderer.cs
   CheckedListBox.cs
   CheckState.cs
   Clipboard.cs
   CloseReason.cs
   ColorDepth.cs
   ColorDialog.cs
   ColumnClickEventArgs.cs
   ColumnClickEventHandler.cs
   ColumnHeader.cs
   ...eaderAutoResizeStyle.cs
   ColumnHeaderStyle.cs
   ...mnReorderedEventArgs.cs
   ...eorderedEventHandler.cs
   ColumnStyle.cs
   ...idthChangedEventArgs.cs
   ...hChangedEventHandler.cs
   ...dthChangingEventArgs.cs
   ...ChangingEventHandler.cs
   ComboBox.cs
   ComboBoxRenderer.cs
   ComboBoxStyle.cs
   CommonDialog.cs
   ComponentModel.cs
   ContainerControl.cs
   ...entsResizedEventArgs.cs
   ...sResizedEventHandler.cs
   ContextMenu.cs
   Control.cs
   ...olBindingsCollection.cs
   ControlEventArgs.cs
   ControlEventHandler.cs
   ControlPaint.cs
   ControlStyles.cs
   ControlUpdateMode.cs
   ConvertEventArgs.cs
   ConvertEventHandler.cs
   CreateParams.cs
   CurrencyManager.cs
   Cursor.cs
   CursorConverter.cs
   Cursors.cs
   DataFormats.cs
   DataGrid.cs
   DataGridBoolColumn.cs
   DataGridCell.cs
   DataGridColumnStyle.cs
   DataGridLineStyle.cs
   ...ParentRowsLabelStyle.cs
   ...mnWidthTypeConverter.cs
   DataGridTableStyle.cs
   DataGridTextBox.cs
   DataGridTextBoxColumn.cs
   DataGridView.cs
   ...wAdvancedBorderStyle.cs
   ...ancedCellBorderStyle.cs
   ...ewAutoSizeColumnMode.cs
   ...eColumnModeEventArgs.cs
   ...lumnModeEventHandler.cs
   ...wAutoSizeColumnsMode.cs
   ...ColumnsModeEventArgs.cs
   ...umnsModeEventHandler.cs
   ...utoSizeModeEventArgs.cs
   ...SizeModeEventHandler.cs
   ...dViewAutoSizeRowMode.cs
   ...ViewAutoSizeRowsMode.cs
   DataGridViewBand.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   DataGridViewButtonCell.cs
   ...GridViewButtonColumn.cs
   DataGridViewCell.cs
   ...dViewCellBorderStyle.cs
   ...wCellCancelEventArgs.cs
   ...llCancelEventHandler.cs
   ...idViewCellCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...ridViewCellEventArgs.cs
   ...ViewCellEventHandler.cs
   ...lFormattingEventArgs.cs
   ...rmattingEventHandler.cs
   ...ewCellMouseEventArgs.cs
   ...ellMouseEventHandler.cs
   ...ellPaintingEventArgs.cs
   ...PaintingEventHandler.cs
   ...CellParsingEventArgs.cs
   ...lParsingEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   DataGridViewCellStyle.cs
   ...tentChangedEventArgs.cs
   ...tChangedEventHandler.cs
   ...ewCellStyleConverter.cs
   ...dViewCellStyleScopes.cs
   ...pTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...lValidatingEventArgs.cs
   ...lidatingEventHandler.cs
   ...ewCellValueEventArgs.cs
   ...ellValueEventHandler.cs
   ...GridViewCheckBoxCell.cs
   ...idViewCheckBoxColumn.cs
   ...iewClipboardCopyMode.cs
   DataGridViewColumn.cs
   ...ViewColumnCollection.cs
   ...TimeVisibleAttribute.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...dViewColumnEventArgs.cs
   ...ewColumnEventHandler.cs
   ...ViewColumnHeaderCell.cs
   ...eadersHeightSizeMode.cs
   ...idViewColumnSortMode.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...GridViewComboBoxCell.cs
   ...idViewComboBoxColumn.cs
   ...ComboBoxDisplayStyle.cs
   ...mboBoxEditingControl.cs
   ...ViewContentAlignment.cs
   ...iewDataErrorContexts.cs
   ...ewDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   ...trolShowingEventArgs.cs
   ...lShowingEventHandler.cs
   DataGridViewEditMode.cs
   DataGridViewElement.cs
   ...ridViewElementStates.cs
   ...iewHeaderBorderStyle.cs
   DataGridViewHeaderCell.cs
   DataGridViewHitTestType.cs
   DataGridViewImageCell.cs
   ...dViewImageCellLayout.cs
   DataGridViewImageColumn.cs
   DataGridViewPaintParts.cs
   DataGridViewRow.cs
   ...ewRowCancelEventArgs.cs
   ...owCancelEventHandler.cs
   ...ridViewRowCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...GridViewRowEventArgs.cs
   ...dViewRowEventHandler.cs
   ...ridViewRowHeaderCell.cs
   ...HeadersWidthSizeMode.cs
   ...tInfoNeededEventArgs.cs
   ...foNeededEventHandler.cs
   ...tInfoPushedEventArgs.cs
   ...foPushedEventHandler.cs
   ...owPostPaintEventArgs.cs
   ...ostPaintEventHandler.cs
   ...RowPrePaintEventArgs.cs
   ...PrePaintEventHandler.cs
   ...ewRowsAddedEventArgs.cs
   ...owsAddedEventHandler.cs
   ...RowsDeletedEventArgs.cs
   ...RowsRemovedEventArgs.cs
   ...sRemovedEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...lectedCellCollection.cs
   ...ctedColumnCollection.cs
   ...electedRowCollection.cs
   ...ridViewSelectionMode.cs
   ...SortCompareEventArgs.cs
   ...tCompareEventHandler.cs
   DataGridViewTextBoxCell.cs
   ...ridViewTextBoxColumn.cs
   ...extBoxEditingControl.cs
   ...iewTopLeftHeaderCell.cs
   DataGridViewTriState.cs
   DataObject.cs
   DataSourceUpdateMode.cs
   DateBoldEventArgs.cs
   DateBoldEventHandler.cs
   DateRangeEventArgs.cs
   DateRangeEventHandler.cs
   DateTimePicker.cs
   DateTimePickerFormat.cs
   Day.cs
   DialogResult.cs
   DockingBehavior.cs
   DockStyle.cs
   DomainUpDown.cs
   DragAction.cs
   DragDropEffects.cs
   DragEventArgs.cs
   DragEventHandler.cs
   DrawItemEventArgs.cs
   DrawItemEventHandler.cs
   DrawItemState.cs
   DrawMode.cs
   ErrorBlinkStyle.cs
   ErrorIconAlignment.cs
   ErrorProvider.cs
   FeatureSupport.cs
   FileDialog.cs
   FixedPanel.cs
   FixedSizeTextBox.cs
   FlatStyle.cs
   FlowDirection.cs
   FolderBrowserDialog.cs
   FontDialog.cs
   Form.cs
   FormBorderStyle.cs
   FormClosedEventArgs.cs
   FormClosedEventHandler.cs
   FormClosingEventArgs.cs
   FormClosingEventHandler.cs
   FormStartPosition.cs
   FormWindowState.cs
   FrameStyle.cs
   GetChildAtPointSkip.cs
   GiveFeedbackEventArgs.cs
   ...FeedbackEventHandler.cs
   ...lumnStylesCollection.cs
   GridEntry.cs
   GridItem.cs
   GridItemCollection.cs
   GridItemType.cs
   GridTablesFactory.cs
   ...ableStylesCollection.cs
   GroupBox.cs
   GroupBoxRenderer.cs
   HandledMouseEventArgs.cs
   Help.cs
   HelpEventArgs.cs
   HelpEventHandler.cs
   HelpNavigator.cs
   HelpProvider.cs
   HorizontalAlignment.cs
   HScrollBar.cs
   ...InsertionOrientation.cs
   Hwnd.cs
   IButtonControl.cs
   ICommandExecutor.cs
   ...ponentEditorPageSite.cs
   IContainerControl.cs
   ...gNotificationService.cs
   IDataGridEditingService.cs
   ...aGridViewEditingCell.cs
   ...idViewEditingControl.cs
   IDataObject.cs
   IDropTarget.cs
   IFeatureSupport.cs
   IFileReaderService.cs
   ImageIndexConverter.cs
   ImageLayout.cs
   ImageList.cs
   ImageListConverter.cs
   ImageListStreamer.cs
   ImeMode.cs
   IMessageFilter.cs
   ImplicitHScrollBar.cs
   ImplicitVScrollBar.cs
   InputLanguage.cs
   ...uageChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ageChangingEventArgs.cs
   ...ChangingEventHandler.cs
   InputLanguageCollection.cs
   InsertKeyMode.cs
   InternalWindowManager.cs
   InvalidateEventArgs.cs
   InvalidateEventHandler.cs
   IRootGridEntry.cs
   ItemActivation.cs
   ItemBoundsPortion.cs
   ItemChangedEventArgs.cs
   ItemChangedEventHandler.cs
   ItemCheckedEventArgs.cs
   ItemCheckedEventHandler.cs
   ItemCheckEventArgs.cs
   ItemCheckEventHandler.cs
   ItemDragEventArgs.cs
   ItemDragEventHandler.cs
   IWin32Window.cs
   IWindowTarget.cs
   KeyboardLayouts.cs
   KeyEventArgs.cs
   KeyEventHandler.cs
   KeyPressEventArgs.cs
   KeyPressEventHandler.cs
   Keys.cs
   KeysConverter.cs
   Label.cs
   LabelEditEventArgs.cs
   LabelEditEventHandler.cs
   LabelEditTextBox.cs
   LayoutEngine.cs
   LayoutEventArgs.cs
   LayoutEventHandler.cs
   LayoutSettings.cs
   LeftRightAlignment.cs
   LibSupport.cs
   LinkArea.cs
   LinkBehavior.cs
   LinkClickedEventArgs.cs
   LinkClickedEventHandler.cs
   LinkLabel.cs
   ...LinkClickedEventArgs.cs
   ...kClickedEventHandler.cs
   LinkState.cs
   ListBindingConverter.cs
   ListBox.cs
   ListControl.cs
   ...trolConvertEventArgs.cs
   ...lConvertEventHandler.cs
   ListView.cs
   ListViewAlignment.cs
   ...ViewHitTestLocations.cs
   ListViewItem.cs
   ListViewItemConverter.cs
   ...mMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   ...tionChangedEventArgs.cs
   ...nChangedEventHandler.cs
   ListViewItemStates.cs
   ...angeChangedEventArgs.cs
   ...eChangedEventHandler.cs
   MainMenu.cs
   MaskFormat.cs
   ...putRejectedEventArgs.cs
   ...RejectedEventHandler.cs
   MdiChildContext.cs
   MdiClient.cs
   MdiLayout.cs
   MdiWindowManager.cs
   MeasureItemEventArgs.cs
   MeasureItemEventHandler.cs
   Menu.cs
   MenuAPI.cs
   MenuGlyph.cs
   MenuItem.cs
   MenuMerge.cs
   MenuStrip.cs
   MergeAction.cs
   Message.cs
   MessageBox.cs
   MessageBoxButtons.cs
   MessageBoxDefaultButton.cs
   MessageBoxIcon.cs
   MessageBoxOptions.cs
   MethodInvoker.cs
   Mime.cs
   MimeIcon.cs
   MonthCalendar.cs
   MouseButtons.cs
   MouseEventArgs.cs
   MouseEventHandler.cs
   MWFCategoryAttribute.cs
   MWFDescriptionAttribute.cs
   NativeWindow.cs
   NavigateEventArgs.cs
   NavigateEventHandler.cs
   NodeLabelEditEventArgs.cs
   ...abelEditEventHandler.cs
   NotifyIcon.cs
   NumericUpDown.cs
   OpacityConverter.cs
   OpenFileDialog.cs
   OpenTreeNodeEnumerator.cs
   Orientation.cs
   OSFeature.cs
   OSXStructs.cs
   OwnerDrawPropertyBag.cs
   Padding.cs
   PageSetupDialog.cs
   PaintEventArgs.cs
   PaintEventHandler.cs
   Panel.cs
   PictureBox.cs
   PictureBoxSizeMode.cs
   PopupEventArgs.cs
   PopupEventHandler.cs
   PowerLineStatus.cs
   PowerState.cs
   PreProcessControlState.cs
   PreviewKeyDownEventArgs.cs
   ...wKeyDownEventHandler.cs
   ...llerWithStatusDialog.cs
   PrintDialog.cs
   PrintPreviewControl.cs
   PrintPreviewDialog.cs
   ProfessionalColors.cs
   ProfessionalColorTable.cs
   ProgressBar.cs
   ProgressBarRenderer.cs
   ProgressBarStyle.cs
   PropertiesTab.cs
   PropertyGrid.cs
   PropertyGridCommands.cs
   PropertyGridEntry.cs
   PropertyGridTextBox.cs
   PropertyGridView.cs
   PropertyManager.cs
   PropertySort.cs
   ...yTabChangedEventArgs.cs
   ...bChangedEventHandler.cs
   ...alueChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ibilityHelpEventArgs.cs
   ...lityHelpEventHandler.cs
   ...ontinueDragEventArgs.cs
   ...inueDragEventHandler.cs
   QuestionEventArgs.cs
   QuestionEventHandler.cs
   RadioButton.cs
   RadioButtonRenderer.cs
   RelatedCurrencyManager.cs
   RelatedPropertyManager.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   RichTextBox.cs
   RichTextBoxFinds.cs
   ...xtBoxLanguageOptions.cs
   RichTextBoxScrollBars.cs
   ...oxSelectionAttribute.cs
   ...extBoxSelectionTypes.cs
   RichTextBoxStreamType.cs
   ...tBoxWordPunctuations.cs
   RightToLeft.cs
   RowStyle.cs
   SaveFileDialog.cs
   Screen.cs
   ScreenOrientation.cs
   ScrollableControl.cs
   ScrollBar.cs
   ScrollBarRenderer.cs
   ScrollBars.cs
   ScrollButton.cs
   ScrollEventArgs.cs
   ScrollEventHandler.cs
   ScrollEventType.cs
   ScrollOrientation.cs
   SearchDirectionHint.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   SecurityIDType.cs
   ...ItemChangedEventArgs.cs
   ...mChangedEventHandler.cs
   SelectionMode.cs
   SelectionRange.cs
   SelectionRangeConverter.cs
   SendKeys.cs
   Shortcut.cs
   SizeGrip.cs
   SizeGripStyle.cs
   SizeType.cs
   SortOrder.cs
   Splitter.cs
   SplitterCancelEventArgs.cs
   ...erCancelEventHandler.cs
   SplitterEventArgs.cs
   SplitterEventHandler.cs
   StatusBar.cs
   ...BarDrawItemEventArgs.cs
   ...DrawItemEventHandler.cs
   StatusBarPanel.cs
   StatusBarPanelAutoSize.cs
   ...sBarPanelBorderStyle.cs
   ...rPanelClickEventArgs.cs
   ...nelClickEventHandler.cs
   StatusBarPanelStyle.cs
   StructFormat.cs
   SWF.csproj.user
   SystemInformation.cs
   SystemParameter.cs
   TabAlignment.cs
   TabAppearance.cs
   TabControl.cs
   TabControlAction.cs
   ...ntrolCancelEventArgs.cs
   ...olCancelEventHandler.cs
   TabControlEventArgs.cs
   TabControlEventHandler.cs
   TabDrawMode.cs
   TableLayout.cs
   ...utCellPaintEventArgs.cs
   ...ellPaintEventHandler.cs
   TableLayoutPanel.cs
   ...PanelCellBorderStyle.cs
   ...LayoutPanelGrowStyle.cs
   TableLayoutSettings.cs
   TabPage.cs
   TabRenderer.cs
   TabSizeMode.cs
   TextBox.cs
   TextBoxBase.cs
   TextBoxRenderer.cs
   TextControl.cs
   TextDataFormat.cs
   TextFormatFlags.cs
   TextImageRelation.cs
   TextRenderer.cs
   Theme.cs
   ThemeClearlooks.cs
   ThemeEngine.cs
   ThemeGtk.cs
   ThemeNice.cs
   ThemeWin32Classic.cs
   ThreadExceptionDialog.cs
   TickStyle.cs
   Timer.cs
   ToolBar.cs
   ToolBarAppearance.cs
   ToolBarButton.cs
   ...ButtonClickEventArgs.cs
   ...tonClickEventHandler.cs
   ToolBarButtonStyle.cs
   ToolBarTextAlign.cs
   ToolStrip.cs
   ...pDownClosedEventArgs.cs
   ...wnClosedEventHandler.cs
   ...pDropDownCloseReason.cs
   ...DownClosingEventArgs.cs
   ...nClosingEventHandler.cs
   ...ripDropDownDirection.cs
   ToolStripDropDownItem.cs
   ...tripGripDisplayStyle.cs
   ToolStripGripStyle.cs
   ToolStripItem.cs
   ToolStripItemAlignment.cs
   ...tripItemDisplayStyle.cs
   ...tripItemImageScaling.cs
   ToolStripItemOverflow.cs
   ToolStripItemPlacement.cs
   ToolStripLayoutStyle.cs
   ...ripManagerRenderMode.cs
   ToolStripMenuItem.cs
   ToolStripRenderMode.cs
   ...atusLabelBorderSides.cs
   ToolStripTextDirection.cs
   ToolTip.cs
   ToolTipIcon.cs
   TrackBar.cs
   TrackBarRenderer.cs
   TreeNode.cs
   TreeNodeCollection.cs
   TreeNodeConverter.cs
   ...eMouseClickEventArgs.cs
   ...useClickEventHandler.cs
   ...eMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   TreeNodeStates.cs
   TreeView.cs
   TreeViewAction.cs
   TreeViewCancelEventArgs.cs
   ...ewCancelEventHandler.cs
   TreeViewDrawMode.cs
   TreeViewEventArgs.cs
   TreeViewEventHandler.cs
   ...ViewHitTestLocations.cs
   ...wImageIndexConverter.cs
   TypeValidationEventArgs.cs
   ...lidationEventHandler.cs
   UICues.cs
   UICuesEventArgs.cs
   UICuesEventHandler.cs
   UnhandledExceptionMode.cs
   UpDownBase.cs
   UpDownEventArgs.cs
   UpDownEventHandler.cs
   UserControl.cs
   ValidationConstraints.cs
   View.cs
   VScrollBar.cs
   ...ntCompletedEventArgs.cs
   ...ompletedEventHandler.cs
   ...owserEncryptionLevel.cs
   ...erNavigatedEventArgs.cs
   ...avigatedEventHandler.cs
   ...rNavigatingEventArgs.cs
   ...vigatingEventHandler.cs
   ...ressChangedEventArgs.cs
   ...sChangedEventHandler.cs
   WebBrowserReadyState.cs
   WebBrowserRefreshOption.cs
   Win32DnD.cs
   X11DesktopColors.cs
   X11Dnd.cs
   X11Keyboard.cs
   X11Structs.cs
   XEventQueue.cs
   XplatUI.cs
   XplatUIDriver.cs
   XplatUIOSX.cs
   XplatUIStructs.cs
   XplatUIWin32.cs
   XplatUIX11.cs
   XplatUIX11GTK.cs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
//	Peter Bartok	(pbartok@novell.com)
//
//

// COMPLETE

using System;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;

namespace System.Windows.Forms {
	public sealed class Clipboard {
		#region Local Variables
		#endregion	// Local Variables

		#region Constructors
		private Clipboard() {
		}
		#endregion	// Constructors

		#region	Private Methods
		private static bool ConvertToClipboardData(ref int type, object obj, out byte[] data) {
			data = null;
			return false;
		}

		private static bool ConvertFromClipboardData(int type, IntPtr data, out object obj) {
			obj = null;
			if (data == IntPtr.Zero) {
				return false;
			}
			return false;
		}
		#endregion	// Private Methods

		#region Public Static Methods
		public static IDataObject GetDataObject() {
			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();
			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;
		}

		public static void SetDataObject(object data) {
			SetDataObject(data, true);
			
		}

		public static void SetDataObject(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();
			XplatUI.ClipboardStore(clipboard_handle, null, 0, null);	// Empty clipboard

			native_format = -1;

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

				formats = ((IDataObject)data).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;
					}

					XplatUI.ClipboardStore(clipboard_handle, ((IDataObject)data).GetData(formats[i]), 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);
		}
		#endregion	// Public Static Methods
	}
}

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us