Annotation of micropolis/res/tk.tcl, revision 1.1.1.1

1.1       root        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: 
                     19: if "[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: 
                     26: set auto_path "$tk_library [info library]"
                     27: 
                     28: # ----------------------------------------------------------------------
                     29: # Class bindings for various flavors of button widgets.  
                     30: # ----------------------------------------------------------------------
                     31: 
                     32: bind Button <Any-Enter> {tk_butEnter %W}
                     33: bind Button <Any-Leave> {tk_butLeave %W}
                     34: bind Button <1> {tk_butDown %W}
                     35: bind Button <ButtonRelease-1> {tk_butUp %W}
                     36: bind Button <2> {tk_butDown %W}
                     37: bind Button <ButtonRelease-2> {tk_butUp %W}
                     38: bind Button <3> {tk_butDown %W}
                     39: bind Button <ButtonRelease-3> {tk_butUp %W}
                     40: 
                     41: bind CheckButton <Any-Enter> {tk_butEnter %W}
                     42: bind CheckButton <Any-Leave> {tk_butLeave %W}
                     43: bind CheckButton <1> {tk_butDown %W}
                     44: bind CheckButton <ButtonRelease-1> {tk_butUp %W}
                     45: bind CheckButton <2> {tk_butDown %W}
                     46: bind CheckButton <ButtonRelease-2> {tk_butUp %W}
                     47: bind CheckButton <3> {tk_butDown %W}
                     48: bind CheckButton <ButtonRelease-3> {tk_butUp %W}
                     49: 
                     50: bind RadioButton <Any-Enter> {tk_butEnter %W}
                     51: bind RadioButton <Any-Leave> {tk_butLeave %W}
                     52: bind RadioButton <1> {tk_butDown %W}
                     53: bind RadioButton <ButtonRelease-1> {tk_butUp %W}
                     54: bind RadioButton <2> {tk_butDown %W}
                     55: bind RadioButton <ButtonRelease-2> {tk_butUp %W}
                     56: bind RadioButton <3> {tk_butDown %W}
                     57: bind RadioButton <ButtonRelease-3> {tk_butUp %W}
                     58: 
                     59: # ----------------------------------------------------------------------
                     60: # Class bindings for entry widgets.
                     61: # ----------------------------------------------------------------------
                     62: 
                     63: bind Entry <1> {
                     64:     %W cursor @%x
                     65:     %W select from @%x
                     66:     if {[lindex [%W config -state] 4] == "normal"} {focus %W}
                     67: }
                     68: bind Entry <B1-Motion> {%W select to @%x}
                     69: bind Entry <Shift-1> {%W select adjust @%x}
                     70: bind Entry <Shift-B1-Motion> {%W select to @%x}
                     71: bind Entry <2> {%W scan mark %x}
                     72: bind Entry <B2-Motion> {%W scan dragto %x}
                     73: bind Entry <Any-KeyPress> {
                     74:     tk_entryCutPress %W
                     75:     if {"%A" != ""} {
                     76:        %W insert cursor %A
                     77:        tk_entrySeeCaret %W
                     78:     }
                     79: }
                     80: bind Entry <Delete> {tk_entryDelPress %W}
                     81: bind Entry <BackSpace> {tk_entryDelPress %W}
                     82: bind Entry <Control-h> {tk_entryDelPress %W}
                     83: bind Entry <Control-d> {tk_entryCutPress %W}
                     84: bind Entry <Control-u> {tk_entryDelLine %W}
                     85: bind Entry <Control-x> {tk_entryCutPress %W}
                     86: bind Entry <Control-y> {tk_entryCopyPress %W}
                     87: bind Entry <Control-v> {tk_entryCopyPress %W}
                     88: bind Entry <Control-w> {tk_entryBackword %W; tk_entrySeeCaret %W}
                     89: tk_bindForTraversal Entry
                     90: 
                     91: # ----------------------------------------------------------------------
                     92: # Class bindings for listbox widgets.
                     93: # ----------------------------------------------------------------------
                     94: 
                     95: bind Listbox <1> {%W select from [%W nearest %y]}
                     96: bind Listbox <B1-Motion> {%W select to [%W nearest %y]}
                     97: bind Listbox <Shift-1> {%W select adjust [%W nearest %y]}
                     98: bind Listbox <Shift-B1-Motion> {%W select to [%W nearest %y]}
                     99: bind Listbox <2> {%W scan mark %x %y}
                    100: bind Listbox <B2-Motion> {%W scan dragto %x %y}
                    101: bind Listbox <3> {%W select from [%W nearest %y]}
                    102: bind Listbox <B3-Motion> {%W select to [%W nearest %y]}
                    103: bind Listbox <Shift-3> {%W select adjust [%W nearest %y]}
                    104: bind 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: 
                    118: bind Menubutton <Enter>                        {tk_mbButtonEnter %W %m}
                    119: bind Menubutton <Any-Leave>            {tk_mbButtonLeave %W}
                    120: bind Menubutton <1>                    {tk_mbButtonDown %W %X %Y}
                    121: bind Menubutton <Any-ButtonRelease-1>  {tk_mbButtonUp %W %X %Y}
                    122: bind Menubutton <B1-Enter>             {tk_mbButton1Enter %W %m}
                    123: bind Menubutton <2>                    {tk_mbButtonDown %W %X %Y}
                    124: bind Menubutton <ButtonRelease-2>      {tk_mbButtonUp %W %X %Y}
                    125: bind Menubutton <3>                    {tk_mbButtonDown %W %X %Y}
                    126: bind Menubutton <ButtonRelease-3>      {tk_mbButtonUp %W %X %Y}
                    127: 
                    128: # ----------------------------------------------------------------------
                    129: # Class bindings for menu widgets.
                    130: # ----------------------------------------------------------------------
                    131: 
                    132: bind Menu <Any-Enter> {tk_menuEnter %W %y}
                    133: bind Menu <Any-Leave> {tk_menuLeave %W}
                    134: bind Menu <Any-Motion> {tk_menuMotion %W %y}
                    135: bind Menu <ButtonRelease-1> {tk_menuUp %W %y}
                    136: bind Menu <ButtonRelease-2> {tk_menuUp %W %y}
                    137: bind Menu <ButtonRelease-3> {tk_menuUp %W %y}
                    138: 
                    139: bind Menu <Escape> {tk_mbUnpost %W}
                    140: bind Menu <Any-KeyPress> {tk_traverseWithinMenu %W %A}
                    141: bind Menu <Left> {tk_nextMenu %W -1}
                    142: bind Menu <Right> {tk_nextMenu %W 1}
                    143: bind Menu <Up> {tk_nextMenuEntry %W -1}
                    144: bind Menu <Down> {tk_nextMenuEntry %W 1}
                    145: bind 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}
                    157: bind Text <2> {%W scan mark %y}
                    158: bind Text <B2-Motion> {%W scan dragto %y}
                    159: bind Text <Any-KeyPress> {tk_textKeyPress %W %A}
                    160: bind Text <Return> {tk_textReturnPress %W}
                    161: bind Text <BackSpace> {tk_textDelPress %W}
                    162: bind Text <Delete> {tk_textDelPress %W}
                    163: bind Text <Control-h> {tk_textDelPress %W}
                    164: bind Text <Control-d> {tk_textCutPress %W}
                    165: bind Text <Control-v> {tk_textCopyPress %W}
                    166: tk_bindForTraversal Text
                    167: 
                    168: # Initialize the elements of tk_priv that require initialization.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.