style.tcl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. # as_style.tcl --
  2. #
  3. # This file implements package as::style.
  4. #
  5. # Copyright (c) 2003 ActiveState Corporation, a division of Sophos
  6. # Donated to tklib style package in early 2004
  7. #
  8. # Copied May 2004 by Bob Techentin and modified to add options
  9. # at "userDefault" priority for DTE sessions on HP-UX.
  10. #
  11. # $Id: style.tcl,v 1.2 2004/07/20 14:51:55 techenti Exp $
  12. #
  13. package provide gui 2.0
  14. namespace eval ::gui {
  15. if { [tk windowingsystem] == "x11" } {
  16. set highlightbg "#316AC5" ; # SystemHighlight
  17. set highlightfg "white" ; # SystemHighlightText
  18. set bg "white" ; # SystemWindow
  19. set fg "black" ; # SystemWindowText
  20. ## Fonts
  21. ##
  22. set size -12
  23. set family Helvetica
  24. set fsize -12
  25. set ffamily Courier
  26. font create ASfont -size $size -family $family
  27. font create ASfontBold -size $size -family $family -weight bold
  28. font create ASfontFixed -size $fsize -family $ffamily
  29. for {set i -2} {$i <= 4} {incr i} {
  30. set isize [expr {$size + ($i * (($size > 0) ? 1 : -1))}]
  31. set ifsize [expr {$fsize + ($i * (($fsize > 0) ? 1 : -1))}]
  32. font create ASfont$i -size $isize -family $family
  33. font create ASfontBold$i -size $isize -family $family -weight bold
  34. font create ASfontFixed$i -size $ifsize -family $ffamily
  35. }
  36. #---------------------------------------------------------------
  37. # Check for CDE - which overrides options at userDefault level.
  38. # Note that the CDE package at http://wiki.tcl.tk/cde has
  39. # a much more complex (and probably more correct) way to
  40. # determine if CDE is running - but this works for Mayo SPPDG.
  41. #---------------------------------------------------------------
  42. if { [info exists ::env(DTUSERSESSION)] } {
  43. set priority userDefault
  44. option add *background #d9d9d9 $priority
  45. } else {
  46. set priority widgetDefault
  47. }
  48. option add *Text.font ASfontFixed $priority
  49. option add *Button.font ASfont $priority
  50. option add *Canvas.font ASfont $priority
  51. option add *Checkbutton.font ASfont $priority
  52. option add *Entry.font ASfont $priority
  53. option add *Label.font ASfont $priority
  54. option add *Labelframe.font ASfont $priority
  55. option add *Listbox.font ASfont $priority
  56. option add *Menu.font ASfont $priority
  57. option add *Menubutton.font ASfont $priority
  58. option add *Message.font ASfont $priority
  59. option add *Radiobutton.font ASfont $priority
  60. option add *Spinbox.font ASfont $priority
  61. option add *Table.font ASfont $priority
  62. option add *TreeCtrl*font ASfont $priority
  63. ## Misc
  64. ##
  65. option add *ScrolledWindow.ipad 0 $priority
  66. ## Listbox
  67. ##
  68. option add *Listbox.background $bg $priority
  69. option add *Listbox.foreground $fg $priority
  70. option add *Listbox.selectBorderWidth 0 $priority
  71. option add *Listbox.selectForeground $highlightfg $priority
  72. option add *Listbox.selectBackground $highlightbg $priority
  73. option add *Listbox.activeStyle dotbox $priority
  74. ## Button
  75. ##
  76. option add *Button.padX 1 $priority
  77. option add *Button.padY 2 $priority
  78. ## Entry
  79. ##
  80. option add *Entry.background $bg $priority
  81. option add *Entry.foreground $fg $priority
  82. option add *Entry.selectBorderWidth 0 $priority
  83. option add *Entry.selectForeground $highlightfg $priority
  84. option add *Entry.selectBackground $highlightbg $priority
  85. ## Spinbox
  86. ##
  87. option add *Spinbox.background $bg $priority
  88. option add *Spinbox.foreground $fg $priority
  89. option add *Spinbox.selectBorderWidth 0 $priority
  90. option add *Spinbox.selectForeground $highlightfg $priority
  91. option add *Spinbox.selectBackground $highlightbg $priority
  92. ## Text
  93. ##
  94. option add *Text.background $bg $priority
  95. option add *Text.foreground $fg $priority
  96. option add *Text.selectBorderWidth 0 $priority
  97. option add *Text.selectForeground $highlightfg $priority
  98. option add *Text.selectBackground $highlightbg $priority
  99. ## Menu
  100. ##
  101. option add *Menu.activeBackground $highlightbg $priority
  102. option add *Menu.activeForeground $highlightfg $priority
  103. option add *Menu.activeBorderWidth 0 $priority
  104. option add *Menu.highlightThickness 0 $priority
  105. option add *Menu.borderWidth 1 $priority
  106. ## Menubutton
  107. ##
  108. option add *Menubutton.activeBackground $highlightbg $priority
  109. option add *Menubutton.activeForeground $highlightfg $priority
  110. option add *Menubutton.activeBorderWidth 0 $priority
  111. option add *Menubutton.highlightThickness 0 $priority
  112. option add *Menubutton.borderWidth 0 $priority
  113. option add *Menubutton*padX 4 $priority
  114. option add *Menubutton*padY 2 $priority
  115. ## Scrollbar
  116. ##
  117. option add *Scrollbar.width 12 $priority
  118. option add *Scrollbar.troughColor #bdb6ad $priority
  119. option add *Scrollbar.borderWidth 1 $priority
  120. option add *Scrollbar.highlightThickness 0 $priority
  121. ## PanedWindow
  122. ##
  123. option add *Panedwindow.borderWidth 0 $priority
  124. option add *Panedwindow.sashwidth 3 $priority
  125. option add *Panedwindow.showhandle 0 $priority
  126. option add *Panedwindow.sashpad 0 $priority
  127. option add *Panedwindow.sashrelief flat $priority
  128. option add *Panedwindow.relief flat $priority
  129. }
  130. }; # end of namespace style::as