vistaTheme.tcl 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. #
  2. # Settings for Microsoft Windows Vista and Server 2008
  3. #
  4. # The Vista theme can only be defined on Windows Vista and above. The theme
  5. # is created in C due to the need to assign a theme-enabled function for
  6. # detecting when themeing is disabled. On systems that cannot support the
  7. # Vista theme, there will be no such theme created and we must not
  8. # evaluate this script.
  9. if {"vista" ni [ttk::style theme names]} {
  10. return
  11. }
  12. namespace eval ttk::theme::vista {
  13. ttk::style theme settings vista {
  14. ttk::style configure . \
  15. -background SystemButtonFace \
  16. -foreground SystemWindowText \
  17. -selectforeground SystemHighlightText \
  18. -selectbackground SystemHighlight \
  19. -insertcolor SystemWindowText \
  20. -font TkDefaultFont \
  21. ;
  22. ttk::style map "." \
  23. -foreground [list disabled SystemGrayText] \
  24. ;
  25. ttk::style configure TButton -anchor center -padding {1 1} -width -11
  26. ttk::style configure TRadiobutton -padding 2
  27. ttk::style configure TCheckbutton -padding 2
  28. ttk::style configure TMenubutton -padding {8 4}
  29. ttk::style element create Menubutton.dropdown vsapi \
  30. TOOLBAR 4 {{selected active} 6 {selected !active} 5
  31. disabled 4 pressed 3 active 2 {} 1} \
  32. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  33. ttk::style configure TNotebook -tabmargins {2 2 2 0}
  34. ttk::style map TNotebook.Tab \
  35. -expand [list selected {2 2 2 2}]
  36. # Treeview:
  37. ttk::style configure Heading -font TkHeadingFont
  38. ttk::style configure Treeview -background SystemWindow
  39. ttk::style map Treeview \
  40. -background [list disabled SystemButtonFace \
  41. selected SystemHighlight] \
  42. -foreground [list disabled SystemGrayText \
  43. selected SystemHighlightText]
  44. # Label and Toolbutton
  45. ttk::style configure TLabelframe.Label -foreground SystemButtonText
  46. ttk::style configure Toolbutton -padding {4 4}
  47. # Combobox
  48. ttk::style configure TCombobox -padding 2
  49. ttk::style element create Combobox.border vsapi \
  50. COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1}
  51. ttk::style element create Combobox.background vsapi \
  52. EDIT 3 {disabled 3 readonly 5 focus 4 hover 2 {} 1}
  53. ttk::style element create Combobox.rightdownarrow vsapi \
  54. COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \
  55. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  56. ttk::style layout TCombobox {
  57. Combobox.border -sticky nswe -border 0 -children {
  58. Combobox.rightdownarrow -side right -sticky ns
  59. Combobox.padding -sticky nswe -children {
  60. Combobox.background -sticky nswe -children {
  61. Combobox.focus -sticky nswe -children {
  62. Combobox.textarea -sticky nswe
  63. }
  64. }
  65. }
  66. }
  67. }
  68. # Vista.Combobox droplist frame
  69. ttk::style element create ComboboxPopdownFrame.background vsapi\
  70. LISTBOX 3 {disabled 4 active 3 focus 2 {} 1}
  71. ttk::style layout ComboboxPopdownFrame {
  72. ComboboxPopdownFrame.background -sticky news -border 1 -children {
  73. ComboboxPopdownFrame.padding -sticky news
  74. }
  75. }
  76. ttk::style map TCombobox \
  77. -selectbackground [list !focus SystemWindow] \
  78. -selectforeground [list !focus SystemWindowText] \
  79. -foreground [list \
  80. disabled SystemGrayText \
  81. {readonly focus} SystemHighlightText \
  82. ] \
  83. -focusfill [list {readonly focus} SystemHighlight] \
  84. ;
  85. # Entry
  86. ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup
  87. ttk::style element create Entry.field vsapi \
  88. EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2}
  89. ttk::style element create Entry.background vsapi \
  90. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
  91. ttk::style layout TEntry {
  92. Entry.field -sticky news -border 0 -children {
  93. Entry.background -sticky news -children {
  94. Entry.padding -sticky news -children {
  95. Entry.textarea -sticky news
  96. }
  97. }
  98. }
  99. }
  100. ttk::style map TEntry \
  101. -selectbackground [list !focus SystemWindow] \
  102. -selectforeground [list !focus SystemWindowText] \
  103. ;
  104. # Spinbox
  105. ttk::style configure TSpinbox -padding 0
  106. ttk::style element create Spinbox.field vsapi \
  107. EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2}
  108. ttk::style element create Spinbox.background vsapi \
  109. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
  110. ttk::style element create Spinbox.innerbg vsapi \
  111. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\
  112. -padding {2 0 15 2}
  113. ttk::style element create Spinbox.uparrow vsapi \
  114. SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \
  115. -padding 1 -halfheight 1 \
  116. -syssize { SM_CXVSCROLL SM_CYVSCROLL }
  117. ttk::style element create Spinbox.downarrow vsapi \
  118. SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \
  119. -padding 1 -halfheight 1 \
  120. -syssize { SM_CXVSCROLL SM_CYVSCROLL }
  121. ttk::style layout TSpinbox {
  122. Spinbox.field -sticky nswe -children {
  123. Spinbox.background -sticky news -children {
  124. Spinbox.padding -sticky news -children {
  125. Spinbox.innerbg -sticky news -children {
  126. Spinbox.textarea
  127. }
  128. }
  129. Spinbox.uparrow -side top -sticky ens
  130. Spinbox.downarrow -side bottom -sticky ens
  131. }
  132. }
  133. }
  134. ttk::style map TSpinbox \
  135. -selectbackground [list !focus SystemWindow] \
  136. -selectforeground [list !focus SystemWindowText] \
  137. ;
  138. # SCROLLBAR elements (Vista includes a state for 'hover')
  139. ttk::style element create Vertical.Scrollbar.uparrow vsapi \
  140. SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
  141. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  142. ttk::style element create Vertical.Scrollbar.downarrow vsapi \
  143. SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \
  144. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  145. ttk::style element create Vertical.Scrollbar.trough vsapi \
  146. SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  147. ttk::style element create Vertical.Scrollbar.thumb vsapi \
  148. SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  149. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  150. ttk::style element create Vertical.Scrollbar.grip vsapi \
  151. SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  152. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  153. ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \
  154. SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9} \
  155. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  156. ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \
  157. SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13} \
  158. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  159. ttk::style element create Horizontal.Scrollbar.trough vsapi \
  160. SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  161. ttk::style element create Horizontal.Scrollbar.thumb vsapi \
  162. SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  163. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  164. ttk::style element create Horizontal.Scrollbar.grip vsapi \
  165. SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  166. # Progressbar
  167. ttk::style element create Horizontal.Progressbar.pbar vsapi \
  168. PROGRESS 3 {{} 1} -padding 8
  169. ttk::style layout Horizontal.TProgressbar {
  170. Horizontal.Progressbar.trough -sticky nswe -children {
  171. Horizontal.Progressbar.pbar -side left -sticky ns
  172. }
  173. }
  174. ttk::style element create Vertical.Progressbar.pbar vsapi \
  175. PROGRESS 3 {{} 1} -padding 8
  176. ttk::style layout Vertical.TProgressbar {
  177. Vertical.Progressbar.trough -sticky nswe -children {
  178. Vertical.Progressbar.pbar -side bottom -sticky we
  179. }
  180. }
  181. # Scale
  182. ttk::style element create Horizontal.Scale.slider vsapi \
  183. TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
  184. -width 6 -height 12
  185. ttk::style layout Horizontal.TScale {
  186. Scale.focus -sticky nswe -children {
  187. Horizontal.Scale.trough -sticky nswe -children {
  188. Horizontal.Scale.track -sticky we
  189. Horizontal.Scale.slider -side left -sticky {}
  190. }
  191. }
  192. }
  193. ttk::style element create Vertical.Scale.slider vsapi \
  194. TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
  195. -width 12 -height 6
  196. ttk::style layout Vertical.TScale {
  197. Scale.focus -sticky nswe -children {
  198. Vertical.Scale.trough -sticky nswe -children {
  199. Vertical.Scale.track -sticky ns
  200. Vertical.Scale.slider -side top -sticky {}
  201. }
  202. }
  203. }
  204. # Treeview
  205. ttk::style configure Item -padding {4 0 0 0}
  206. package provide ttk::theme::vista 1.0
  207. }
  208. }