vistaTheme.tcl 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. {!disabled !selected} SystemWindow \
  42. selected SystemHighlight] \
  43. -foreground [list disabled SystemGrayText \
  44. {!disabled !selected} SystemWindowText \
  45. selected SystemHighlightText]
  46. # Label and Toolbutton
  47. ttk::style configure TLabelframe.Label -foreground SystemButtonText
  48. ttk::style configure Toolbutton -padding {4 4}
  49. # Combobox
  50. ttk::style configure TCombobox -padding 2
  51. ttk::style element create Combobox.border vsapi \
  52. COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1}
  53. ttk::style element create Combobox.background vsapi \
  54. EDIT 3 {disabled 3 readonly 5 focus 4 hover 2 {} 1}
  55. ttk::style element create Combobox.rightdownarrow vsapi \
  56. COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \
  57. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  58. ttk::style layout TCombobox {
  59. Combobox.border -sticky nswe -border 0 -children {
  60. Combobox.rightdownarrow -side right -sticky ns
  61. Combobox.padding -expand 1 -sticky nswe -children {
  62. Combobox.background -sticky nswe -children {
  63. Combobox.focus -expand 1 -sticky nswe -children {
  64. Combobox.textarea -sticky nswe
  65. }
  66. }
  67. }
  68. }
  69. }
  70. # Vista.Combobox droplist frame
  71. ttk::style element create ComboboxPopdownFrame.background vsapi\
  72. LISTBOX 3 {disabled 4 active 3 focus 2 {} 1}
  73. ttk::style layout ComboboxPopdownFrame {
  74. ComboboxPopdownFrame.background -sticky news -border 1 -children {
  75. ComboboxPopdownFrame.padding -sticky news
  76. }
  77. }
  78. ttk::style map TCombobox \
  79. -selectbackground [list !focus SystemWindow] \
  80. -selectforeground [list !focus SystemWindowText] \
  81. -foreground [list \
  82. disabled SystemGrayText \
  83. {readonly focus} SystemHighlightText \
  84. ] \
  85. -focusfill [list {readonly focus} SystemHighlight] \
  86. ;
  87. # Entry
  88. ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup
  89. ttk::style element create Entry.field vsapi \
  90. EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2}
  91. ttk::style element create Entry.background vsapi \
  92. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
  93. ttk::style layout TEntry {
  94. Entry.field -sticky news -border 0 -children {
  95. Entry.background -sticky news -children {
  96. Entry.padding -sticky news -children {
  97. Entry.textarea -sticky news
  98. }
  99. }
  100. }
  101. }
  102. ttk::style map TEntry \
  103. -selectbackground [list !focus SystemWindow] \
  104. -selectforeground [list !focus SystemWindowText] \
  105. ;
  106. # Spinbox
  107. ttk::style configure TSpinbox -padding 0
  108. ttk::style element create Spinbox.field vsapi \
  109. EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2}
  110. ttk::style element create Spinbox.background vsapi \
  111. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
  112. ttk::style element create Spinbox.innerbg vsapi \
  113. EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\
  114. -padding {2 0 15 2}
  115. ttk::style element create Spinbox.uparrow vsapi \
  116. SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \
  117. -padding 1 -halfheight 1 \
  118. -syssize { SM_CXVSCROLL SM_CYVSCROLL }
  119. ttk::style element create Spinbox.downarrow vsapi \
  120. SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \
  121. -padding 1 -halfheight 1 \
  122. -syssize { SM_CXVSCROLL SM_CYVSCROLL }
  123. ttk::style layout TSpinbox {
  124. Spinbox.field -sticky nswe -children {
  125. Spinbox.background -sticky news -children {
  126. Spinbox.padding -sticky news -children {
  127. Spinbox.innerbg -sticky news -children {
  128. Spinbox.textarea -expand 1
  129. }
  130. }
  131. Spinbox.uparrow -side top -sticky ens
  132. Spinbox.downarrow -side bottom -sticky ens
  133. }
  134. }
  135. }
  136. ttk::style map TSpinbox \
  137. -selectbackground [list !focus SystemWindow] \
  138. -selectforeground [list !focus SystemWindowText] \
  139. ;
  140. # SCROLLBAR elements (Vista includes a state for 'hover')
  141. ttk::style element create Vertical.Scrollbar.uparrow vsapi \
  142. SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
  143. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  144. ttk::style element create Vertical.Scrollbar.downarrow vsapi \
  145. SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \
  146. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  147. ttk::style element create Vertical.Scrollbar.trough vsapi \
  148. SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  149. ttk::style element create Vertical.Scrollbar.thumb vsapi \
  150. SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  151. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  152. ttk::style element create Vertical.Scrollbar.grip vsapi \
  153. SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  154. -syssize {SM_CXVSCROLL SM_CYVSCROLL}
  155. ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \
  156. SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9} \
  157. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  158. ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \
  159. SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13} \
  160. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  161. ttk::style element create Horizontal.Scrollbar.trough vsapi \
  162. SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  163. ttk::style element create Horizontal.Scrollbar.thumb vsapi \
  164. SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
  165. -syssize {SM_CXHSCROLL SM_CYHSCROLL}
  166. ttk::style element create Horizontal.Scrollbar.grip vsapi \
  167. SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1}
  168. # Progressbar
  169. ttk::style element create Horizontal.Progressbar.pbar vsapi \
  170. PROGRESS 3 {{} 1} -padding 8
  171. ttk::style layout Horizontal.TProgressbar {
  172. Horizontal.Progressbar.trough -sticky nswe -children {
  173. Horizontal.Progressbar.pbar -side left -sticky ns
  174. }
  175. }
  176. ttk::style element create Vertical.Progressbar.pbar vsapi \
  177. PROGRESS 3 {{} 1} -padding 8
  178. ttk::style layout Vertical.TProgressbar {
  179. Vertical.Progressbar.trough -sticky nswe -children {
  180. Vertical.Progressbar.pbar -side bottom -sticky we
  181. }
  182. }
  183. # Scale
  184. ttk::style element create Horizontal.Scale.slider vsapi \
  185. TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
  186. -width 6 -height 12
  187. ttk::style layout Horizontal.TScale {
  188. Scale.focus -expand 1 -sticky nswe -children {
  189. Horizontal.Scale.trough -expand 1 -sticky nswe -children {
  190. Horizontal.Scale.track -sticky we
  191. Horizontal.Scale.slider -side left -sticky {}
  192. }
  193. }
  194. }
  195. ttk::style element create Vertical.Scale.slider vsapi \
  196. TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
  197. -width 12 -height 6
  198. ttk::style layout Vertical.TScale {
  199. Scale.focus -expand 1 -sticky nswe -children {
  200. Vertical.Scale.trough -expand 1 -sticky nswe -children {
  201. Vertical.Scale.track -sticky ns
  202. Vertical.Scale.slider -side top -sticky {}
  203. }
  204. }
  205. }
  206. # Treeview
  207. ttk::style configure Item -padding {4 0 0 0}
  208. package provide ttk::theme::vista 1.0
  209. }
  210. }