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