Posted to tcl by patthoyts at Thu May 08 15:18:18 GMT 2008view raw

  1. The width -8 sets a minimum size for the tab. The padding ensures space around the button. The order of the lable and close elements ensures that when the tab gets too small, the button is shown and the label gets clipped.
  2.  
  3. # This places the button elements on each tab which uses quite a
  4. # lot of space but we can identify the elements. Changes to the
  5. # widget state affect all the button elements though.
  6. if {$pertab} {
  7. ttk::style layout ButtonNotebook {
  8. ButtonNotebook.client -sticky nswe
  9. }
  10. ttk::style layout ButtonNotebook.Tab {
  11. ButtonNotebook.tab -sticky nswe -children {
  12. ButtonNotebook.focus -side top -sticky nswe -children {
  13. ButtonNotebook.padding -side right -sticky nswe -children {
  14. ButtonNotebook.close -side right -sticky {}
  15. }
  16. ButtonNotebook.label -side left -sticky {}
  17. }
  18. }
  19. }
  20. if {$::ttk::currentTheme eq "xpnative"} {
  21. ttk::style configure ButtonNotebook.Tab -width -8
  22. ttk::style configure ButtonNotebook.Tab -padding {8 0 0 0}
  23. }
  24. }