diff options
author | Pat Thoyts <patthoyts@users.sourceforge.net> | 2010-01-26 00:05:31 +0000 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-01-27 17:13:52 -0800 |
commit | c80d7be5e1e0d110ea77cd41f658aabe5bcad0d8 (patch) | |
tree | bae6c567a406ffb3ca363d2e5a6eb319ea8decaa /lib/sshkey.tcl | |
parent | ab2d3b0d7d29bcdfd5c710cd762d90e78d5fc917 (diff) | |
download | git-c80d7be5e1e0d110ea77cd41f658aabe5bcad0d8.tar.gz git-c80d7be5e1e0d110ea77cd41f658aabe5bcad0d8.tar.xz |
git-gui: use themed tk widgets with Tk 8.5
This patch enables the use of themed Tk widgets with Tk 8.5 and above.
These make a significant difference on Windows in making the
application appear native. On Windows and MacOSX ttk defaults to the
native look as much as possible. On X11 the user may select a theme
using the TkTheme XRDB resource class by adding an line to the
.Xresources file. The set of installed theme names is available using
the Tk command 'ttk::themes'. The default on X11 is similar to the current
un-themed style - a kind of thin bordered motif look.
A new git config variable 'gui.usettk' may be set to disable this if
the user prefers the classic Tk look. Using Tk 8.4 will also avoid the
use of themed widgets as these are only available since 8.5.
Some support is included for Tk 8.6 features (themed spinbox and native
font chooser for MacOSX and Windows).
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/sshkey.tcl')
-rw-r--r-- | lib/sshkey.tcl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/sshkey.tcl b/lib/sshkey.tcl index 82a1a80ff..5f75bc96b 100644 --- a/lib/sshkey.tcl +++ b/lib/sshkey.tcl @@ -15,7 +15,7 @@ proc find_ssh_key {} { } proc do_ssh_key {} { - global sshkey_title have_tk85 sshkey_fd + global sshkey_title have_tk85 sshkey_fd use_ttk NS set w .sshkey_dialog if {[winfo exists $w]} { @@ -23,7 +23,7 @@ proc do_ssh_key {} { return } - toplevel $w + Dialog $w wm transient $w . set finfo [find_ssh_key] @@ -35,9 +35,9 @@ proc do_ssh_key {} { set gen_state disabled } - frame $w.header -relief flat - label $w.header.lbl -textvariable sshkey_title -anchor w - button $w.header.gen -text [mc "Generate Key"] \ + ${NS}::frame $w.header + ${NS}::label $w.header.lbl -textvariable sshkey_title -anchor w + ${NS}::button $w.header.gen -text [mc "Generate Key"] \ -command [list make_ssh_key $w] -state $gen_state pack $w.header.lbl -side left -expand 1 -fill x pack $w.header.gen -side right @@ -46,14 +46,16 @@ proc do_ssh_key {} { text $w.contents -width 60 -height 10 -wrap char -relief sunken pack $w.contents -fill both -expand 1 if {$have_tk85} { - $w.contents configure -inactiveselectbackground darkblue + set clr darkblue + if {$use_ttk} { set clr [ttk::style lookup . -selectbackground] } + $w.contents configure -inactiveselectbackground $clr } - frame $w.buttons - button $w.buttons.close -text [mc Close] \ + ${NS}::frame $w.buttons + ${NS}::button $w.buttons.close -text [mc Close] \ -default active -command [list destroy $w] pack $w.buttons.close -side right - button $w.buttons.copy -text [mc "Copy To Clipboard"] \ + ${NS}::button $w.buttons.copy -text [mc "Copy To Clipboard"] \ -command [list tk_textCopy $w.contents] pack $w.buttons.copy -side left pack $w.buttons -side bottom -fill x -pady 5 -padx 5 |