Pratt 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. data/.exrc +61 -0
  2. data/.gitignore +4 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +46 -0
  5. data/Pratt.gemspec +351 -0
  6. data/README.txt +66 -0
  7. data/Rakefile +85 -0
  8. data/TODO +54 -0
  9. data/VERSION +1 -0
  10. data/bin/pratt.rb +13 -0
  11. data/config.rb +34 -0
  12. data/lib/pratt.rb +527 -0
  13. data/lib/pratt/array.rb +11 -0
  14. data/lib/pratt/string.rb +18 -0
  15. data/models/app.rb +40 -0
  16. data/models/customer.rb +24 -0
  17. data/models/payment.rb +22 -0
  18. data/models/pratt.rb +19 -0
  19. data/models/project.rb +82 -0
  20. data/models/whence.rb +70 -0
  21. data/pkgs/tile-0.8.2.tar.gz +0 -0
  22. data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
  23. data/pkgs/tile-0.8.2/ChangeLog +4651 -0
  24. data/pkgs/tile-0.8.2/Makefile +250 -0
  25. data/pkgs/tile-0.8.2/Makefile.in +250 -0
  26. data/pkgs/tile-0.8.2/README.txt +86 -0
  27. data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
  28. data/pkgs/tile-0.8.2/altTheme.o +0 -0
  29. data/pkgs/tile-0.8.2/blink.o +0 -0
  30. data/pkgs/tile-0.8.2/button.o +0 -0
  31. data/pkgs/tile-0.8.2/cache.o +0 -0
  32. data/pkgs/tile-0.8.2/clamTheme.o +0 -0
  33. data/pkgs/tile-0.8.2/classicTheme.o +0 -0
  34. data/pkgs/tile-0.8.2/config.log +1330 -0
  35. data/pkgs/tile-0.8.2/config.status +795 -0
  36. data/pkgs/tile-0.8.2/configure +15248 -0
  37. data/pkgs/tile-0.8.2/configure.in +89 -0
  38. data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
  39. data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
  40. data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
  41. data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
  42. data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
  43. data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
  44. data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
  45. data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
  46. data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
  47. data/pkgs/tile-0.8.2/doc/Makefile +36 -0
  48. data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
  49. data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
  50. data/pkgs/tile-0.8.2/doc/button.n +75 -0
  51. data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
  52. data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
  53. data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
  54. data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
  55. data/pkgs/tile-0.8.2/doc/entry.n +438 -0
  56. data/pkgs/tile-0.8.2/doc/frame.n +43 -0
  57. data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
  58. data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
  59. data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
  60. data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
  61. data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
  62. data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
  63. data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
  64. data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
  65. data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
  66. data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
  67. data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
  68. data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
  69. data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
  70. data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
  71. data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
  72. data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
  73. data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
  74. data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
  75. data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
  76. data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
  77. data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
  78. data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
  79. data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
  80. data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
  81. data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
  82. data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
  83. data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
  84. data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
  85. data/pkgs/tile-0.8.2/doc/image.n +81 -0
  86. data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
  87. data/pkgs/tile-0.8.2/doc/label.n +75 -0
  88. data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
  89. data/pkgs/tile-0.8.2/doc/man.macros +239 -0
  90. data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
  91. data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
  92. data/pkgs/tile-0.8.2/doc/paned.n +95 -0
  93. data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
  94. data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
  95. data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
  96. data/pkgs/tile-0.8.2/doc/separator.n +30 -0
  97. data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
  98. data/pkgs/tile-0.8.2/doc/style.n +119 -0
  99. data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
  100. data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
  101. data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
  102. data/pkgs/tile-0.8.2/doc/widget.n +227 -0
  103. data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
  104. data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
  105. data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
  106. data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
  107. data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
  108. data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
  109. data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
  110. data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
  111. data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
  112. data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
  113. data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
  114. data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
  115. data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
  116. data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
  117. data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
  118. data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
  119. data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
  120. data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
  121. data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
  122. data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
  123. data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
  124. data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
  125. data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
  126. data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
  127. data/pkgs/tile-0.8.2/entry.o +0 -0
  128. data/pkgs/tile-0.8.2/frame.o +0 -0
  129. data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
  130. data/pkgs/tile-0.8.2/generic/TODO +493 -0
  131. data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
  132. data/pkgs/tile-0.8.2/generic/blink.c +168 -0
  133. data/pkgs/tile-0.8.2/generic/button.c +858 -0
  134. data/pkgs/tile-0.8.2/generic/cache.c +354 -0
  135. data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
  136. data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
  137. data/pkgs/tile-0.8.2/generic/configure +10334 -0
  138. data/pkgs/tile-0.8.2/generic/configure.in +100 -0
  139. data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
  140. data/pkgs/tile-0.8.2/generic/frame.c +648 -0
  141. data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
  142. data/pkgs/tile-0.8.2/generic/image.c +416 -0
  143. data/pkgs/tile-0.8.2/generic/label.c +663 -0
  144. data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
  145. data/pkgs/tile-0.8.2/generic/manager.c +554 -0
  146. data/pkgs/tile-0.8.2/generic/manager.h +91 -0
  147. data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
  148. data/pkgs/tile-0.8.2/generic/paned.c +958 -0
  149. data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
  150. data/pkgs/tile-0.8.2/generic/progress.c +549 -0
  151. data/pkgs/tile-0.8.2/generic/scale.c +526 -0
  152. data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
  153. data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
  154. data/pkgs/tile-0.8.2/generic/separator.c +132 -0
  155. data/pkgs/tile-0.8.2/generic/square.c +306 -0
  156. data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
  157. data/pkgs/tile-0.8.2/generic/tile.c +296 -0
  158. data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
  159. data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
  160. data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
  161. data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
  162. data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
  163. data/pkgs/tile-0.8.2/generic/trace.c +145 -0
  164. data/pkgs/tile-0.8.2/generic/track.c +174 -0
  165. data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
  166. data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
  167. data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
  168. data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
  169. data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
  170. data/pkgs/tile-0.8.2/generic/widget.c +785 -0
  171. data/pkgs/tile-0.8.2/generic/widget.h +263 -0
  172. data/pkgs/tile-0.8.2/image.o +0 -0
  173. data/pkgs/tile-0.8.2/label.o +0 -0
  174. data/pkgs/tile-0.8.2/layout.o +0 -0
  175. data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
  176. data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
  177. data/pkgs/tile-0.8.2/library/button.tcl +85 -0
  178. data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
  179. data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
  180. data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
  181. data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
  182. data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
  183. data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
  184. data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
  185. data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
  186. data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
  187. data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
  188. data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
  189. data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
  190. data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
  191. data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
  192. data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
  193. data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
  194. data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
  195. data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
  196. data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
  197. data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
  198. data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
  199. data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
  200. data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
  201. data/pkgs/tile-0.8.2/libttkstub.a +0 -0
  202. data/pkgs/tile-0.8.2/license.terms +24 -0
  203. data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
  204. data/pkgs/tile-0.8.2/manager.o +0 -0
  205. data/pkgs/tile-0.8.2/notebook.o +0 -0
  206. data/pkgs/tile-0.8.2/paned.o +0 -0
  207. data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
  208. data/pkgs/tile-0.8.2/progress.o +0 -0
  209. data/pkgs/tile-0.8.2/scale.o +0 -0
  210. data/pkgs/tile-0.8.2/scroll.o +0 -0
  211. data/pkgs/tile-0.8.2/scrollbar.o +0 -0
  212. data/pkgs/tile-0.8.2/separator.o +0 -0
  213. data/pkgs/tile-0.8.2/tagset.o +0 -0
  214. data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
  215. data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
  216. data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
  217. data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
  218. data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
  219. data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
  220. data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
  221. data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
  222. data/pkgs/tile-0.8.2/tests/entry.test +285 -0
  223. data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
  224. data/pkgs/tile-0.8.2/tests/image.test +94 -0
  225. data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
  226. data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
  227. data/pkgs/tile-0.8.2/tests/layout.test +33 -0
  228. data/pkgs/tile-0.8.2/tests/misc.test +35 -0
  229. data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
  230. data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
  231. data/pkgs/tile-0.8.2/tests/paned.test +298 -0
  232. data/pkgs/tile-0.8.2/tests/progress.test +92 -0
  233. data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
  234. data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
  235. data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
  236. data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
  237. data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
  238. data/pkgs/tile-0.8.2/tests/tile.test +674 -0
  239. data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
  240. data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
  241. data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
  242. data/pkgs/tile-0.8.2/tests/validate.test +278 -0
  243. data/pkgs/tile-0.8.2/tile.o +0 -0
  244. data/pkgs/tile-0.8.2/tkElements.o +0 -0
  245. data/pkgs/tile-0.8.2/tkTheme.o +0 -0
  246. data/pkgs/tile-0.8.2/tkstate.o +0 -0
  247. data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
  248. data/pkgs/tile-0.8.2/trace.o +0 -0
  249. data/pkgs/tile-0.8.2/track.o +0 -0
  250. data/pkgs/tile-0.8.2/treeview.o +0 -0
  251. data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
  252. data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
  253. data/pkgs/tile-0.8.2/widget.o +0 -0
  254. data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
  255. data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
  256. data/pkgs/tile-0.8.2/win/monitor.c +164 -0
  257. data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
  258. data/pkgs/tile-0.8.2/win/rules.vc +512 -0
  259. data/pkgs/tile-0.8.2/win/tile.rc +40 -0
  260. data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
  261. data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
  262. data/spec/app_spec.rb +48 -0
  263. data/spec/customer_spec.rb +31 -0
  264. data/spec/fixtures/graph.expectation +18 -0
  265. data/spec/payment_spec.rb +19 -0
  266. data/spec/pratt_spec.rb +148 -0
  267. data/spec/project_spec.rb +163 -0
  268. data/spec/rcov.opts +0 -0
  269. data/spec/spec.opts +1 -0
  270. data/spec/spec_helper.rb +21 -0
  271. data/spec/whence_spec.rb +54 -0
  272. data/tasks/pratt.rb +84 -0
  273. data/templates/model.eruby +12 -0
  274. data/templates/spec.eruby +8 -0
  275. data/views/env.rb +22 -0
  276. data/views/graph.eruby +20 -0
  277. data/views/invoice.eruby +148 -0
  278. data/views/main.rb +92 -0
  279. data/views/pid.eruby +3 -0
  280. data/views/pop.rb +94 -0
  281. data/views/pop2.rb +75 -0
  282. data/views/raw.eruby +11 -0
  283. 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*