1# obsolete.tcl --
2#
3# This file contains obsolete procedures that people really shouldn't
4# be using anymore, but which are kept around for backward compatibility.
5#
6# RCS: @(#) $Id$
7#
8# Copyright (c) 1994 The Regents of the University of California.
9# Copyright (c) 1994 Sun Microsystems, Inc.
10#
11# See the file "license.terms" for information on usage and redistribution
12# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13#
14
15# The procedures below are here strictly for backward compatibility with
16# Tk version 3.6 and earlier.  The procedures are no longer needed, so
17# they are no-ops.  You should not use these procedures anymore, since
18# they may be removed in some future release.
19
20proc tk_menuBar args {}
21proc tk_bindForTraversal args {}
22
23# ::tk::classic::restore --
24#
25# Restore the pre-8.5 (Tk classic) look as the widget defaults for classic
26# Tk widgets.
27#
28# The value following an 'option add' call is the new 8.5 value.
29#
30namespace eval ::tk::classic {
31    # This may need to be adjusted for some window managers that are
32    # more aggressive with their own Xdefaults (like KDE and CDE)
33    variable prio "widgetDefault"
34}
35
36proc ::tk::classic::restore {args} {
37    # Restore classic (8.4) look to classic Tk widgets
38    variable prio
39
40    if {[llength $args]} {
41	foreach what $args {
42	    ::tk::classic::restore_$what
43	}
44    } else {
45	foreach cmd [info procs restore_*] {
46	    $cmd
47	}
48    }
49}
50
51proc ::tk::classic::restore_font {args} {
52    # Many widgets were adjusted from hard-coded defaults to using the
53    # TIP#145 fonts defined in fonts.tcl (eg TkDefaultFont, TkFixedFont, ...)
54    # For restoring compatibility, we only correct size and weighting changes,
55    # as the fonts themselves remained mostly the same.
56    if {[tk windowingsystem] eq "x11"} {
57	font configure TkDefaultFont -weight bold ; # normal
58	font configure TkFixedFont -size -12 ; # -10
59    }
60    # Add these with prio 21 to override value in dialog/msgbox.tcl
61    if {[tk windowingsystem] eq "aqua"} {
62	option add *Dialog.msg.font system 21; # TkCaptionFont
63	option add *Dialog.dtl.font system 21; # TkCaptionFont
64	option add *ErrorDialog*Label.font system 21; # TkCaptionFont
65    } else {
66	option add *Dialog.msg.font {Times 12} 21; # TkCaptionFont
67	option add *Dialog.dtl.font {Times 10} 21; # TkCaptionFont
68	option add *ErrorDialog*Label.font {Times -18} 21; # TkCaptionFont
69    }
70}
71
72proc ::tk::classic::restore_button {args} {
73    variable prio
74    if {[tk windowingsystem] eq "x11"} {
75	foreach cls {Button Radiobutton Checkbutton} {
76	    option add *$cls.borderWidth 2 $prio; # 1
77	}
78    }
79}
80
81proc ::tk::classic::restore_entry {args} {
82    variable prio
83    # Entry and Spinbox share core defaults
84    foreach cls {Entry Spinbox} {
85	if {[tk windowingsystem] ne "aqua"} {
86	    option add *$cls.borderWidth	2 $prio; # 1
87	}
88	if {[tk windowingsystem] eq "x11"} {
89	    option add *$cls.background		"#d9d9d9" $prio; # "white"
90	    option add *$cls.selectBorderWidth	1 $prio; # 0
91	}
92    }
93}
94
95proc ::tk::classic::restore_listbox {args} {
96    variable prio
97    if {[tk windowingsystem] ne "win32"} {
98	option add *Listbox.background		"#d9d9d9" $prio; # "white"
99	option add *Listbox.activeStyle		"underline" $prio; # "dotbox"
100    }
101    if {[tk windowingsystem] ne "aqua"} {
102	option add *Listbox.borderWidth		2 $prio; # 1
103    }
104    if {[tk windowingsystem] eq "x11"} {
105	option add *Listbox.selectBorderWidth	1 $prio; # 0
106    }
107    # Remove focus into Listbox added for 8.5
108    bind Listbox <1> {
109	if {[winfo exists %W]} {
110	    tk::ListboxBeginSelect %W [%W index @%x,%y]
111	}
112    }
113}
114
115proc ::tk::classic::restore_menu {args} {
116    variable prio
117    if {[tk windowingsystem] eq "x11"} {
118	option add *Menu.activeBorderWidth	2 $prio; # 1
119	option add *Menu.borderWidth		2 $prio; # 1
120        option add *Menu.clickToFocus		true $prio
121        option add *Menu.useMotifHelp		true $prio
122    }
123    if {[tk windowingsystem] ne "aqua"} {
124	option add *Menu.font		"TkDefaultFont" $prio; # "TkMenuFont"
125    }
126}
127
128proc ::tk::classic::restore_menubutton {args} {
129    variable prio
130    option add *Menubutton.borderWidth	2 $prio; # 1
131}
132
133proc ::tk::classic::restore_message {args} {
134    variable prio
135    option add *Message.borderWidth	2 $prio; # 1
136}
137
138proc ::tk::classic::restore_panedwindow {args} {
139    variable prio
140    option add *Panedwindow.borderWidth	2 $prio; # 1
141    option add *Panedwindow.sashWidth	2 $prio; # 3
142    option add *Panedwindow.sashPad	2 $prio; # 0
143    option add *Panedwindow.sashRelief	raised $prio; # flat
144    option add *Panedwindow.opaqueResize	0 $prio; # 1
145    if {[tk windowingsystem] ne "win32"} {
146	option add *Panedwindow.showHandle	1 $prio; # 0
147    }
148}
149
150proc ::tk::classic::restore_scale {args} {
151    variable prio
152    option add *Scale.borderWidth	2 $prio; # 1
153    if {[tk windowingsystem] eq "x11"} {
154	option add *Scale.troughColor	"#c3c3c3" $prio; # "#b3b3b3"
155    }
156}
157
158proc ::tk::classic::restore_scrollbar {args} {
159    variable prio
160    if {[tk windowingsystem] eq "x11"} {
161	option add *Scrollbar.borderWidth	2 $prio; # 1
162	option add *Scrollbar.highlightThickness 1 $prio; # 0
163	option add *Scrollbar.width		15 $prio; # 11
164	option add *Scrollbar.troughColor	"#c3c3c3" $prio; # "#b3b3b3"
165    }
166}
167
168proc ::tk::classic::restore_text {args} {
169    variable prio
170    if {[tk windowingsystem] ne "aqua"} {
171	option add *Text.borderWidth	2 $prio; # 1
172    }
173    if {[tk windowingsystem] eq "win32"} {
174	option add *Text.font		"TkDefaultFont" $prio; # "TkFixedFont"
175    }
176    if {[tk windowingsystem] eq "x11"} {
177	option add *Text.background		"#d9d9d9" $prio; # white
178	option add *Text.selectBorderWidth	1 $prio; # 0
179    }
180}
181