arcadia 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- metadata +141 -5
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------
|
|
2
|
+
# dialog.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: dialog.tcl,v 1.15 2004/09/24 23:56:59 hobbs Exp $
|
|
5
|
+
# ----------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - Dialog::create
|
|
8
|
+
# - Dialog::configure
|
|
9
|
+
# - Dialog::cget
|
|
10
|
+
# - Dialog::getframe
|
|
11
|
+
# - Dialog::add
|
|
12
|
+
# - Dialog::itemconfigure
|
|
13
|
+
# - Dialog::itemcget
|
|
14
|
+
# - Dialog::invoke
|
|
15
|
+
# - Dialog::setfocus
|
|
16
|
+
# - Dialog::enddialog
|
|
17
|
+
# - Dialog::draw
|
|
18
|
+
# - Dialog::withdraw
|
|
19
|
+
# - Dialog::_destroy
|
|
20
|
+
# ----------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
# JDC: added -transient and -place flag
|
|
23
|
+
|
|
24
|
+
namespace eval Dialog {
|
|
25
|
+
Widget::define Dialog dialog ButtonBox
|
|
26
|
+
|
|
27
|
+
Widget::bwinclude Dialog ButtonBox .bbox \
|
|
28
|
+
remove {-orient} \
|
|
29
|
+
initialize {-spacing 10 -padx 10}
|
|
30
|
+
|
|
31
|
+
Widget::declare Dialog {
|
|
32
|
+
{-title String "" 0}
|
|
33
|
+
{-geometry String "" 0}
|
|
34
|
+
{-modal Enum local 0 {none local global}}
|
|
35
|
+
{-bitmap TkResource "" 1 label}
|
|
36
|
+
{-image TkResource "" 1 label}
|
|
37
|
+
{-separator Boolean 0 1}
|
|
38
|
+
{-cancel Int -1 0 "%d >= -1"}
|
|
39
|
+
{-parent String "" 0}
|
|
40
|
+
{-side Enum bottom 1 {bottom left top right}}
|
|
41
|
+
{-anchor Enum c 1 {n e w s c}}
|
|
42
|
+
{-class String Dialog 1}
|
|
43
|
+
{-transient Boolean 1 1}
|
|
44
|
+
{-place Enum center 0 {none center left right above below}}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Widget::addmap Dialog "" :cmd {-background {}}
|
|
48
|
+
Widget::addmap Dialog "" .frame {-background {}}
|
|
49
|
+
|
|
50
|
+
bind BwDialog <Destroy> [list Dialog::_destroy %W]
|
|
51
|
+
|
|
52
|
+
variable _widget
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# ----------------------------------------------------------------------------
|
|
57
|
+
# Command Dialog::create
|
|
58
|
+
# ----------------------------------------------------------------------------
|
|
59
|
+
proc Dialog::create { path args } {
|
|
60
|
+
global tcl_platform
|
|
61
|
+
variable _widget
|
|
62
|
+
|
|
63
|
+
array set maps [list Dialog {} .bbox {}]
|
|
64
|
+
array set maps [Widget::parseArgs Dialog $args]
|
|
65
|
+
|
|
66
|
+
# Check to see if the -class flag was specified
|
|
67
|
+
set dialogClass "Dialog"
|
|
68
|
+
array set dialogArgs $maps(Dialog)
|
|
69
|
+
if { [info exists dialogArgs(-class)] } {
|
|
70
|
+
set dialogClass $dialogArgs(-class)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if { [string equal $tcl_platform(platform) "unix"] } {
|
|
74
|
+
set re raised
|
|
75
|
+
set bd 1
|
|
76
|
+
} else {
|
|
77
|
+
set re flat
|
|
78
|
+
set bd 0
|
|
79
|
+
}
|
|
80
|
+
toplevel $path -relief $re -borderwidth $bd -class $dialogClass
|
|
81
|
+
wm withdraw $path
|
|
82
|
+
|
|
83
|
+
Widget::initFromODB Dialog $path $maps(Dialog)
|
|
84
|
+
|
|
85
|
+
bindtags $path [list $path BwDialog all]
|
|
86
|
+
wm overrideredirect $path 1
|
|
87
|
+
wm title $path [Widget::cget $path -title]
|
|
88
|
+
set parent [Widget::cget $path -parent]
|
|
89
|
+
if { ![winfo exists $parent] } {
|
|
90
|
+
set parent [winfo parent $path]
|
|
91
|
+
}
|
|
92
|
+
# JDC: made transient optional
|
|
93
|
+
if { [Widget::getoption $path -transient] } {
|
|
94
|
+
wm transient $path [winfo toplevel $parent]
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
set side [Widget::cget $path -side]
|
|
98
|
+
if { [string equal $side "left"] || [string equal $side "right"] } {
|
|
99
|
+
set orient vertical
|
|
100
|
+
} else {
|
|
101
|
+
set orient horizontal
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
set bbox [eval [list ButtonBox::create $path.bbox] $maps(.bbox) \
|
|
105
|
+
-orient $orient]
|
|
106
|
+
set frame [frame $path.frame -relief flat -borderwidth 0]
|
|
107
|
+
set bg [Widget::cget $path -background]
|
|
108
|
+
$path configure -background $bg
|
|
109
|
+
$frame configure -background $bg
|
|
110
|
+
if { [set bitmap [Widget::getoption $path -image]] != "" } {
|
|
111
|
+
set label [label $path.label -image $bitmap -background $bg]
|
|
112
|
+
} elseif { [set bitmap [Widget::getoption $path -bitmap]] != "" } {
|
|
113
|
+
set label [label $path.label -bitmap $bitmap -background $bg]
|
|
114
|
+
}
|
|
115
|
+
if { [Widget::getoption $path -separator] } {
|
|
116
|
+
Separator::create $path.sep -orient $orient -background $bg
|
|
117
|
+
}
|
|
118
|
+
set _widget($path,realized) 0
|
|
119
|
+
set _widget($path,nbut) 0
|
|
120
|
+
|
|
121
|
+
bind $path <Escape> [list ButtonBox::invoke $path.bbox [Widget::getoption $path -cancel]]
|
|
122
|
+
bind $path <Return> [list ButtonBox::invoke $path.bbox default]
|
|
123
|
+
|
|
124
|
+
return [Widget::create Dialog $path]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# ----------------------------------------------------------------------------
|
|
129
|
+
# Command Dialog::configure
|
|
130
|
+
# ----------------------------------------------------------------------------
|
|
131
|
+
proc Dialog::configure { path args } {
|
|
132
|
+
set res [Widget::configure $path $args]
|
|
133
|
+
|
|
134
|
+
if { [Widget::hasChanged $path -title title] } {
|
|
135
|
+
wm title $path $title
|
|
136
|
+
}
|
|
137
|
+
if { [Widget::hasChanged $path -background bg] } {
|
|
138
|
+
if { [winfo exists $path.label] } {
|
|
139
|
+
$path.label configure -background $bg
|
|
140
|
+
}
|
|
141
|
+
if { [winfo exists $path.sep] } {
|
|
142
|
+
Separator::configure $path.sep -background $bg
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return $res
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# ----------------------------------------------------------------------------
|
|
150
|
+
# Command Dialog::cget
|
|
151
|
+
# ----------------------------------------------------------------------------
|
|
152
|
+
proc Dialog::cget { path option } {
|
|
153
|
+
return [Widget::cget $path $option]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# ----------------------------------------------------------------------------
|
|
158
|
+
# Command Dialog::getframe
|
|
159
|
+
# ----------------------------------------------------------------------------
|
|
160
|
+
proc Dialog::getframe { path } {
|
|
161
|
+
return $path.frame
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ----------------------------------------------------------------------------
|
|
166
|
+
# Command Dialog::add
|
|
167
|
+
# ----------------------------------------------------------------------------
|
|
168
|
+
proc Dialog::add { path args } {
|
|
169
|
+
variable _widget
|
|
170
|
+
|
|
171
|
+
if {[string equal $::tcl_platform(platform) "windows"]
|
|
172
|
+
&& $::tk_version >= 8.4} {
|
|
173
|
+
set width -11
|
|
174
|
+
} else {
|
|
175
|
+
set width 8
|
|
176
|
+
}
|
|
177
|
+
set cmd [list ButtonBox::add $path.bbox -width $width \
|
|
178
|
+
-command [list Dialog::enddialog $path $_widget($path,nbut)]]
|
|
179
|
+
set res [eval $cmd $args]
|
|
180
|
+
incr _widget($path,nbut)
|
|
181
|
+
return $res
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# ----------------------------------------------------------------------------
|
|
186
|
+
# Command Dialog::itemconfigure
|
|
187
|
+
# ----------------------------------------------------------------------------
|
|
188
|
+
proc Dialog::itemconfigure { path index args } {
|
|
189
|
+
return [eval [list ButtonBox::itemconfigure $path.bbox $index] $args]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# ----------------------------------------------------------------------------
|
|
194
|
+
# Command Dialog::itemcget
|
|
195
|
+
# ----------------------------------------------------------------------------
|
|
196
|
+
proc Dialog::itemcget { path index option } {
|
|
197
|
+
return [ButtonBox::itemcget $path.bbox $index $option]
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
# ----------------------------------------------------------------------------
|
|
202
|
+
# Command Dialog::invoke
|
|
203
|
+
# ----------------------------------------------------------------------------
|
|
204
|
+
proc Dialog::invoke { path index } {
|
|
205
|
+
ButtonBox::invoke $path.bbox $index
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# ----------------------------------------------------------------------------
|
|
210
|
+
# Command Dialog::setfocus
|
|
211
|
+
# ----------------------------------------------------------------------------
|
|
212
|
+
proc Dialog::setfocus { path index } {
|
|
213
|
+
ButtonBox::setfocus $path.bbox $index
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
# ----------------------------------------------------------------------------
|
|
218
|
+
# Command Dialog::enddialog
|
|
219
|
+
# ----------------------------------------------------------------------------
|
|
220
|
+
proc Dialog::enddialog { path result } {
|
|
221
|
+
variable _widget
|
|
222
|
+
|
|
223
|
+
set _widget($path,result) $result
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# ----------------------------------------------------------------------------
|
|
228
|
+
# Command Dialog::draw
|
|
229
|
+
# ----------------------------------------------------------------------------
|
|
230
|
+
proc Dialog::draw { path {focus ""} {overrideredirect 0} {geometry ""}} {
|
|
231
|
+
variable _widget
|
|
232
|
+
|
|
233
|
+
set parent [Widget::getoption $path -parent]
|
|
234
|
+
if { !$_widget($path,realized) } {
|
|
235
|
+
set _widget($path,realized) 1
|
|
236
|
+
if { [llength [winfo children $path.bbox]] } {
|
|
237
|
+
set side [Widget::getoption $path -side]
|
|
238
|
+
if {[string equal $side "left"] || [string equal $side "right"]} {
|
|
239
|
+
set pad -padx
|
|
240
|
+
set fill y
|
|
241
|
+
} else {
|
|
242
|
+
set pad -pady
|
|
243
|
+
set fill x
|
|
244
|
+
}
|
|
245
|
+
pack $path.bbox -side $side -padx 1m -pady 1m \
|
|
246
|
+
-anchor [Widget::getoption $path -anchor]
|
|
247
|
+
if { [winfo exists $path.sep] } {
|
|
248
|
+
pack $path.sep -side $side -fill $fill $pad 2m
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if { [winfo exists $path.label] } {
|
|
252
|
+
pack $path.label -side left -anchor n -padx 3m -pady 3m
|
|
253
|
+
}
|
|
254
|
+
pack $path.frame -padx 1m -pady 1m -fill both -expand yes
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
set geom [Widget::getMegawidgetOption $path -geometry]
|
|
258
|
+
if { $geom != "" } {
|
|
259
|
+
wm geometry $path $geom
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if { [string equal $geometry ""] && ($geom == "") } {
|
|
263
|
+
set place [Widget::getoption $path -place]
|
|
264
|
+
if { ![string equal $place none] } {
|
|
265
|
+
if { [winfo exists $parent] } {
|
|
266
|
+
BWidget::place $path 0 0 $place $parent
|
|
267
|
+
} else {
|
|
268
|
+
BWidget::place $path 0 0 $place
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
if { $geom != "" } {
|
|
273
|
+
wm geometry $path $geom
|
|
274
|
+
} else {
|
|
275
|
+
wm geometry $path $geometry
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
update idletasks
|
|
279
|
+
wm overrideredirect $path $overrideredirect
|
|
280
|
+
wm deiconify $path
|
|
281
|
+
|
|
282
|
+
# patch by Bastien Chevreux (bach@mwgdna.com)
|
|
283
|
+
# As seen on Windows systems *sigh*
|
|
284
|
+
# When the toplevel is withdrawn, the tkwait command will wait forever.
|
|
285
|
+
# So, check that we are not withdrawn
|
|
286
|
+
if {![winfo exists $parent] || \
|
|
287
|
+
([wm state [winfo toplevel $parent]] != "withdrawn")} {
|
|
288
|
+
tkwait visibility $path
|
|
289
|
+
}
|
|
290
|
+
BWidget::focus set $path
|
|
291
|
+
if { [winfo exists $focus] } {
|
|
292
|
+
focus -force $focus
|
|
293
|
+
} else {
|
|
294
|
+
ButtonBox::setfocus $path.bbox default
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if { [set grab [Widget::cget $path -modal]] != "none" } {
|
|
298
|
+
BWidget::grab $grab $path
|
|
299
|
+
if {[info exists _widget($path,result)]} {
|
|
300
|
+
unset _widget($path,result)
|
|
301
|
+
}
|
|
302
|
+
tkwait variable Dialog::_widget($path,result)
|
|
303
|
+
if { [info exists _widget($path,result)] } {
|
|
304
|
+
set res $_widget($path,result)
|
|
305
|
+
unset _widget($path,result)
|
|
306
|
+
} else {
|
|
307
|
+
set res -1
|
|
308
|
+
}
|
|
309
|
+
withdraw $path
|
|
310
|
+
return $res
|
|
311
|
+
}
|
|
312
|
+
return ""
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
# ----------------------------------------------------------------------------
|
|
317
|
+
# Command Dialog::withdraw
|
|
318
|
+
# ----------------------------------------------------------------------------
|
|
319
|
+
proc Dialog::withdraw { path } {
|
|
320
|
+
BWidget::grab release $path
|
|
321
|
+
BWidget::focus release $path
|
|
322
|
+
if { [winfo exists $path] } {
|
|
323
|
+
wm withdraw $path
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
# ----------------------------------------------------------------------------
|
|
329
|
+
# Command Dialog::_destroy
|
|
330
|
+
# ----------------------------------------------------------------------------
|
|
331
|
+
proc Dialog::_destroy { path } {
|
|
332
|
+
variable _widget
|
|
333
|
+
|
|
334
|
+
Dialog::enddialog $path -1
|
|
335
|
+
|
|
336
|
+
BWidget::grab release $path
|
|
337
|
+
BWidget::focus release $path
|
|
338
|
+
if {[info exists _widget($path,result)]} {
|
|
339
|
+
unset _widget($path,result)
|
|
340
|
+
}
|
|
341
|
+
unset _widget($path,realized)
|
|
342
|
+
unset _widget($path,nbut)
|
|
343
|
+
|
|
344
|
+
Widget::destroy $path
|
|
345
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# dragsite.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: dragsite.tcl,v 1.8 2003/10/20 21:23:52 damonc Exp $
|
|
5
|
+
# ------------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - DragSite::include
|
|
8
|
+
# - DragSite::setdrag
|
|
9
|
+
# - DragSite::register
|
|
10
|
+
# - DragSite::_begin_drag
|
|
11
|
+
# - DragSite::_init_drag
|
|
12
|
+
# - DragSite::_end_drag
|
|
13
|
+
# - DragSite::_update_operation
|
|
14
|
+
# ----------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
namespace eval DragSite {
|
|
17
|
+
Widget::define DragSite dragsite -classonly
|
|
18
|
+
|
|
19
|
+
Widget::declare DragSite [list \
|
|
20
|
+
[list -dragevent Enum 1 0 [list 1 2 3]] \
|
|
21
|
+
[list -draginitcmd String "" 0] \
|
|
22
|
+
[list -dragendcmd String "" 0] \
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
variable _topw ".drag"
|
|
26
|
+
variable _tabops
|
|
27
|
+
variable _state
|
|
28
|
+
variable _x0
|
|
29
|
+
variable _y0
|
|
30
|
+
|
|
31
|
+
bind BwDrag1 <ButtonPress-1> {DragSite::_begin_drag press %W %s %X %Y}
|
|
32
|
+
bind BwDrag1 <B1-Motion> {DragSite::_begin_drag motion %W %s %X %Y}
|
|
33
|
+
bind BwDrag2 <ButtonPress-2> {DragSite::_begin_drag press %W %s %X %Y}
|
|
34
|
+
bind BwDrag2 <B2-Motion> {DragSite::_begin_drag motion %W %s %X %Y}
|
|
35
|
+
bind BwDrag3 <ButtonPress-3> {DragSite::_begin_drag press %W %s %X %Y}
|
|
36
|
+
bind BwDrag3 <B3-Motion> {DragSite::_begin_drag motion %W %s %X %Y}
|
|
37
|
+
|
|
38
|
+
proc use {} {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# ----------------------------------------------------------------------------
|
|
43
|
+
# Command DragSite::include
|
|
44
|
+
# ----------------------------------------------------------------------------
|
|
45
|
+
proc DragSite::include { class type event } {
|
|
46
|
+
set dragoptions [list \
|
|
47
|
+
[list -dragenabled Boolean 0 0] \
|
|
48
|
+
[list -draginitcmd String "" 0] \
|
|
49
|
+
[list -dragendcmd String "" 0] \
|
|
50
|
+
[list -dragtype String $type 0] \
|
|
51
|
+
[list -dragevent Enum $event 0 [list 1 2 3]] \
|
|
52
|
+
]
|
|
53
|
+
Widget::declare $class $dragoptions
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# ----------------------------------------------------------------------------
|
|
58
|
+
# Command DragSite::setdrag
|
|
59
|
+
# Widget interface to register
|
|
60
|
+
# ----------------------------------------------------------------------------
|
|
61
|
+
proc DragSite::setdrag { path subpath initcmd endcmd {force 0}} {
|
|
62
|
+
set cen [Widget::hasChanged $path -dragenabled en]
|
|
63
|
+
set cdragevt [Widget::hasChanged $path -dragevent dragevt]
|
|
64
|
+
if { $en } {
|
|
65
|
+
if { $force || $cen || $cdragevt } {
|
|
66
|
+
register $subpath \
|
|
67
|
+
-draginitcmd $initcmd \
|
|
68
|
+
-dragendcmd $endcmd \
|
|
69
|
+
-dragevent $dragevt
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
register $subpath
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# ----------------------------------------------------------------------------
|
|
78
|
+
# Command DragSite::register
|
|
79
|
+
# ----------------------------------------------------------------------------
|
|
80
|
+
proc DragSite::register { path args } {
|
|
81
|
+
upvar \#0 DragSite::$path drag
|
|
82
|
+
|
|
83
|
+
if { [info exists drag] } {
|
|
84
|
+
bind $path $drag(evt) {}
|
|
85
|
+
unset drag
|
|
86
|
+
}
|
|
87
|
+
Widget::init DragSite .drag$path $args
|
|
88
|
+
set event [Widget::getMegawidgetOption .drag$path -dragevent]
|
|
89
|
+
set initcmd [Widget::getMegawidgetOption .drag$path -draginitcmd]
|
|
90
|
+
set endcmd [Widget::getMegawidgetOption .drag$path -dragendcmd]
|
|
91
|
+
set tags [bindtags $path]
|
|
92
|
+
set idx [lsearch $tags "BwDrag*"]
|
|
93
|
+
Widget::destroy .drag$path
|
|
94
|
+
if { $initcmd != "" } {
|
|
95
|
+
if { $idx != -1 } {
|
|
96
|
+
bindtags $path [lreplace $tags $idx $idx BwDrag$event]
|
|
97
|
+
} else {
|
|
98
|
+
bindtags $path [concat $tags BwDrag$event]
|
|
99
|
+
}
|
|
100
|
+
set drag(initcmd) $initcmd
|
|
101
|
+
set drag(endcmd) $endcmd
|
|
102
|
+
set drag(evt) $event
|
|
103
|
+
} elseif { $idx != -1 } {
|
|
104
|
+
bindtags $path [lreplace $tags $idx $idx]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# ----------------------------------------------------------------------------
|
|
110
|
+
# Command DragSite::_begin_drag
|
|
111
|
+
# ----------------------------------------------------------------------------
|
|
112
|
+
proc DragSite::_begin_drag { event source state X Y } {
|
|
113
|
+
variable _x0
|
|
114
|
+
variable _y0
|
|
115
|
+
variable _state
|
|
116
|
+
|
|
117
|
+
switch -- $event {
|
|
118
|
+
press {
|
|
119
|
+
set _x0 $X
|
|
120
|
+
set _y0 $Y
|
|
121
|
+
set _state "press"
|
|
122
|
+
}
|
|
123
|
+
motion {
|
|
124
|
+
if { ![info exists _state] } {
|
|
125
|
+
# This is just extra protection. There seem to be
|
|
126
|
+
# rare cases where the motion comes before the press.
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
if { [string equal $_state "press"] } {
|
|
130
|
+
if { abs($_x0-$X) > 3 || abs($_y0-$Y) > 3 } {
|
|
131
|
+
set _state "done"
|
|
132
|
+
_init_drag $source $state $X $Y
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# ----------------------------------------------------------------------------
|
|
141
|
+
# Command DragSite::_init_drag
|
|
142
|
+
# ----------------------------------------------------------------------------
|
|
143
|
+
proc DragSite::_init_drag { source state X Y } {
|
|
144
|
+
variable _topw
|
|
145
|
+
upvar \#0 DragSite::$source drag
|
|
146
|
+
|
|
147
|
+
destroy $_topw
|
|
148
|
+
toplevel $_topw
|
|
149
|
+
wm withdraw $_topw
|
|
150
|
+
wm overrideredirect $_topw 1
|
|
151
|
+
|
|
152
|
+
set info [uplevel \#0 $drag(initcmd) [list $source $X $Y .drag]]
|
|
153
|
+
if { $info != "" } {
|
|
154
|
+
set type [lindex $info 0]
|
|
155
|
+
set ops [lindex $info 1]
|
|
156
|
+
set data [lindex $info 2]
|
|
157
|
+
|
|
158
|
+
if { [winfo children $_topw] == "" } {
|
|
159
|
+
if { [string equal $type "BITMAP"] || [string equal $type "IMAGE"] } {
|
|
160
|
+
label $_topw.l -image [Bitmap::get dragicon] -relief flat -bd 0
|
|
161
|
+
} else {
|
|
162
|
+
label $_topw.l -image [Bitmap::get dragfile] -relief flat -bd 0
|
|
163
|
+
}
|
|
164
|
+
pack $_topw.l
|
|
165
|
+
}
|
|
166
|
+
wm geometry $_topw +[expr {$X+1}]+[expr {$Y+1}]
|
|
167
|
+
wm deiconify $_topw
|
|
168
|
+
if {[catch {tkwait visibility $_topw}]} {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
BWidget::grab set $_topw
|
|
172
|
+
BWidget::focus set $_topw
|
|
173
|
+
|
|
174
|
+
bindtags $_topw [list $_topw DragTop]
|
|
175
|
+
DropSite::_init_drag $_topw $drag(evt) $source $state $X $Y $type $ops $data
|
|
176
|
+
} else {
|
|
177
|
+
destroy $_topw
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# ----------------------------------------------------------------------------
|
|
183
|
+
# Command DragSite::_end_drag
|
|
184
|
+
# ----------------------------------------------------------------------------
|
|
185
|
+
proc DragSite::_end_drag { source target op type data result } {
|
|
186
|
+
variable _topw
|
|
187
|
+
upvar \#0 DragSite::$source drag
|
|
188
|
+
|
|
189
|
+
BWidget::grab release $_topw
|
|
190
|
+
BWidget::focus release $_topw
|
|
191
|
+
destroy $_topw
|
|
192
|
+
if { $drag(endcmd) != "" } {
|
|
193
|
+
uplevel \#0 $drag(endcmd) [list $source $target $op $type $data $result]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|