hgk: update backgroud colour when Ttk is available
authorAndrew Shadura <bugzilla@tut.by>
Sun, 10 Mar 2013 16:42:16 +0100
changeset 18805 6a0578d07024
parent 18804 870505ec3e56
child 18806 932f5d3587c9
hgk: update backgroud colour when Ttk is available Ttk doesn't automatically set up Tk colour palette. Because of that, Ttk controls look differently when used together with old Tk controls. When we use Ttk controls, we first query if we have any setting for the client background, and if we do, we update Tk palette as well.
contrib/hgk
--- a/contrib/hgk	Tue Oct 16 15:31:56 2012 +0200
+++ b/contrib/hgk	Sun Mar 10 16:42:16 2013 +0100
@@ -30,6 +30,8 @@
     interp alias {} ttk::label {} label
     interp alias {} ttk::scrollbar {} scrollbar
     interp alias {} ttk::optionMenu {} tk_optionMenu
+
+    proc updatepalette {} {}
 } else {
     proc ::ttk::optionMenu {w varName firstValue args} {
         upvar #0 $varName var
@@ -46,6 +48,11 @@
         }
         return $w.menu
     }
+    proc updatepalette {} {
+        catch {
+            tk_setPalette background [ttk::style lookup client -background]
+        }
+    }
 }
 
 if {[tk windowingsystem] eq "win32"} {
@@ -120,6 +127,7 @@
 
 }
 
+updatepalette
 
 # Unify right mouse button handling.
 # See "mouse buttons on macintosh" thread on comp.lang.tcl