]> git.zerfleddert.de Git - micropolis/blame_incremental - res/tk.tcl
XINCLUDE: use /usr/X11R6/include everywhere
[micropolis] / res / tk.tcl
... / ...
CommitLineData
1# tk.tcl --
2#
3# Initialization script normally executed in the interpreter for each
4# Tk-based application. Arranges class bindings for widgets.
5#
6# $Header: /user6/ouster/wish/scripts/RCS/tk.tcl,v 1.19 92/08/08 14:50:08 ouster Exp $ SPRITE (Berkeley)
7#
8# Copyright 1992 Regents of the University of California
9# Permission to use, copy, modify, and distribute this
10# software and its documentation for any purpose and without
11# fee is hereby granted, provided that this copyright
12# notice appears in all copies. The University of California
13# makes no representations about the suitability of this
14# software for any purpose. It is provided "as is" without
15# express or implied warranty.
16
17# Insist on running with a compatible version of Tcl.
18
19if "[info tclversion] != {6.4}" {
20 error "wrong version of Tcl loaded ([info tclversion]): need 6.4"
21}
22
23# Initialize the auto-load path to include Tk's directory as well as
24# Tcl's directory:
25
26set auto_path "$tk_library [info library]"
27
28# ----------------------------------------------------------------------
29# Class bindings for various flavors of button widgets.
30# ----------------------------------------------------------------------
31
32bind Button <Any-Enter> {tk_butEnter %W}
33bind Button <Any-Leave> {tk_butLeave %W}
34bind Button <1> {tk_butDown %W}
35bind Button <ButtonRelease-1> {tk_butUp %W}
36bind Button <2> {tk_butDown %W}
37bind Button <ButtonRelease-2> {tk_butUp %W}
38bind Button <3> {tk_butDown %W}
39bind Button <ButtonRelease-3> {tk_butUp %W}
40
41bind CheckButton <Any-Enter> {tk_butEnter %W}
42bind CheckButton <Any-Leave> {tk_butLeave %W}
43bind CheckButton <1> {tk_butDown %W}
44bind CheckButton <ButtonRelease-1> {tk_butUp %W}
45bind CheckButton <2> {tk_butDown %W}
46bind CheckButton <ButtonRelease-2> {tk_butUp %W}
47bind CheckButton <3> {tk_butDown %W}
48bind CheckButton <ButtonRelease-3> {tk_butUp %W}
49
50bind RadioButton <Any-Enter> {tk_butEnter %W}
51bind RadioButton <Any-Leave> {tk_butLeave %W}
52bind RadioButton <1> {tk_butDown %W}
53bind RadioButton <ButtonRelease-1> {tk_butUp %W}
54bind RadioButton <2> {tk_butDown %W}
55bind RadioButton <ButtonRelease-2> {tk_butUp %W}
56bind RadioButton <3> {tk_butDown %W}
57bind RadioButton <ButtonRelease-3> {tk_butUp %W}
58
59# ----------------------------------------------------------------------
60# Class bindings for entry widgets.
61# ----------------------------------------------------------------------
62
63bind Entry <1> {
64 %W cursor @%x
65 %W select from @%x
66 if {[lindex [%W config -state] 4] == "normal"} {focus %W}
67}
68bind Entry <B1-Motion> {%W select to @%x}
69bind Entry <Shift-1> {%W select adjust @%x}
70bind Entry <Shift-B1-Motion> {%W select to @%x}
71bind Entry <2> {%W scan mark %x}
72bind Entry <B2-Motion> {%W scan dragto %x}
73bind Entry <Any-KeyPress> {
74 tk_entryCutPress %W
75 if {"%A" != ""} {
76 %W insert cursor %A
77 tk_entrySeeCaret %W
78 }
79}
80bind Entry <Delete> {tk_entryDelPress %W}
81bind Entry <BackSpace> {tk_entryDelPress %W}
82bind Entry <Control-h> {tk_entryDelPress %W}
83bind Entry <Control-d> {tk_entryCutPress %W}
84bind Entry <Control-u> {tk_entryDelLine %W}
85bind Entry <Control-x> {tk_entryCutPress %W}
86bind Entry <Control-y> {tk_entryCopyPress %W}
87bind Entry <Control-v> {tk_entryCopyPress %W}
88bind Entry <Control-w> {tk_entryBackword %W; tk_entrySeeCaret %W}
89tk_bindForTraversal Entry
90
91# ----------------------------------------------------------------------
92# Class bindings for listbox widgets.
93# ----------------------------------------------------------------------
94
95bind Listbox <1> {%W select from [%W nearest %y]}
96bind Listbox <B1-Motion> {%W select to [%W nearest %y]}
97bind Listbox <Shift-1> {%W select adjust [%W nearest %y]}
98bind Listbox <Shift-B1-Motion> {%W select to [%W nearest %y]}
99bind Listbox <2> {%W scan mark %x %y}
100bind Listbox <B2-Motion> {%W scan dragto %x %y}
101bind Listbox <3> {%W select from [%W nearest %y]}
102bind Listbox <B3-Motion> {%W select to [%W nearest %y]}
103bind Listbox <Shift-3> {%W select adjust [%W nearest %y]}
104bind Listbox <Shift-B3-Motion> {%W select to [%W nearest %y]}
105
106# ----------------------------------------------------------------------
107# Class bindings for scrollbar widgets.
108# ----------------------------------------------------------------------
109
110# ----------------------------------------------------------------------
111# Class bindings for scale widgets.
112# ----------------------------------------------------------------------
113
114# ----------------------------------------------------------------------
115# Class bindings for menubutton widgets.
116# ----------------------------------------------------------------------
117
118bind Menubutton <Enter> {tk_mbButtonEnter %W %m}
119bind Menubutton <Any-Leave> {tk_mbButtonLeave %W}
120bind Menubutton <1> {tk_mbButtonDown %W %X %Y}
121bind Menubutton <Any-ButtonRelease-1> {tk_mbButtonUp %W %X %Y}
122bind Menubutton <B1-Enter> {tk_mbButton1Enter %W %m}
123bind Menubutton <2> {tk_mbButtonDown %W %X %Y}
124bind Menubutton <ButtonRelease-2> {tk_mbButtonUp %W %X %Y}
125bind Menubutton <3> {tk_mbButtonDown %W %X %Y}
126bind Menubutton <ButtonRelease-3> {tk_mbButtonUp %W %X %Y}
127
128# ----------------------------------------------------------------------
129# Class bindings for menu widgets.
130# ----------------------------------------------------------------------
131
132bind Menu <Any-Enter> {tk_menuEnter %W %y}
133bind Menu <Any-Leave> {tk_menuLeave %W}
134bind Menu <Any-Motion> {tk_menuMotion %W %y}
135bind Menu <ButtonRelease-1> {tk_menuUp %W %y}
136bind Menu <ButtonRelease-2> {tk_menuUp %W %y}
137bind Menu <ButtonRelease-3> {tk_menuUp %W %y}
138
139bind Menu <Escape> {tk_mbUnpost %W}
140bind Menu <Any-KeyPress> {tk_traverseWithinMenu %W %A}
141bind Menu <Left> {tk_nextMenu %W -1}
142bind Menu <Right> {tk_nextMenu %W 1}
143bind Menu <Up> {tk_nextMenuEntry %W -1}
144bind Menu <Down> {tk_nextMenuEntry %W 1}
145bind Menu <Return> {tk_invokeMenu %W}
146
147# ----------------------------------------------------------------------
148# Class bindings for text widgets.
149# ----------------------------------------------------------------------
150
151#bind Text <1> {tk_textDown %W %x %y}
152#bind Text <Double-1> {tk_textDoubleDown %W %x %y}
153#bind Text <Triple-1> {tk_textTripleDown %W %x %y}
154#bind Text <B1-Motion> {tk_textSelectTo %W %x %y}
155#bind Text <Shift-1> {tk_textAdjustTo %W %x %y}
156#bind Text <Shift-B1-Motion> {tk_textSelectTo %W %x %y}
157bind Text <2> {%W scan mark %y}
158bind Text <B2-Motion> {%W scan dragto %y}
159bind Text <Any-KeyPress> {tk_textKeyPress %W %A}
160bind Text <Return> {tk_textReturnPress %W}
161bind Text <BackSpace> {tk_textDelPress %W}
162bind Text <Delete> {tk_textDelPress %W}
163bind Text <Control-h> {tk_textDelPress %W}
164bind Text <Control-d> {tk_textCutPress %W}
165bind Text <Control-v> {tk_textCopyPress %W}
166tk_bindForTraversal Text
167
168# Initialize the elements of tk_priv that require initialization.
Impressum, Datenschutz