]> www.wagner.pp.ru Git - oss/ck.git/blob - library/ck.tcl
Ck console graphics toolkit
[oss/ck.git] / library / ck.tcl
1 # ck.tcl --
2 #
3 # Initialization script normally executed in the interpreter for each
4 # curses wish-based application.  Arranges class bindings for widgets.
5 #
6 # Copyright (c) 1992-1994 The Regents of the University of California.
7 # Copyright (c) 1994-1995 Sun Microsystems, Inc.
8 # Copyright (c) 1995-2000 Christian Werner
9 #
10 # See the file "license.terms" for information on usage and redistribution
11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
13 # Insist on running with compatible versions of Tcl and Ck.
14
15 scan [info tclversion] "%d.%d" a b
16 scan $ck_version "%d.%d" c d
17 if {$a == 7} {
18     if {$c != 4} {
19         error "wrong version of Ck loaded ($c.$d): need 4.X"
20     }
21     if {$b != $d+4 } {
22         error "wrong version of Ck loaded ($c.$d): need 4.[expr $b-4]"
23     } 
24 } elseif {$a == 8} {
25     if {$c != 8} {
26         error "wrong version of Ck loaded ($c.$d): need 8.X"
27     }
28     if {$d != $b} {
29         error "wrong version of Ck loaded ($c.$d): need 8.$b"
30     } 
31 }
32
33 unset a b c d
34
35 if {[string compare $tcl_platform(platform) windows] == 0 } {
36     curses encoding IBM437
37     set env(TERM) win32
38 } elseif {[string compare $tcl_platform(platform) dos]==0} {
39         curses encoding IBM437
40 }       
41
42 # Inhibit exec of unknown commands
43
44 set auto_noexec 1
45
46 # Add this directory to the begin of the auto-load search path:
47
48 if {[info exists auto_path]} {
49     set auto_path [concat $ck_library $auto_path]
50 }
51
52 # ----------------------------------------------------------------------
53 # Read in files that define all of the class bindings.
54 # ----------------------------------------------------------------------
55
56 source $ck_library/button.tcl
57 source $ck_library/entry.tcl
58 source $ck_library/listbox.tcl
59 source $ck_library/scrollbar.tcl
60 source $ck_library/text.tcl
61 source $ck_library/menu.tcl
62
63 # ----------------------------------------------------------------------
64 # Default bindings for keyboard traversal.
65 # ----------------------------------------------------------------------
66
67 bind all <Tab> {focus [ck_focusNext %W]}
68 bind all <BackTab> {focus [ck_focusPrev %W]}
69 if {$tcl_interactive} {
70     bind all <Control-c> ckCommand
71     ckCommand
72 }
73