Пример #1
0
        // Allocate a new format identifier.
        private static int AllocID(String format)
        {
            IToolkitClipboard clipboard =
                ToolkitManager.Toolkit.GetClipboard();

            if (clipboard != null)
            {
                int id = clipboard.RegisterFormat(format);
                if (id != -1)
                {
                    return(id);
                }
            }
            Format info = formats;
            int    max  = 0;

            while (info != null)
            {
                if (info.Id > max)
                {
                    max = info.Id;
                }
                info = info.Next;
            }
            return(max + 1);
        }
Пример #2
0
        // Set the contents of the X selection.
        internal static void SetSelection(String text, int index, int count)
        {
            IToolkitClipboard clipboard =
                ToolkitManager.Toolkit.GetClipboard();

            if (clipboard != null)
            {
                clipboard.SetSelection(text, index, count);
            }
        }
Пример #3
0
        // Get the contents of the X selection, or null if none.  See the
        // comments in "IToolkitClipboard.cs" for a description of the correct
        // usage of the X selection.
        internal static String GetSelection()
        {
            IToolkitClipboard clipboard =
                ToolkitManager.Toolkit.GetClipboard();

            if (clipboard != null)
            {
                return(clipboard.GetSelection());
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        // Get the name of an existing format identifier.
        private static String GetFormatName(int id)
        {
            IToolkitClipboard clipboard =
                ToolkitManager.Toolkit.GetClipboard();

            if (clipboard != null)
            {
                String format = clipboard.GetFormat(id);
                if (format != null)
                {
                    return(format);
                }
            }
            return("Format" + id.ToString());
        }