public DragCheckEventArgs(Point position, TransferDataType[] types, DragDropAction action) { DataTypes = types; Action = action; Position = position; Result = DragDropResult.None; }
public DragOverCheckEventArgs (Point position, TransferDataType[] types, DragDropAction action) { DataTypes = types; Action = action; Position = position; AllowedAction = DragDropAction.Default; }
/// <summary> /// Adds a value to the data source /// </summary> /// <param name='value'> /// Value. /// </param> public void AddValue <T> (T value) where T : class { if (value == null) { throw new ArgumentNullException("value"); } data [TransferDataType.FromType(typeof(T))] = value; }
public static void SetData <T> (T data) { if (data == null) { throw new ArgumentNullException("data"); } SetData(TransferDataType.FromType(data.GetType()), data); }
public void AddValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } data [TransferDataType.FromType(value.GetType())] = value; }
object GetValue(TransferDataType type) { object val; if (data.TryGetValue(type, out val)) { if (val != null) { return(val); } } return(null); }
public void AddValue(TransferDataType type, byte[] value) { Type t = Type.GetType(type.Id); if (t != null) { data [type] = TransferDataSource.DeserializeValue(value); } else { data [type] = value; } }
T ITransferData.GetValue <T> () { object ob = GetValue(TransferDataType.FromType(typeof(T))); if (ob == null || ob.GetType() == typeof(Type)) { return((T)ob); } if (ob is byte[]) { T val = (T)TransferDataSource.DeserializeValue((byte[])ob); data[TransferDataType.FromType(typeof(T))] = val; return(val); } return((T)ob); }
/// <summary> /// Gets the value for a specific type /// </summary> /// <returns> /// The value, or null if there is not value for this type /// </returns> /// <param name='type'> /// A type. /// </param> public object GetValue(TransferDataType type) { object val; if (data.TryGetValue(type, out val)) { if (val != null) { return(val); } if (DataRequestCallback != null) { return(DataRequestCallback(type)); } } return(null); }
public static IAsyncResult BeginGetData <T> (AsyncCallback callback, object state) { return(Backend.BeginGetData(TransferDataType.FromType(typeof(T)), callback, state)); }
public static IAsyncResult BeginGetData(TransferDataType type, AsyncCallback callback, object state) { return(Backend.BeginGetData(type, callback, state)); }
public void SetDragTarget(TransferDataType[] types, DragDropAction dragAction) { DragDropInfo.DestDragAction = ConvertDragAction (dragAction); var table = Util.BuildTargetTable (types); DragDropInfo.ValidDropTypes = (Gtk.TargetEntry[]) table; OnSetDragTarget (DragDropInfo.ValidDropTypes, DragDropInfo.DestDragAction); }
public void SetDragSource(TransferDataType[] types, DragDropAction dragAction) { AllocEventBox (); DragDropInfo.SourceDragAction = ConvertDragAction (dragAction); var table = Util.BuildTargetTable (types); OnSetDragSource (Gdk.ModifierType.Button1Mask, (Gtk.TargetEntry[]) table, DragDropInfo.SourceDragAction); }
object ITransferData.GetValue(TransferDataType type) { return(GetValue(type)); }
/// <summary> /// Registers that the data store contains data of the provided type /// </summary> /// <param name='type'> /// The transfer data type /// </param> /// <remarks> /// This method can be used in combination with DataRequestCallback to /// generate the data on demand. In some scenarios, the drop/paste /// side of a drag&drop or clipboard operation can decide if a drop/paste /// is allowed or not by checking the available data type in this /// data source. Once the operation is accepted, the DataRequestCallback /// callback will be invoked to get the data for the type. /// </remarks> public void AddType(TransferDataType type) { data [type] = null; }
public static void SetData(TransferDataType type, Func <object> dataSource) { Backend.SetData(type, dataSource); }
/// <summary> /// Registers that the data store contains data of the provided type /// </summary> /// <param name='type'> /// A type /// </param> /// <remarks> /// This method can be used in combination with DataRequestCallback to /// generate the data on demand. In some scenarios, the drop/paste /// side of a drag&drop or clipboard operation can decide if a drop/paste /// is allowed or not by checking the available data type in this /// data source. Once the operation is accepted, the DataRequestCallback /// callback will be invoked to get the data for the type. /// </remarks> public void AddType(Type type) { data [TransferDataType.FromType(type)] = null; }
public void SetDragSource(DragDropAction dragAction, params Type[] types) { Backend.SetDragSource(types.Select(t => TransferDataType.FromType(t)).ToArray(), dragAction); }
public void SetDragDropTarget(params Type[] types) { Backend.SetDragTarget(types.Select(t => TransferDataType.FromType(t)).ToArray(), DragDropAction.All); }
/// <summary> /// Gets the value for a specific type /// </summary> /// <returns> /// The value, or null if there is not value for this type /// </returns> /// <param name='type'> /// A type. /// </param> public object GetValue(TransferDataType type) { object val; if (data.TryGetValue (type, out val)) { if (val != null) return val; if (DataRequestCallback != null) return DataRequestCallback (type); } return null; }
public static bool ContainsData(TransferDataType type) { return(Backend.IsTypeAvailable(type)); }
public static void SetData(TransferDataType type, object data) { Backend.SetData(type, delegate { return(data); }); }
public static object GetData(TransferDataType type) { return(Backend.GetData(type)); }
public static void SetData <T> (Func <T> dataSource) { Backend.SetData(TransferDataType.FromType(typeof(T)), delegate() { return(dataSource()); }); }
bool ITransferData.HasType(TransferDataType type) { return(data.ContainsKey(type)); }
public static bool ContainsData <T> () { return(Backend.IsTypeAvailable(TransferDataType.FromType(typeof(T)))); }
/// <summary> /// Registers that the data store contains data of the provided type /// </summary> /// <param name='type'> /// The transfer data type /// </param> /// <remarks> /// This method can be used in combination with DataRequestCallback to /// generate the data on demand. In some scenarios, the drop/paste /// side of a drag&drop or clipboard operation can decide if a drop/paste /// is allowed or not by checking the available data type in this /// data source. Once the operation is accepted, the DataRequestCallback /// callback will be invoked to get the data for the type. /// </remarks> public void AddType(TransferDataType type) { data [type] = null; }
public static T GetData <T> () { return((T)Backend.GetData(TransferDataType.FromType(typeof(T)))); }
public override bool Equals(object obj) { TransferDataType t = obj as TransferDataType; return(t != null && t.id == id); }