Posted to tcl by patthoyts at Thu Mar 05 22:28:44 GMT 2009view pretty
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 3faa731..51ccc2b 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -58,6 +58,8 @@ namespace eval ttk::theme::alt { ttk::style configure TEntry -padding 1 ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style configure TEntryFrame -padding 2 + ttk::style map TEntryFrame -background {} ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index b421aff..8b8d847 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -97,6 +97,8 @@ namespace eval ttk::theme::clam { -darkcolor [list focus "#6f9dc6"] \ ; + ttk::style configure TEntryFrame -padding 2 + ttk::style map TEntryFrame -background {} ttk::style configure TCombobox -padding 1 -insertwidth 1 ttk::style map TCombobox \ -background [list active $colors(-lighter) \ diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index e807705..a6d0cc9 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -67,6 +67,8 @@ namespace eval ttk::theme::classic { ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style configure TEntryFrame -padding 2 -relief sunken + ttk::style map TEntryFrame -background {} ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 2600082..7eaab36 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -62,6 +62,16 @@ namespace eval ttk::theme::default { ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style layout TEntryFrame { + TEntryFrame.field -sticky nswe -border 0 -children { + TEntryFrame.fill -sticky nswe -children { + TEntryFrame.padding -sticky nswe + } + } + } + ttk::style configure TEntryFrame -padding 1 -relief sunken + ttk::style map TEntryFrame -background {} + ttk::style configure TCombobox -arrowsize 12 -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index 266163b..58edb6e 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -115,6 +115,13 @@ source [file join $::ttk::library sizegrip.tcl] bind TLabelframe <<Invoke>> { tk::TabToWindow [tk_focusNext %W] } bind TLabel <<Invoke>> { tk::TabToWindow [tk_focusNext %W] } +bind TEntryFrame <<ThemeChanged>> { + set pad [ttk::style lookup TEntryFrame -padding] + catch {%W configure -padding [expr {$pad eq {} ? 1 : $pad}]} +} +bind TEntryFrame <Enter> {%W instate !disabled {%W state active}} +bind TEntryFrame <Leave> {%W state !active} + ### Load settings for built-in themes: # proc ttk::LoadThemes {} { diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 76f3e3e..315706b 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -102,6 +102,10 @@ namespace eval ttk::theme::vista { -selectforeground [list !focus SystemWindowText] \ ; + ttk::style configure TEntryFrame -padding 2 + ttk::style element create TEntryFrame.field vsapi \ + EDIT 6 {disabled 4 focus 3 active 2 {} 1} -padding 2 + # Spinbox ttk::style configure TSpinbox -padding 0 ;#{2 0 15 1} ttk::style element create Spinbox.field vsapi \ diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl index 63ffabf..533da30 100644 --- a/library/ttk/winTheme.tcl +++ b/library/ttk/winTheme.tcl @@ -37,6 +37,7 @@ namespace eval ttk::theme::winnative { -selectforeground [list !focus SystemWindowText] \ ; + ttk::style configure TEntryFrame -padding 2 ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 165eaba..3788af1 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -44,6 +44,9 @@ namespace eval ttk::theme::xpnative { -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; + ttk::style configure TEntryFrame -padding 1 + ttk::style element create TEntryFrame.field vsapi \ + EDIT 1 {disabled 4 focus 3 active 2 {} 1} -padding 1 ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \