Data type to be used in drag & drop and copy & paste operations
Exemplo n.º 1
0
 public DragCheckEventArgs(Point position, TransferDataType[] types, DragDropAction action)
 {
     DataTypes = types;
     Action = action;
     Position = position;
     Result = DragDropResult.None;
 }
Exemplo n.º 2
0
		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;
 }
Exemplo n.º 4
0
 public static void SetData <T> (T data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     SetData(TransferDataType.FromType(data.GetType()), data);
 }
Exemplo n.º 5
0
 public void AddValue(object value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     data [TransferDataType.FromType(value.GetType())] = value;
 }
Exemplo n.º 6
0
        object GetValue(TransferDataType type)
        {
            object val;

            if (data.TryGetValue(type, out val))
            {
                if (val != null)
                {
                    return(val);
                }
            }
            return(null);
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 10
0
 public static IAsyncResult BeginGetData <T> (AsyncCallback callback, object state)
 {
     return(Backend.BeginGetData(TransferDataType.FromType(typeof(T)), callback, state));
 }
Exemplo n.º 11
0
 public static IAsyncResult BeginGetData(TransferDataType type, AsyncCallback callback, object state)
 {
     return(Backend.BeginGetData(type, callback, state));
 }
Exemplo n.º 12
0
 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);
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 14
0
 object ITransferData.GetValue(TransferDataType type)
 {
     return(GetValue(type));
 }
Exemplo n.º 15
0
 /// <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;
 }
Exemplo n.º 16
0
 public static void SetData(TransferDataType type, Func <object> dataSource)
 {
     Backend.SetData(type, dataSource);
 }
Exemplo n.º 17
0
 /// <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&amp;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;
 }
Exemplo n.º 18
0
 public void SetDragSource(DragDropAction dragAction, params Type[] types)
 {
     Backend.SetDragSource(types.Select(t => TransferDataType.FromType(t)).ToArray(), dragAction);
 }
Exemplo n.º 19
0
 public void SetDragDropTarget(params Type[] types)
 {
     Backend.SetDragTarget(types.Select(t => TransferDataType.FromType(t)).ToArray(), DragDropAction.All);
 }
Exemplo n.º 20
0
 /// <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;
 }
Exemplo n.º 21
0
 public static bool ContainsData(TransferDataType type)
 {
     return(Backend.IsTypeAvailable(type));
 }
Exemplo n.º 22
0
 public static void SetData(TransferDataType type, object data)
 {
     Backend.SetData(type, delegate {
         return(data);
     });
 }
Exemplo n.º 23
0
 public static object GetData(TransferDataType type)
 {
     return(Backend.GetData(type));
 }
Exemplo n.º 24
0
 public static void SetData <T> (Func <T> dataSource)
 {
     Backend.SetData(TransferDataType.FromType(typeof(T)), delegate() {
         return(dataSource());
     });
 }
Exemplo n.º 25
0
 bool ITransferData.HasType(TransferDataType type)
 {
     return(data.ContainsKey(type));
 }
Exemplo n.º 26
0
 public static bool ContainsData <T> ()
 {
     return(Backend.IsTypeAvailable(TransferDataType.FromType(typeof(T))));
 }
Exemplo n.º 27
0
 /// <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&amp;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;
 }
Exemplo n.º 28
0
 public static T GetData <T> ()
 {
     return((T)Backend.GetData(TransferDataType.FromType(typeof(T))));
 }
Exemplo n.º 29
0
        public override bool Equals(object obj)
        {
            TransferDataType t = obj as TransferDataType;

            return(t != null && t.id == id);
        }