vistaTheme.tcl 9.1 KB

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