Tk Library Source Code

Artifact [67c30711f3]
Login

Artifact 67c30711f396a1f5a86e9cfb6e16fcc4eac5e03e:

Attachment "bwidget1.9.4.patch" to ticket [3168761fff] added by zoro2 2011-01-31 23:13:36.
diff -ru bwidget1.9.4.orig/entry.tcl bwidget1.9.4/entry.tcl
--- bwidget1.9.4.orig/entry.tcl	2009-06-10 10:48:06.000000000 +0200
+++ bwidget1.9.4/entry.tcl	2011-01-18 14:54:38.000000000 +0100
@@ -64,8 +64,14 @@
         COLOR   {move {}}
     }
 
-    foreach event [bind Entry] {
-        bind BwEntry $event [bind Entry $event]
+    if {[Widget::theme]} {
+        foreach event [bind TEntry] {
+            bind BwEntry $event [bind TEntry $event]
+        }
+    }  else  {
+        foreach event [bind Entry] {
+            bind BwEntry $event [bind Entry $event]
+        }
     }
 
     # Copy is kind of a special event.  It should be enabled when the
@@ -92,17 +98,29 @@
     array set maps [Widget::parseArgs Entry $args]
 
     set data(afterid) ""
-    eval [list entry $path] $maps(:cmd)
+    if {[Widget::theme]} {
+        eval [list ttk::entry $path] $maps(:cmd)
+    }  else  {
+        eval [list entry $path] $maps(:cmd)
+    }
     Widget::initFromODB Entry $path $maps(Entry)
     set state    [Widget::getMegawidgetOption $path -state]
     set editable [Widget::getMegawidgetOption $path -editable]
     set text     [Widget::getMegawidgetOption $path -text]
     if { $editable && [string equal $state "normal"] } {
         bindtags $path [list $path BwEntry [winfo toplevel $path] all]
-        $path configure -takefocus 1 -insertontime 600
+    	if {[Widget::theme]} {
+            $path configure -takefocus 1
+	}  else  {
+            $path configure -takefocus 1 -insertontime 600
+	}
     } else {
         bindtags $path [list $path BwDisabledEntry [winfo toplevel $path] all]
-        $path configure -takefocus 0 -insertontime 0
+    	if {[Widget::theme]} {
+            $path configure -takefocus 0
+	}  else  {
+            $path configure -takefocus 0 -insertontime 0
+	}
     }
     if { $editable == 0 } {
         $path configure -cursor left_ptr
@@ -166,20 +184,28 @@
             if { $idx != -1 } {
                 bindtags $path [lreplace $btags $idx $idx BwEntry]
             }
-            $path:cmd configure -takefocus 1 -insertontime 600
+    	    if {[Widget::theme]} {
+                $path:cmd configure -takefocus 1
+	    }  else  {
+                $path:cmd configure -takefocus 1 -insertontime 600
+	    }
         } else {
             set idx [lsearch $btags BwEntry]
             if { $idx != -1 } {
                 bindtags $path [lreplace $btags $idx $idx BwDisabledEntry]
             }
-            $path:cmd configure -takefocus 0 -insertontime 0
+    	    if {[Widget::theme]} {
+                $path:cmd configure -takefocus 0
+	    }  else  {
+                $path:cmd configure -takefocus 0 -insertontime 0
+	    }
             if { [string equal [focus] $path] } {
                 focus .
             }
         }
     }
 
-    if { $chstate || $chfg || $chdfg || $chbg || $chdbg } {
+    if { [Widget::theme] && ($chstate || $chfg || $chdfg || $chbg || $chdbg) } {
 	set state [Widget::getMegawidgetOption $path -state]
         if { [string equal $state "disabled"] } {
             $path:cmd configure \
@@ -267,7 +293,7 @@
             return [eval [linsert $larg 0 Entry::$cmd $path]]
         }
         default {
-            return [eval [linsert $larg 0 $path:cmd $cmd]]
+            return [uplevel 2 [linsert $larg 0 $path:cmd $cmd]]
         }
     }
 }
diff -ru bwidget1.9.4.orig/labelentry.tcl bwidget1.9.4/labelentry.tcl
--- bwidget1.9.4.orig/labelentry.tcl	2003-10-20 23:23:52.000000000 +0200
+++ bwidget1.9.4/labelentry.tcl	2011-01-18 15:02:04.000000000 +0100
@@ -39,8 +39,13 @@
     array set maps [list LabelEntry {} :cmd {} .labf {} .e {}]
     array set maps [Widget::parseArgs LabelEntry $args]
 
