1#
2# itk.tcl
3# ----------------------------------------------------------------------
4# Invoked automatically upon startup to customize the interpreter
5# for [incr Tk].
6# ----------------------------------------------------------------------
7#   AUTHOR:  Michael J. McLennan
8#            Bell Labs Innovations for Lucent Technologies
9#            mmclennan@lucent.com
10#            http://www.tcltk.com/itcl
11#
12#      RCS:  $Id: itk.tcl,v 1.3 2002/05/14 22:53:28 davygrvy Exp $
13# ----------------------------------------------------------------------
14#            Copyright (c) 1993-1998  Lucent Technologies, Inc.
15# ======================================================================
16# See the file "license.terms" for information on usage and
17# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
18
19#
20# Provide transparent access to all [incr Tk] commands
21#
22if {$tcl_platform(os) == "MacOS"} {
23    source -rsrc itk:tclIndex
24} else {
25    lappend auto_path ${itk::library}
26}
27
28# ----------------------------------------------------------------------
29#  USAGE:  itk::remove_destroy_hook <widget>
30#
31#  Used internally via "itk_component delete" when disconnecting a
32#  component <widget> from the mega-widget that contains it.
33#  Each component has a special binding for the <Destroy> event
34#  that causes it to disconnect itself from its parent when destroyed.
35#  This procedure removes the binding from the binding tag list and
36#  deletes the binding.  It is much easier to implement this in
37#  Tcl than C.
38# ----------------------------------------------------------------------
39proc ::itk::remove_destroy_hook {widget} {
40    if {![winfo exists $widget]} {return}
41    set tags [bindtags $widget]
42    set i [lsearch $tags "itk-destroy-$widget"]
43    if {$i >= 0} {
44        bindtags $widget [lreplace $tags $i $i]
45    }
46    bind itk-destroy-$widget <Destroy> {}
47}
48
49#
50# Define "usual" option-handling code for the Tk widgets:
51#
52itk::usual Button {
53    keep -background -cursor -foreground -font
54    keep -activebackground -activeforeground -disabledforeground
55    keep -highlightcolor -highlightthickness
56    rename -highlightbackground -background background Background
57}
58
59itk::usual Canvas {
60    keep -background -cursor
61    keep -insertbackground -insertborderwidth -insertwidth
62    keep -insertontime -insertofftime
63    keep -selectbackground -selectborderwidth -selectforeground
64    keep -highlightcolor -highlightthickness
65    rename -highlightbackground -background background Background
66}
67
68itk::usual Checkbutton {
69    keep -background -cursor -foreground -font
70    keep -activebackground -activeforeground -disabledforeground
71    keep -selectcolor
72    keep -highlightcolor -highlightthickness
73    rename -highlightbackground -background background Background
74}
75
76itk::usual Entry {
77    keep -background -cursor -foreground -font
78    keep -insertbackground -insertborderwidth -insertwidth
79    keep -insertontime -insertofftime
80    keep -selectbackground -selectborderwidth -selectforeground
81    keep -highlightcolor -highlightthickness
82    rename -highlightbackground -background background Background
83}
84
85itk::usual Frame {
86    keep -background -cursor
87}
88
89itk::usual Label {
90    keep -background -cursor -foreground -font
91    keep -highlightcolor -highlightthickness
92    rename -highlightbackground -background background Background
93}
94
95itk::usual Listbox {
96    keep -background -cursor -foreground -font
97    keep -selectbackground -selectborderwidth -selectforeground
98    keep -highlightcolor -highlightthickness
99    rename -highlightbackground -background background Background
100}
101
102itk::usual Menu {
103    keep -background -cursor -foreground -font
104    keep -activebackground -activeforeground -disabledforeground
105    keep -selectcolor -tearoff
106}
107
108itk::usual Menubutton {
109    keep -background -cursor -foreground -font
110    keep -activebackground -activeforeground -disabledforeground
111    keep -highlightcolor -highlightthickness
112    rename -highlightbackground -background background Background
113}
114
115itk::usual Message {
116    keep -background -cursor -foreground -font
117    keep -highlightcolor -highlightthickness
118    rename -highlightbackground -background background Background
119}
120
121itk::usual Radiobutton {
122    keep -background -cursor -foreground -font
123    keep -activebackground -activeforeground -disabledforeground
124    keep -selectcolor
125    keep -highlightcolor -highlightthickness
126    rename -highlightbackground -background background Background
127}
128
129itk::usual Scale {
130    keep -background -cursor -foreground -font -troughcolor
131    keep -activebackground
132    keep -highlightcolor -highlightthickness
133    rename -highlightbackground -background background Background
134}
135
136itk::usual Scrollbar {
137    keep -background -cursor -troughcolor
138    keep -activebackground -activerelief
139    keep -highlightcolor -highlightthickness
140    rename -highlightbackground -background background Background
141}
142
143itk::usual Text {
144    keep -background -cursor -foreground -font
145    keep -insertbackground -insertborderwidth -insertwidth
146    keep -insertontime -insertofftime
147    keep -selectbackground -selectborderwidth -selectforeground
148    keep -highlightcolor -highlightthickness
149    rename -highlightbackground -background background Background
150}
151
152itk::usual Toplevel {
153    keep -background -cursor
154}
155