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,171 @@
|
|
1
|
+
#
|
2
|
+
# menubutton.tcl,v 1.8 2006/08/20 19:40:39 jenglish Exp
|
3
|
+
#
|
4
|
+
# Bindings for Menubuttons.
|
5
|
+
#
|
6
|
+
# Menubuttons have three interaction modes:
|
7
|
+
#
|
8
|
+
# Pulldown: Press menubutton, drag over menu, release to activate menu entry
|
9
|
+
# Popdown: Click menubutton to post menu
|
10
|
+
# Keyboard: <Key-space> or accelerator key to post menu
|
11
|
+
#
|
12
|
+
# (In addition, when menu system is active, "dropdown" -- menu posts
|
13
|
+
# on mouse-over. Tile menubuttons don't implement this).
|
14
|
+
#
|
15
|
+
# For keyboard and popdown mode, we hand off to tk_popup and let
|
16
|
+
# the built-in Tk bindings handle the rest of the interaction.
|
17
|
+
#
|
18
|
+
# ON X11:
|
19
|
+
#
|
20
|
+
# Standard Tk menubuttons use a global grab on the menubutton.
|
21
|
+
# This won't work for Tile menubuttons in pulldown mode,
|
22
|
+
# since we need to process the final <ButtonRelease> event,
|
23
|
+
# and this might be delivered to the menu. So instead we
|
24
|
+
# rely on the passive grab that occurs on <ButtonPress> events,
|
25
|
+
# and transition to popdown mode when the mouse is released
|
26
|
+
# or dragged outside the menubutton.
|
27
|
+
#
|
28
|
+
# ON WINDOWS:
|
29
|
+
#
|
30
|
+
# I'm not sure what the hell is going on here. [$menu post] apparently
|
31
|
+
# sets up some kind of internal grab for native menus.
|
32
|
+
# On this platform, just use [tk_popup] for all menu actions.
|
33
|
+
#
|
34
|
+
# ON MACOS:
|
35
|
+
#
|
36
|
+
# Same probably applies here.
|
37
|
+
#
|
38
|
+
|
39
|
+
namespace eval ttk {
|
40
|
+
namespace eval menubutton {
|
41
|
+
variable State
|
42
|
+
array set State {
|
43
|
+
pulldown 0
|
44
|
+
oldcursor {}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
bind TMenubutton <Enter> { %W instate !disabled {%W state active } }
|
50
|
+
bind TMenubutton <Leave> { %W state !active }
|
51
|
+
bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W }
|
52
|
+
bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W }
|
53
|
+
|
54
|
+
if {[tk windowingsystem] eq "x11"} {
|
55
|
+
bind TMenubutton <ButtonPress-1> { ttk::menubutton::Pulldown %W }
|
56
|
+
bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W }
|
57
|
+
bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W }
|
58
|
+
} else {
|
59
|
+
bind TMenubutton <ButtonPress-1> \
|
60
|
+
{ %W state pressed ; ttk::menubutton::Popdown %W }
|
61
|
+
bind TMenubutton <ButtonRelease-1> \
|
62
|
+
{ %W state !pressed }
|
63
|
+
}
|
64
|
+
|
65
|
+
# PostPosition --
|
66
|
+
# Returns the x and y coordinates where the menu
|
67
|
+
# should be posted, based on the menubutton and menu size
|
68
|
+
# and -direction option.
|
69
|
+
#
|
70
|
+
# TODO: adjust menu width to be at least as wide as the button
|
71
|
+
# for -direction above, below.
|
72
|
+
#
|
73
|
+
proc ttk::menubutton::PostPosition {mb menu} {
|
74
|
+
set x [winfo rootx $mb]
|
75
|
+
set y [winfo rooty $mb]
|
76
|
+
set dir [$mb cget -direction]
|
77
|
+
|
78
|
+
set bw [winfo width $mb]
|
79
|
+
set bh [winfo height $mb]
|
80
|
+
set mw [winfo reqwidth $menu]
|
81
|
+
set mh [winfo reqheight $menu]
|
82
|
+
set sw [expr {[winfo screenwidth $menu] - $bw - $mw}]
|
83
|
+
set sh [expr {[winfo screenheight $menu] - $bh - $mh}]
|
84
|
+
|
85
|
+
switch -- $dir {
|
86
|
+
above { if {$y >= $mh} { incr y -$mh } { incr y $bh } }
|
87
|
+
below { if {$y <= $sh} { incr y $bh } { incr y -$mh } }
|
88
|
+
left { if {$x >= $mw} { incr x -$mw } { incr x $bw } }
|
89
|
+
right { if {$x <= $sw} { incr x $bw } { incr x -$mw } }
|
90
|
+
flush {
|
91
|
+
# post menu atop menubutton.
|
92
|
+
# If there's a menu entry whose label matches the
|
93
|
+
# menubutton -text, assume this is an optionmenu
|
94
|
+
# and place that entry over the menubutton.
|
95
|
+
set index [FindMenuEntry $menu [$mb cget -text]]
|
96
|
+
if {$index ne ""} {
|
97
|
+
incr y -[$menu yposition $index]
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
return [list $x $y]
|
103
|
+
}
|
104
|
+
|
105
|
+
# Popdown --
|
106
|
+
# Post the menu and set a grab on the menu.
|
107
|
+
#
|
108
|
+
proc ttk::menubutton::Popdown {mb} {
|
109
|
+
if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
|
110
|
+
return
|
111
|
+
}
|
112
|
+
foreach {x y} [PostPosition $mb $menu] { break }
|
113
|
+
tk_popup $menu $x $y
|
114
|
+
}
|
115
|
+
|
116
|
+
# Pulldown (X11 only) --
|
117
|
+
# Called when Button1 is pressed on a menubutton.
|
118
|
+
# Posts the menu; a subsequent ButtonRelease
|
119
|
+
# or Leave event will set a grab on the menu.
|
120
|
+
#
|
121
|
+
proc ttk::menubutton::Pulldown {mb} {
|
122
|
+
variable State
|
123
|
+
if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
|
124
|
+
return
|
125
|
+
}
|
126
|
+
foreach {x y} [PostPosition $mb $menu] { break }
|
127
|
+
set State(pulldown) 1
|
128
|
+
set State(oldcursor) [$mb cget -cursor]
|
129
|
+
|
130
|
+
$mb state pressed
|
131
|
+
$mb configure -cursor [$menu cget -cursor]
|
132
|
+
$menu post $x $y
|
133
|
+
tk_menuSetFocus $menu
|
134
|
+
}
|
135
|
+
|
136
|
+
# TransferGrab (X11 only) --
|
137
|
+
# Switch from pulldown mode (menubutton has an implicit grab)
|
138
|
+
# to popdown mode (menu has an explicit grab).
|
139
|
+
#
|
140
|
+
proc ttk::menubutton::TransferGrab {mb} {
|
141
|
+
variable State
|
142
|
+
if {$State(pulldown)} {
|
143
|
+
$mb configure -cursor $State(oldcursor)
|
144
|
+
$mb state {!pressed !active}
|
145
|
+
set State(pulldown) 0
|
146
|
+
|
147
|
+
set menu [$mb cget -menu]
|
148
|
+
tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
# FindMenuEntry --
|
153
|
+
# Hack to support tk_optionMenus.
|
154
|
+
# Returns the index of the menu entry with a matching -label,
|
155
|
+
# -1 if not found.
|
156
|
+
#
|
157
|
+
proc ttk::menubutton::FindMenuEntry {menu s} {
|
158
|
+
set last [$menu index last]
|
159
|
+
if {$last eq "none"} {
|
160
|
+
return ""
|
161
|
+
}
|
162
|
+
for {set i 0} {$i <= $last} {incr i} {
|
163
|
+
if {![catch {$menu entrycget $i -label} label]
|
164
|
+
&& ($label eq $s)} {
|
165
|
+
return $i
|
166
|
+
}
|
167
|
+
}
|
168
|
+
return ""
|
169
|
+
}
|
170
|
+
|
171
|
+
#*EOF*
|
@@ -0,0 +1,193 @@
|
|
1
|
+
#
|
2
|
+
# notebook.tcl,v 1.24 2007/02/26 18:06:26 hobbs Exp
|
3
|
+
#
|
4
|
+
# Bindings for TNotebook widget
|
5
|
+
#
|
6
|
+
|
7
|
+
namespace eval ttk::notebook {
|
8
|
+
variable TLNotebooks ;# See enableTraversal
|
9
|
+
}
|
10
|
+
|
11
|
+
bind TNotebook <ButtonPress-1> { ttk::notebook::Press %W %x %y }
|
12
|
+
bind TNotebook <Key-Right> { ttk::notebook::CycleTab %W 1; break }
|
13
|
+
bind TNotebook <Key-Left> { ttk::notebook::CycleTab %W -1; break }
|
14
|
+
bind TNotebook <Control-Key-Tab> { ttk::notebook::CycleTab %W 1; break }
|
15
|
+
bind TNotebook <Control-Shift-Key-Tab> { ttk::notebook::CycleTab %W -1; break }
|
16
|
+
catch {
|
17
|
+
bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
|
18
|
+
}
|
19
|
+
bind TNotebook <Destroy> { ttk::notebook::Cleanup %W }
|
20
|
+
|
21
|
+
# ActivateTab $nb $tab --
|
22
|
+
# Select the specified tab and set focus.
|
23
|
+
#
|
24
|
+
# If $tab was already the current tab, set the focus to the
|
25
|
+
# notebook widget. Otherwise, set the focus to the first
|
26
|
+
# traversable widget in the pane. The behavior is that the
|
27
|
+
# notebook takes focus when the user selects the same tab
|
28
|
+
# a second time. This mirrors Windows tab behavior.
|
29
|
+
#
|
30
|
+
proc ttk::notebook::ActivateTab {w tab} {
|
31
|
+
if {[$w index $tab] eq [$w index current]} {
|
32
|
+
focus $w
|
33
|
+
} else {
|
34
|
+
$w select $tab
|
35
|
+
update ;# needed so focus logic sees correct mapped/unmapped states
|
36
|
+
if {[set f [ttk::focusFirst [$w select]]] ne ""} {
|
37
|
+
ttk::traverseTo $f
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
# Press $nb $x $y --
|
43
|
+
# ButtonPress-1 binding for notebook widgets.
|
44
|
+
# Activate the tab under the mouse cursor, if any.
|
45
|
+
#
|
46
|
+
proc ttk::notebook::Press {w x y} {
|
47
|
+
set index [$w index @$x,$y]
|
48
|
+
if {$index ne ""} {
|
49
|
+
ActivateTab $w $index
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
# CycleTab --
|
54
|
+
# Select the next/previous tab in the list.
|
55
|
+
#
|
56
|
+
proc ttk::notebook::CycleTab {w dir} {
|
57
|
+
if {[$w index end] != 0} {
|
58
|
+
set current [$w index current]
|
59
|
+
set select [expr {($current + $dir) % [$w index end]}]
|
60
|
+
while {[$w tab $select -state] != "normal" && ($select != $current)} {
|
61
|
+
set select [expr {($select + $dir) % [$w index end]}]
|
62
|
+
}
|
63
|
+
if {$select != $current} {
|
64
|
+
ActivateTab $w $select
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
# MnemonicTab $nb $key --
|
70
|
+
# Scan all tabs in the specified notebook for one with the
|
71
|
+
# specified mnemonic. If found, returns path name of tab;
|
72
|
+
# otherwise returns ""
|
73
|
+
#
|
74
|
+
proc ttk::notebook::MnemonicTab {nb key} {
|
75
|
+
set key [string toupper $key]
|
76
|
+
foreach tab [$nb tabs] {
|
77
|
+
set label [$nb tab $tab -text]
|
78
|
+
set underline [$nb tab $tab -underline]
|
79
|
+
set mnemonic [string toupper [string index $label $underline]]
|
80
|
+
if {$mnemonic ne "" && $mnemonic eq $key} {
|
81
|
+
return $tab
|
82
|
+
}
|
83
|
+
}
|
84
|
+
return ""
|
85
|
+
}
|
86
|
+
|
87
|
+
# +++ Toplevel keyboard traversal.
|
88
|
+
#
|
89
|
+
|
90
|
+
# enableTraversal --
|
91
|
+
# Enable keyboard traversal for a notebook widget
|
92
|
+
# by adding bindings to the containing toplevel window.
|
93
|
+
#
|
94
|
+
# TLNotebooks($top) keeps track of the list of all traversal-enabled
|
95
|
+
# notebooks contained in the toplevel
|
96
|
+
#
|
97
|
+
proc ttk::notebook::enableTraversal {nb} {
|
98
|
+
variable TLNotebooks
|
99
|
+
|
100
|
+
set top [winfo toplevel $nb]
|
101
|
+
|
102
|
+
if {![info exists TLNotebooks($top)]} {
|
103
|
+
# Augment $top bindings:
|
104
|
+
#
|
105
|
+
bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1}
|
106
|
+
bind $top <Shift-Control-Key-Tab> {+ttk::notebook::TLCycleTab %W -1}
|
107
|
+
catch {
|
108
|
+
bind $top <Control-Key-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
|
109
|
+
}
|
110
|
+
if {[tk windowingsystem] eq "aqua"} {
|
111
|
+
bind $top <Option-KeyPress> \
|
112
|
+
+[list ttk::notebook::MnemonicActivation $top %K]
|
113
|
+
} else {
|
114
|
+
bind $top <Alt-KeyPress> \
|
115
|
+
+[list ttk::notebook::MnemonicActivation $top %K]
|
116
|
+
}
|
117
|
+
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
|
118
|
+
}
|
119
|
+
|
120
|
+
lappend TLNotebooks($top) $nb
|
121
|
+
}
|
122
|
+
|
123
|
+
# TLCleanup -- <Destroy> binding for traversal-enabled toplevels
|
124
|
+
#
|
125
|
+
proc ttk::notebook::TLCleanup {w} {
|
126
|
+
variable TLNotebooks
|
127
|
+
if {$w eq [winfo toplevel $w]} {
|
128
|
+
unset -nocomplain -please TLNotebooks($w)
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
# Cleanup -- <Destroy> binding for notebooks
|
133
|
+
#
|
134
|
+
proc ttk::notebook::Cleanup {nb} {
|
135
|
+
variable TLNotebooks
|
136
|
+
set top [winfo toplevel $nb]
|
137
|
+
if {[info exists TLNotebooks($top)]} {
|
138
|
+
set index [lsearch -exact $TLNotebooks($top) $nb]
|
139
|
+
set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index]
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
# EnclosingNotebook $w --
|
144
|
+
# Return the nearest traversal-enabled notebook widget
|
145
|
+
# that contains $w.
|
146
|
+
#
|
147
|
+
# BUGS: this only works properly for tabs that are direct children
|
148
|
+
# of the notebook widget. This routine should follow the
|
149
|
+
# geometry manager hierarchy, not window ancestry, but that
|
150
|
+
# information is not available in Tk.
|
151
|
+
#
|
152
|
+
proc ttk::notebook::EnclosingNotebook {w} {
|
153
|
+
variable TLNotebooks
|
154
|
+
|
155
|
+
set top [winfo toplevel $w]
|
156
|
+
if {![info exists TLNotebooks($top)]} { return }
|
157
|
+
|
158
|
+
while {$w ne $top && $w ne ""} {
|
159
|
+
if {[lsearch -exact $TLNotebooks($top) $w] >= 0} {
|
160
|
+
return $w
|
161
|
+
}
|
162
|
+
set w [winfo parent $w]
|
163
|
+
}
|
164
|
+
return ""
|
165
|
+
}
|
166
|
+
|
167
|
+
# TLCycleTab --
|
168
|
+
# toplevel binding procedure for Control-Tab / Shift-Control-Tab
|
169
|
+
# Select the next/previous tab in the nearest ancestor notebook.
|
170
|
+
#
|
171
|
+
proc ttk::notebook::TLCycleTab {w dir} {
|
172
|
+
set nb [EnclosingNotebook $w]
|
173
|
+
if {$nb ne ""} {
|
174
|
+
CycleTab $nb $dir
|
175
|
+
return -code break
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
# MnemonicActivation $nb $key --
|
180
|
+
# Alt-KeyPress binding procedure for mnemonic activation.
|
181
|
+
# Scan all notebooks in specified toplevel for a tab with the
|
182
|
+
# the specified mnemonic. If found, activate it and return TCL_BREAK.
|
183
|
+
#
|
184
|
+
proc ttk::notebook::MnemonicActivation {top key} {
|
185
|
+
variable TLNotebooks
|
186
|
+
foreach nb $TLNotebooks($top) {
|
187
|
+
if {[set tab [MnemonicTab $nb $key]] ne ""} {
|
188
|
+
ActivateTab $nb [$nb index $tab]
|
189
|
+
return -code break
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#
|
2
|
+
# paned.tcl,v 1.5 2007/06/09 21:45:51 jenglish Exp
|
3
|
+
#
|
4
|
+
# Bindings for ttk::panedwindow widget.
|
5
|
+
#
|
6
|
+
|
7
|
+
namespace eval ttk::panedwindow {
|
8
|
+
variable State
|
9
|
+
array set State {
|
10
|
+
pressed 0
|
11
|
+
pressX -
|
12
|
+
pressY -
|
13
|
+
sash -
|
14
|
+
sashPos -
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
## Bindings:
|
19
|
+
#
|
20
|
+
bind TPanedwindow <ButtonPress-1> { ttk::panedwindow::Press %W %x %y }
|
21
|
+
bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y }
|
22
|
+
bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y }
|
23
|
+
|
24
|
+
bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y }
|
25
|
+
bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y }
|
26
|
+
bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W }
|
27
|
+
# See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
|
28
|
+
bind TPanedwindow <<EnteredChild>> { ttk::panedwindow::ResetCursor %W }
|
29
|
+
|
30
|
+
|
31
|
+
## Sash movement:
|
32
|
+
#
|
33
|
+
proc ttk::panedwindow::Press {w x y} {
|
34
|
+
variable State
|
35
|
+
|
36
|
+
set sash [$w identify $x $y]
|
37
|
+
if {$sash eq ""} {
|
38
|
+
set State(pressed) 0
|
39
|
+
return
|
40
|
+
}
|
41
|
+
set State(pressed) 1
|
42
|
+
set State(pressX) $x
|
43
|
+
set State(pressY) $y
|
44
|
+
set State(sash) $sash
|
45
|
+
set State(sashPos) [$w sashpos $sash]
|
46
|
+
}
|
47
|
+
|
48
|
+
proc ttk::panedwindow::Drag {w x y} {
|
49
|
+
variable State
|
50
|
+
if {!$State(pressed)} { return }
|
51
|
+
switch -- [$w cget -orient] {
|
52
|
+
horizontal { set delta [expr {$x - $State(pressX)}] }
|
53
|
+
vertical { set delta [expr {$y - $State(pressY)}] }
|
54
|
+
}
|
55
|
+
$w sashpos $State(sash) [expr {$State(sashPos) + $delta}]
|
56
|
+
}
|
57
|
+
|
58
|
+
proc ttk::panedwindow::Release {w x y} {
|
59
|
+
variable State
|
60
|
+
set State(pressed) 0
|
61
|
+
SetCursor $w $x $y
|
62
|
+
}
|
63
|
+
|
64
|
+
## Cursor management:
|
65
|
+
#
|
66
|
+
proc ttk::panedwindow::ResetCursor {w} {
|
67
|
+
variable State
|
68
|
+
if {!$State(pressed)} {
|
69
|
+
$w configure -cursor {}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
proc ttk::panedwindow::SetCursor {w x y} {
|
74
|
+
variable ::ttk::Cursors
|
75
|
+
|
76
|
+
if {![llength [$w identify $x $y]]} {
|
77
|
+
ResetCursor $w
|
78
|
+
} else {
|
79
|
+
# Assume we're over a sash.
|
80
|
+
switch -- [$w cget -orient] {
|
81
|
+
horizontal { $w configure -cursor $Cursors(hresize) }
|
82
|
+
vertical { $w configure -cursor $Cursors(vresize) }
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
#*EOF*
|