Pratt 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
@@ -0,0 +1,382 @@
|
|
1
|
+
# treeview.tcl,v 1.22 2006/12/18 15:05:59 jenglish Exp
|
2
|
+
#
|
3
|
+
# ttk::treeview widget bindings and utilities.
|
4
|
+
#
|
5
|
+
|
6
|
+
namespace eval ttk::treeview {
|
7
|
+
variable State
|
8
|
+
|
9
|
+
# Enter/Leave/Motion
|
10
|
+
#
|
11
|
+
set State(activeWidget) {}
|
12
|
+
set State(activeHeading) {}
|
13
|
+
|
14
|
+
# Press/drag/release:
|
15
|
+
#
|
16
|
+
set State(pressMode) none
|
17
|
+
set State(pressX) 0
|
18
|
+
|
19
|
+
# For pressMode == "resize"
|
20
|
+
set State(resizeColumn) #0
|
21
|
+
|
22
|
+
# For pressmode == "heading"
|
23
|
+
set State(heading) {}
|
24
|
+
|
25
|
+
# Provide [lassign] if not already present
|
26
|
+
# (@@@ TODO: check if this is still needed after horrible-identify purge)
|
27
|
+
#
|
28
|
+
if {![llength [info commands lassign]]} {
|
29
|
+
proc lassign {vals args} {
|
30
|
+
uplevel 1 [list foreach $args $vals break]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
### Widget bindings.
|
36
|
+
#
|
37
|
+
|
38
|
+
bind Treeview <Motion> { ttk::treeview::Motion %W %x %y }
|
39
|
+
bind Treeview <B1-Leave> { #nothing }
|
40
|
+
bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}}
|
41
|
+
bind Treeview <ButtonPress-1> { ttk::treeview::Press %W %x %y }
|
42
|
+
bind Treeview <Double-ButtonPress-1> { ttk::treeview::DoubleClick %W %x %y }
|
43
|
+
bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y }
|
44
|
+
bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y }
|
45
|
+
bind Treeview <KeyPress-Up> { ttk::treeview::Keynav %W up }
|
46
|
+
bind Treeview <KeyPress-Down> { ttk::treeview::Keynav %W down }
|
47
|
+
bind Treeview <KeyPress-Right> { ttk::treeview::Keynav %W right }
|
48
|
+
bind Treeview <KeyPress-Left> { ttk::treeview::Keynav %W left }
|
49
|
+
bind Treeview <KeyPress-Prior> { %W yview scroll -1 pages }
|
50
|
+
bind Treeview <KeyPress-Next> { %W yview scroll 1 pages }
|
51
|
+
bind Treeview <KeyPress-Return> { ttk::treeview::ToggleFocus %W }
|
52
|
+
bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W }
|
53
|
+
|
54
|
+
bind Treeview <Shift-ButtonPress-1> \
|
55
|
+
{ ttk::treeview::Select %W %x %y extend }
|
56
|
+
bind Treeview <Control-ButtonPress-1> \
|
57
|
+
{ ttk::treeview::Select %W %x %y toggle }
|
58
|
+
|
59
|
+
# Standard mousewheel bindings:
|
60
|
+
#
|
61
|
+
bind Treeview <MouseWheel> { %W yview scroll [expr {- (%D / 120) * 4}] units }
|
62
|
+
if {[string equal "x11" [tk windowingsystem]]} {
|
63
|
+
bind Treeview <ButtonPress-4> { %W yview scroll -5 units }
|
64
|
+
bind Treeview <ButtonPress-5> { %W yview scroll 5 units }
|
65
|
+
}
|
66
|
+
|
67
|
+
### Binding procedures.
|
68
|
+
#
|
69
|
+
|
70
|
+
## Keynav -- Keyboard navigation
|
71
|
+
#
|
72
|
+
# @@@ TODO: verify/rewrite up and down code.
|
73
|
+
#
|
74
|
+
proc ttk::treeview::Keynav {w dir} {
|
75
|
+
set focus [$w focus]
|
76
|
+
if {$focus eq ""} { return }
|
77
|
+
|
78
|
+
switch -- $dir {
|
79
|
+
up {
|
80
|
+
if {[set up [$w prev $focus]] eq ""} {
|
81
|
+
set focus [$w parent $focus]
|
82
|
+
} else {
|
83
|
+
while {[$w item $up -open] && [llength [$w children $up]]} {
|
84
|
+
set up [lindex [$w children $up] end]
|
85
|
+
}
|
86
|
+
set focus $up
|
87
|
+
}
|
88
|
+
}
|
89
|
+
down {
|
90
|
+
if {[$w item $focus -open] && [llength [$w children $focus]]} {
|
91
|
+
set focus [lindex [$w children $focus] 0]
|
92
|
+
} else {
|
93
|
+
set up $focus
|
94
|
+
while {$up ne "" && [set down [$w next $up]] eq ""} {
|
95
|
+
set up [$w parent $up]
|
96
|
+
}
|
97
|
+
set focus $down
|
98
|
+
}
|
99
|
+
}
|
100
|
+
left {
|
101
|
+
if {[$w item $focus -open] && [llength [$w children $focus]]} {
|
102
|
+
CloseItem $w $focus
|
103
|
+
} else {
|
104
|
+
set focus [$w parent $focus]
|
105
|
+
}
|
106
|
+
}
|
107
|
+
right {
|
108
|
+
OpenItem $w $focus
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
if {$focus != {}} {
|
113
|
+
SelectOp $w $focus choose
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
## Motion -- pointer motion binding.
|
118
|
+
# Sets cursor, active element ...
|
119
|
+
#
|
120
|
+
proc ttk::treeview::Motion {w x y} {
|
121
|
+
variable ::ttk::Cursors
|
122
|
+
variable State
|
123
|
+
|
124
|
+
set cursor {}
|
125
|
+
set activeHeading {}
|
126
|
+
|
127
|
+
lassign [$w identify $x $y] what where detail
|
128
|
+
switch -- $what {
|
129
|
+
separator { set cursor $Cursors(hresize) }
|
130
|
+
heading { set activeHeading $where }
|
131
|
+
}
|
132
|
+
|
133
|
+
if {[$w cget -cursor] ne $cursor} {
|
134
|
+
$w configure -cursor $cursor
|
135
|
+
}
|
136
|
+
ActivateHeading $w $activeHeading
|
137
|
+
}
|
138
|
+
|
139
|
+
## ActivateHeading -- track active heading element
|
140
|
+
#
|
141
|
+
proc ttk::treeview::ActivateHeading {w heading} {
|
142
|
+
variable State
|
143
|
+
|
144
|
+
if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
|
145
|
+
if {$State(activeHeading) != {}} {
|
146
|
+
$State(activeWidget) heading $State(activeHeading) state !active
|
147
|
+
}
|
148
|
+
if {$heading != {}} {
|
149
|
+
$w heading $heading state active
|
150
|
+
}
|
151
|
+
set State(activeHeading) $heading
|
152
|
+
set State(activeWidget) $w
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
## Select $w $x $y $selectop
|
157
|
+
# Binding procedure for selection operations.
|
158
|
+
# See "Selection modes", below.
|
159
|
+
#
|
160
|
+
proc ttk::treeview::Select {w x y op} {
|
161
|
+
if {[set item [$w identify row $x $y]] ne "" } {
|
162
|
+
SelectOp $w $item $op
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
## DoubleClick -- Double-ButtonPress-1 binding.
|
167
|
+
#
|
168
|
+
proc ttk::treeview::DoubleClick {w x y} {
|
169
|
+
if {[set row [$w identify row $x $y]] ne ""} {
|
170
|
+
Toggle $w $row
|
171
|
+
} else {
|
172
|
+
Press $w $x $y ;# perform single-click action
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
## Press -- ButtonPress binding.
|
177
|
+
#
|
178
|
+
proc ttk::treeview::Press {w x y} {
|
179
|
+
lassign [$w identify $x $y] what where detail
|
180
|
+
focus $w ;# or: ClickToFocus?
|
181
|
+
|
182
|
+
switch -- $what {
|
183
|
+
nothing { }
|
184
|
+
heading { heading.press $w $where }
|
185
|
+
separator { resize.press $w $x $where }
|
186
|
+
cell -
|
187
|
+
row -
|
188
|
+
item { SelectOp $w $where choose }
|
189
|
+
}
|
190
|
+
if {$what eq "item" && [string match *indicator $detail]} {
|
191
|
+
Toggle $w $where
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
## Drag -- B1-Motion binding
|
196
|
+
#
|
197
|
+
proc ttk::treeview::Drag {w x y} {
|
198
|
+
variable State
|
199
|
+
switch $State(pressMode) {
|
200
|
+
resize { resize.drag $w $x }
|
201
|
+
heading { heading.drag $w $x $y }
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
proc ttk::treeview::Release {w x y} {
|
206
|
+
variable State
|
207
|
+
switch $State(pressMode) {
|
208
|
+
resize { resize.release $w $x }
|
209
|
+
heading { heading.release $w }
|
210
|
+
}
|
211
|
+
set State(pressMode) none
|
212
|
+
Motion $w $x $y
|
213
|
+
}
|
214
|
+
|
215
|
+
### Interactive column resizing.
|
216
|
+
#
|
217
|
+
proc ttk::treeview::resize.press {w x column} {
|
218
|
+
variable State
|
219
|
+
set State(pressMode) "resize"
|
220
|
+
set State(resizeColumn) $column
|
221
|
+
}
|
222
|
+
|
223
|
+
proc ttk::treeview::resize.drag {w x} {
|
224
|
+
variable State
|
225
|
+
$w drag $State(resizeColumn) $x
|
226
|
+
}
|
227
|
+
|
228
|
+
proc ttk::treeview::resize.release {w x} {
|
229
|
+
# no-op
|
230
|
+
}
|
231
|
+
|
232
|
+
### Heading activation.
|
233
|
+
#
|
234
|
+
|
235
|
+
proc ttk::treeview::heading.press {w column} {
|
236
|
+
variable State
|
237
|
+
set State(pressMode) "heading"
|
238
|
+
set State(heading) $column
|
239
|
+
$w heading $column state pressed
|
240
|
+
}
|
241
|
+
|
242
|
+
proc ttk::treeview::heading.drag {w x y} {
|
243
|
+
variable State
|
244
|
+
lassign [$w identify $x $y] what where detail
|
245
|
+
if {$what eq "heading" && $where eq $State(heading)} {
|
246
|
+
$w heading $State(heading) state pressed
|
247
|
+
} else {
|
248
|
+
$w heading $State(heading) state !pressed
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
proc ttk::treeview::heading.release {w} {
|
253
|
+
variable State
|
254
|
+
if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} {
|
255
|
+
after idle [$w heading $State(heading) -command]
|
256
|
+
}
|
257
|
+
$w heading $State(heading) state !pressed
|
258
|
+
}
|
259
|
+
|
260
|
+
### Selection modes.
|
261
|
+
#
|
262
|
+
|
263
|
+
## SelectOp $w $item [ choose | extend | toggle ] --
|
264
|
+
# Dispatch to appropriate selection operation
|
265
|
+
# depending on current value of -selectmode.
|
266
|
+
#
|
267
|
+
proc ttk::treeview::SelectOp {w item op} {
|
268
|
+
select.$op.[$w cget -selectmode] $w $item
|
269
|
+
}
|
270
|
+
|
271
|
+
## -selectmode none:
|
272
|
+
#
|
273
|
+
proc ttk::treeview::select.choose.none {w item} { $w focus $item }
|
274
|
+
proc ttk::treeview::select.toggle.none {w item} { $w focus $item }
|
275
|
+
proc ttk::treeview::select.extend.none {w item} { $w focus $item }
|
276
|
+
|
277
|
+
## -selectmode browse:
|
278
|
+
#
|
279
|
+
proc ttk::treeview::select.choose.browse {w item} { BrowseTo $w $item }
|
280
|
+
proc ttk::treeview::select.toggle.browse {w item} { BrowseTo $w $item }
|
281
|
+
proc ttk::treeview::select.extend.browse {w item} { BrowseTo $w $item }
|
282
|
+
|
283
|
+
## -selectmode multiple:
|
284
|
+
#
|
285
|
+
proc ttk::treeview::select.choose.extended {w item} {
|
286
|
+
BrowseTo $w $item
|
287
|
+
}
|
288
|
+
proc ttk::treeview::select.toggle.extended {w item} {
|
289
|
+
$w selection toggle $item
|
290
|
+
}
|
291
|
+
proc ttk::treeview::select.extend.extended {w item} {
|
292
|
+
if {[set anchor [$w focus]] ne ""} {
|
293
|
+
$w selection set [between $w $anchor $item]
|
294
|
+
} else {
|
295
|
+
BrowseTo $item
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
### Tree structure utilities.
|
300
|
+
#
|
301
|
+
|
302
|
+
## between $tv $item1 $item2 --
|
303
|
+
# Returns a list of all items between $item1 and $item2,
|
304
|
+
# in preorder traversal order. $item1 and $item2 may be
|
305
|
+
# in either order.
|
306
|
+
#
|
307
|
+
# NOTES:
|
308
|
+
# This routine is O(N) in the size of the tree.
|
309
|
+
# There's probably a way to do this that's O(N) in the number
|
310
|
+
# of items returned, but I'm not clever enough to figure it out.
|
311
|
+
#
|
312
|
+
proc ttk::treeview::between {tv item1 item2} {
|
313
|
+
variable between [list]
|
314
|
+
variable selectingBetween 0
|
315
|
+
ScanBetween $tv $item1 $item2 {}
|
316
|
+
return $between
|
317
|
+
}
|
318
|
+
|
319
|
+
## ScanBetween --
|
320
|
+
# Recursive worker routine for ttk::treeview::between
|
321
|
+
#
|
322
|
+
proc ttk::treeview::ScanBetween {tv item1 item2 item} {
|
323
|
+
variable between
|
324
|
+
variable selectingBetween
|
325
|
+
|
326
|
+
if {$item eq $item1 || $item eq $item2} {
|
327
|
+
lappend between $item
|
328
|
+
set selectingBetween [expr {!$selectingBetween}]
|
329
|
+
} elseif {$selectingBetween} {
|
330
|
+
lappend between $item
|
331
|
+
}
|
332
|
+
foreach child [$tv children $item] {
|
333
|
+
ScanBetween $tv $item1 $item2 $child
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
### User interaction utilities.
|
338
|
+
#
|
339
|
+
|
340
|
+
## OpenItem, CloseItem -- Set the open state of an item, generate event
|
341
|
+
#
|
342
|
+
|
343
|
+
proc ttk::treeview::OpenItem {w item} {
|
344
|
+
$w focus $item
|
345
|
+
event generate $w <<TreeviewOpen>>
|
346
|
+
$w item $item -open true
|
347
|
+
}
|
348
|
+
|
349
|
+
proc ttk::treeview::CloseItem {w item} {
|
350
|
+
$w item $item -open false
|
351
|
+
$w focus $item
|
352
|
+
event generate $w <<TreeviewClose>>
|
353
|
+
}
|
354
|
+
|
355
|
+
## Toggle -- toggle opened/closed state of item
|
356
|
+
#
|
357
|
+
proc ttk::treeview::Toggle {w item} {
|
358
|
+
if {[$w item $item -open]} {
|
359
|
+
CloseItem $w $item
|
360
|
+
} else {
|
361
|
+
OpenItem $w $item
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
## ToggleFocus -- toggle opened/closed state of focus item
|
366
|
+
#
|
367
|
+
proc ttk::treeview::ToggleFocus {w} {
|
368
|
+
set item [$w focus]
|
369
|
+
if {$item ne ""} {
|
370
|
+
Toggle $w $item
|
371
|
+
}
|
372
|
+
}
|
373
|
+
|
374
|
+
## BrowseTo -- navigate to specified item; set focus and selection
|
375
|
+
#
|
376
|
+
proc ttk::treeview::BrowseTo {w item} {
|
377
|
+
$w see $item
|
378
|
+
$w focus $item
|
379
|
+
$w selection set [list $item]
|
380
|
+
}
|
381
|
+
|
382
|
+
#*EOF*
|
@@ -0,0 +1,254 @@
|
|
1
|
+
#
|
2
|
+
# utils.tcl,v 1.10 2007/10/22 03:21:25 jenglish Exp
|
3
|
+
#
|
4
|
+
# Utilities for widget implementations.
|
5
|
+
#
|
6
|
+
|
7
|
+
### Focus management.
|
8
|
+
#
|
9
|
+
|
10
|
+
## ttk::takefocus --
|
11
|
+
# This is the default value of the "-takefocus" option
|
12
|
+
# for widgets that participate in keyboard navigation.
|
13
|
+
#
|
14
|
+
# See also: tk::FocusOK
|
15
|
+
#
|
16
|
+
proc ttk::takefocus {w} {
|
17
|
+
expr {[$w instate !disabled] && [winfo viewable $w]}
|
18
|
+
}
|
19
|
+
|
20
|
+
## ttk::traverseTo $w --
|
21
|
+
# Set the keyboard focus to the specified window.
|
22
|
+
#
|
23
|
+
proc ttk::traverseTo {w} {
|
24
|
+
set focus [focus]
|
25
|
+
if {$focus ne ""} {
|
26
|
+
event generate $focus <<TraverseOut>>
|
27
|
+
}
|
28
|
+
focus $w
|
29
|
+
event generate $w <<TraverseIn>>
|
30
|
+
}
|
31
|
+
|
32
|
+
## ttk::clickToFocus $w --
|
33
|
+
# Utility routine, used in <ButtonPress-1> bindings --
|
34
|
+
# Assign keyboard focus to the specified widget if -takefocus is enabled.
|
35
|
+
#
|
36
|
+
proc ttk::clickToFocus {w} {
|
37
|
+
if {[ttk::takesFocus $w]} { focus $w }
|
38
|
+
}
|
39
|
+
|
40
|
+
## ttk::takesFocus w --
|
41
|
+
# Test if the widget can take keyboard focus:
|
42
|
+
#
|
43
|
+
# + widget is viewable, AND:
|
44
|
+
# - if -takefocus is missing or empty, return 0, OR
|
45
|
+
# - if -takefocus is 0 or 1, return that value, OR
|
46
|
+
# - append the widget name to -takefocus and evaluate it
|
47
|
+
# as a script.
|
48
|
+
#
|
49
|
+
# See also: tk::FocusOK
|
50
|
+
#
|
51
|
+
# Note: This routine doesn't implement the same fallback heuristics
|
52
|
+
# as tk::FocusOK.
|
53
|
+
#
|
54
|
+
proc ttk::takesFocus {w} {
|
55
|
+
|
56
|
+
if {![winfo viewable $w]} { return 0 }
|
57
|
+
|
58
|
+
if {![catch {$w cget -takefocus} takefocus]} {
|
59
|
+
switch -- $takefocus {
|
60
|
+
0 -
|
61
|
+
1 { return $takefocus }
|
62
|
+
"" { return 0 }
|
63
|
+
default {
|
64
|
+
set value [uplevel #0 $takefocus [list $w]]
|
65
|
+
return [expr {$value eq 1}]
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
return 0
|
71
|
+
}
|
72
|
+
|
73
|
+
## ttk::focusFirst $w --
|
74
|
+
# Return the first descendant of $w, in preorder traversal order,
|
75
|
+
# that can take keyboard focus, "" if none do.
|
76
|
+
#
|
77
|
+
# See also: tk_focusNext
|
78
|
+
#
|
79
|
+
|
80
|
+
proc ttk::focusFirst {w} {
|
81
|
+
if {[ttk::takesFocus $w]} {
|
82
|
+
return $w
|
83
|
+
}
|
84
|
+
foreach child [winfo children $w] {
|
85
|
+
if {[set c [ttk::focusFirst $child]] ne ""} {
|
86
|
+
return $c
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return ""
|
90
|
+
}
|
91
|
+
|
92
|
+
### Grabs.
|
93
|
+
#
|
94
|
+
# Rules:
|
95
|
+
# Each call to [grabWindow $w] or [globalGrab $w] must be
|
96
|
+
# matched with a call to [releaseGrab $w] in LIFO order.
|
97
|
+
#
|
98
|
+
# Do not call [grabWindow $w] for a window that currently
|
99
|
+
# appears on the grab stack.
|
100
|
+
#
|
101
|
+
# See #1239190 and #1411983 for more discussion.
|
102
|
+
#
|
103
|
+
namespace eval ttk {
|
104
|
+
variable Grab ;# map: window name -> grab token
|
105
|
+
|
106
|
+
# grab token details:
|
107
|
+
# Two-element list containing:
|
108
|
+
# 1) a script to evaluate to restore the previous grab (if any);
|
109
|
+
# 2) a script to evaluate to restore the focus (if any)
|
110
|
+
}
|
111
|
+
|
112
|
+
## SaveGrab --
|
113
|
+
# Record current grab and focus windows.
|
114
|
+
#
|
115
|
+
proc ttk::SaveGrab {w} {
|
116
|
+
variable Grab
|
117
|
+
|
118
|
+
if {[info exists Grab($w)]} {
|
119
|
+
# $w is already on the grab stack.
|
120
|
+
# This should not happen, but bail out in case it does anyway:
|
121
|
+
#
|
122
|
+
return
|
123
|
+
}
|
124
|
+
|
125
|
+
set restoreGrab [set restoreFocus ""]
|
126
|
+
|
127
|
+
set grabbed [grab current $w]
|
128
|
+
if {[winfo exists $grabbed]} {
|
129
|
+
switch [grab status $grabbed] {
|
130
|
+
global { set restoreGrab [list grab -global $grabbed] }
|
131
|
+
local { set restoreGrab [list grab $grabbed] }
|
132
|
+
none { ;# grab window is really in a different interp }
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
set focus [focus]
|
137
|
+
if {$focus ne ""} {
|
138
|
+
set restoreFocus [list focus -force $focus]
|
139
|
+
}
|
140
|
+
|
141
|
+
set Grab($w) [list $restoreGrab $restoreFocus]
|
142
|
+
}
|
143
|
+
|
144
|
+
## RestoreGrab --
|
145
|
+
# Restore previous grab and focus windows.
|
146
|
+
# If called more than once without an intervening [SaveGrab $w],
|
147
|
+
# does nothing.
|
148
|
+
#
|
149
|
+
proc ttk::RestoreGrab {w} {
|
150
|
+
variable Grab
|
151
|
+
|
152
|
+
if {![info exists Grab($w)]} { # Ignore
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
|
156
|
+
# The previous grab/focus window may have been destroyed,
|
157
|
+
# unmapped, or some other abnormal condition; ignore any errors.
|
158
|
+
#
|
159
|
+
foreach script $Grab($w) {
|
160
|
+
catch $script
|
161
|
+
}
|
162
|
+
|
163
|
+
unset Grab($w)
|
164
|
+
}
|
165
|
+
|
166
|
+
## ttk::grabWindow $w --
|
167
|
+
# Records the current focus and grab windows, sets an application-modal
|
168
|
+
# grab on window $w.
|
169
|
+
#
|
170
|
+
proc ttk::grabWindow {w} {
|
171
|
+
SaveGrab $w
|
172
|
+
grab $w
|
173
|
+
}
|
174
|
+
|
175
|
+
## ttk::globalGrab $w --
|
176
|
+
# Same as grabWindow, but sets a global grab on $w.
|
177
|
+
#
|
178
|
+
proc ttk::globalGrab {w} {
|
179
|
+
SaveGrab $w
|
180
|
+
grab -global $w
|
181
|
+
}
|
182
|
+
|
183
|
+
## ttk::releaseGrab --
|
184
|
+
# Release the grab previously set by [ttk::grabWindow]
|
185
|
+
# or [ttk::globalGrab].
|
186
|
+
#
|
187
|
+
proc ttk::releaseGrab {w} {
|
188
|
+
grab release $w
|
189
|
+
RestoreGrab $w
|
190
|
+
}
|
191
|
+
|
192
|
+
### Auto-repeat.
|
193
|
+
#
|
194
|
+
# NOTE: repeating widgets do not have -repeatdelay
|
195
|
+
# or -repeatinterval resources as in standard Tk;
|
196
|
+
# instead a single set of settings is applied application-wide.
|
197
|
+
# (TODO: make this user-configurable)
|
198
|
+
#
|
199
|
+
# (@@@ Windows seems to use something like 500/50 milliseconds
|
200
|
+
# @@@ for -repeatdelay/-repeatinterval)
|
201
|
+
#
|
202
|
+
|
203
|
+
namespace eval ttk {
|
204
|
+
variable Repeat
|
205
|
+
array set Repeat {
|
206
|
+
delay 300
|
207
|
+
interval 100
|
208
|
+
timer {}
|
209
|
+
script {}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
## ttk::Repeatedly --
|
214
|
+
# Begin auto-repeat.
|
215
|
+
#
|
216
|
+
proc ttk::Repeatedly {args} {
|
217
|
+
variable Repeat
|
218
|
+
after cancel $Repeat(timer)
|
219
|
+
set script [uplevel 1 [list namespace code $args]]
|
220
|
+
set Repeat(script) $script
|
221
|
+
uplevel #0 $script
|
222
|
+
set Repeat(timer) [after $Repeat(delay) ttk::Repeat]
|
223
|
+
}
|
224
|
+
|
225
|
+
## Repeat --
|
226
|
+
# Continue auto-repeat
|
227
|
+
#
|
228
|
+
proc ttk::Repeat {} {
|
229
|
+
variable Repeat
|
230
|
+
uplevel #0 $Repeat(script)
|
231
|
+
set Repeat(timer) [after $Repeat(interval) ttk::Repeat]
|
232
|
+
}
|
233
|
+
|
234
|
+
## ttk::CancelRepeat --
|
235
|
+
# Halt auto-repeat.
|
236
|
+
#
|
237
|
+
proc ttk::CancelRepeat {} {
|
238
|
+
variable Repeat
|
239
|
+
after cancel $Repeat(timer)
|
240
|
+
}
|
241
|
+
|
242
|
+
### Miscellaneous.
|
243
|
+
#
|
244
|
+
|
245
|
+
## ttk::copyBindings $from $to --
|
246
|
+
# Utility routine; copies bindings from one bindtag onto another.
|
247
|
+
#
|
248
|
+
proc ttk::copyBindings {from to} {
|
249
|
+
foreach event [bind $from] {
|
250
|
+
bind $to $event [bind $from $event]
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
#*EOF*
|