├── .gitignore ├── LICENSE ├── README.md ├── changelog.txt ├── demos ├── demo_canvas.py ├── demo_files_and_text.py ├── demo_megawidgets.py └── demo_simple_text.py ├── docs ├── Makefile ├── TkinterDnD.html ├── TkinterDnD2.rst ├── conf.py ├── index.rst ├── make.bat └── tkDND.htm ├── hook-tkinterdnd2.py ├── setup.py ├── tests └── test_tkinterdnd2.py └── tkinterdnd2 ├── TkinterDnD.py ├── __init__.py └── tkdnd ├── linux-arm64 ├── libtkdnd2.9.3.so ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl ├── linux-x64 ├── libtkdnd2.9.5.so ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl ├── osx-arm64 ├── libtkdnd2.9.3.dylib ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl ├── osx-x64 ├── libtkdnd2.9.4.dylib ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl ├── win-arm64 ├── libtkdnd2.9.3.dll ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd2.9.3.lib ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl ├── win-x64 ├── libtkdnd2.9.5.dll ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd2.9.5.lib ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl └── win-x86 ├── libtkdnd2.9.5.dll ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd2.9.5.lib ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl ├── tkdnd_utils.tcl └── tkdnd_windows.tcl /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | *.py[cod] 6 | *$py.class 7 | 8 | # C extensions 9 | #*.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | build/ 14 | develop-eggs/ 15 | dist/ 16 | downloads/ 17 | eggs/ 18 | .eggs/ 19 | lib/ 20 | lib64/ 21 | parts/ 22 | sdist/ 23 | var/ 24 | wheels/ 25 | pip-wheel-metadata/ 26 | share/python-wheels/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | MANIFEST 31 | 32 | # PyInstaller 33 | # Usually these files are written by a python script from a template 34 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 35 | *.manifest 36 | *.spec 37 | 38 | # Installer logs 39 | pip-log.txt 40 | pip-delete-this-directory.txt 41 | 42 | # Unit test / coverage reports 43 | htmlcov/ 44 | .tox/ 45 | .nox/ 46 | .coverage 47 | .coverage.* 48 | .cache 49 | nosetests.xml 50 | coverage.xml 51 | *.cover 52 | *.py,cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # Django stuff: 61 | *.log 62 | local_settings.py 63 | db.sqlite3 64 | db.sqlite3-journal 65 | 66 | # Flask stuff: 67 | instance/ 68 | .webassets-cache 69 | 70 | # Scrapy stuff: 71 | .scrapy 72 | 73 | # Sphinx documentation 74 | docs/_build/ 75 | 76 | # PyBuilder 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | .python-version 88 | 89 | # pipenv 90 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 91 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 92 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 93 | # install all needed dependencies. 94 | #Pipfile.lock 95 | 96 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 97 | __pypackages__/ 98 | 99 | # Celery stuff 100 | celerybeat-schedule 101 | celerybeat.pid 102 | 103 | # SageMath parsed files 104 | *.sage.py 105 | 106 | # Environments 107 | .env 108 | .venv 109 | env/ 110 | venv/ 111 | ENV/ 112 | env.bak/ 113 | venv.bak/ 114 | 115 | # Spyder project settings 116 | .spyderproject 117 | .spyproject 118 | 119 | # Rope project settings 120 | .ropeproject 121 | 122 | # mkdocs documentation 123 | /site 124 | 125 | # mypy 126 | .mypy_cache/ 127 | .dmypy.json 128 | dmypy.json 129 | 130 | # Pyre type checker 131 | .pyre/ 132 | 133 | .idea 134 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Philippe Gagné 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## TkinterDnD2 2 | 3 | [Eliav2/tkinterdnd2](https://github.com/Eliav2/tkinterdnd2) is a fork of the (unmaintained) [pmgagne/tkinterdnd2](https://github.com/pmgagne/tkinterdnd2) which is a python wrapper for [tkdnd](https://github.com/petasis/tkdnd) . 4 | 5 | This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`. 6 | 7 | This repository is being maintained to ensure availability of `tkinterdnd2` into the future. 8 | 9 | ## Install 10 | 11 | `python -m pip install tkinterdnd2` 12 | 13 | ## Usage 14 | 15 | ```python 16 | import tkinter as tk 17 | 18 | from tkinterdnd2 import DND_FILES, TkinterDnD 19 | 20 | root = TkinterDnD.Tk() # notice - use this instead of tk.Tk() 21 | 22 | lb = tk.Listbox(root) 23 | lb.insert(1, "drag files to here") 24 | 25 | # register the listbox as a drop target 26 | lb.drop_target_register(DND_FILES) 27 | lb.dnd_bind('<>', lambda e: lb.insert(tk.END, e.data)) 28 | 29 | lb.pack() 30 | root.mainloop() 31 | ``` 32 | ![tkinterdnd2 example usage](https://i.stack.imgur.com/jnOWd.png) 33 | 34 | 35 | see any of the [demos](./demos) for usage examples. 36 | 37 | # tkinterdnd2 38 | 39 | Tkinter native drag and drop support for windows, unix and Mac OSX. 40 | 41 | ## What is TkinterDnD2 42 | 43 | [TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2. 44 | 45 | It is a domain public project. 46 | 47 | ## What is TkDnD2 48 | 49 | [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support. 50 | 51 | ## What this repository is about 52 | 53 | This repo package TkinterDnD2 and tkdnd2 into a standard python module. 54 | 55 | When the extension is imported in python its location will be automatically added to the Tk search path. 56 | 57 | This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support. 58 | 59 | ## pyinstaller 60 | 61 | When using `pyinstaller`, you should use the hook-tkinterdnd2.py file included to collect the TkDnD binaries and build them into the project. To use it, copy it into the base directory of your project, then run pyinstaller as follows: 62 | 63 | pyinstaller -F -w myproject/myproject.py --additional-hooks-dir=. 64 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | 0.4.3 2 | - Improved architecture detection thanks to @rokm 3 | 4 | 0.4.2 5 | - Fixed an error in hook file due to the omission of a comma. I didn't do enough testing across systems. 6 | 7 | 0.4.1 8 | - Fixed error in hook file which failed to account for new architechures. 9 | 10 | 0.4.0 11 | - Removed support for Tix. Tix was depreciated in python3.6 and will be removed in python3.13 12 | - Updated most tkdnd binaries from 2.9.2 to 2.9.4. ARM binaries are on 2.9.3 and need to be rebuilt (a problem I don't yet have a solution for) 13 | - Updated hook.py to only include files for the appropriate platform. 14 | 15 | 0.3.1 16 | - Updates to readme 17 | 18 | 0.3.0 19 | - Original fork 20 | -------------------------------------------------------------------------------- /demos/demo_canvas.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import tkinterdnd2 5 | try: 6 | from Tkinter import * 7 | except ImportError: 8 | from tkinter import * 9 | 10 | root = tkinterdnd2.Tk() 11 | root.withdraw() 12 | root.title('TkinterDnD Canvas demo') 13 | root.grid_rowconfigure(1, weight=1, minsize=250) 14 | root.grid_columnconfigure(0, weight=1, minsize=300) 15 | 16 | Label(root, text='Drag and drop files here:').grid( 17 | row=0, column=0, padx=10, pady=5) 18 | buttonbox = Frame(root) 19 | buttonbox.grid(row=2, column=0, columnspan=2, pady=5) 20 | Button(buttonbox, text='Quit', command=root.quit).pack( 21 | side=LEFT, padx=5) 22 | 23 | file_data = ('R0lGODlhGAAYAKIAANnZ2TMzM////wAAAJmZmf///////////yH5BAEAAAAALAA' 24 | 'AAAAYABgAAAPACBi63IqgC4GiyxwogaAbKLrMgSKBoBoousyBogEACIGiyxwoKgGAECI' 25 | '4uiyCExMTOACBosuNpDoAGCI4uiyCIkREOACBosutSDoAgSI4usyCIjQAGCi63Iw0ACE' 26 | 'oOLrMgiI0ABgoutyMNAAhKDi6zIIiNAAYKLrcjDQAISg4usyCIjQAGCi63Iw0AIGiiqP' 27 | 'LIyhCA4CBosvNSAMQKKo4ujyCIjQAGCi63Iw0AIGiy81IAxCBpMu9GAMAgKPL3QgJADs' 28 | '=') 29 | folder_data = ('R0lGODlhGAAYAKECAAAAAPD/gP///////yH+EUNyZWF0ZWQgd2l0aCBHSU1QA' 30 | 'CH5BAEKAAIALAAAAAAYABgAAAJClI+pK+DvGINQKhCyztEavGmd5IQmYJXmhi7UC8frH' 31 | 'EL0Hdj4rO/n41v1giIgkWU8cpLK4dFJhAalvpj1is16toICADs=') 32 | 33 | file_icon = PhotoImage(data=file_data) 34 | folder_icon = PhotoImage(data=folder_data) 35 | 36 | canvas = Canvas(root, name='dnd_demo_canvas', bg='white', relief='sunken', 37 | bd=1, highlightthickness=1, takefocus=True, width=600) 38 | canvas.grid(row=1, column=0, padx=5, pady=5, sticky='news') 39 | 40 | # store the filename associated with each canvas item in a dictionary 41 | canvas.filenames = {} 42 | # store the next icon's x and y coordinates in a list 43 | canvas.nextcoords = [50, 20] 44 | # add a boolean flag to the canvas which can be used to disable 45 | # files from the canvas being dropped on the canvas again 46 | canvas.dragging = False 47 | 48 | def add_file(filename): 49 | icon = file_icon 50 | if os.path.isdir(filename): 51 | icon = folder_icon 52 | id1 = canvas.create_image(canvas.nextcoords[0], canvas.nextcoords[1], 53 | image=icon, anchor='n', tags=('file',)) 54 | id2 = canvas.create_text(canvas.nextcoords[0], canvas.nextcoords[1] + 30, 55 | text=os.path.basename(filename), anchor='n', 56 | justify='center', width=90) 57 | def select_item(ev): 58 | canvas.select_from(id2, 0) 59 | canvas.select_to(id2, 'end') 60 | canvas.tag_bind(id1, '', select_item) 61 | canvas.tag_bind(id2, '', select_item) 62 | canvas.filenames[id1] = filename 63 | canvas.filenames[id2] = filename 64 | if canvas.nextcoords[0] > 450: 65 | canvas.nextcoords = [50, canvas.nextcoords[1] + 80] 66 | else: 67 | canvas.nextcoords = [canvas.nextcoords[0] + 100, canvas.nextcoords[1]] 68 | 69 | # drop methods 70 | 71 | def drop_enter(event): 72 | event.widget.focus_force() 73 | print('Entering %s' % event.widget) 74 | return event.action 75 | 76 | def drop_position(event): 77 | return event.action 78 | 79 | def drop_leave(event): 80 | print('Leaving %s' % event.widget) 81 | return event.action 82 | 83 | def drop(event): 84 | if canvas.dragging: 85 | # the canvas itself is the drag source 86 | return tkinterdnd2.REFUSE_DROP 87 | if event.data: 88 | files = canvas.tk.splitlist(event.data) 89 | for f in files: 90 | add_file(f) 91 | return event.action 92 | 93 | canvas.drop_target_register(tkinterdnd2.DND_FILES) 94 | canvas.dnd_bind('<>', drop_enter) 95 | canvas.dnd_bind('<>', drop_position) 96 | canvas.dnd_bind('<>', drop_leave) 97 | canvas.dnd_bind('<>', drop) 98 | 99 | # drag methods 100 | 101 | def drag_init(event): 102 | data = () 103 | sel = canvas.select_item() 104 | if sel: 105 | # in a decent application we should check here if the mouse 106 | # actually hit an item, but for now we will stick with this 107 | data = (canvas.filenames[sel],) 108 | canvas.dragging = True 109 | return ((tkinterdnd2.ASK, tkinterdnd2.COPY), (tkinterdnd2.DND_FILES, tkinterdnd2.DND_TEXT), data) 110 | else: 111 | # don't start a dnd-operation when nothing is selected; the 112 | # return "break" here is only cosmetical, return "foobar" would 113 | # probably do the same 114 | return 'break' 115 | 116 | def drag_end(event): 117 | # reset the "dragging" flag to enable drops again 118 | canvas.dragging = False 119 | 120 | canvas.drag_source_register(1, tkinterdnd2.DND_FILES) 121 | canvas.dnd_bind('<>', drag_init) 122 | canvas.dnd_bind('<>', drag_end) 123 | 124 | root.update_idletasks() 125 | root.deiconify() 126 | root.mainloop() 127 | -------------------------------------------------------------------------------- /demos/demo_files_and_text.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import platform 5 | from tkinterdnd2 import * 6 | try: 7 | from Tkinter import * 8 | from ScrolledText import ScrolledText 9 | except ImportError: 10 | from tkinter import * 11 | from tkinter.scrolledtext import ScrolledText 12 | 13 | root = TkinterDnD.Tk() 14 | root.withdraw() 15 | root.title('TkinterDnD demo') 16 | root.grid_rowconfigure(1, weight=1, minsize=250) 17 | root.grid_columnconfigure(0, weight=1, minsize=300) 18 | root.grid_columnconfigure(1, weight=1, minsize=300) 19 | 20 | def print_event_info(event): 21 | print('\nAction:', event.action) 22 | print('Supported actions:', event.actions) 23 | print('Mouse button:', event.button) 24 | print('Type codes:', event.codes) 25 | print('Current type code:', event.code) 26 | print('Common source types:', event.commonsourcetypes) 27 | print('Common target types:', event.commontargettypes) 28 | print('Data:', event.data) 29 | print('Event name:', event.name) 30 | print('Supported types:', event.types) 31 | print('Modifier keys:', event.modifiers) 32 | print('Supported source types:', event.supportedsourcetypes) 33 | print('Operation type:', event.type) 34 | print('Source types:', event.sourcetypes) 35 | print('Supported target types:', event.supportedtargettypes) 36 | print('Widget:', event.widget, '(type: %s)' % type(event.widget)) 37 | print('X:', event.x_root) 38 | print('Y:', event.y_root, '\n') 39 | 40 | Label(root, text='Drag and drop files here:').grid( 41 | row=0, column=0, padx=10, pady=5) 42 | Label(root, text='Drag and drop text here:').grid( 43 | row=0, column=1, padx=10, pady=5) 44 | buttonbox = Frame(root) 45 | buttonbox.grid(row=2, column=0, columnspan=2, pady=5) 46 | Button(buttonbox, text='Quit', command=root.quit).pack( 47 | side=LEFT, padx=5) 48 | 49 | ############################################################################## 50 | ###### Basic demo window: a Listbox to drag & drop files ## 51 | ###### and a Text widget to drag & drop text ## 52 | ############################################################################## 53 | listbox = Listbox(root, name='dnd_demo_listbox', 54 | selectmode='extended', width=1, height=1) 55 | listbox.grid(row=1, column=0, padx=5, pady=5, sticky='news') 56 | text = Text(root, name='dnd_demo_text', wrap='word', undo=True, width=1, height=1) 57 | text.grid(row=1, column=1, pady=5, sticky='news') 58 | 59 | listbox.insert(END, os.path.abspath(__file__)) 60 | info = 'TkinterDnD demo\nDetected versions:\n' 61 | info += ' Python: %s\n' % platform.python_version() 62 | info += ' Tk : %f\n' % TkVersion 63 | info += ' Tkdnd : %s\n' % TkinterDnD.TkdndVersion 64 | info += 'Use mouse button 3 to drag hightlighted text from the text box.\n' 65 | text.insert(END, info) 66 | 67 | # Drop callbacks can be shared between the Listbox and Text; 68 | # according to the man page these callbacks must return an action type, 69 | # however they also seem to work without 70 | 71 | def drop_enter(event): 72 | event.widget.focus_force() 73 | print('Entering widget: %s' % event.widget) 74 | #print_event_info(event) 75 | return event.action 76 | 77 | def drop_position(event): 78 | print('Position: x %d, y %d' %(event.x_root, event.y_root)) 79 | #print_event_info(event) 80 | return event.action 81 | 82 | def drop_leave(event): 83 | print('Leaving %s' % event.widget) 84 | #print_event_info(event) 85 | return event.action 86 | 87 | def drop(event): 88 | if event.data: 89 | print('Dropped data:\n', event.data) 90 | #print_event_info(event) 91 | if event.widget == listbox: 92 | # event.data is a list of filenames as one string; 93 | # if one of these filenames contains whitespace characters 94 | # it is rather difficult to reliably tell where one filename 95 | # ends and the next begins; the best bet appears to be 96 | # to count on tkdnd's and tkinter's internal magic to handle 97 | # such cases correctly; the following seems to work well 98 | # at least with Windows and Gtk/X11 99 | files = listbox.tk.splitlist(event.data) 100 | for f in files: 101 | if os.path.exists(f): 102 | print('Dropped file: "%s"' % f) 103 | listbox.insert('end', f) 104 | else: 105 | print('Not dropping file "%s": file does not exist.' % f) 106 | elif event.widget == text: 107 | # calculate the mouse pointer's text index 108 | bd = text['bd'] + text['highlightthickness'] 109 | x = event.x_root - text.winfo_rootx() - bd 110 | y = event.y_root - text.winfo_rooty() - bd 111 | index = text.index('@%d,%d' % (x,y)) 112 | text.insert(index, event.data) 113 | else: 114 | print('Error: reported event.widget not known') 115 | return event.action 116 | 117 | # now make the Listbox and Text drop targets 118 | listbox.drop_target_register(DND_FILES, DND_TEXT) 119 | text.drop_target_register(DND_TEXT) 120 | 121 | for widget in (listbox, text): 122 | widget.dnd_bind('<>', drop_enter) 123 | widget.dnd_bind('<>', drop_position) 124 | widget.dnd_bind('<>', drop_leave) 125 | widget.dnd_bind('<>', drop) 126 | #widget.dnd_bind('<>', drop) 127 | #widget.dnd_bind('<>', drop) 128 | 129 | # define drag callbacks 130 | 131 | def drag_init_listbox(event): 132 | print_event_info(event) 133 | # use a tuple as file list, this should hopefully be handled gracefully 134 | # by tkdnd and the drop targets like file managers or text editors 135 | data = () 136 | if listbox.curselection(): 137 | data = tuple([listbox.get(i) for i in listbox.curselection()]) 138 | print('Dragging :', data) 139 | # tuples can also be used to specify possible alternatives for 140 | # action type and DnD type: 141 | return ((ASK, COPY), (DND_FILES, DND_TEXT), data) 142 | 143 | def drag_init_text(event): 144 | print_event_info(event) 145 | # use a string if there is only a single text string to be dragged 146 | data = '' 147 | sel = text.tag_nextrange(SEL, '1.0') 148 | if sel: 149 | data = text.get(*sel) 150 | print('Dragging :\n', data) 151 | # if there is only one possible alternative for action and DnD type 152 | # we can also use strings here 153 | return (COPY, DND_TEXT, data) 154 | 155 | def drag_end(event): 156 | #print_event_info(event) 157 | # this callback is not really necessary if it doesn't do anything useful 158 | print('Drag ended for widget:', event.widget) 159 | 160 | # finally make the widgets a drag source 161 | 162 | listbox.drag_source_register(1, DND_TEXT, DND_FILES) 163 | text.drag_source_register(3, DND_TEXT) 164 | 165 | listbox.dnd_bind('<>', drag_init_listbox) 166 | listbox.dnd_bind('<>', drag_end) 167 | text.dnd_bind('<>', drag_init_text) 168 | # skip the useless drag_end() binding for the text widget 169 | 170 | root.update_idletasks() 171 | root.deiconify() 172 | root.mainloop() 173 | 174 | -------------------------------------------------------------------------------- /demos/demo_megawidgets.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import platform 5 | from tkinterdnd2 import * 6 | try: 7 | from Tkinter import * 8 | from ScrolledText import ScrolledText 9 | except ImportError: 10 | from tkinter import * 11 | from tkinter.scrolledtext import ScrolledText 12 | 13 | root = TkinterDnD.Tk() 14 | root.withdraw() 15 | root.title('TkinterDnD megawidget demo') 16 | root.grid_rowconfigure(1, weight=1, minsize=250) 17 | root.grid_columnconfigure(0, weight=1, minsize=300) 18 | 19 | Label(root, text='Drop text here:').grid( 20 | row=0, column=0, padx=10, pady=5) 21 | buttonbox = Frame(root) 22 | buttonbox.grid(row=2, column=0, columnspan=2, pady=5) 23 | Button(buttonbox, text='Quit', command=root.quit).pack( 24 | side=LEFT, padx=5) 25 | 26 | msg = 'Dropping onto compound widgets works only with the latest versions ' +\ 27 | 'of tkdnd.\nIf you can drop text here, the installed version of ' +\ 28 | 'tkdnd already supports this feature.\n' 29 | 30 | lf = LabelFrame(root, text='"Megawidget" text box') 31 | lf.grid(row=1, column=0, padx=5, pady=5, sticky='news') 32 | text = ScrolledText(lf) 33 | text.pack(fill='both', expand=1) 34 | text.insert('end', msg) 35 | 36 | # make the text box a drop target: 37 | 38 | def drop_enter(event): 39 | event.widget.focus_force() 40 | print('Entering %s' % event.widget) 41 | return event.action 42 | 43 | def drop_position(event): 44 | print('Position: x %d, y %d' %(event.x_root, event.y_root)) 45 | return event.action 46 | 47 | def drop_leave(event): 48 | print('Leaving %s' % event.widget) 49 | return event.action 50 | 51 | def drop(event): 52 | if event.data: 53 | text.insert('end', event.data) 54 | return event.action 55 | 56 | text.drop_target_register(DND_TEXT) 57 | text.dnd_bind('<>', drop_enter) 58 | text.dnd_bind('<>', drop_position) 59 | text.dnd_bind('<>', drop_leave) 60 | text.dnd_bind('<>', drop) 61 | 62 | root.update_idletasks() 63 | root.deiconify() 64 | root.mainloop() 65 | -------------------------------------------------------------------------------- /demos/demo_simple_text.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import platform 5 | from tkinterdnd2 import * 6 | try: 7 | from Tkinter import * 8 | from ScrolledText import ScrolledText 9 | except ImportError: 10 | from tkinter import * 11 | from tkinter.scrolledtext import ScrolledText 12 | 13 | root = TkinterDnD.Tk() 14 | root.withdraw() 15 | root.title('TkinterDnD simple text demo') 16 | root.grid_rowconfigure(1, weight=1, minsize=250) 17 | root.grid_columnconfigure(0, weight=1, minsize=300) 18 | 19 | Label(root, text='Drag and drop text here:').grid( 20 | row=0, column=0, padx=10, pady=5) 21 | buttonbox = Frame(root) 22 | buttonbox.grid(row=2, column=0, columnspan=2, pady=5) 23 | Button(buttonbox, text='Quit', command=root.quit).pack( 24 | side=LEFT, padx=5) 25 | 26 | msg = "You can drop text onto the Label to append it to the Label's text "+\ 27 | "string.\nYou can drag the Label's text string into other " +\ 28 | "applications.\n" 29 | label = Label(root, name='dnd_demo_label', bg='white', relief='sunken', 30 | bd=1, highlightthickness=1, text=msg, takefocus=True, 31 | justify='left', anchor='nw', padx=5, pady=5) 32 | label.grid(row=1, column=0, padx=5, pady=5, sticky='news') 33 | 34 | # make the Label a drop target: 35 | 36 | def drop_enter(event): 37 | event.widget.focus_force() 38 | print('Entering %s' % event.widget) 39 | return event.action 40 | 41 | def drop_position(event): 42 | print('Position: x %d, y %d' %(event.x_root, event.y_root)) 43 | return event.action 44 | 45 | def drop_leave(event): 46 | print('Leaving %s' % event.widget) 47 | return event.action 48 | 49 | def drop(event): 50 | if event.data: 51 | label.configure(text=label['text'] + event.data) 52 | return event.action 53 | 54 | label.drop_target_register(DND_TEXT) 55 | label.dnd_bind('<>', drop_enter) 56 | label.dnd_bind('<>', drop_position) 57 | label.dnd_bind('<>', drop_leave) 58 | label.dnd_bind('<>', drop) 59 | 60 | # make the Label a drag source: 61 | 62 | def drag_init(event): 63 | data = label['text'] 64 | return (COPY, DND_TEXT, data) 65 | 66 | label.drag_source_register(DND_TEXT) 67 | label.dnd_bind('<>', drag_init) 68 | 69 | root.update_idletasks() 70 | root.deiconify() 71 | root.mainloop() 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/TkinterDnD2.rst: -------------------------------------------------------------------------------- 1 | TkinterDnD2 Package 2 | =================== 3 | 4 | :mod:`TkinterDnD2` Module 5 | ------------------------- 6 | 7 | .. automodule:: TkinterDnD2.TkinterDnD 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | :class:`DnDEvent` Class 13 | ----------------------- 14 | 15 | .. autoclass:: TkinterDnD2.TkinterDnD.DnDEvent 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | :class:`DnDWrapper` Class 21 | ------------------------- 22 | .. autoclass:: TkinterDnD2.TkinterDnD.DnDWrapper 23 | :members: 24 | :undoc-members: 25 | :show-inheritance: 26 | 27 | :class:`TixTk` Class 28 | ----------------------- 29 | .. autoclass:: TkinterDnD2.TkinterDnD.TixTk 30 | :members: 31 | :undoc-members: 32 | :show-inheritance: 33 | 34 | :class:`Tk` Class 35 | ----------------------- 36 | .. autoclass:: TkinterDnD2.TkinterDnD.Tk 37 | :members: 38 | :undoc-members: 39 | :show-inheritance: -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | #sys.path.insert(0, os.path.abspath('../TkinterDnD2')) 16 | 17 | import TkinterDnD2 18 | 19 | # -- Project information ----------------------------------------------------- 20 | 21 | project = 'tkinterdnd2' 22 | copyright = '2020, klappnase, pmgagne' 23 | author = 'klappnase, pmgagne' 24 | 25 | 26 | # -- General configuration --------------------------------------------------- 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [ 32 | 'sphinx.ext.napoleon', 33 | 'sphinx.ext.autodoc', 34 | 'sphinx.ext.autodoc.typehints', 35 | "sphinx.ext.viewcode"] 36 | 37 | # Add any paths that contain templates here, relative to this directory. 38 | templates_path = ['_templates'] 39 | 40 | # List of patterns, relative to source directory, that match files and 41 | # directories to ignore when looking for source files. 42 | # This pattern also affects html_static_path and html_extra_path. 43 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 44 | 45 | autodoc_typehints = 'description' 46 | 47 | # -- Options for HTML output ------------------------------------------------- 48 | 49 | # The theme to use for HTML and HTML Help pages. See the documentation for 50 | # a list of builtin themes. 51 | # 52 | html_theme = 'alabaster' 53 | 54 | # Add any paths that contain custom static files (such as style sheets) here, 55 | # relative to this directory. They are copied after the builtin static files, 56 | # so a file named "default.css" will overwrite the builtin "default.css". 57 | html_static_path = ['_static'] -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. tkinterdnd2 documentation master file, created by 2 | sphinx-quickstart on Wed Feb 19 10:27:56 2020. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to tkinterdnd2's documentation! 7 | ======================================= 8 | 9 | `klappnase' TkinterDnD2 `_ is a python wrapper for `George Petasis' tkDnD Tk 10 | extension version 2 `_. 11 | 12 | Here we packaged TkinterDnD2 and tkdnd2 into a standard python module. When it is imported in python 13 | the Tk extension location is automatically added to the Tk search path. 14 | 15 | .. toctree:: 16 | :maxdepth: 2 17 | :caption: Contents: 18 | 19 | TkinterDnD2.rst 20 | 21 | 22 | Indices and tables 23 | ================== 24 | 25 | * :ref:`genindex` 26 | * :ref:`modindex` 27 | * :ref:`search` 28 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /hook-tkinterdnd2.py: -------------------------------------------------------------------------------- 1 | """pyinstaller hook file. 2 | 3 | You need to use this hook-file if you are packaging a project using tkinterdnd2. 4 | Just put hook-tkinterdnd2.py in the same directory where you call pyinstaller and type: 5 | 6 | pyinstaller myproject/myproject.py --additional-hooks-dir=. 7 | """ 8 | 9 | import os 10 | import platform 11 | from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs 12 | 13 | 14 | s = platform.system() 15 | p = { 16 | 'Windows': ({'win-arm64', 'win-x86', 'win-x64' },{'tkdnd_unix.tcl', 'tkdnd_macosx.tcl'}), 17 | 'Linux': ({'linux-x64', 'linux-arm64'}, {'tkdnd_windows.tcl', 'tkdnd_macosx.tcl'}), 18 | 'Darwin': ({'osx-x64', 'osx-arm64'}, {'tkdnd_windows.tcl', 'tkdnd_unix.tcl'}), 19 | } 20 | if s in p: 21 | datas = set([ 22 | x for x in ( 23 | *collect_data_files('tkinterdnd2'), 24 | *collect_dynamic_libs('tkinterdnd2'), 25 | ) 26 | if os.path.split(x[1])[1] in p[s][0] and os.path.split(x[0])[1] not in p[s][1] 27 | ]) 28 | else: 29 | raise RuntimeError(f'TkinterDnD2 is not supported on platform "{s}".') 30 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open("README.md", "r") as fh: 4 | long_description = fh.read() 5 | 6 | setuptools.setup( 7 | name="tkinterdnd2", 8 | version="0.4.2", 9 | author="petasis\\pmgagne\\eliav2", 10 | description="TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2", 11 | long_description=long_description, 12 | long_description_content_type="text/markdown", 13 | url="https://github.com/Eliav2/tkinterdnd2", 14 | packages=setuptools.find_packages(), 15 | include_package_data=True, 16 | package_data={ 17 | # Include tkdnd extension files. 18 | "tkinterdnd2": ["tkdnd/linux-x64/*.*", "tkdnd/linux-arm64/*.*", "tkdnd/osx-x64/*.*", "tkdnd/osx-arm64/*.*", "tkdnd/win-x64/*.*", "tkdnd/win-x86/*.*", "tkdnd/win-arm64/*.*"], 19 | }, 20 | classifiers=[ 21 | "Development Status :: 2 - Pre-Alpha", 22 | "Programming Language :: Python :: 3", 23 | "License :: OSI Approved :: MIT License", 24 | ], 25 | python_requires='>=3.6', 26 | ) 27 | -------------------------------------------------------------------------------- /tests/test_tkinterdnd2.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import tkinter 4 | import tkinterdnd2 5 | 6 | class TestStringMethods(unittest.TestCase): 7 | 8 | def test_version(self): 9 | root = tkinterdnd2.Tk() 10 | root.withdraw() 11 | self.assertEqual(root.TkdndVersion, '2.9.2') 12 | 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tkinterdnd2/__init__.py: -------------------------------------------------------------------------------- 1 | # dnd actions 2 | PRIVATE = 'private' 3 | NONE = 'none' 4 | ASK = 'ask' 5 | COPY = 'copy' 6 | MOVE = 'move' 7 | LINK = 'link' 8 | REFUSE_DROP = 'refuse_drop' 9 | 10 | # dnd types 11 | DND_TEXT = 'DND_Text' 12 | DND_FILES = 'DND_Files' 13 | DND_ALL = '*' 14 | CF_UNICODETEXT = 'CF_UNICODETEXT' 15 | CF_TEXT = 'CF_TEXT' 16 | CF_HDROP = 'CF_HDROP' 17 | 18 | FileGroupDescriptor = 'FileGroupDescriptor - FileContents'# ?? 19 | FileGroupDescriptorW = 'FileGroupDescriptorW - FileContents'# ?? 20 | 21 | from . import TkinterDnD 22 | from .TkinterDnD import Tk 23 | 24 | 25 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-arm64/libtkdnd2.9.3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/linux-arm64/libtkdnd2.9.3.so -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-arm64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.3 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.3[info sharedlibextension] tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.3 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.3" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-arm64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-arm64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | NSFilenamesPboardType DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-arm64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [encoding convertfrom utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/libtkdnd2.9.5.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/linux-x64/libtkdnd2.9.5.so -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.5 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.5.so tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.5 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.5" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | [macdnd::generictype2ostype DND_Files] DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/tkdnd_utils.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_utils.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | package require tkdnd 40 | namespace eval ::tkdnd { 41 | namespace eval utils { 42 | };# namespace ::tkdnd::utils 43 | namespace eval text { 44 | variable _drag_tag tkdnd::drag::selection::tag 45 | variable _state {} 46 | variable _drag_source_widget {} 47 | variable _drop_target_widget {} 48 | variable _now_dragging 0 49 | };# namespace ::tkdnd::text 50 | };# namespace ::tkdnd 51 | 52 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag clear 1 %W %s %X %Y %x %y} 53 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag motion 1 %W %s %X %Y %x %y} 54 | bind TkDND_Drag_Text1 {tkdnd::text::_TextAutoScan %W %x %y} 55 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag reset 1 %W %s %X %Y %x %y} 56 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag clear 2 %W %s %X %Y %x %y} 57 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag motion 2 %W %s %X %Y %x %y} 58 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag reset 2 %W %s %X %Y %x %y} 59 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag clear 3 %W %s %X %Y %x %y} 60 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag motion 3 %W %s %X %Y %x %y} 61 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag reset 3 %W %s %X %Y %x %y} 62 | 63 | # ---------------------------------------------------------------------------- 64 | # Command tkdnd::text::drag_source 65 | # ---------------------------------------------------------------------------- 66 | proc ::tkdnd::text::drag_source { mode path { types DND_Text } { event 1 } { tagprefix TkDND_Drag_Text } { tag sel } } { 67 | switch -exact -- $mode { 68 | register { 69 | $path tag bind $tag \ 70 | [list tkdnd::text::_begin_drag press ${event} %W %s %X %Y %x %y] 71 | ## Set a binding to the widget, to put selection as data... 72 | bind $path <> \ 73 | [list ::tkdnd::text::DragInitCmd $path %t $tag] 74 | ## Set a binding to the widget, to remove selection if action is move... 75 | bind $path <> \ 76 | [list ::tkdnd::text::DragEndCmd $path %A $tag] 77 | } 78 | unregister { 79 | $path tag bind $tag {} 80 | bind $path <> {} 81 | bind $path <> {} 82 | } 83 | } 84 | ::tkdnd::drag_source $mode $path $types $event $tagprefix 85 | };# ::tkdnd::text::drag_source 86 | 87 | # ---------------------------------------------------------------------------- 88 | # Command tkdnd::text::drop_target 89 | # ---------------------------------------------------------------------------- 90 | proc ::tkdnd::text::drop_target { mode path { types DND_Text } } { 91 | switch -exact -- $mode { 92 | register { 93 | bind $path <> \ 94 | [list ::tkdnd::text::DropPosition $path %X %Y %A %a %m] 95 | bind $path <> \ 96 | [list ::tkdnd::text::Drop $path %D %X %Y %A %a %m] 97 | } 98 | unregister { 99 | bind $path <> {} 100 | bind $path <> {} 101 | bind $path <> {} 102 | bind $path <> {} 103 | } 104 | } 105 | ::tkdnd::drop_target $mode $path $types 106 | };# ::tkdnd::text::drop_target 107 | 108 | # ---------------------------------------------------------------------------- 109 | # Command tkdnd::text::DragInitCmd 110 | # ---------------------------------------------------------------------------- 111 | proc ::tkdnd::text::DragInitCmd { path { types DND_Text } { tag sel } { actions { copy move } } } { 112 | ## Save the selection indices... 113 | variable _drag_source_widget 114 | variable _drop_target_widget 115 | set _drag_source_widget $path 116 | set _drop_target_widget {} 117 | _save_selection $path $tag 118 | list $actions $types [$path get $tag.first $tag.last] 119 | };# ::tkdnd::text::DragInitCmd 120 | 121 | # ---------------------------------------------------------------------------- 122 | # Command tkdnd::text::DragEndCmd 123 | # ---------------------------------------------------------------------------- 124 | proc ::tkdnd::text::DragEndCmd { path action { tag sel } } { 125 | variable _drag_source_widget 126 | variable _drop_target_widget 127 | set _drag_source_widget {} 128 | set _drop_target_widget {} 129 | _restore_selection $path $tag 130 | switch -exact -- $action { 131 | move { 132 | ## Delete the original selected text... 133 | variable _selection_first 134 | variable _selection_last 135 | $path delete $_selection_first $_selection_last 136 | } 137 | } 138 | };# ::tkdnd::text::DragEndCmd 139 | 140 | # ---------------------------------------------------------------------------- 141 | # Command tkdnd::text::DropPosition 142 | # ---------------------------------------------------------------------------- 143 | proc ::tkdnd::text::DropPosition { path X Y action actions keys} { 144 | variable _drag_source_widget 145 | variable _drop_target_widget 146 | set _drop_target_widget $path 147 | ## This check is primitive, a more accurate one is needed! 148 | if {$path eq $_drag_source_widget} { 149 | ## This is a drag within the same widget! Set action to move... 150 | if {"move" in $actions} {set action move} 151 | } 152 | incr X -[winfo rootx $path] 153 | incr Y -[winfo rooty $path] 154 | $path mark set insert @$X,$Y; update 155 | return $action 156 | };# ::tkdnd::text::DropPosition 157 | 158 | # ---------------------------------------------------------------------------- 159 | # Command tkdnd::text::Drop 160 | # ---------------------------------------------------------------------------- 161 | proc ::tkdnd::text::Drop { path data X Y action actions keys } { 162 | incr X -[winfo rootx $path] 163 | incr Y -[winfo rooty $path] 164 | $path mark set insert @$X,$Y 165 | $path insert [$path index insert] $data 166 | return $action 167 | };# ::tkdnd::text::Drop 168 | 169 | # ---------------------------------------------------------------------------- 170 | # Command tkdnd::text::_save_selection 171 | # ---------------------------------------------------------------------------- 172 | proc ::tkdnd::text::_save_selection { path tag} { 173 | variable _drag_tag 174 | variable _selection_first 175 | variable _selection_last 176 | variable _selection_tag $tag 177 | set _selection_first [$path index $tag.first] 178 | set _selection_last [$path index $tag.last] 179 | $path tag add $_drag_tag $_selection_first $_selection_last 180 | $path tag configure $_drag_tag \ 181 | -background [$path tag cget $tag -background] \ 182 | -foreground [$path tag cget $tag -foreground] 183 | };# tkdnd::text::_save_selection 184 | 185 | # ---------------------------------------------------------------------------- 186 | # Command tkdnd::text::_restore_selection 187 | # ---------------------------------------------------------------------------- 188 | proc ::tkdnd::text::_restore_selection { path tag} { 189 | variable _drag_tag 190 | variable _selection_first 191 | variable _selection_last 192 | $path tag delete $_drag_tag 193 | $path tag remove $tag 0.0 end 194 | #$path tag add $tag $_selection_first $_selection_last 195 | };# tkdnd::text::_restore_selection 196 | 197 | # ---------------------------------------------------------------------------- 198 | # Command tkdnd::text::_begin_drag 199 | # ---------------------------------------------------------------------------- 200 | proc ::tkdnd::text::_begin_drag { event button source state X Y x y } { 201 | variable _drop_target_widget 202 | variable _state 203 | # puts "::tkdnd::text::_begin_drag $event $button $source $state $X $Y $x $y" 204 | 205 | switch -exact -- $event { 206 | clear { 207 | switch -exact -- $_state { 208 | press { 209 | ## Do not execute other bindings, as they will erase selection... 210 | return -code break 211 | } 212 | } 213 | set _state clear 214 | } 215 | motion { 216 | variable _now_dragging 217 | if {$_now_dragging} {return -code break} 218 | if { [string equal $_state "press"] } { 219 | variable _x0; variable _y0 220 | if { abs($_x0-$X) > ${::tkdnd::_dx} || abs($_y0-$Y) > ${::tkdnd::_dy} } { 221 | set _state "done" 222 | set _drop_target_widget {} 223 | set _now_dragging 1 224 | set code [catch { 225 | ::tkdnd::_init_drag $button $source $state $X $Y $x $y 226 | } info options] 227 | set _drop_target_widget {} 228 | set _now_dragging 0 229 | if {$code != 0} { 230 | ## Something strange occurred... 231 | return -options $options $info 232 | } 233 | } 234 | return -code break 235 | } 236 | set _state clear 237 | } 238 | press { 239 | variable _x0; variable _y0 240 | set _x0 $X 241 | set _y0 $Y 242 | set _state "press" 243 | } 244 | reset { 245 | set _state {} 246 | } 247 | } 248 | if {$source eq $_drop_target_widget} {return -code break} 249 | return -code continue 250 | };# tkdnd::text::_begin_drag 251 | 252 | proc ::tkdnd::text::_TextAutoScan {w x y} { 253 | variable _now_dragging 254 | if {$_now_dragging} {return -code break} 255 | return -code continue 256 | };# tkdnd::text::_TextAutoScan 257 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/linux-x64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [::tkdnd::from_encoding utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/libtkdnd2.9.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/osx-arm64/libtkdnd2.9.3.dylib -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.3 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.3.dylib tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.3 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.3" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | NSFilenamesPboardType DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/tkdnd_utils.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_utils.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | package require tkdnd 40 | namespace eval ::tkdnd { 41 | namespace eval utils { 42 | };# namespace ::tkdnd::utils 43 | namespace eval text { 44 | variable _drag_tag tkdnd::drag::selection::tag 45 | variable _state {} 46 | variable _drag_source_widget {} 47 | variable _drop_target_widget {} 48 | variable _now_dragging 0 49 | };# namespace ::tkdnd::text 50 | };# namespace ::tkdnd 51 | 52 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag clear 1 %W %s %X %Y %x %y} 53 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag motion 1 %W %s %X %Y %x %y} 54 | bind TkDND_Drag_Text1 {tkdnd::text::_TextAutoScan %W %x %y} 55 | bind TkDND_Drag_Text1 {tkdnd::text::_begin_drag reset 1 %W %s %X %Y %x %y} 56 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag clear 2 %W %s %X %Y %x %y} 57 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag motion 2 %W %s %X %Y %x %y} 58 | bind TkDND_Drag_Text2 {tkdnd::text::_begin_drag reset 2 %W %s %X %Y %x %y} 59 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag clear 3 %W %s %X %Y %x %y} 60 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag motion 3 %W %s %X %Y %x %y} 61 | bind TkDND_Drag_Text3 {tkdnd::text::_begin_drag reset 3 %W %s %X %Y %x %y} 62 | 63 | # ---------------------------------------------------------------------------- 64 | # Command tkdnd::text::drag_source 65 | # ---------------------------------------------------------------------------- 66 | proc ::tkdnd::text::drag_source { mode path { types DND_Text } { event 1 } { tagprefix TkDND_Drag_Text } { tag sel } } { 67 | switch -exact -- $mode { 68 | register { 69 | $path tag bind $tag \ 70 | [list tkdnd::text::_begin_drag press ${event} %W %s %X %Y %x %y] 71 | ## Set a binding to the widget, to put selection as data... 72 | bind $path <> \ 73 | [list ::tkdnd::text::DragInitCmd $path %t $tag] 74 | ## Set a binding to the widget, to remove selection if action is move... 75 | bind $path <> \ 76 | [list ::tkdnd::text::DragEndCmd $path %A $tag] 77 | } 78 | unregister { 79 | $path tag bind $tag {} 80 | bind $path <> {} 81 | bind $path <> {} 82 | } 83 | } 84 | ::tkdnd::drag_source $mode $path $types $event $tagprefix 85 | };# ::tkdnd::text::drag_source 86 | 87 | # ---------------------------------------------------------------------------- 88 | # Command tkdnd::text::drop_target 89 | # ---------------------------------------------------------------------------- 90 | proc ::tkdnd::text::drop_target { mode path { types DND_Text } } { 91 | switch -exact -- $mode { 92 | register { 93 | bind $path <> \ 94 | [list ::tkdnd::text::DropPosition $path %X %Y %A %a %m] 95 | bind $path <> \ 96 | [list ::tkdnd::text::Drop $path %D %X %Y %A %a %m] 97 | } 98 | unregister { 99 | bind $path <> {} 100 | bind $path <> {} 101 | bind $path <> {} 102 | bind $path <> {} 103 | } 104 | } 105 | ::tkdnd::drop_target $mode $path $types 106 | };# ::tkdnd::text::drop_target 107 | 108 | # ---------------------------------------------------------------------------- 109 | # Command tkdnd::text::DragInitCmd 110 | # ---------------------------------------------------------------------------- 111 | proc ::tkdnd::text::DragInitCmd { path { types DND_Text } { tag sel } { actions { copy move } } } { 112 | ## Save the selection indices... 113 | variable _drag_source_widget 114 | variable _drop_target_widget 115 | set _drag_source_widget $path 116 | set _drop_target_widget {} 117 | _save_selection $path $tag 118 | list $actions $types [$path get $tag.first $tag.last] 119 | };# ::tkdnd::text::DragInitCmd 120 | 121 | # ---------------------------------------------------------------------------- 122 | # Command tkdnd::text::DragEndCmd 123 | # ---------------------------------------------------------------------------- 124 | proc ::tkdnd::text::DragEndCmd { path action { tag sel } } { 125 | variable _drag_source_widget 126 | variable _drop_target_widget 127 | set _drag_source_widget {} 128 | set _drop_target_widget {} 129 | _restore_selection $path $tag 130 | switch -exact -- $action { 131 | move { 132 | ## Delete the original selected text... 133 | variable _selection_first 134 | variable _selection_last 135 | $path delete $_selection_first $_selection_last 136 | } 137 | } 138 | };# ::tkdnd::text::DragEndCmd 139 | 140 | # ---------------------------------------------------------------------------- 141 | # Command tkdnd::text::DropPosition 142 | # ---------------------------------------------------------------------------- 143 | proc ::tkdnd::text::DropPosition { path X Y action actions keys} { 144 | variable _drag_source_widget 145 | variable _drop_target_widget 146 | set _drop_target_widget $path 147 | ## This check is primitive, a more accurate one is needed! 148 | if {$path eq $_drag_source_widget} { 149 | ## This is a drag within the same widget! Set action to move... 150 | if {"move" in $actions} {set action move} 151 | } 152 | incr X -[winfo rootx $path] 153 | incr Y -[winfo rooty $path] 154 | $path mark set insert @$X,$Y; update 155 | return $action 156 | };# ::tkdnd::text::DropPosition 157 | 158 | # ---------------------------------------------------------------------------- 159 | # Command tkdnd::text::Drop 160 | # ---------------------------------------------------------------------------- 161 | proc ::tkdnd::text::Drop { path data X Y action actions keys } { 162 | incr X -[winfo rootx $path] 163 | incr Y -[winfo rooty $path] 164 | $path mark set insert @$X,$Y 165 | $path insert [$path index insert] $data 166 | return $action 167 | };# ::tkdnd::text::Drop 168 | 169 | # ---------------------------------------------------------------------------- 170 | # Command tkdnd::text::_save_selection 171 | # ---------------------------------------------------------------------------- 172 | proc ::tkdnd::text::_save_selection { path tag} { 173 | variable _drag_tag 174 | variable _selection_first 175 | variable _selection_last 176 | variable _selection_tag $tag 177 | set _selection_first [$path index $tag.first] 178 | set _selection_last [$path index $tag.last] 179 | $path tag add $_drag_tag $_selection_first $_selection_last 180 | $path tag configure $_drag_tag \ 181 | -background [$path tag cget $tag -background] \ 182 | -foreground [$path tag cget $tag -foreground] 183 | };# tkdnd::text::_save_selection 184 | 185 | # ---------------------------------------------------------------------------- 186 | # Command tkdnd::text::_restore_selection 187 | # ---------------------------------------------------------------------------- 188 | proc ::tkdnd::text::_restore_selection { path tag} { 189 | variable _drag_tag 190 | variable _selection_first 191 | variable _selection_last 192 | $path tag delete $_drag_tag 193 | $path tag remove $tag 0.0 end 194 | #$path tag add $tag $_selection_first $_selection_last 195 | };# tkdnd::text::_restore_selection 196 | 197 | # ---------------------------------------------------------------------------- 198 | # Command tkdnd::text::_begin_drag 199 | # ---------------------------------------------------------------------------- 200 | proc ::tkdnd::text::_begin_drag { event button source state X Y x y } { 201 | variable _drop_target_widget 202 | variable _state 203 | # puts "::tkdnd::text::_begin_drag $event $button $source $state $X $Y $x $y" 204 | 205 | switch -exact -- $event { 206 | clear { 207 | switch -exact -- $_state { 208 | press { 209 | ## Do not execute other bindings, as they will erase selection... 210 | return -code break 211 | } 212 | } 213 | set _state clear 214 | } 215 | motion { 216 | variable _now_dragging 217 | if {$_now_dragging} {return -code break} 218 | if { [string equal $_state "press"] } { 219 | variable _x0; variable _y0 220 | if { abs($_x0-$X) > ${::tkdnd::_dx} || abs($_y0-$Y) > ${::tkdnd::_dy} } { 221 | set _state "done" 222 | set _drop_target_widget {} 223 | set _now_dragging 1 224 | set code [catch { 225 | ::tkdnd::_init_drag $button $source $state $X $Y $x $y 226 | } info options] 227 | set _drop_target_widget {} 228 | set _now_dragging 0 229 | if {$code != 0} { 230 | ## Something strange occurred... 231 | return -options $options $info 232 | } 233 | } 234 | return -code break 235 | } 236 | set _state clear 237 | } 238 | press { 239 | variable _x0; variable _y0 240 | set _x0 $X 241 | set _y0 $Y 242 | set _state "press" 243 | } 244 | reset { 245 | set _state {} 246 | } 247 | } 248 | if {$source eq $_drop_target_widget} {return -code break} 249 | return -code continue 250 | };# tkdnd::text::_begin_drag 251 | 252 | proc ::tkdnd::text::_TextAutoScan {w x y} { 253 | variable _now_dragging 254 | if {$_now_dragging} {return -code break} 255 | return -code continue 256 | };# tkdnd::text::_TextAutoScan 257 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-arm64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [encoding convertfrom utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-x64/libtkdnd2.9.4.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/osx-x64/libtkdnd2.9.4.dylib -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-x64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.4 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.4.dylib tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.4 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.4" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-x64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-x64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | [macdnd::generictype2ostype DND_Files] DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/osx-x64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [encoding convertfrom utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/libtkdnd2.9.3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-arm64/libtkdnd2.9.3.dll -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.3 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.3[info sharedlibextension] tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.3 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.3" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/tkdnd2.9.3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-arm64/tkdnd2.9.3.lib -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | NSFilenamesPboardType DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-arm64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [encoding convertfrom utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/libtkdnd2.9.5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-x64/libtkdnd2.9.5.dll -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.5 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.5[info sharedlibextension] tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.5 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.5" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/tkdnd2.9.5.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-x64/tkdnd2.9.5.lib -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | [macdnd::generictype2ostype DND_Files] DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [::tkdnd::from_encoding utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/libtkdnd2.9.5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-x86/libtkdnd2.9.5.dll -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | 5 | namespace eval ::tkdnd { 6 | ## Check if a debug level must be set... 7 | if {[info exists ::TKDND_DEBUG_LEVEL]} { 8 | variable _debug_level $::TKDND_DEBUG_LEVEL 9 | } elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} { 10 | variable _debug_level $::env(TKDND_DEBUG_LEVEL) 11 | } else { 12 | variable _debug_level 0 13 | } 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug). 17 | # ---------------------------------------------------------------------------- 18 | proc debug_enabled { {level {}} } { 19 | variable _debug_level 20 | if {$level != {}} { 21 | if {[string is integer -strict $level]} { 22 | set _debug_level $level 23 | } elseif {[string is true $level]} { 24 | set _debug_level 1 25 | } 26 | } 27 | return $_debug_level 28 | };# debug_enabled 29 | 30 | # ---------------------------------------------------------------------------- 31 | # Command tkdnd::source: source a Tcl fileInitialise the TkDND package. 32 | # ---------------------------------------------------------------------------- 33 | proc source { filename { encoding utf-8 } } { 34 | variable _package_dir 35 | # If in debug mode, enable debug statements... 36 | set dbg_lvl [debug_enabled] 37 | if {$dbg_lvl} { 38 | puts "tkdnd::source (debug level $dbg_lvl) $filename" 39 | set fd [open $filename r] 40 | fconfigure $fd -encoding $encoding 41 | set script [read $fd] 42 | close $fd 43 | set map {} 44 | for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} { 45 | lappend map "#DBG$lvl " {} 46 | } 47 | lappend map {#DBG } {} 48 | set script [string map $map $script] 49 | return [eval $script] 50 | } 51 | ::source -encoding $encoding $filename 52 | };# source 53 | 54 | }; # namespace ::tkdnd 55 | 56 | package ifneeded tkdnd 2.9.5 \ 57 | "tkdnd::source \{$dir/tkdnd.tcl\} ; \ 58 | tkdnd::initialise \{$dir\} libtkdnd2.9.5[info sharedlibextension] tkdnd" 59 | 60 | package ifneeded tkdnd::utils 2.9.5 \ 61 | "tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \ 62 | package provide tkdnd::utils 2.9.5" 63 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/tkdnd2.9.5.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eliav2/tkinterdnd2/aba38d56c5a9569ef0e6caf2e9a2f782f2fa8332/tkinterdnd2/tkdnd/win-x86/tkdnd2.9.5.lib -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag 1 $window "press" 0 0 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | set type [normalise_type $type] 142 | ::tkdnd::drag_source register $window $type 143 | bind $window <> "list {copy} {%t} \[$script\]" 144 | };# compat::bindsource2 145 | 146 | proc compat::bindsource3 {window type script priority} { 147 | return [bindsource2 $window $type $script] 148 | };# compat::bindsource3 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command compat::cleartarget 152 | # ---------------------------------------------------------------------------- 153 | proc compat::cleartarget {window} { 154 | };# compat::cleartarget 155 | 156 | # ---------------------------------------------------------------------------- 157 | # Command compat::clearsource 158 | # ---------------------------------------------------------------------------- 159 | proc compat::clearsource {window} { 160 | };# compat::clearsource 161 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | [macdnd::generictype2ostype DND_Files] DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist { data {} } } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::SetDroppedData $data 76 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 77 | $_actionlist $_pressedkeys 78 | };# macdnd::HandleEnter 79 | 80 | # ---------------------------------------------------------------------------- 81 | # Command macdnd::HandlePosition 82 | # ---------------------------------------------------------------------------- 83 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 84 | variable _pressedkeys 85 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 86 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 87 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 88 | $_pressedkeys $rootX $rootY 89 | };# macdnd::HandlePosition 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command macdnd::HandleLeave 93 | # ---------------------------------------------------------------------------- 94 | proc macdnd::HandleLeave { args } { 95 | ::tkdnd::generic::HandleLeave 96 | };# macdnd::HandleLeave 97 | 98 | # ---------------------------------------------------------------------------- 99 | # Command macdnd::HandleDrop 100 | # ---------------------------------------------------------------------------- 101 | proc macdnd::HandleDrop { drop_target data args } { 102 | variable _pressedkeys 103 | variable _last_mouse_root_x 104 | variable _last_mouse_root_y 105 | ## Get the dropped data... 106 | ::tkdnd::generic::SetDroppedData $data 107 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 108 | $_last_mouse_root_x $_last_mouse_root_y 0 109 | };# macdnd::HandleDrop 110 | 111 | # ---------------------------------------------------------------------------- 112 | # Command macdnd::GetDragSourceCommonTypes 113 | # ---------------------------------------------------------------------------- 114 | proc macdnd::GetDragSourceCommonTypes { } { 115 | ::tkdnd::generic::GetDragSourceCommonTypes 116 | };# macdnd::GetDragSourceCommonTypes 117 | 118 | # ---------------------------------------------------------------------------- 119 | # Command macdnd::platform_specific_types 120 | # ---------------------------------------------------------------------------- 121 | proc macdnd::platform_specific_types { types } { 122 | ::tkdnd::generic::platform_specific_types $types 123 | }; # macdnd::platform_specific_types 124 | 125 | # ---------------------------------------------------------------------------- 126 | # Command macdnd::platform_specific_type 127 | # ---------------------------------------------------------------------------- 128 | proc macdnd::platform_specific_type { type } { 129 | ::tkdnd::generic::platform_specific_type $type 130 | }; # macdnd::platform_specific_type 131 | 132 | # ---------------------------------------------------------------------------- 133 | # Command tkdnd::platform_independent_types 134 | # ---------------------------------------------------------------------------- 135 | proc ::tkdnd::platform_independent_types { types } { 136 | ::tkdnd::generic::platform_independent_types $types 137 | }; # tkdnd::platform_independent_types 138 | 139 | # ---------------------------------------------------------------------------- 140 | # Command macdnd::platform_independent_type 141 | # ---------------------------------------------------------------------------- 142 | proc macdnd::platform_independent_type { type } { 143 | ::tkdnd::generic::platform_independent_type $type 144 | }; # macdnd::platform_independent_type 145 | -------------------------------------------------------------------------------- /tkinterdnd2/tkdnd/win-x86/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | UniformResourceLocator DND_URL \ 48 | CF_HTML DND_HTML \ 49 | {HTML Format} DND_HTML \ 50 | CF_RTF DND_RTF \ 51 | CF_RTFTEXT DND_RTF \ 52 | {Rich Text Format} DND_RTF \ 53 | ] 54 | # FileGroupDescriptorW DND_Files \ 55 | # FileGroupDescriptor DND_Files \ 56 | 57 | ## Mapping from TkDND types to platform types... 58 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 59 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 60 | DND_Files {CF_HDROP} \ 61 | DND_URL {UniformResourceLocator UniformResourceLocatorW} \ 62 | DND_HTML {CF_HTML {HTML Format}} \ 63 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 64 | ] 65 | };# initialise 66 | 67 | };# namespace olednd 68 | 69 | # ---------------------------------------------------------------------------- 70 | # Command olednd::HandleDragEnter 71 | # ---------------------------------------------------------------------------- 72 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 73 | rootX rootY codelist { data {} } } { 74 | ::tkdnd::generic::SetDroppedData $data 75 | focus $drop_target 76 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 77 | $codelist $actionlist $pressedkeys 78 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 79 | $pressedkeys $rootX $rootY] 80 | if {$::tkdnd::_auto_update} {update idletasks} 81 | return $action 82 | };# olednd::HandleDragEnter 83 | 84 | # ---------------------------------------------------------------------------- 85 | # Command olednd::HandleDragOver 86 | # ---------------------------------------------------------------------------- 87 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 88 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 89 | $pressedkeys $rootX $rootY] 90 | if {$::tkdnd::_auto_update} {update idletasks} 91 | return $action 92 | };# olednd::HandleDragOver 93 | 94 | # ---------------------------------------------------------------------------- 95 | # Command olednd::HandleDragLeave 96 | # ---------------------------------------------------------------------------- 97 | proc olednd::HandleDragLeave { drop_target } { 98 | ::tkdnd::generic::HandleLeave 99 | if {$::tkdnd::_auto_update} {update idletasks} 100 | };# olednd::HandleDragLeave 101 | 102 | # ---------------------------------------------------------------------------- 103 | # Command olednd::HandleDrop 104 | # ---------------------------------------------------------------------------- 105 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 106 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 107 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 108 | $pressedkeys $rootX $rootY 0] 109 | if {$::tkdnd::_auto_update} {update idletasks} 110 | return $action 111 | };# olednd::HandleDrop 112 | 113 | # ---------------------------------------------------------------------------- 114 | # Command olednd::GetDataType 115 | # ---------------------------------------------------------------------------- 116 | proc olednd::GetDataType { drop_target typelist } { 117 | foreach {drop_target common_drag_source_types common_drop_target_types} \ 118 | [::tkdnd::generic::FindWindowWithCommonTypes $drop_target $typelist] {break} 119 | lindex $common_drag_source_types 0 120 | };# olednd::GetDataType 121 | 122 | # ---------------------------------------------------------------------------- 123 | # Command olednd::GetDragSourceCommonTypes 124 | # ---------------------------------------------------------------------------- 125 | proc olednd::GetDragSourceCommonTypes { drop_target } { 126 | ::tkdnd::generic::GetDragSourceCommonTypes 127 | };# olednd::GetDragSourceCommonTypes 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command olednd::platform_specific_types 131 | # ---------------------------------------------------------------------------- 132 | proc olednd::platform_specific_types { types } { 133 | ::tkdnd::generic::platform_specific_types $types 134 | }; # olednd::platform_specific_types 135 | 136 | # ---------------------------------------------------------------------------- 137 | # Command olednd::platform_specific_type 138 | # ---------------------------------------------------------------------------- 139 | proc olednd::platform_specific_type { type } { 140 | ::tkdnd::generic::platform_specific_type $type 141 | }; # olednd::platform_specific_type 142 | 143 | # ---------------------------------------------------------------------------- 144 | # Command tkdnd::platform_independent_types 145 | # ---------------------------------------------------------------------------- 146 | proc ::tkdnd::platform_independent_types { types } { 147 | ::tkdnd::generic::platform_independent_types $types 148 | }; # tkdnd::platform_independent_types 149 | 150 | # ---------------------------------------------------------------------------- 151 | # Command olednd::platform_independent_type 152 | # ---------------------------------------------------------------------------- 153 | proc olednd::platform_independent_type { type } { 154 | ::tkdnd::generic::platform_independent_type $type 155 | }; # olednd::platform_independent_type 156 | 157 | # ---------------------------------------------------------------------------- 158 | # Command olednd::normalise_data 159 | # ---------------------------------------------------------------------------- 160 | proc olednd::normalise_data { type data } { 161 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 162 | DND_Text {return $data} 163 | DND_Files {return $data} 164 | DND_HTML {return [::tkdnd::from_encoding utf-8 $data]} 165 | default {return $data} 166 | } 167 | }; # olednd::normalise_data 168 | --------------------------------------------------------------------------------