arcadia 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/README +126 -123
  2. data/arcadia.rb +770 -756
  3. data/base/a-contracts.rb +130 -93
  4. data/base/a-ext.rb +280 -280
  5. data/base/a-libs.rb +5 -11
  6. data/base/a-utils.rb +235 -44
  7. data/conf/arcadia.conf +20 -16
  8. data/conf/arcadia.init.rb +0 -0
  9. data/conf/arcadia.res.rb +74 -0
  10. data/ext/ae-complete-code/ae-complete-code.conf +0 -0
  11. data/ext/ae-complete-code/ae-complete-code.rb +80 -79
  12. data/ext/ae-debug/ae-debug.conf +0 -0
  13. data/ext/ae-debug/ae-debug.rb +2 -6
  14. data/ext/ae-debug/debug1.57.rb +0 -0
  15. data/ext/ae-doc-code/ae-doc-code.conf +15 -0
  16. data/ext/ae-doc-code/ae-doc-code.rb +289 -0
  17. data/ext/ae-editor/ae-editor.conf +17 -8
  18. data/ext/ae-editor/ae-editor.rb +738 -396
  19. data/ext/ae-event-log/ae-event-log.conf +0 -0
  20. data/ext/ae-event-log/ae-event-log.rb +0 -0
  21. data/ext/ae-file-history/ae-file-history.conf +2 -2
  22. data/ext/ae-file-history/ae-file-history.rb +286 -290
  23. data/ext/ae-inspector/ae-inspector.conf +0 -0
  24. data/ext/ae-inspector/ae-inspector.rb +0 -0
  25. data/ext/ae-output-event/ae-output-event.conf +2 -2
  26. data/ext/ae-output/ae-output.conf +2 -2
  27. data/ext/ae-output/ae-output.rb +173 -178
  28. data/ext/ae-palette/ae-palette.conf +0 -0
  29. data/ext/ae-palette/ae-palette.rb +0 -0
  30. data/ext/ae-shell/ae-shell.conf +0 -0
  31. data/ext/ae-shell/ae-shell.rb +54 -54
  32. data/lib/tk/al-tk.rb +3076 -3082
  33. data/lib/tk/al-tk.res.rb +0 -0
  34. data/lib/tk/al-tkarcadia.rb +0 -0
  35. data/lib/tk/al-tkcustom.rb +0 -0
  36. data/lib/tkext/al-bwidget.rb +0 -0
  37. data/lib/tkext/al-iwidgets.rb +0 -0
  38. data/lib/tkext/al-tile.rb +0 -0
  39. data/lib/tkext/al-tktable.rb +0 -0
  40. data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
  41. data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
  42. data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
  43. data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
  44. data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
  45. data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
  46. data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
  47. data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
  48. data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
  49. data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
  50. data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
  51. data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
  52. data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
  53. data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
  54. data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
  55. data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
  56. data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
  57. data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
  58. data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
  59. data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
  60. data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
  61. data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
  62. data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
  63. data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
  64. data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
  65. data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
  66. data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
  67. data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
  68. data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
  69. data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
  70. data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
  71. data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
  72. data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
  73. data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
  74. data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
  75. data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
  76. data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
  77. data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
  78. data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
  79. data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
  80. data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
  81. data/tcl/BWidget-1.8.0/README.txt +127 -0
  82. data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
  83. data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
  84. data/tcl/BWidget-1.8.0/button.tcl +324 -0
  85. data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
  86. data/tcl/BWidget-1.8.0/color.tcl +493 -0
  87. data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
  88. data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
  89. data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
  90. data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
  91. data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
  92. data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
  93. data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
  94. data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
  95. data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
  96. data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
  97. data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
  98. data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
  99. data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
  100. data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
  101. data/tcl/BWidget-1.8.0/entry.tcl +469 -0
  102. data/tcl/BWidget-1.8.0/font.tcl +566 -0
  103. data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
  104. data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
  105. data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
  106. data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
  107. data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
  108. data/tcl/BWidget-1.8.0/images/error.gif +0 -0
  109. data/tcl/BWidget-1.8.0/images/file.gif +0 -0
  110. data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
  111. data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
  112. data/tcl/BWidget-1.8.0/images/info.gif +0 -0
  113. data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
  114. data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
  115. data/tcl/BWidget-1.8.0/images/new.gif +0 -0
  116. data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
  117. data/tcl/BWidget-1.8.0/images/open.gif +0 -0
  118. data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
  119. data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
  120. data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
  121. data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
  122. data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
  123. data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
  124. data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
  125. data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
  126. data/tcl/BWidget-1.8.0/images/print.gif +0 -0
  127. data/tcl/BWidget-1.8.0/images/question.gif +0 -0
  128. data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
  129. data/tcl/BWidget-1.8.0/images/save.gif +0 -0
  130. data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
  131. data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
  132. data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
  133. data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
  134. data/tcl/BWidget-1.8.0/init.tcl +40 -0
  135. data/tcl/BWidget-1.8.0/label.tcl +271 -0
  136. data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
  137. data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
  138. data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
  139. data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
  140. data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
  141. data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
  142. data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
  143. data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
  144. data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
  145. data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
  146. data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
  147. data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
  148. data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
  149. data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
  150. data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
  151. data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
  152. data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
  153. data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
  154. data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
  155. data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
  156. data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
  157. data/tcl/BWidget-1.8.0/separator.tcl +75 -0
  158. data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
  159. data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
  160. data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
  161. data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
  162. data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
  163. data/tcl/BWidget-1.8.0/utils.tcl +645 -0
  164. data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
  165. data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
  166. data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
  167. metadata +141 -5
