obsolete.tcl 5.5 KB

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