-    eval [list frame $path] $maps(:cmd) -class LabelEntry \
+    if {[Widget::theme]} {
+        eval [list ttk::frame $path] $maps(:cmd) -class LabelEntry \
+	    -takefocus 0
+    }  else  {
+        eval [list frame $path] $maps(:cmd) -class LabelEntry \
 	    -relief flat -bd 0 -highlightthickness 0 -takefocus 0
+    }
     Widget::initFromODB LabelEntry $path $maps(LabelEntry)
 	
     set labf  [eval [list LabelFrame::create $path.labf] $maps(.labf) \
diff -ru bwidget1.9.4.orig/labelframe.tcl bwidget1.9.4/labelframe.tcl
--- bwidget1.9.4.orig/labelframe.tcl	2003-10-20 23:23:52.000000000 +0200
+++ bwidget1.9.4/labelframe.tcl	2011-01-18 15:00:30.000000000 +0100
@@ -46,15 +46,25 @@
 proc LabelFrame::create { path args } {
     Widget::init LabelFrame $path $args
 
-    set path  [eval [list frame $path] [Widget::subcget $path :cmd] \
+    if {[Widget::theme]} {
+        set path  [eval [list ttk::frame $path] [Widget::subcget $path :cmd] \
+	    -takefocus 0 \
+	    -class LabelFrame]
+    }  else  {
+        set path  [eval [list frame $path] [Widget::subcget $path :cmd] \
 	    -relief flat -bd 0 -takefocus 0 -highlightthickness 0 \
 	    -class LabelFrame]
+    }
 
     set label [eval [list Label::create $path.l] [Widget::subcget $path .l] \
-                   -takefocus 0 -highlightthickness 0 -relief flat \
-		   -borderwidth 0 -dropenabled 0 -dragenabled 0]
-    set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
+                   -takefocus 0 -dropenabled 0 -dragenabled 0]
+    if {[Widget::theme]} {
+        set frame [eval [list ttk::frame $path.f] [Widget::subcget $path .f] \
+                   -takefocus 0]
+    }  else  {
+        set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
                    -highlightthickness 0 -takefocus 0]
+    }
 
     switch  [Widget::getoption $path -side] {
         left   {set packopt "-side left"}
diff -ru bwidget1.9.4.orig/mainframe.tcl bwidget1.9.4/mainframe.tcl
--- bwidget1.9.4.orig/mainframe.tcl	2010-11-09 17:05:44.000000000 +0100
+++ bwidget1.9.4/mainframe.tcl	2011-01-04 11:29:52.000000000 +0100
@@ -303,11 +303,11 @@
     set index     $_widget($path,ntoolbar)
     set toolframe $path.topf.f$index
     set toolbar   $path.topf.tb$index
-    set bg        [Widget::getoption $path -background]
     if { $tcl_platform(platform) == "unix" } {
 	if {[Widget::theme]} {
 	    ttk::frame $toolframe -padding 1
 	} else {
+    set bg        [Widget::getoption $path -background]
 	    frame $toolframe -relief raised -borderwidth 1 \
 		-takefocus 0 -highlightthickness 0 -background $bg
 	}
@@ -316,6 +316,7 @@
 	    ttk::frame $toolframe
 	    set sep [ttk::separator $toolframe.sep -orient horizontal]
 	} else {
+    set bg        [Widget::getoption $path -background]
 	    frame $toolframe -relief flat -borderwidth 0 -takefocus 0 \
 		-highlightthickness 0 -background $bg
 	    set sep [Separator::create $toolframe.sep -orient horizontal -background $bg]
diff -ru bwidget1.9.4.orig/pagesmgr.tcl bwidget1.9.4/pagesmgr.tcl
--- bwidget1.9.4.orig/pagesmgr.tcl	2003-10-20 23:23:52.000000000 +0200
+++ bwidget1.9.4/pagesmgr.tcl	2011-01-18 15:51:34.000000000 +0100
@@ -110,8 +110,12 @@
 
     lappend data(pages) $page
 
-    frame $path.f$page -relief flat \
+    if {[Widget::theme]} {
+        ttk::frame $path.f$page
+    }  else  {
+        frame $path.f$page -relief flat \
 	    -background [Widget::cget $path -background] -borderwidth 0
+    }
 
     return $path.f$page
 }
diff -ru bwidget1.9.4.orig/pkgIndex.tcl bwidget1.9.4/pkgIndex.tcl
--- bwidget1.9.4.orig/pkgIndex.tcl	2010-12-14 23:14:02.000000000 +0100
+++ bwidget1.9.4/pkgIndex.tcl	2011-01-03 14:19:30.000000000 +0100
@@ -1,7 +1,7 @@
 if {[catch {package require Tcl}]} return
 package ifneeded BWidget 1.9.4 "\
     package require Tk 8.1.1;\
-    [list tclPkgSetup $dir BWidget 1.9.3 {
+    [list tclPkgSetup $dir BWidget 1.9.4 {
 {arrow.tcl source {ArrowButton ArrowButton::create ArrowButton::use}}
 {labelframe.tcl source {LabelFrame LabelFrame::create LabelFrame::use}}
 {labelentry.tcl source {LabelEntry LabelEntry::create LabelEntry::use}}
diff -ru bwidget1.9.4.orig/scrollw.tcl bwidget1.9.4/scrollw.tcl
--- bwidget1.9.4.orig/scrollw.tcl	2010-11-23 09:21:18.000000000 +0100
+++ bwidget1.9.4/scrollw.tcl	2011-01-04 12:48:40.000000000 +0100
@@ -57,20 +57,21 @@
         ttk::scrollbar $path.vscroll \
             -takefocus 0 -orient vert
     } else {
+        if {$bg != ""} {
+            set bg [list -background $bg]
+        }
         set sw     [eval [list frame $path \
-                      -relief flat -borderwidth 0 -background $bg \
+                      -relief flat -borderwidth 0] $bg [list \
                       -highlightthickness 0 -takefocus 0] \
                         [Widget::subcget $path :cmd]]
         scrollbar $path.hscroll \
             -highlightthickness 0 -takefocus 0 \
             -orient	 horiz	\
-            -relief	 sunken	\
-            -bg	 $bg
+            -relief	 sunken
         scrollbar $path.vscroll \
             -highlightthickness 0 -takefocus 0 \
             -orient	 vert	\
-            -relief	 sunken	\
-            -bg	 $bg
+            -relief	 sunken
     }
 
     set data(realized) 0