aboutsummaryrefslogtreecommitdiff
path: root/test/toxy
diff options
context:
space:
mode:
Diffstat (limited to 'test/toxy')
-rw-r--r--test/toxy/kb.wid3
-rw-r--r--test/toxy/multiscale.wid6
-rw-r--r--test/toxy/setup.wid49
3 files changed, 46 insertions, 12 deletions
diff --git a/test/toxy/kb.wid b/test/toxy/kb.wid
index 901db15..b3bd051 100644
--- a/test/toxy/kb.wid
+++ b/test/toxy/kb.wid
@@ -208,9 +208,6 @@ proc ::toxy::kbset {path target remote args} {
::toxy::kb .- .| . .#oct .#size
-# undo the "bind Canvas <1> {+focus %W}" from the setup.wid
-bind .- <FocusIn> {focus .^.c}
-
#@ new
set ::toxy::kbchord(.|) {}
diff --git a/test/toxy/multiscale.wid b/test/toxy/multiscale.wid
index bff9c4f..063146b 100644
--- a/test/toxy/multiscale.wid
+++ b/test/toxy/multiscale.wid
@@ -35,8 +35,7 @@ proc ::toxy::multiscale {path cvpath target remote count lo hi res dx dy bg} {
}
set id [$path create window $px $py -width $dx -height $dy \
-anchor nw -window $path.s$ndx -tags $path.s$ndx]
-# ::toxy::master $path.s$ndx $path $cvpath $target
- ::toxy::master $path.s$ndx $cvpath $target
+ ::toxy::subwidget $path.s$ndx $path $cvpath $target
incr px $dx
}
}
@@ -51,6 +50,3 @@ proc ::toxy::multiscale {path cvpath target remote count lo hi res dx dy bg} {
#. @list ::toxy::multiscale_list .- .#n .#2 .#1
::toxy::multiscale .- .^.c .| . .#n .#lo .#hi .#res .#dx .#dy .#bg
-
-# undo the "bind Canvas <1> {+focus %W}" from the setup.wid
-bind .- <FocusIn> {focus .^.c}
diff --git a/test/toxy/setup.wid b/test/toxy/setup.wid
index 98fe7fb..1d544c9 100644
--- a/test/toxy/setup.wid
+++ b/test/toxy/setup.wid
@@ -1,4 +1,4 @@
-package provide toxywidgets 0.1.0.14
+package provide toxywidgets 0.1.0.15
# LATER keep standard widget setup in a .tcl file (transfered into a .wiq), and
# glue separate .wid files with standard widget definitions into another .wiq
@@ -81,8 +81,15 @@ proc ::toxy::item_destroy {path varname} {
}
proc ::toxy::item_getconfig {path target} {
- pd $target.rp _config $target.rp [$path cget -bg] \
- [winfo reqwidth $path] [winfo reqheight $path] \
+ set wd [winfo reqwidth $path]
+ set ht [winfo reqheight $path]
+ if {$wd < 2 || $ht < 2} {
+# LATER rethink
+ update idletasks
+ set wd [winfo width $path]
+ set ht [winfo height $path]
+ }
+ pd $target.rp _config $target.rp [$path cget -bg] $wd $ht \
[catch {$path config -state normal}]\;
}
@@ -185,7 +192,6 @@ proc ::toxy::master_motion {target cvpath x y} {
}
proc ::toxy::master {path cvpath target} {
-# FIXME subitem handling in megawidgets
bind $path <ButtonRelease> "::toxy::master_release $target $cvpath %X %Y %b"
bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0"
bind $path <Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 1"
@@ -202,6 +208,41 @@ proc ::toxy::master {path cvpath target} {
bind $path <B1-Motion> "::toxy::master_motion $target $cvpath %X %Y"
bind $path <Enter> "::toxy::item_inout $target 1"
bind $path <Leave> "::toxy::item_inout $target 0"
+
+ if {[catch {$path config -state normal}] == 0} {
+ bind $path <<disable>> "$path config -state disabled"
+ bind $path <<enable>> "$path config -state normal"
+ }
+
+ if {[winfo class $path] == "Canvas"} {
+# undo the "bind Canvas <1> {+focus %W}" from above
+ bind $path <FocusIn> "focus $cvpath"
+ }
+}
+
+# to be called explicitly from type initializer, LATER rethink
+proc ::toxy::subwidget {path parent cvpath target} {
+ bind $path <ButtonRelease> "::toxy::master_release $target $cvpath %X %Y %b"
+ bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0"
+ bind $path <Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 1"
+ bind $path <Control-1> "::toxy::item_click $target $cvpath %X %Y %b 2"
+ bind $path <Control-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 3"
+ bind $path <Alt-1> "::toxy::item_click $target $cvpath %X %Y %b 4"
+ bind $path <Alt-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 5"
+ bind $path <Alt-Control-1> "::toxy::item_click $target $cvpath %X %Y %b 6"
+ bind $path <Alt-Control-Shift-1> \
+ "::toxy::item_click $target $cvpath %X %Y %b 7"
+ bind $path <3> "::toxy::item_click $target $cvpath %X %Y %b 8"
+
+ bind $path <Motion> "::toxy::master_motion $target $cvpath %X %Y"
+ bind $path <B1-Motion> "::toxy::master_motion $target $cvpath %X %Y"
+ bind $path <Enter> "::toxy::item_inout $target 1"
+ bind $path <Leave> "::toxy::item_inout $target 0"
+
+ if {[catch {$path config -state normal}] == 0} {
+ bind $parent <<disable>> "+$path config -state disabled"
+ bind $parent <<enable>> "+$path config -state normal"
+ }
}
# standard widget types, LATER move to separate .wid files