@@ -0,0 +1,41 @@
1
+ BWidget ToolKit
2
+ Copyright (c) 1998-1999 UNIFIX.
3
+ Copyright (c) 2001-2002 ActiveState Corp.
4
+
5
+ The following terms apply to all files associated with the software
6
+ unless explicitly disclaimed in individual files.
7
+
8
+ The authors hereby grant permission to use, copy, modify, distribute,
9
+ and license this software and its documentation for any purpose, provided
10
+ that existing copyright notices are retained in all copies and that this
11
+ notice is included verbatim in any distributions. No written agreement,
12
+ license, or royalty fee is required for any of the authorized uses.
13
+ Modifications to this software may be copyrighted by their authors
14
+ and need not follow the licensing terms described here, provided that
15
+ the new terms are clearly indicated on the first page of each file where
16
+ they apply.
17
+
18
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
19
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
20
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
21
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
22
+ POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
25
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
27
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
28
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
29
+ MODIFICATIONS.
30
+
31
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
32
+ U.S. government, the Government shall have only "Restricted Rights"
33
+ in the software and related documentation as defined in the Federal
34
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
35
+ are acquiring the software on behalf of the Department of Defense, the
36
+ software shall be classified as "Commercial Computer Software" and the
37
+ Government shall have only "Restricted Rights" as defined in Clause
38
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
39
+ authors grant the U.S. Government and others acting in its behalf
40
+ permission to use and distribute the software in accordance with the
41
+ terms specified in this license.
@@ -0,0 +1,127 @@
1
+ BWidget ToolKit 1.8.0 October 2006
2
+ Copyright (c) 1998-1999 UNIFIX.
3
+ Copyright (c) 2001-2002 ActiveState Corp.
4
+
5
+ See the file LICENSE.txt for license info (uses Tcl's BSD-style license).
6
+
7
+ --------------------------------------------------------------------------
8
+
9
+ WHAT IS BWIDGET ?
10
+
11
+ The BWidget Toolkit is a high-level Widget Set for Tcl/Tk built using
12
+ native Tcl/Tk 8.x namespaces.
13
+
14
+ The BWidgets have a professional look&feel as in other well known
15
+ Toolkits (Tix or Incr Widgets), but the concept is radically different
16
+ because everything is pure Tcl/Tk. No platform dependencies, and no
17
+ compiling required. The code is 100% Pure Tcl/Tk.
18
+
19
+ The BWidget library was originally developed by UNIFIX Online, and
20
+ released under both the GNU Public License and the Tcl license.
21
+ BWidget is now maintained as a community project, hosted by
22
+ Sourceforge. Scores of fixes and enhancements have been added by
23
+ community developers. See the ChangeLog file for details.
24
+
25
+ --------------------------------------------------------------------------
26
+
27
+ WIDGET LIST (1.8)
28
+
29
+ Simple Widgets
30
+ Label Extended Label widget
31
+ Entry Extended Entry widget
32
+ Button Extended Button widget
33
+ ArrowButton Button widget with an arrow shape.
34
+ ProgressBar Progress indicator widget
35
+ ScrollView Display the visible area of a scrolled window
36
+ Separator 3D separator widget
37
+
38
+ Manager Widgets
39
+ MainFrame Manage toplevel with menu, toolbar and statusbar
40
+ LabelFrame Frame with a Label
41
+ TitleFrame Frame with a title
42
+ ScrolledWindow Generic scrolled widget
43
+ ScrollableFrame Scrollable frame containing widget
44
+ PanedWindow Tiled layout manager widget
45
+ ButtonBox Set of buttons with horizontal or vertical layout
46
+ PagesManager Pages manager widget
47
+ NoteBook Notebook manager widget
48
+ Dialog Dialog abstraction with custom buttons
49
+
50
+ Composite Widgets
51
+ LabelEntry LabelFrame containing an Entry widget.
52
+ ComboBox ComboBox widget
53
+ SpinBox SpinBox widget
54
+ Tree Tree widget
55
+ ListBox ListBox widget
56
+ MessageDlg Message dialog box
57
+ ProgressDlg Progress indicator dialog box
58
+ PasswdDlg Login/Password dialog box (contributed by Stephane Lavirotte)
59
+ SelectFont Font selection widget
60
+ SelectColor Color selection widget
61
+
62
+ Commands Classes
63
+ Widget The Widget base class
64
+ DynamicHelp Provide help to Tk widget or BWidget
65
+ DragSite Commands set for Drag facilities
66
+ DropSite Commands set for Drop facilities
67
+ BWidget Utilities
68
+
69
+ --------------------------------------------------------------------------
70
+ INSTALLATION AND USE
71
+
72
+ - On Unix Platform:
73
+ Uncompress the file BWidget-<version>.tar.Z|gz
74
+
75
+ To use the BWidget:
76
+ - If you have uncompressed the archive file under the Tcl Library Path
77
+ directory, you only need to do:
78
+ % package require BWidget
79
+ - If not, you have to specify the BWidget installation path in auto_path
80
+ global variable:
81
+ % lappend auto_path <install_path>
82
+ % package require BWidget
83
+
84
+ To launch the demo, you need to cd into the demo subdirectory:
85
+ $ cd <install_path>/demo
86
+ $ wish demo.tcl
87
+
88
+ - On Windows and others Platforms:
89
+ Uncompress the file BWidget-<version>.zip
90
+
91
+ To use the BWidget:
92
+ - If you uncompressed the archive file under the Tcl Library Path
93
+ directory, you only need to do:
94
+ % package require BWidget
95
+ - If not, you have to specify the BWidget installation path in auto_path
96
+ global variable:
97
+ % lappend auto_path your_path
98
+ % package require BWidget
99
+
100
+ To launch the demo :
101
+ Double click on demo.tcl in the demo subdirectory
102
+
103
+
104
+ Distribution contains these directories:
105
+
106
+ BWidget-<version> Root directory and BWidget Tcl sources
107
+ BWman HTML manual pages
108
+ images images used by BWidget
109
+ lang Resources for language customization
110
+ demo Demo sources
111
+ tests BWidgets test suite
112
+
113
+
114
+ --------------------------------------------------------------------------
115
+
116
+ DOCUMENTATION
117
+
118
+ HTML manual pages are available in the BWman subdirectory. Point to
119
+ index.html for frame version with tree navigation, or to contents.html
120
+ for no frame version.
121
+
122
+ --------------------------------------------------------------------------
123
+
124
+ CONTACTS
125
+
126
+ The BWidget toolkit is maintained on Sourceforge, at
127
+ http://www.sourceforge.net/projects/tcllib/
@@ -0,0 +1,551 @@
1
+ # ------------------------------------------------------------------------------
2
+ # arrow.tcl
3
+ # This file is part of Unifix BWidget Toolkit
4
+ # ------------------------------------------------------------------------------
5
+ # Index of commands:
6
+ # Public commands
7
+ # - ArrowButton::create
8
+ # - ArrowButton::configure
9
+ # - ArrowButton::cget
10
+ # - ArrowButton::invoke
11
+ # Private commands (redraw commands)
12
+ # - ArrowButton::_redraw
13
+ # - ArrowButton::_redraw_state
14
+ # - ArrowButton::_redraw_relief
15
+ # - ArrowButton::_redraw_whole
16
+ # Private commands (event bindings)
17
+ # - ArrowButton::_destroy
18
+ # - ArrowButton::_enter
19
+ # - ArrowButton::_leave
20
+ # - ArrowButton::_press
21
+ # - ArrowButton::_release
22
+ # - ArrowButton::_repeat
23
+ # ------------------------------------------------------------------------------
24
+
25
+ namespace eval ArrowButton {
26
+ Widget::define ArrowButton arrow DynamicHelp
27
+
28
+ Widget::tkinclude ArrowButton button .c \
29
+ include [list \
30
+ -borderwidth -bd \
31
+ -relief -highlightbackground \
32
+ -highlightcolor -highlightthickness -takefocus]
33
+
34
+ Widget::declare ArrowButton [list \
35
+ [list -type Enum button 0 [list arrow button]] \
36
+ [list -dir Enum top 0 [list top bottom left right]] \
37
+ [list -width Int 15 0 "%d >= 0"] \
38
+ [list -height Int 15 0 "%d >= 0"] \
39
+ [list -ipadx Int 0 0 "%d >= 0"] \
40
+ [list -ipady Int 0 0 "%d >= 0"] \
41
+ [list -clean Int 2 0 "%d >= 0 && %d <= 2"] \
42
+ [list -activeforeground TkResource "" 0 button] \
43
+ [list -activebackground TkResource "" 0 button] \
44
+ [list -disabledforeground TkResource "" 0 button] \
45
+ [list -foreground TkResource "" 0 button] \
46
+ [list -background TkResource "" 0 button] \
47
+ [list -state TkResource "" 0 button] \
48
+ [list -troughcolor TkResource "" 0 scrollbar] \
49
+ [list -arrowbd Int 1 0 "%d >= 0 && %d <= 2"] \
50
+ [list -arrowrelief Enum raised 0 [list raised sunken]] \
51
+ [list -command String "" 0] \
52
+ [list -armcommand String "" 0] \
53
+ [list -disarmcommand String "" 0] \
54
+ [list -repeatdelay Int 0 0 "%d >= 0"] \
55
+ [list -repeatinterval Int 0 0 "%d >= 0"] \
56
+ [list -fg Synonym -foreground] \
57
+ [list -bg Synonym -background] \
58
+ ]
59
+ DynamicHelp::include ArrowButton balloon
60
+
61
+ bind BwArrowButtonC <Enter> {ArrowButton::_enter %W}
62
+ bind BwArrowButtonC <Leave> {ArrowButton::_leave %W}
63
+ bind BwArrowButtonC <ButtonPress-1> {ArrowButton::_press %W}
64
+ bind BwArrowButtonC <ButtonRelease-1> {ArrowButton::_release %W}
65
+ bind BwArrowButtonC <Key-space> {ArrowButton::invoke %W; break}
66
+ bind BwArrowButtonC <Return> {ArrowButton::invoke %W; break}
67
+ bind BwArrowButton <Configure> {ArrowButton::_redraw_whole %W %w %h}
68
+ bind BwArrowButton <Destroy> {ArrowButton::_destroy %W}
69
+
70
+ variable _grab
71
+ variable _moved
72
+
73
+ array set _grab {current "" pressed "" oldstate "" oldrelief ""}
74
+ }
75
+
76
+
77
+ # -----------------------------------------------------------------------------
78
+ # Command ArrowButton::create
79
+ # -----------------------------------------------------------------------------
80
+ proc ArrowButton::create { path args } {
81
+ # Initialize configuration mappings and parse arguments
82
+ array set submaps [list ArrowButton [list ] .c [list ]]
83
+ array set submaps [Widget::parseArgs ArrowButton $args]
84
+
85
+ # Create the class frame (so we can do the option db queries)
86
+ frame $path -class ArrowButton -borderwidth 0 -highlightthickness 0
87
+ Widget::initFromODB ArrowButton $path $submaps(ArrowButton)
88
+
89
+ # Create the canvas with the initial options
90
+ eval [list canvas $path.c] $submaps(.c)
91
+
92
+ # Compute the width and height of the canvas from the width/height
93
+ # of the ArrowButton and the borderwidth/hightlightthickness.
94
+ set w [Widget::getMegawidgetOption $path -width]
95
+ set h [Widget::getMegawidgetOption $path -height]
96
+ set bd [Widget::cget $path -borderwidth]
97
+ set ht [Widget::cget $path -highlightthickness]
98
+ set pad [expr {2*($bd+$ht)}]
99
+
100
+ $path.c configure -width [expr {$w-$pad}] -height [expr {$h-$pad}]
101
+ bindtags $path [list $path BwArrowButton [winfo toplevel $path] all]
102
+ bindtags $path.c [list $path.c BwArrowButtonC [winfo toplevel $path.c] all]
103
+ pack $path.c -expand yes -fill both
104
+
105
+ DynamicHelp::sethelp $path $path.c 1
106
+
107
+ set ::ArrowButton::_moved($path) 0
108
+
109
+ return [Widget::create ArrowButton $path]
110
+ }
111
+
112
+
113
+ # -----------------------------------------------------------------------------
114
+ # Command ArrowButton::configure
115
+ # -----------------------------------------------------------------------------
116
+ proc ArrowButton::configure { path args } {
117
+ set res [Widget::configure $path $args]
118
+
119
+ set ch1 [expr {[Widget::hasChanged $path -width w] |
120
+ [Widget::hasChanged $path -height h] |
121
+ [Widget::hasChanged $path -borderwidth bd] |
122
+ [Widget::hasChanged $path -highlightthickness ht]}]
123
+ set ch2 [expr {[Widget::hasChanged $path -type val] |
124
+ [Widget::hasChanged $path -ipadx val] |
125
+ [Widget::hasChanged $path -ipady val] |
126
+ [Widget::hasChanged $path -arrowbd val] |
127
+ [Widget::hasChanged $path -clean val] |
128
+ [Widget::hasChanged $path -dir val]}]
129
+
130
+ if { $ch1 } {
131
+ set pad [expr {2*($bd+$ht)}]
132
+ $path.c configure \
133
+ -width [expr {$w-$pad}] -height [expr {$h-$pad}] \
134
+ -borderwidth $bd -highlightthickness $ht
135
+ set ch2 1
136
+ }
137
+ if { $ch2 } {
138
+ _redraw_whole $path [winfo width $path] [winfo height $path]
139
+ } else {
140
+ _redraw_relief $path
141
+ _redraw_state $path
142
+ }
143
+ DynamicHelp::sethelp $path $path.c
144
+
145
+ return $res
146
+ }
147
+
148
+
149
+ # -----------------------------------------------------------------------------
150
+ # Command ArrowButton::cget
151
+ # -----------------------------------------------------------------------------
152
+ proc ArrowButton::cget { path option } {
153
+ return [Widget::cget $path $option]
154
+ }
155
+
156
+
157
+ # ------------------------------------------------------------------------------
158
+ # Command ArrowButton::invoke
159
+ # ------------------------------------------------------------------------------
160
+ proc ArrowButton::invoke { path } {
161
+ if { ![string equal [winfo class $path] "ArrowButton"] } {
162
+ set path [winfo parent $path]
163
+ }
164
+ if { ![string equal [Widget::getoption $path -state] "disabled"] } {
165
+ set oldstate [Widget::getoption $path -state]
166
+ if { [string equal [Widget::getoption $path -type] "button"] } {
167
+ set oldrelief [Widget::getoption $path -relief]
168
+ configure $path -state active -relief sunken
169
+ } else {
170
+ set oldrelief [Widget::getoption $path -arrowrelief]
171
+ configure $path -state active -arrowrelief sunken
172
+ }
173
+ update idletasks
174
+ if {[llength [set cmd [Widget::getoption $path -armcommand]]]} {
175
+ uplevel \#0 $cmd
176
+ }
177
+ after 10
178
+ if { [string equal [Widget::getoption $path -type] "button"] } {
179
+ configure $path -state $oldstate -relief $oldrelief
180
+ } else {
181
+ configure $path -state $oldstate -arrowrelief $oldrelief
182
+ }
183
+ if {[llength [set cmd [Widget::getoption $path -disarmcommand]]]} {
184
+ uplevel \#0 $cmd
185
+ }
186
+ if {[llength [set cmd [Widget::getoption $path -command]]]} {
187
+ uplevel \#0 $cmd
188
+ }
189
+ }
190
+ }
191
+
192
+
193
+ # ------------------------------------------------------------------------------
194
+ # Command ArrowButton::_redraw
195
+ # ------------------------------------------------------------------------------
196
+ proc ArrowButton::_redraw { path width height } {
197
+ variable _moved
198
+
199
+ set _moved($path) 0
200
+ set type [Widget::getoption $path -type]
201
+ set dir [Widget::getoption $path -dir]
202
+ set bd [expr {[$path.c cget -borderwidth] + [$path.c cget -highlightthickness] + 1}]
203
+ set clean [Widget::getoption $path -clean]
204
+ if { [string equal $type "arrow"] } {
205
+ if { [set id [$path.c find withtag rect]] == "" } {
206
+ $path.c create rectangle $bd $bd [expr {$width-$bd-1}] [expr {$height-$bd-1}] -tags rect
207
+ } else {
208
+ $path.c coords $id $bd $bd [expr {$width-$bd-1}] [expr {$height-$bd-1}]
209
+ }
210
+ $path.c lower rect
211
+ set arrbd [Widget::getoption $path -arrowbd]
212
+ set bd [expr {$bd+$arrbd-1}]
213
+ } else {
214
+ $path.c delete rect
215
+ }
216
+ # w and h are max width and max height of arrow
217
+ set w [expr {$width - 2*([Widget::getoption $path -ipadx]+$bd)}]
218
+ set h [expr {$height - 2*([Widget::getoption $path -ipady]+$bd)}]
219
+
220
+ if { $w < 2 } {set w 2}
221
+ if { $h < 2 } {set h 2}
222
+
223
+ if { $clean > 0 } {
224
+ # arrange for base to be odd
225
+ if { [string equal $dir "top"] || [string equal $dir "bottom"] } {
226
+ if { !($w % 2) } {
227
+ incr w -1
228
+ }
229
+ if { $clean == 2 } {
230
+ # arrange for h = (w+1)/2
231
+ set h2 [expr {($w+1)/2}]
232
+ if { $h2 > $h } {
233
+ set w [expr {2*$h-1}]
234
+ } else {
235
+ set h $h2
236
+ }
237
+ }
238
+ } else {
239
+ if { !($h % 2) } {
240
+ incr h -1
241
+ }
242
+ if { $clean == 2 } {
243
+ # arrange for w = (h+1)/2
244
+ set w2 [expr {($h+1)/2}]
245
+ if { $w2 > $w } {
246
+ set h [expr {2*$w-1}]
247
+ } else {
248
+ set w $w2
249
+ }
250
+ }
251
+ }
252
+ }
253
+
254
+ set x0 [expr {($width-$w)/2}]
255
+ set y0 [expr {($height-$h)/2}]
256
+ set x1 [expr {$x0+$w-1}]
257
+ set y1 [expr {$y0+$h-1}]
258
+
259
+ switch $dir {
260
+ top {
261
+ set xd [expr {($x0+$x1)/2}]
262
+ if { [set id [$path.c find withtag poly]] == "" } {
263
+ $path.c create polygon $x0 $y1 $x1 $y1 $xd $y0 -tags poly
264
+ } else {
265
+ $path.c coords $id $x0 $y1 $x1 $y1 $xd $y0
266
+ }
267
+ if { [string equal $type "arrow"] } {
268
+ if { [set id [$path.c find withtag bot]] == "" } {
269
+ $path.c create line $x0 $y1 $x1 $y1 $xd $y0 -tags bot
270
+ } else {
271
+ $path.c coords $id $x0 $y1 $x1 $y1 $xd $y0
272
+ }
273
+ if { [set id [$path.c find withtag top]] == "" } {
274
+ $path.c create line $x0 $y1 $xd $y0 -tags top
275
+ } else {
276
+ $path.c coords $id $x0 $y1 $xd $y0
277
+ }
278
+ $path.c itemconfigure top -width $arrbd
279
+ $path.c itemconfigure bot -width $arrbd
280
+ } else {
281
+ $path.c delete top
282
+ $path.c delete bot
283
+ }
284
+ }
285
+ bottom {
286
+ set xd [expr {($x0+$x1)/2}]
287
+ if { [set id [$path.c find withtag poly]] == "" } {
288
+ $path.c create polygon $x1 $y0 $x0 $y0 $xd $y1 -tags poly
289
+ } else {
290
+ $path.c coords $id $x1 $y0 $x0 $y0 $xd $y1
291
+ }
292
+ if { [string equal $type "arrow"] } {
293
+ if { [set id [$path.c find withtag top]] == "" } {
294
+ $path.c create line $x1 $y0 $x0 $y0 $xd $y1 -tags top
295
+ } else {
296
+ $path.c coords $id $x1 $y0 $x0 $y0 $xd $y1
297
+ }
298
+ if { [set id [$path.c find withtag bot]] == "" } {
299
+ $path.c create line $x1 $y0 $xd $y1 -tags bot
300
+ } else {
301
+ $path.c coords $id $x1 $y0 $xd $y1
302
+ }
303
+ $path.c itemconfigure top -width $arrbd
304
+ $path.c itemconfigure bot -width $arrbd
305
+ } else {
306
+ $path.c delete top
307
+ $path.c delete bot
308
+ }
309
+ }
310
+ left {
311
+ set yd [expr {($y0+$y1)/2}]
312
+ if { [set id [$path.c find withtag poly]] == "" } {
313
+ $path.c create polygon $x1 $y0 $x1 $y1 $x0 $yd -tags poly
314
+ } else {
315
+ $path.c coords $id $x1 $y0 $x1 $y1 $x0 $yd
316
+ }
317
+ if { [string equal $type "arrow"] } {
318
+ if { [set id [$path.c find withtag bot]] == "" } {
319
+ $path.c create line $x1 $y0 $x1 $y1 $x0 $yd -tags bot
320
+ } else {
321
+ $path.c coords $id $x1 $y0 $x1 $y1 $x0 $yd
322
+ }
323
+ if { [set id [$path.c find withtag top]] == "" } {
324
+ $path.c create line $x1 $y0 $x0 $yd -tags top
325
+ } else {
326
+ $path.c coords $id $x1 $y0 $x0 $yd
327
+ }
328
+ $path.c itemconfigure top -width $arrbd
329
+ $path.c itemconfigure bot -width $arrbd
330
+ } else {
331
+ $path.c delete top
332
+ $path.c delete bot
333
+ }
334
+ }
335
+ right {
336
+ set yd [expr {($y0+$y1)/2}]
337
+ if { [set id [$path.c find withtag poly]] == "" } {
338
+ $path.c create polygon $x0 $y1 $x0 $y0 $x1 $yd -tags poly
339
+ } else {
340
+ $path.c coords $id $x0 $y1 $x0 $y0 $x1 $yd
341
+ }
342
+ if { [string equal $type "arrow"] } {
343
+ if { [set id [$path.c find withtag top]] == "" } {
344
+ $path.c create line $x0 $y1 $x0 $y0 $x1 $yd -tags top
345
+ } else {
346
+ $path.c coords $id $x0 $y1 $x0 $y0 $x1 $yd
347
+ }
348
+ if { [set id [$path.c find withtag bot]] == "" } {
349
+ $path.c create line $x0 $y1 $x1 $yd -tags bot
350
+ } else {
351
+ $path.c coords $id $x0 $y1 $x1 $yd
352
+ }
353
+ $path.c itemconfigure top -width $arrbd
354
+ $path.c itemconfigure bot -width $arrbd
355
+ } else {
356
+ $path.c delete top
357
+ $path.c delete bot
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+
364
+ # ------------------------------------------------------------------------------
365
+ # Command ArrowButton::_redraw_state
366
+ # ------------------------------------------------------------------------------
367
+ proc ArrowButton::_redraw_state { path } {
368
+ set state [Widget::getoption $path -state]
369
+ if { [string equal [Widget::getoption $path -type] "button"] } {
370
+ switch $state {
371
+ normal {set bg -background; set fg -foreground}
372
+ active {set bg -activebackground; set fg -activeforeground}
373
+ disabled {set bg -background; set fg -disabledforeground}
374
+ }
375
+ set fg [Widget::getoption $path $fg]
376
+ $path.c configure -background [Widget::getoption $path $bg]
377
+ $path.c itemconfigure poly -fill $fg -outline $fg
378
+ } else {
379
+ switch $state {
380
+ normal {set stipple ""; set bg [Widget::getoption $path -background] }
381
+ active {set stipple ""; set bg [Widget::getoption $path -activebackground] }
382
+ disabled {set stipple gray50; set bg black }
383
+ }
384
+ set thrc [Widget::getoption $path -troughcolor]
385
+ $path.c configure -background [Widget::getoption $path -background]
386
+ $path.c itemconfigure rect -fill $thrc -outline $thrc
387
+ $path.c itemconfigure poly -fill $bg -outline $bg -stipple $stipple
388
+ }
389
+ }
390
+
391
+
392
+ # ------------------------------------------------------------------------------
393
+ # Command ArrowButton::_redraw_relief
394
+ # ------------------------------------------------------------------------------
395
+ proc ArrowButton::_redraw_relief { path } {
396
+ variable _moved
397
+
398
+ if { [string equal [Widget::getoption $path -type] "button"] } {
399
+ if { [string equal [Widget::getoption $path -relief] "sunken"] } {
400
+ if { !$_moved($path) } {
401
+ $path.c move poly 1 1
402
+ set _moved($path) 1
403
+ }
404
+ } else {
405
+ if { $_moved($path) } {
406
+ $path.c move poly -1 -1
407
+ set _moved($path) 0
408
+ }
409
+ }
410
+ } else {
411
+ set col3d [BWidget::get3dcolor $path [Widget::getoption $path -background]]
412
+ switch [Widget::getoption $path -arrowrelief] {
413
+ raised {set top [lindex $col3d 1]; set bot [lindex $col3d 0]}
414
+ sunken {set top [lindex $col3d 0]; set bot [lindex $col3d 1]}
415
+ }
416
+ $path.c itemconfigure top -fill $top
417
+ $path.c itemconfigure bot -fill $bot
418
+ }
419
+ }
420
+
421
+
422
+ # ------------------------------------------------------------------------------
423
+ # Command ArrowButton::_redraw_whole
424
+ # ------------------------------------------------------------------------------
425
+ proc ArrowButton::_redraw_whole { path width height } {
426
+ _redraw $path $width $height
427
+ _redraw_relief $path
428
+ _redraw_state $path
429
+ }
430
+
431
+
432
+ # ------------------------------------------------------------------------------
433
+ # Command ArrowButton::_enter
434
+ # ------------------------------------------------------------------------------
435
+ proc ArrowButton::_enter { path } {
436
+ variable _grab
437
+ set path [winfo parent $path]
438
+ set _grab(current) $path
439
+ if { ![string equal [Widget::getoption $path -state] "disabled"] } {
440
+ set _grab(oldstate) [Widget::getoption $path -state]
441
+ configure $path -state active
442
+ if { $_grab(pressed) == $path } {
443
+ if { [string equal [Widget::getoption $path -type] "button"] } {
444
+ set _grab(oldrelief) [Widget::getoption $path -relief]
445
+ configure $path -relief sunken
446
+ } else {
447
+ set _grab(oldrelief) [Widget::getoption $path -arrowrelief]
448
+ configure $path -arrowrelief sunken
449
+ }
450
+ }
451
+ }
452
+ }
453
+
454
+
455
+ # ------------------------------------------------------------------------------
456
+ # Command ArrowButton::_leave
457
+ # ------------------------------------------------------------------------------
458
+ proc ArrowButton::_leave { path } {
459
+ variable _grab
460
+ set path [winfo parent $path]
461
+ set _grab(current) ""
462
+ if { ![string equal [Widget::getoption $path -state] "disabled"] } {
463
+ configure $path -state $_grab(oldstate)
464
+ if { $_grab(pressed) == $path } {
465
+ if { [string equal [Widget::getoption $path -type] "button"] } {
466
+ configure $path -relief $_grab(oldrelief)
467
+ } else {
468
+ configure $path -arrowrelief $_grab(oldrelief)
469
+ }
470
+ }
471
+ }
472
+ }
473
+
474
+
475
+ # ------------------------------------------------------------------------------
476
+ # Command ArrowButton::_press
477
+ # ------------------------------------------------------------------------------
478
+ proc ArrowButton::_press { path } {
479
+ variable _grab
480
+ set path [winfo parent $path]
481
+ if { ![string equal [Widget::getoption $path -state] "disabled"] } {
482
+ set _grab(pressed) $path
483
+ if { [string equal [Widget::getoption $path -type] "button"] } {
484
+ set _grab(oldrelief) [Widget::getoption $path -relief]
485
+ configure $path -relief sunken
486
+ } else {
487
+ set _grab(oldrelief) [Widget::getoption $path -arrowrelief]
488
+ configure $path -arrowrelief sunken
489
+ }
490
+ if {[llength [set cmd [Widget::getoption $path -armcommand]]]} {
491
+ uplevel \#0 $cmd
492
+ if { [set delay [Widget::getoption $path -repeatdelay]] > 0 ||
493
+ [set delay [Widget::getoption $path -repeatinterval]] > 0 } {
494
+ after $delay [list ArrowButton::_repeat $path]
495
+ }
496
+ }
497
+ }
498
+ }
499
+
500
+
501
+ # ------------------------------------------------------------------------------
502
+ # Command ArrowButton::_release
503
+ # ------------------------------------------------------------------------------
504
+ proc ArrowButton::_release { path } {
505
+ variable _grab
506
+ set path [winfo parent $path]
507
+ if { $_grab(pressed) == $path } {
508
+ set _grab(pressed) ""
509
+ if { [string equal [Widget::getoption $path -type] "button"] } {
510
+ configure $path -relief $_grab(oldrelief)
511
+ } else {
512
+ configure $path -arrowrelief $_grab(oldrelief)
513
+ }
514
+ if {[llength [set cmd [Widget::getoption $path -disarmcommand]]]} {
515
+ uplevel \#0 $cmd
516
+ }
517
+ if { $_grab(current) == $path &&
518
+ ![string equal [Widget::getoption $path -state] "disabled"] &&
519
+ [llength [set cmd [Widget::getoption $path -command]]]} {
520
+ uplevel \#0 $cmd
521
+ }
522
+ }
523
+ }
524
+
525
+
526
+ # ------------------------------------------------------------------------------
527
+ # Command ArrowButton::_repeat
528
+ # ------------------------------------------------------------------------------
529
+ proc ArrowButton::_repeat { path } {
530
+ variable _grab
531
+ if { $_grab(current) == $path && $_grab(pressed) == $path &&
532
+ ![string equal [Widget::getoption $path -state] "disabled"] &&
533
+ [llength [set cmd [Widget::getoption $path -armcommand]]]} {
534
+ uplevel \#0 $cmd
535
+ }
536
+ if { $_grab(pressed) == $path &&
537
+ ([set delay [Widget::getoption $path -repeatinterval]] > 0 ||
538
+ [set delay [Widget::getoption $path -repeatdelay]] > 0) } {
539
+ after $delay [list ArrowButton::_repeat $path]
540
+ }
541
+ }
542
+
543
+
544
+ # ------------------------------------------------------------------------------
545
+ # Command ArrowButton::_destroy
546
+ # ------------------------------------------------------------------------------
547
+ proc ArrowButton::_destroy { path } {
548
+ variable _moved
549
+ Widget::destroy $path
550
+ unset _moved($path)
551
+ }