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,160 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# labelframe.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: labelframe.tcl,v 1.6 2003/10/20 21:23:52 damonc Exp $
|
|
5
|
+
# ------------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - LabelFrame::create
|
|
8
|
+
# - LabelFrame::getframe
|
|
9
|
+
# - LabelFrame::configure
|
|
10
|
+
# - LabelFrame::cget
|
|
11
|
+
# - LabelFrame::align
|
|
12
|
+
# ------------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
namespace eval LabelFrame {
|
|
15
|
+
Widget::define LabelFrame labelframe Label
|
|
16
|
+
|
|
17
|
+
Widget::bwinclude LabelFrame Label .l \
|
|
18
|
+
remove {
|
|
19
|
+
-highlightthickness -highlightcolor -highlightbackground
|
|
20
|
+
-takefocus -relief -borderwidth
|
|
21
|
+
-cursor
|
|
22
|
+
-dragenabled -draginitcmd -dragendcmd -dragevent -dragtype
|
|
23
|
+
-dropenabled -droptypes -dropovercmd -dropcmd} \
|
|
24
|
+
initialize {-anchor w}
|
|
25
|
+
|
|
26
|
+
Widget::declare LabelFrame {
|
|
27
|
+
{-relief TkResource flat 0 frame}
|
|
28
|
+
{-borderwidth TkResource 0 0 frame}
|
|
29
|
+
{-side Enum left 1 {left right top bottom}}
|
|
30
|
+
{-bd Synonym -borderwidth}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Widget::addmap LabelFrame "" :cmd {-background {}}
|
|
34
|
+
Widget::addmap LabelFrame "" .f {-background {} -relief {} -borderwidth {}}
|
|
35
|
+
|
|
36
|
+
Widget::syncoptions LabelFrame Label .l {-text {} -underline {}}
|
|
37
|
+
|
|
38
|
+
bind BwLabelFrame <FocusIn> [list Label::setfocus %W.l]
|
|
39
|
+
bind BwLabelFrame <Destroy> [list LabelFrame::_destroy %W]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# ----------------------------------------------------------------------------
|
|
44
|
+
# Command LabelFrame::create
|
|
45
|
+
# ----------------------------------------------------------------------------
|
|
46
|
+
proc LabelFrame::create { path args } {
|
|
47
|
+
Widget::init LabelFrame $path $args
|
|
48
|
+
|
|
49
|
+
set path [eval [list frame $path] [Widget::subcget $path :cmd] \
|
|
50
|
+
-relief flat -bd 0 -takefocus 0 -highlightthickness 0 \
|
|
51
|
+
-class LabelFrame]
|
|
52
|
+
|
|
53
|
+
set label [eval [list Label::create $path.l] [Widget::subcget $path .l] \
|
|
54
|
+
-takefocus 0 -highlightthickness 0 -relief flat \
|
|
55
|
+
-borderwidth 0 -dropenabled 0 -dragenabled 0]
|
|
56
|
+
set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
|
|
57
|
+
-highlightthickness 0 -takefocus 0]
|
|
58
|
+
|
|
59
|
+
switch [Widget::getoption $path -side] {
|
|
60
|
+
left {set packopt "-side left"}
|
|
61
|
+
right {set packopt "-side right"}
|
|
62
|
+
top {set packopt "-side top -fill x"}
|
|
63
|
+
bottom {set packopt "-side bottom -fill x"}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
eval [list pack $label] $packopt
|
|
67
|
+
pack $frame -fill both -expand yes
|
|
68
|
+
|
|
69
|
+
bindtags $path [list $path BwLabelFrame [winfo toplevel $path] all]
|
|
70
|
+
|
|
71
|
+
return [Widget::create LabelFrame $path]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# ----------------------------------------------------------------------------
|
|
76
|
+
# Command LabelFrame::getframe
|
|
77
|
+
# ----------------------------------------------------------------------------
|
|
78
|
+
proc LabelFrame::getframe { path } {
|
|
79
|
+
return $path.f
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# ----------------------------------------------------------------------------
|
|
84
|
+
# Command LabelFrame::configure
|
|
85
|
+
# ----------------------------------------------------------------------------
|
|
86
|
+
proc LabelFrame::configure { path args } {
|
|
87
|
+
return [Widget::configure $path $args]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# ----------------------------------------------------------------------------
|
|
92
|
+
# Command LabelFrame::cget
|
|
93
|
+
# ----------------------------------------------------------------------------
|
|
94
|
+
proc LabelFrame::cget { path option } {
|
|
95
|
+
return [Widget::cget $path $option]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# ----------------------------------------------------------------------------
|
|
100
|
+
# Command LabelFrame::align
|
|
101
|
+
# This command align label of all widget given by args of class LabelFrame
|
|
102
|
+
# (or "derived") by setting their width to the max one +1
|
|
103
|
+
# ----------------------------------------------------------------------------
|
|
104
|
+
proc LabelFrame::align { args } {
|
|
105
|
+
set maxlen 0
|
|
106
|
+
set wlist {}
|
|
107
|
+
foreach wl $args {
|
|
108
|
+
foreach w $wl {
|
|
109
|
+
if { ![info exists Widget::_class($w)] } {
|
|
110
|
+
continue
|
|
111
|
+
}
|
|
112
|
+
set class $Widget::_class($w)
|
|
113
|
+
if { [string equal $class "LabelFrame"] } {
|
|
114
|
+
set textopt -text
|
|
115
|
+
set widthopt -width
|
|
116
|
+
} else {
|
|
117
|
+
upvar 0 Widget::${class}::map classmap
|
|
118
|
+
set textopt ""
|
|
119
|
+
set widthopt ""
|
|
120
|
+
set notdone 2
|
|
121
|
+
foreach {option lmap} [array get classmap] {
|
|
122
|
+
foreach {subpath subclass realopt} $lmap {
|
|
123
|
+
if { [string equal $subclass "LabelFrame"] } {
|
|
124
|
+
if { [string equal $realopt "-text"] } {
|
|
125
|
+
set textopt $option
|
|
126
|
+
incr notdone -1
|
|
127
|
+
break
|
|
128
|
+
}
|
|
129
|
+
if { [string equal $realopt "-width"] } {
|
|
130
|
+
set widthopt $option
|
|
131
|
+
incr notdone -1
|
|
132
|
+
break
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if { !$notdone } {
|
|
137
|
+
break
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if { $notdone } {
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
set len [string length [$w cget $textopt]]
|
|
145
|
+
if { $len > $maxlen } {
|
|
146
|
+
set maxlen $len
|
|
147
|
+
}
|
|
148
|
+
lappend wlist $w $widthopt
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
incr maxlen
|
|
152
|
+
foreach {w widthopt} $wlist {
|
|
153
|
+
$w configure $widthopt $maxlen
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
proc LabelFrame::_destroy { path } {
|
|
159
|
+
Widget::destroy $path
|
|
160
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
! -----------------------------------------------------------------------------
|
|
2
|
+
! da.rc
|
|
3
|
+
! This file is part of Unifix BWidget Toolkit
|
|
4
|
+
! Definition of Danish resources
|
|
5
|
+
! -----------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
! --- symbolic names of buttons -----------------------------------------------
|
|
9
|
+
|
|
10
|
+
*abortName: &Annull�r
|
|
11
|
+
*retryName: P&r�v igen
|
|
12
|
+
*ignoreName: &Ignorer
|
|
13
|
+
*okName: &OK
|
|
14
|
+
*cancelName: &Cancel
|
|
15
|
+
*yesName: &Ja
|
|
16
|
+
*noName: &Nej
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
! --- symbolic names of label of SelectFont dialog ----------------------------
|
|
20
|
+
|
|
21
|
+
*boldName: Fed
|
|
22
|
+
*italicName: Kursiv
|
|
23
|
+
*underlineName: Understreg
|
|
24
|
+
*overstrikeName: Overstreg
|
|
25
|
+
*fontName: &Font
|
|
26
|
+
*sizeName: &St�rrelse
|
|
27
|
+
*styleName: St&il
|
|
28
|
+
|
|
29
|
+
! --- symbolic names of label of PasswdDlg dialog -----------------------------
|
|
30
|
+
|
|
31
|
+
*loginName: &Brugernavn
|
|
32
|
+
*passwordName: &Password
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
! --- resource for SelectFont dialog ------------------------------------------
|
|
36
|
+
|
|
37
|
+
*SelectFont.title: Font-valg
|
|
38
|
+
*SelectFont.sampletext: Eksempeltekst ���
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
! --- resource for MessageDlg dialog ------------------------------------------
|
|
42
|
+
|
|
43
|
+
*MessageDlg.noneTitle: Besked
|
|
44
|
+
*MessageDlg.infoTitle: Information
|
|
45
|
+
*MessageDlg.questionTitle: Sp�rgsm�l
|
|
46
|
+
*MessageDlg.warningTitle: Advarsel
|
|
47
|
+
*MessageDlg.errorTitle: Fejl
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
! --- resource for PasswdDlg dialog -------------------------------------------
|
|
51
|
+
|
|
52
|
+
*PasswdDlg.title: Indtast brugernavn og password
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
! ------------------------------------------------------------------------------
|
|
2
|
+
! de.rc
|
|
3
|
+
! This file is part of Unifix BWidget Toolkit
|
|
4
|
+
! Definition of german resources
|
|
5
|
+
! ------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
! --- symbolic names of buttons ------------------------------------------------
|
|
9
|
+
|
|
10
|
+
*abortName: &Abbrechen
|
|
11
|
+
*retryName: &Wiederholen
|
|
12
|
+
*ignoreName: &Ignorieren
|
|
13
|
+
*okName: &OK
|
|
14
|
+
*cancelName: &Abbrechen
|
|
15
|
+
*yesName: &Ja
|
|
16
|
+
*noName: &Nein
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
! --- symbolic names of label of SelectFont dialog ----------------------------
|
|
20
|
+
|
|
21
|
+
*boldName: Fett
|
|
22
|
+
*italicName: Kursiv
|
|
23
|
+
*underlineName: Unterstrichen
|
|
24
|
+
*overstrikeName: Durchgestrichen
|
|
25
|
+
*fontName: &Schriftart
|
|
26
|
+
*sizeName: S&chriftgrad
|
|
27
|
+
*styleName: Sc&hriftschnitt
|
|
28
|
+
|
|
29
|
+
! --- symbolic names of label of PasswdDlg dialog -----------------------------
|
|
30
|
+
|
|
31
|
+
*loginName: &Login
|
|
32
|
+
*passwordName: &Password
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
! --- resource for SelectFont dialog ------------------------------------------
|
|
36
|
+
|
|
37
|
+
*SelectFont.title: Schrift Auswahl
|
|
38
|
+
*SelectFont.sampletext: Beispieltext
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
! --- resource for MessageDlg dialog ------------------------------------------
|
|
42
|
+
|
|
43
|
+
*MessageDlg.noneTitle: Meldung
|
|
44
|
+
*MessageDlg.infoTitle: Hinweis
|
|
45
|
+
*MessageDlg.questionTitle: Frage
|
|
46
|
+
*MessageDlg.warningTitle: Warnung
|
|
47
|
+
*MessageDlg.errorTitle: Fehler
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
! --- resource for PasswdDlg dialog -------------------------------------------
|
|
51
|
+
|
|
52
|
+
*PasswdDlg.title: Enter login and password
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
! ------------------------------------------------------------------------------
|
|
2
|
+
! en.rc
|
|
3
|
+
! This file is part of Unifix BWidget Toolkit
|
|
4
|
+
! Definition of english resources
|
|
5
|
+
! ------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
! --- symbolic names of buttons ------------------------------------------------
|
|
9
|
+
|
|
10
|
+
*abortName: &Abort
|
|
11
|
+
*retryName: &Retry
|
|
12
|
+
*ignoreName: &Ignore
|
|
13
|
+
*okName: &OK
|
|
14
|
+
*cancelName: &Cancel
|
|
15
|
+
*yesName: &Yes
|
|
16
|
+
*noName: &No
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
! --- symbolic names of label of SelectFont dialog ----------------------------
|
|
20
|
+
|
|
21
|
+
*boldName: Bold
|
|
22
|
+
*italicName: Italic
|
|
23
|
+
*underlineName: Underline
|
|
24
|
+
*overstrikeName: Overstrike
|
|
25
|
+
*fontName: &Font
|
|
26
|
+
*sizeName: &Size
|
|
27
|
+
*styleName: St&yle
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
! --- symbolic names of label of PasswdDlg dialog -----------------------------
|
|
31
|
+
|
|
32
|
+
*loginName: &Login
|
|
33
|
+
*passwordName: &Password
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
! --- resource for SelectFont dialog ------------------------------------------
|
|
37
|
+
|
|
38
|
+
*SelectFont.title: Font selection
|
|
39
|
+
*SelectFont.sampletext: Sample text
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
! --- resource for MessageDlg dialog ------------------------------------------
|
|
43
|
+
|
|
44
|
+
*MessageDlg.noneTitle: Message
|
|
45
|
+
*MessageDlg.infoTitle: Information
|
|
46
|
+
*MessageDlg.questionTitle: Question
|
|
47
|
+
*MessageDlg.warningTitle: Warning
|
|
48
|
+
*MessageDlg.errorTitle: Error
|
|
49
|
+
|
|
50
|
+
! --- resource for PasswdDlg dialog -------------------------------------------
|
|
51
|
+
|
|
52
|
+
*PasswdDlg.title: Enter login and password
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
! ------------------------------------------------------------------------------
|
|
2
|
+
! es.rc
|
|
3
|
+
! This file is part of Unifix BWidget Toolkit
|
|
4
|
+
! Definition of spanish resources
|
|
5
|
+
! daniel@rawbyte.com
|
|
6
|
+
! ------------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
! --- symbolic names of buttons ------------------------------------------------
|
|
10
|
+
|
|
11
|
+
*abortName: A&bortar
|
|
12
|
+
*retryName: &Reintentar
|
|
13
|
+
*ignoreName: &Ignorar
|
|
14
|
+
*okName: &OK
|
|
15
|
+
*cancelName: &Anular
|
|
16
|
+
*yesName: &S�
|
|
17
|
+
*noName: &No
|
|
18
|
+
|
|
19
|
+
! --- symbolic names of label of SelectFont dialog ----------------------------
|
|
20
|
+
|
|
21
|
+
*boldName: &Negrita
|
|
22
|
+
*italicName: &Cursiva
|
|
23
|
+
*underlineName: &Subrayado
|
|
24
|
+
*overstrikeName: &Tachado
|
|
25
|
+
*fontName: &Fuente
|
|
26
|
+
*sizeName: &Tama�o
|
|
27
|
+
*styleName: &Estilo
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
! --- symbolic names of label of PasswdDlg dialog -----------------------------
|
|
31
|
+
|
|
32
|
+
*loginName: Nombre de &usuario
|
|
33
|
+
*passwordName: &Contrase�a
|
|
34
|
+
|
|
35
|
+
! --- resource for SelectFont dialog ------------------------------------------
|
|
36
|
+
|
|
37
|
+
*SelectFont.title: Selecci�n de fuente
|
|
38
|
+
*SelectFont.sampletext: Texto de Ejemplo
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
! --- resource for MessageDlg dialog ------------------------------------------
|
|
42
|
+
|
|
43
|
+
*MessageDlg.noneTitle: Indicaci�n
|
|
44
|
+
*MessageDlg.infoTitle: Informaci�n
|
|
45
|
+
*MessageDlg.questionTitle: Pregunta
|
|
46
|
+
*MessageDlg.warningTitle: Atenci�n
|
|
47
|
+
*MessageDlg.errorTitle: Error
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
! --- resource for PasswdDlg dialog -------------------------------------------
|
|
51
|
+
|
|
52
|
+
*PasswdDlg.title: Introduzca su nombre de usuario y contrase�a
|
|
53
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
! ------------------------------------------------------------------------------
|
|
2
|
+
! fr.rc
|
|
3
|
+
! This file is part of Unifix BWidget Toolkit
|
|
4
|
+
! Definition of french resources
|
|
5
|
+
! ------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
! --- symbolic names of buttons ------------------------------------------------
|
|
9
|
+
|
|
10
|
+
*abortName: A&bandonner
|
|
11
|
+
*retryName: &R�essayer
|
|
12
|
+
*ignoreName: &Ignorer
|
|
13
|
+
*okName: &OK
|
|
14
|
+
*cancelName: &Annuler
|
|
15
|
+
*yesName: &Oui
|
|
16
|
+
*noName: &Non
|
|
17
|
+
|
|
18
|
+
! --- symbolic names of label of SelectFont dialog ----------------------------
|
|
19
|
+
|
|
20
|
+
*boldName: &Gras
|
|
21
|
+
*italicName: &Italique
|
|
22
|
+
*underlineName: &Soulign�
|
|
23
|
+
*overstrikeName: &Barr�
|
|
24
|
+
*fontName: &Police
|
|
25
|
+
*sizeName: &Taille
|
|
26
|
+
*styleName: St&yle
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
! --- symbolic names of label of PasswdDlg dialog -----------------------------
|
|
30
|
+
|
|
31
|
+
*loginName: Nom de l'&utilisateur
|
|
32
|
+
*passwordName: Mot de &passe
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
! --- resource for SelectFont dialog ------------------------------------------
|
|
36
|
+
|
|
37
|
+
*SelectFont.title: S�lection d'une police
|
|
38
|
+
*SelectFont.sampletext: Texte d'exemple
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
! --- resource for MessageDlg dialog ------------------------------------------
|
|
42
|
+
|
|
43
|
+
*MessageDlg.noneTitle: Message
|
|
44
|
+
*MessageDlg.infoTitle: Information
|
|
45
|
+
*MessageDlg.questionTitle: Question
|
|
46
|
+
*MessageDlg.warningTitle: Attention
|
|
47
|
+
*MessageDlg.errorTitle: Erreur
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
! --- resource for PasswdDlg dialog -------------------------------------------
|
|
51
|
+
|
|
52
|
+
*PasswdDlg.title: Entrez le login et le mot de passe
|
|
@@ -0,0 +1,1638 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------
|
|
2
|
+
# listbox.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: listbox.tcl,v 1.23 2006/03/23 23:32:12 dev_null42a Exp $
|
|
5
|
+
# ----------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - ListBox::create
|
|
8
|
+
# - ListBox::configure
|
|
9
|
+
# - ListBox::cget
|
|
10
|
+
# - ListBox::insert
|
|
11
|
+
# - ListBox::itemconfigure
|
|
12
|
+
# - ListBox::itemcget
|
|
13
|
+
# - ListBox::bindText
|
|
14
|
+
# - ListBox::bindImage
|
|
15
|
+
# - ListBox::delete
|
|
16
|
+
# - ListBox::move
|
|
17
|
+
# - ListBox::reorder
|
|
18
|
+
# - ListBox::selection
|
|
19
|
+
# - ListBox::exists
|
|
20
|
+
# - ListBox::index
|
|
21
|
+
# - ListBox::item - deprecated
|
|
22
|
+
# - ListBox::items
|
|
23
|
+
# - ListBox::see
|
|
24
|
+
# - ListBox::edit
|
|
25
|
+
# - ListBox::xview
|
|
26
|
+
# - ListBox::yview
|
|
27
|
+
# - ListBox::_update_edit_size
|
|
28
|
+
# - ListBox::_destroy
|
|
29
|
+
# - ListBox::_see
|
|
30
|
+
# - ListBox::_update_scrollregion
|
|
31
|
+
# - ListBox::_draw_item
|
|
32
|
+
# - ListBox::_redraw_items
|
|
33
|
+
# - ListBox::_redraw_selection
|
|
34
|
+
# - ListBox::_redraw_listbox
|
|
35
|
+
# - ListBox::_redraw_idle
|
|
36
|
+
# - ListBox::_resize
|
|
37
|
+
# - ListBox::_init_drag_cmd
|
|
38
|
+
# - ListBox::_drop_cmd
|
|
39
|
+
# - ListBox::_over_cmd
|
|
40
|
+
# - ListBox::_auto_scroll
|
|
41
|
+
# - ListBox::_scroll
|
|
42
|
+
# ----------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
namespace eval ListBox {
|
|
45
|
+
Widget::define ListBox listbox DragSite DropSite DynamicHelp
|
|
46
|
+
|
|
47
|
+
namespace eval Item {
|
|
48
|
+
Widget::declare ListBox::Item {
|
|
49
|
+
{-indent Int 0 0 "%d >= 0"}
|
|
50
|
+
{-text String "" 0}
|
|
51
|
+
{-font String "" 0}
|
|
52
|
+
{-foreground String "" 0}
|
|
53
|
+
{-image TkResource "" 0 label}
|
|
54
|
+
{-window String "" 0}
|
|
55
|
+
{-data String "" 0}
|
|
56
|
+
|
|
57
|
+
{-fill Synonym -foreground}
|
|
58
|
+
{-fg Synonym -foreground}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
DynamicHelp::include ListBox::Item balloon
|
|
63
|
+
|
|
64
|
+
Widget::tkinclude ListBox canvas .c \
|
|
65
|
+
remove {
|
|
66
|
+
-insertwidth -insertbackground -insertborderwidth -insertofftime
|
|
67
|
+
-insertontime -selectborderwidth -closeenough -confine -scrollregion
|
|
68
|
+
-xscrollincrement -yscrollincrement -width -height
|
|
69
|
+
} \
|
|
70
|
+
initialize {
|
|
71
|
+
-relief sunken -borderwidth 2 -takefocus 1
|
|
72
|
+
-highlightthickness 1 -width 200
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
DragSite::include ListBox "LISTBOX_ITEM" 1
|
|
76
|
+
DropSite::include ListBox {
|
|
77
|
+
LISTBOX_ITEM {copy {} move {}}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
Widget::declare ListBox {
|
|
81
|
+
{-deltax Int 10 0 "%d >= 0"}
|
|
82
|
+
{-deltay Int 15 0 "%d >= 0"}
|
|
83
|
+
{-padx Int 20 0 "%d >= 0"}
|
|
84
|
+
{-foreground TkResource "" 0 listbox}
|
|
85
|
+
{-background TkResource "" 0 listbox}
|
|
86
|
+
{-selectbackground TkResource "" 0 listbox}
|
|
87
|
+
{-selectforeground TkResource "" 0 listbox}
|
|
88
|
+
{-font TkResource "" 0 listbox}
|
|
89
|
+
{-width TkResource "" 0 listbox}
|
|
90
|
+
{-height TkResource "" 0 listbox}
|
|
91
|
+
{-redraw Boolean 1 0}
|
|
92
|
+
{-multicolumn Boolean 0 0}
|
|
93
|
+
{-dropovermode Flag "wpi" 0 "wpi"}
|
|
94
|
+
{-selectmode Enum none 1 {none single multiple}}
|
|
95
|
+
{-fg Synonym -foreground}
|
|
96
|
+
{-bg Synonym -background}
|
|
97
|
+
{-dropcmd String "ListBox::_drag_and_drop" 0}
|
|
98
|
+
{-autofocus Boolean 1 1}
|
|
99
|
+
{-selectfill Boolean 0 1}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Widget::addmap ListBox "" .c {-deltay -yscrollincrement}
|
|
103
|
+
|
|
104
|
+
bind ListBox <FocusIn> [list after idle {BWidget::refocus %W %W.c}]
|
|
105
|
+
bind ListBox <Destroy> [list ListBox::_destroy %W]
|
|
106
|
+
bind ListBox <Configure> [list ListBox::_resize %W]
|
|
107
|
+
bind ListBoxFocus <1> [list focus %W]
|
|
108
|
+
bind ListBox <Key-Up> [list ListBox::_keyboard_navigation %W -1]
|
|
109
|
+
bind ListBox <Key-Down> [list ListBox::_keyboard_navigation %W 1]
|
|
110
|
+
|
|
111
|
+
variable _edit
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# ----------------------------------------------------------------------------
|
|
116
|
+
# Command ListBox::create
|
|
117
|
+
# ----------------------------------------------------------------------------
|
|
118
|
+
proc ListBox::create { path args } {
|
|
119
|
+
Widget::init ListBox $path $args
|
|
120
|
+
|
|
121
|
+
variable $path
|
|
122
|
+
upvar 0 $path data
|
|
123
|
+
|
|
124
|
+
frame $path -class ListBox -bd 0 -highlightthickness 0 -relief flat \
|
|
125
|
+
-takefocus 0
|
|
126
|
+
# For 8.4+ we don't want to inherit the padding
|
|
127
|
+
catch {$path configure -padx 0 -pady 0}
|
|
128
|
+
# widget informations
|
|
129
|
+
set data(nrows) -1
|
|
130
|
+
|
|
131
|
+
# items informations
|
|
132
|
+
set data(items) {}
|
|
133
|
+
set data(selitems) {}
|
|
134
|
+
|
|
135
|
+
# update informations
|
|
136
|
+
set data(upd,level) 0
|
|
137
|
+
set data(upd,afterid) ""
|
|
138
|
+
set data(upd,level) 0
|
|
139
|
+
set data(upd,delete) {}
|
|
140
|
+
|
|
141
|
+
# drag and drop informations
|
|
142
|
+
set data(dnd,scroll) ""
|
|
143
|
+
set data(dnd,afterid) ""
|
|
144
|
+
set data(dnd,item) ""
|
|
145
|
+
|
|
146
|
+
eval [list canvas $path.c] [Widget::subcget $path .c] \
|
|
147
|
+
[list -xscrollincrement 8]
|
|
148
|
+
pack $path.c -expand yes -fill both
|
|
149
|
+
|
|
150
|
+
DragSite::setdrag $path $path.c ListBox::_init_drag_cmd \
|
|
151
|
+
[Widget::cget $path -dragendcmd] 1
|
|
152
|
+
DropSite::setdrop $path $path.c ListBox::_over_cmd ListBox::_drop_cmd 1
|
|
153
|
+
|
|
154
|
+
Widget::create ListBox $path
|
|
155
|
+
|
|
156
|
+
set w [Widget::cget $path -width]
|
|
157
|
+
set h [Widget::cget $path -height]
|
|
158
|
+
set dy [Widget::cget $path -deltay]
|
|
159
|
+
$path.c configure -width [expr {$w*8}] -height [expr {$h*$dy}]
|
|
160
|
+
|
|
161
|
+
# Insert $path into the canvas bindings, so that anyone binding
|
|
162
|
+
# directly onto the widget will see their bindings activated when
|
|
163
|
+
# the canvas has focus.
|
|
164
|
+
set bindtags [bindtags $path.c]
|
|
165
|
+
set bindtags [linsert $bindtags 1 $path]
|
|
166
|
+
# Let any click within the canvas focus on the canvas so that
|
|
167
|
+
# MouseWheel scroll events will be properly handled by the canvas.
|
|
168
|
+
if {[Widget::cget $path -autofocus]} {
|
|
169
|
+
lappend bindtags ListBoxFocus
|
|
170
|
+
BWidget::bindMouseWheel $path.c
|
|
171
|
+
}
|
|
172
|
+
bindtags $path.c $bindtags
|
|
173
|
+
|
|
174
|
+
# Add slightly modified up/down bindings to the canvas, in case
|
|
175
|
+
# it gets the focus (like with -autofocus).
|
|
176
|
+
bind $path.c <Key-Up> {ListBox::_keyboard_navigation [winfo parent %W] -1}
|
|
177
|
+
bind $path.c <Key-Down> {ListBox::_keyboard_navigation [winfo parent %W] 1}
|
|
178
|
+
|
|
179
|
+
switch -exact -- [Widget::getoption $path -selectmode] {
|
|
180
|
+
single {
|
|
181
|
+
$path bindText <Button-1> [list ListBox::_mouse_select $path set]
|
|
182
|
+
$path bindImage <Button-1> [list ListBox::_mouse_select $path set]
|
|
183
|
+
}
|
|
184
|
+
multiple {
|
|
185
|
+
set cmd ListBox::_multiple_select
|
|
186
|
+
$path bindText <Button-1> [list $cmd $path n %x %y]
|
|
187
|
+
$path bindText <Shift-Button-1> [list $cmd $path s %x %y]
|
|
188
|
+
$path bindText <Control-Button-1> [list $cmd $path c %x %y]
|
|
189
|
+
|
|
190
|
+
$path bindImage <Button-1> [list $cmd $path n %x %y]
|
|
191
|
+
$path bindImage <Shift-Button-1> [list $cmd $path s %x %y]
|
|
192
|
+
$path bindImage <Control-Button-1> [list $cmd $path c %x %y]
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return $path
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# ----------------------------------------------------------------------------
|
|
201
|
+
# Command ListBox::configure
|
|
202
|
+
# ----------------------------------------------------------------------------
|
|
203
|
+
proc ListBox::configure { path args } {
|
|
204
|
+
set res [Widget::configure $path $args]
|
|
205
|
+
|
|
206
|
+
set ch1 [expr {[Widget::hasChanged $path -deltay dy] |
|
|
207
|
+
[Widget::hasChanged $path -padx val] |
|
|
208
|
+
[Widget::hasChanged $path -multicolumn val]}]
|
|
209
|
+
|
|
210
|
+
set ch2 [expr {[Widget::hasChanged $path -selectbackground val] |
|
|
211
|
+
[Widget::hasChanged $path -selectforeground val]}]
|
|
212
|
+
|
|
213
|
+
set redraw 0
|
|
214
|
+
if { [Widget::hasChanged $path -height h] } {
|
|
215
|
+
$path.c configure -height [expr {$h*$dy}]
|
|
216
|
+
set redraw 1
|
|
217
|
+
}
|
|
218
|
+
if { [Widget::hasChanged $path -width w] } {
|
|
219
|
+
$path.c configure -width [expr {$w*8}]
|
|
220
|
+
set redraw 1
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if { [Widget::hasChanged $path -background bg] } {
|
|
224
|
+
$path.c itemconfigure box -fill $bg
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if { !$redraw } {
|
|
228
|
+
if { $ch1 } {
|
|
229
|
+
_redraw_idle $path 2
|
|
230
|
+
} elseif { $ch2 } {
|
|
231
|
+
_redraw_idle $path 1
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if { [Widget::hasChanged $path -redraw bool] && $bool } {
|
|
236
|
+
variable $path
|
|
237
|
+
upvar 0 $path data
|
|
238
|
+
set lvl $data(upd,level)
|
|
239
|
+
set data(upd,level) 0
|
|
240
|
+
_redraw_idle $path $lvl
|
|
241
|
+
}
|
|
242
|
+
set force [Widget::hasChanged $path -dragendcmd dragend]
|
|
243
|
+
DragSite::setdrag $path $path.c ListBox::_init_drag_cmd $dragend $force
|
|
244
|
+
DropSite::setdrop $path $path.c ListBox::_over_cmd ListBox::_drop_cmd
|
|
245
|
+
|
|
246
|
+
return $res
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# ----------------------------------------------------------------------------
|
|
251
|
+
# Command ListBox::cget
|
|
252
|
+
# ----------------------------------------------------------------------------
|
|
253
|
+
proc ListBox::cget { path option } {
|
|
254
|
+
return [Widget::cget $path $option]
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# ----------------------------------------------------------------------------
|
|
259
|
+
# Command ListBox::insert
|
|
260
|
+
# ----------------------------------------------------------------------------
|
|
261
|
+
proc ListBox::insert { path index item args } {
|
|
262
|
+
variable $path
|
|
263
|
+
upvar 0 $path data
|
|
264
|
+
|
|
265
|
+
set item [Widget::nextIndex $path $item]
|
|
266
|
+
|
|
267
|
+
if { [lsearch -exact $data(items) $item] != -1 } {
|
|
268
|
+
return -code error "item \"$item\" already exists"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
Widget::init ListBox::Item $path.$item $args
|
|
272
|
+
|
|
273
|
+
set data(items) [linsert $data(items) $index $item]
|
|
274
|
+
set data(upd,create,$item) $item
|
|
275
|
+
|
|
276
|
+
_redraw_idle $path 2
|
|
277
|
+
return $item
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
# Bastien Chevreux (bach@mwgdna.com)
|
|
281
|
+
# The multipleinsert command performs inserts several items at once into
|
|
282
|
+
# the list. It is faster than calling insert multiple times as it uses the
|
|
283
|
+
# Widget::copyinit command for initializing all items after the 1st. The
|
|
284
|
+
# speedup factor is between 2 and 3 for typical usage, but could be higher
|
|
285
|
+
# for inserts with many options.
|
|
286
|
+
#
|
|
287
|
+
# Syntax: path and index are as in the insert command
|
|
288
|
+
# args is a list of even numbered elements where the 1st of each pair
|
|
289
|
+
# corresponds to the item of 'insert' and the second to args of 'insert'.
|
|
290
|
+
# ----------------------------------------------------------------------------
|
|
291
|
+
# Command ListBox::multipleinsert
|
|
292
|
+
# ----------------------------------------------------------------------------
|
|
293
|
+
proc ListBox::multipleinsert { path index args } {
|
|
294
|
+
variable $path
|
|
295
|
+
upvar 0 $path data
|
|
296
|
+
|
|
297
|
+
# If we got only one list as arg, take the first element as args
|
|
298
|
+
# This enables callers to use
|
|
299
|
+
# $list multipleinsert index $thelist
|
|
300
|
+
# instead of
|
|
301
|
+
# eval $list multipleinsert index $thelist
|
|
302
|
+
|
|
303
|
+
if {[llength $args] == 1} {
|
|
304
|
+
set args [lindex $args 0]
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
set count 0
|
|
308
|
+
foreach {item iargs} $args {
|
|
309
|
+
if { [lsearch -exact $data(items) $item] != -1 } {
|
|
310
|
+
return -code error "item \"$item\" already exists"
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if {$count==0} {
|
|
314
|
+
Widget::init ListBox::Item $path.$item $iargs
|
|
315
|
+
set firstpath $path.$item
|
|
316
|
+
} else {
|
|
317
|
+
Widget::copyinit ListBox::Item $firstpath $path.$item $iargs
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
set data(items) [linsert $data(items) $index $item]
|
|
321
|
+
set data(upd,create,$item) $item
|
|
322
|
+
|
|
323
|
+
incr count
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
_redraw_idle $path 2
|
|
327
|
+
return $item
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
# ----------------------------------------------------------------------------
|
|
331
|
+
# Command ListBox::itemconfigure
|
|
332
|
+
# ----------------------------------------------------------------------------
|
|
333
|
+
proc ListBox::itemconfigure { path item args } {
|
|
334
|
+
variable $path
|
|
335
|
+
upvar 0 $path data
|
|
336
|
+
|
|
337
|
+
if { [lsearch -exact $data(items) $item] == -1 } {
|
|
338
|
+
return -code error "item \"$item\" does not exist"
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
set oldind [Widget::getoption $path.$item -indent]
|
|
342
|
+
|
|
343
|
+
set res [Widget::configure $path.$item $args]
|
|
344
|
+
set chind [Widget::hasChanged $path.$item -indent indent]
|
|
345
|
+
set chw [Widget::hasChanged $path.$item -window win]
|
|
346
|
+
set chi [Widget::hasChanged $path.$item -image img]
|
|
347
|
+
set cht [Widget::hasChanged $path.$item -text txt]
|
|
348
|
+
set chf [Widget::hasChanged $path.$item -font fnt]
|
|
349
|
+
set chfg [Widget::hasChanged $path.$item -foreground fg]
|
|
350
|
+
set idn [$path.c find withtag n:$item]
|
|
351
|
+
|
|
352
|
+
_set_help $path $item
|
|
353
|
+
|
|
354
|
+
if { $idn == "" } {
|
|
355
|
+
# item is not drawn yet
|
|
356
|
+
_redraw_idle $path 2
|
|
357
|
+
return $res
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
set oldb [$path.c bbox $idn]
|
|
361
|
+
set coords [$path.c coords $idn]
|
|
362
|
+
set padx [Widget::getoption $path -padx]
|
|
363
|
+
set x0 [expr {[lindex $coords 0]-$padx-$oldind+$indent}]
|
|
364
|
+
set y0 [lindex $coords 1]
|
|
365
|
+
if { $chw || $chi } {
|
|
366
|
+
# -window or -image modified
|
|
367
|
+
set idi [$path.c find withtag i:$item]
|
|
368
|
+
set type [lindex [$path.c gettags $idi] 0]
|
|
369
|
+
if { [string length $win] } {
|
|
370
|
+
if { [string equal $type "win"] } {
|
|
371
|
+
$path.c itemconfigure $idi -window $win
|
|
372
|
+
} else {
|
|
373
|
+
$path.c delete $idi
|
|
374
|
+
$path.c create window $x0 $y0 -window $win -anchor w \
|
|
375
|
+
-tags [list win i:$item]
|
|
376
|
+
}
|
|
377
|
+
} elseif { [string length $img] } {
|
|
378
|
+
if { [string equal $type "img"] } {
|
|
379
|
+
$path.c itemconfigure $idi -image $img
|
|
380
|
+
} else {
|
|
381
|
+
$path.c delete $idi
|
|
382
|
+
$path.c create image $x0 $y0 -image $img -anchor w \
|
|
383
|
+
-tags [list img i:$item]
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
$path.c delete $idi
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if { $cht || $chf || $chfg } {
|
|
391
|
+
# -text or -font modified, or -foreground modified
|
|
392
|
+
set fnt [_getoption $path $item -font]
|
|
393
|
+
set fg [_getoption $path $item -foreground]
|
|
394
|
+
$path.c itemconfigure $idn -text $txt -font $fnt -fill $fg
|
|
395
|
+
_redraw_idle $path 1
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if { $chind } {
|
|
399
|
+
# -indent modified
|
|
400
|
+
$path.c coords $idn [expr {$x0+$padx}] $y0
|
|
401
|
+
$path.c coords i:$item $x0 $y0
|
|
402
|
+
_redraw_idle $path 1
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if { [Widget::getoption $path -multicolumn] && ($cht || $chf || $chind) } {
|
|
406
|
+
set bbox [$path.c bbox $idn]
|
|
407
|
+
if { [lindex $bbox 2] > [lindex $oldb 2] } {
|
|
408
|
+
_redraw_idle $path 2
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return $res
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
# ----------------------------------------------------------------------------
|
|
417
|
+
# Command ListBox::itemcget
|
|
418
|
+
# ----------------------------------------------------------------------------
|
|
419
|
+
proc ListBox::itemcget { path item option } {
|
|
420
|
+
return [Widget::cget $path.$item $option]
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
# ----------------------------------------------------------------------------
|
|
425
|
+
# Command ListBox::bindText
|
|
426
|
+
# ----------------------------------------------------------------------------
|
|
427
|
+
proc ListBox::bindText { path event script } {
|
|
428
|
+
if { $script != "" } {
|
|
429
|
+
set map [list %W $path]
|
|
430
|
+
set script [string map $map $script]
|
|
431
|
+
append script " \[ListBox::_get_current [list $path]\]"
|
|
432
|
+
}
|
|
433
|
+
$path.c bind "click" $event $script
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
# ----------------------------------------------------------------------------
|
|
438
|
+
# Command ListBox::bindImage
|
|
439
|
+
# ----------------------------------------------------------------------------
|
|
440
|
+
proc ListBox::bindImage { path event script } {
|
|
441
|
+
if { $script != "" } {
|
|
442
|
+
set map [list %W $path]
|
|
443
|
+
set script [string map $map $script]
|
|
444
|
+
append script " \[ListBox::_get_current [list $path]\]"
|
|
445
|
+
}
|
|
446
|
+
$path.c bind "img" $event $script
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
# ----------------------------------------------------------------------------
|
|
451
|
+
# Command ListBox::delete
|
|
452
|
+
# ----------------------------------------------------------------------------
|
|
453
|
+
proc ListBox::delete { path args } {
|
|
454
|
+
variable $path
|
|
455
|
+
upvar 0 $path data
|
|
456
|
+
Widget::getVariable $path help
|
|
457
|
+
|
|
458
|
+
foreach litems $args {
|
|
459
|
+
foreach item $litems {
|
|
460
|
+
set idx [lsearch -exact $data(items) $item]
|
|
461
|
+
if { $idx != -1 } {
|
|
462
|
+
set data(items) [lreplace $data(items) $idx $idx]
|
|
463
|
+
array unset help $item
|
|
464
|
+
Widget::destroy $path.$item
|
|
465
|
+
if { [info exists data(upd,create,$item)] } {
|
|
466
|
+
unset data(upd,create,$item)
|
|
467
|
+
} else {
|
|
468
|
+
lappend data(upd,delete) $item
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
set sel $data(selitems)
|
|
475
|
+
set data(selitems) {}
|
|
476
|
+
eval [list selection $path set] $sel
|
|
477
|
+
_redraw_idle $path 2
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
# ----------------------------------------------------------------------------
|
|
482
|
+
# Command ListBox::move
|
|
483
|
+
# ----------------------------------------------------------------------------
|
|
484
|
+
proc ListBox::move { path item index } {
|
|
485
|
+
variable $path
|
|
486
|
+
upvar 0 $path data
|
|
487
|
+
|
|
488
|
+
if { [set idx [lsearch -exact $data(items) $item]] == -1 } {
|
|
489
|
+
return -code error "item \"$item\" does not exist"
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
set data(items) [linsert [lreplace $data(items) $idx $idx] $index $item]
|
|
493
|
+
|
|
494
|
+
_redraw_idle $path 2
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
# ----------------------------------------------------------------------------
|
|
499
|
+
# Command ListBox::reorder
|
|
500
|
+
# ----------------------------------------------------------------------------
|
|
501
|
+
proc ListBox::reorder { path neworder } {
|
|
502
|
+
variable $path
|
|
503
|
+
upvar 0 $path data
|
|
504
|
+
|
|
505
|
+
set data(items) [BWidget::lreorder $data(items) $neworder]
|
|
506
|
+
_redraw_idle $path 2
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
# ----------------------------------------------------------------------------
|
|
511
|
+
# Command ListBox::selection
|
|
512
|
+
# ----------------------------------------------------------------------------
|
|
513
|
+
proc ListBox::selection { path cmd args } {
|
|
514
|
+
variable $path
|
|
515
|
+
upvar 0 $path data
|
|
516
|
+
|
|
517
|
+
switch -- $cmd {
|
|
518
|
+
set {
|
|
519
|
+
set data(selitems) {}
|
|
520
|
+
foreach item $args {
|
|
521
|
+
if { [lsearch -exact $data(selitems) $item] == -1 } {
|
|
522
|
+
if { [lsearch -exact $data(items) $item] != -1 } {
|
|
523
|
+
lappend data(selitems) $item
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
add {
|
|
529
|
+
foreach item $args {
|
|
530
|
+
if { [lsearch -exact $data(selitems) $item] == -1 } {
|
|
531
|
+
if { [lsearch -exact $data(items) $item] != -1 } {
|
|
532
|
+
lappend data(selitems) $item
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
remove {
|
|
538
|
+
foreach item $args {
|
|
539
|
+
if { [set idx [lsearch -exact $data(selitems) $item]] != -1 } {
|
|
540
|
+
set data(selitems) [lreplace $data(selitems) $idx $idx]
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
clear {
|
|
545
|
+
set data(selitems) {}
|
|
546
|
+
}
|
|
547
|
+
get {
|
|
548
|
+
return $data(selitems)
|
|
549
|
+
}
|
|
550
|
+
includes {
|
|
551
|
+
return [expr {[lsearch -exact $data(selitems) $args] != -1}]
|
|
552
|
+
}
|
|
553
|
+
default {
|
|
554
|
+
return
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
_redraw_idle $path 1
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
# ----------------------------------------------------------------------------
|
|
563
|
+
# Command ListBox::exists
|
|
564
|
+
# ----------------------------------------------------------------------------
|
|
565
|
+
proc ListBox::exists { path item } {
|
|
566
|
+
variable $path
|
|
567
|
+
upvar 0 $path data
|
|
568
|
+
|
|
569
|
+
return [expr {[lsearch -exact $data(items) $item] != -1}]
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
# ----------------------------------------------------------------------------
|
|
574
|
+
# Command ListBox::index
|
|
575
|
+
# ----------------------------------------------------------------------------
|
|
576
|
+
proc ListBox::index { path item } {
|
|
577
|
+
variable $path
|
|
578
|
+
upvar 0 $path data
|
|
579
|
+
if {[string equal $item "active"]} { return [$path selection get] }
|
|
580
|
+
return [lsearch -exact $data(items) $item]
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
# ----------------------------------------------------------------------------
|
|
585
|
+
# ListBox::find
|
|
586
|
+
# Returns the item given a position.
|
|
587
|
+
# findInfo @x,y ?confine?
|
|
588
|
+
# lineNumber
|
|
589
|
+
# ----------------------------------------------------------------------------
|
|
590
|
+
proc ListBox::find {path findInfo {confine ""}} {
|
|
591
|
+
variable $path
|
|
592
|
+
upvar 0 $path widgetData
|
|
593
|
+
|
|
594
|
+
if {[regexp -- {^@([0-9]+),([0-9]+)$} $findInfo match x y]} {
|
|
595
|
+
set x [$path.c canvasx $x]
|
|
596
|
+
set y [$path.c canvasy $y]
|
|
597
|
+
} elseif {[regexp -- {^[0-9]+$} $findInfo lineNumber]} {
|
|
598
|
+
set dy [Widget::getoption $path -deltay]
|
|
599
|
+
set y [expr {$dy*($lineNumber+0.5)}]
|
|
600
|
+
set confine ""
|
|
601
|
+
} else {
|
|
602
|
+
return -code error "invalid find spec \"$findInfo\""
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
set found 0
|
|
606
|
+
set xi 0
|
|
607
|
+
foreach xs $widgetData(xlist) {
|
|
608
|
+
if {$x <= $xs} {
|
|
609
|
+
foreach id [$path.c find overlapping $xi $y $xs $y] {
|
|
610
|
+
set ltags [$path.c gettags $id]
|
|
611
|
+
set item [lindex $ltags 0]
|
|
612
|
+
if { [string equal $item "item"] ||
|
|
613
|
+
[string equal $item "img"] ||
|
|
614
|
+
[string equal $item "win"] } {
|
|
615
|
+
# item is the label or image/window of the node
|
|
616
|
+
set item [string range [lindex $ltags 1] 2 end]
|
|
617
|
+
set found 1
|
|
618
|
+
break
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
break
|
|
622
|
+
}
|
|
623
|
+
set xi $xs
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if {$found} {
|
|
627
|
+
if {[string equal $confine "confine"]} {
|
|
628
|
+
# test if x stand inside node bbox
|
|
629
|
+
set xi [expr {[lindex [$path.c coords n:$item] 0]-[Widget::getoption $path -padx]}]
|
|
630
|
+
set xs [lindex [$path.c bbox n:$item] 2]
|
|
631
|
+
if {$x >= $xi && $x <= $xs} {
|
|
632
|
+
return $item
|
|
633
|
+
}
|
|
634
|
+
} else {
|
|
635
|
+
return $item
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return ""
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
# ----------------------------------------------------------------------------
|
|
643
|
+
# Command ListBox::item - deprecated
|
|
644
|
+
# ----------------------------------------------------------------------------
|
|
645
|
+
proc ListBox::item { path first {last ""} } {
|
|
646
|
+
variable $path
|
|
647
|
+
upvar 0 $path data
|
|
648
|
+
|
|
649
|
+
if { ![string length $last] } {
|
|
650
|
+
return [lindex $data(items) $first]
|
|
651
|
+
} else {
|
|
652
|
+
return [lrange $data(items) $first $last]
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
# ----------------------------------------------------------------------------
|
|
658
|
+
# Command ListBox::items
|
|
659
|
+
# ----------------------------------------------------------------------------
|
|
660
|
+
proc ListBox::items { path {first ""} {last ""}} {
|
|
661
|
+
variable $path
|
|
662
|
+
upvar 0 $path data
|
|
663
|
+
|
|
664
|
+
if { ![string length $first] } {
|
|
665
|
+
return $data(items)
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if { ![string length $last] } {
|
|
669
|
+
return [lindex $data(items) $first]
|
|
670
|
+
} else {
|
|
671
|
+
return [lrange $data(items) $first $last]
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
# ----------------------------------------------------------------------------
|
|
677
|
+
# Command ListBox::see
|
|
678
|
+
# ----------------------------------------------------------------------------
|
|
679
|
+
proc ListBox::see { path item } {
|
|
680
|
+
variable $path
|
|
681
|
+
upvar 0 $path data
|
|
682
|
+
|
|
683
|
+
if { [Widget::getoption $path -redraw] && $data(upd,afterid) != "" } {
|
|
684
|
+
after cancel $data(upd,afterid)
|
|
685
|
+
_redraw_listbox $path
|
|
686
|
+
}
|
|
687
|
+
set idn [$path.c find withtag n:$item]
|
|
688
|
+
if { $idn != "" } {
|
|
689
|
+
ListBox::_see $path $idn right
|
|
690
|
+
ListBox::_see $path $idn left
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
# ----------------------------------------------------------------------------
|
|
696
|
+
# Command ListBox::edit
|
|
697
|
+
# ----------------------------------------------------------------------------
|
|
698
|
+
proc ListBox::edit { path item text {verifycmd ""} {clickres 0} {select 1}} {
|
|
699
|
+
variable _edit
|
|
700
|
+
variable $path
|
|
701
|
+
upvar 0 $path data
|
|
702
|
+
|
|
703
|
+
if { [Widget::getoption $path -redraw] && $data(upd,afterid) != "" } {
|
|
704
|
+
after cancel $data(upd,afterid)
|
|
705
|
+
_redraw_listbox $path
|
|
706
|
+
}
|
|
707
|
+
set idn [$path.c find withtag n:$item]
|
|
708
|
+
if { $idn != "" } {
|
|
709
|
+
ListBox::_see $path $idn right
|
|
710
|
+
ListBox::_see $path $idn left
|
|
711
|
+
|
|
712
|
+
set oldfg [$path.c itemcget $idn -fill]
|
|
713
|
+
set sbg [Widget::getoption $path -selectbackground]
|
|
714
|
+
set coords [$path.c coords $idn]
|
|
715
|
+
set x [lindex $coords 0]
|
|
716
|
+
set y [lindex $coords 1]
|
|
717
|
+
set bd [expr {[$path.c cget -borderwidth]+[$path.c cget -highlightthickness]}]
|
|
718
|
+
set w [expr {[winfo width $path] - 2*$bd}]
|
|
719
|
+
set wmax [expr {[$path.c canvasx $w]-$x}]
|
|
720
|
+
|
|
721
|
+
$path.c itemconfigure $idn -fill [Widget::getoption $path -background]
|
|
722
|
+
$path.c itemconfigure s:$item -fill {} -outline {}
|
|
723
|
+
|
|
724
|
+
set _edit(text) $text
|
|
725
|
+
set _edit(wait) 0
|
|
726
|
+
|
|
727
|
+
set frame [frame $path.edit \
|
|
728
|
+
-relief flat -borderwidth 0 -highlightthickness 0 \
|
|
729
|
+
-background [Widget::getoption $path -background]]
|
|
730
|
+
set ent [entry $frame.edit \
|
|
731
|
+
-width 0 \
|
|
732
|
+
-relief solid \
|
|
733
|
+
-borderwidth 1 \
|
|
734
|
+
-highlightthickness 0 \
|
|
735
|
+
-foreground [_getoption $path $item -foreground] \
|
|
736
|
+
-background [Widget::getoption $path -background] \
|
|
737
|
+
-selectforeground [Widget::getoption $path -selectforeground] \
|
|
738
|
+
-selectbackground $sbg \
|
|
739
|
+
-font [_getoption $path $item -font] \
|
|
740
|
+
-textvariable ListBox::_edit(text)]
|
|
741
|
+
pack $ent -ipadx 8 -anchor w
|
|
742
|
+
|
|
743
|
+
set idw [$path.c create window $x $y -window $frame -anchor w]
|
|
744
|
+
trace variable ListBox::_edit(text) w [list ListBox::_update_edit_size $path $ent $idw $wmax]
|
|
745
|
+
tkwait visibility $ent
|
|
746
|
+
grab $frame
|
|
747
|
+
BWidget::focus set $ent
|
|
748
|
+
_update_edit_size $path $ent $idw $wmax
|
|
749
|
+
update
|
|
750
|
+
if { $select } {
|
|
751
|
+
$ent selection range 0 end
|
|
752
|
+
$ent icursor end
|
|
753
|
+
$ent xview end
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
bindtags $ent [list $ent Entry]
|
|
757
|
+
bind $ent <Escape> {set ListBox::_edit(wait) 0}
|
|
758
|
+
bind $ent <Return> {set ListBox::_edit(wait) 1}
|
|
759
|
+
if { $clickres == 0 || $clickres == 1 } {
|
|
760
|
+
bind $frame <Button> [list set ListBox::_edit(wait) $clickres]
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
set ok 0
|
|
764
|
+
while { !$ok } {
|
|
765
|
+
tkwait variable ListBox::_edit(wait)
|
|
766
|
+
if { !$_edit(wait) || [llength $verifycmd]==0 ||
|
|
767
|
+
[uplevel \#0 $verifycmd [list $_edit(text)]] } {
|
|
768
|
+
set ok 1
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
trace vdelete ListBox::_edit(text) w [list ListBox::_update_edit_size $path $ent $idw $wmax]
|
|
772
|
+
grab release $frame
|
|
773
|
+
BWidget::focus release $ent
|
|
774
|
+
destroy $frame
|
|
775
|
+
$path.c delete $idw
|
|
776
|
+
$path.c itemconfigure $idn -fill $oldfg
|
|
777
|
+
$path.c itemconfigure s:$item -fill $sbg -outline $sbg
|
|
778
|
+
|
|
779
|
+
if { $_edit(wait) } {
|
|
780
|
+
return $_edit(text)
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return ""
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
# ----------------------------------------------------------------------------
|
|
788
|
+
# Command ListBox::xview
|
|
789
|
+
# ----------------------------------------------------------------------------
|
|
790
|
+
proc ListBox::xview { path args } {
|
|
791
|
+
return [eval [linsert $args 0 $path.c xview]]
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
# ----------------------------------------------------------------------------
|
|
796
|
+
# Command ListBox::yview
|
|
797
|
+
# ----------------------------------------------------------------------------
|
|
798
|
+
proc ListBox::yview { path args } {
|
|
799
|
+
return [eval [linsert $args 0 $path.c yview]]
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
proc ListBox::getcanvas { path } {
|
|
804
|
+
return $path.c
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
proc ListBox::curselection { path } {
|
|
809
|
+
return [$path selection get]
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
# ----------------------------------------------------------------------------
|
|
814
|
+
# Command ListBox::_update_edit_size
|
|
815
|
+
# ----------------------------------------------------------------------------
|
|
816
|
+
proc ListBox::_update_edit_size { path entry idw wmax args } {
|
|
817
|
+
set entw [winfo reqwidth $entry]
|
|
818
|
+
if { $entw >= $wmax } {
|
|
819
|
+
$path.c itemconfigure $idw -width $wmax
|
|
820
|
+
} else {
|
|
821
|
+
$path.c itemconfigure $idw -width 0
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
# ----------------------------------------------------------------------------
|
|
827
|
+
# Command ListBox::_getoption
|
|
828
|
+
# Returns the value of option for node. If empty, returned value is those
|
|
829
|
+
# of the ListBox.
|
|
830
|
+
# ----------------------------------------------------------------------------
|
|
831
|
+
proc ListBox::_getoption { path item option } {
|
|
832
|
+
set value [Widget::getoption $path.$item $option]
|
|
833
|
+
if {![string length $value]} {
|
|
834
|
+
set value [Widget::getoption $path $option]
|
|
835
|
+
}
|
|
836
|
+
return $value
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
# ----------------------------------------------------------------------------
|
|
841
|
+
# Command ListBox::_destroy
|
|
842
|
+
# ----------------------------------------------------------------------------
|
|
843
|
+
proc ListBox::_destroy { path } {
|
|
844
|
+
variable $path
|
|
845
|
+
upvar 0 $path data
|
|
846
|
+
|
|
847
|
+
if { $data(upd,afterid) != "" } {
|
|
848
|
+
after cancel $data(upd,afterid)
|
|
849
|
+
}
|
|
850
|
+
if { $data(dnd,afterid) != "" } {
|
|
851
|
+
after cancel $data(dnd,afterid)
|
|
852
|
+
}
|
|
853
|
+
foreach item $data(items) {
|
|
854
|
+
Widget::destroy $path.$item
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
Widget::destroy $path
|
|
858
|
+
unset data
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
# ----------------------------------------------------------------------------
|
|
863
|
+
# Command ListBox::_see
|
|
864
|
+
# ----------------------------------------------------------------------------
|
|
865
|
+
proc ListBox::_see { path idn side } {
|
|
866
|
+
set bbox [$path.c bbox $idn]
|
|
867
|
+
set scrl [$path.c cget -scrollregion]
|
|
868
|
+
|
|
869
|
+
set ymax [lindex $scrl 3]
|
|
870
|
+
set dy [$path.c cget -yscrollincrement]
|
|
871
|
+
set yv [$path.c yview]
|
|
872
|
+
set yv0 [expr {round([lindex $yv 0]*$ymax/$dy)}]
|
|
873
|
+
set yv1 [expr {round([lindex $yv 1]*$ymax/$dy)}]
|
|
874
|
+
set y [expr {int([lindex [$path.c coords $idn] 1]/$dy)}]
|
|
875
|
+
if { $y < $yv0 } {
|
|
876
|
+
$path.c yview scroll [expr {$y-$yv0}] units
|
|
877
|
+
} elseif { $y >= $yv1 } {
|
|
878
|
+
$path.c yview scroll [expr {$y-$yv1+1}] units
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
set xmax [lindex $scrl 2]
|
|
882
|
+
set dx [$path.c cget -xscrollincrement]
|
|
883
|
+
set xv [$path.c xview]
|
|
884
|
+
if { [string equal $side "right"] } {
|
|
885
|
+
set xv1 [expr {round([lindex $xv 1]*$xmax/$dx)}]
|
|
886
|
+
set x1 [expr {int([lindex $bbox 2]/$dx)}]
|
|
887
|
+
if { $x1 >= $xv1 } {
|
|
888
|
+
$path.c xview scroll [expr {$x1-$xv1+1}] units
|
|
889
|
+
}
|
|
890
|
+
} else {
|
|
891
|
+
set xv0 [expr {round([lindex $xv 0]*$xmax/$dx)}]
|
|
892
|
+
set x0 [expr {int([lindex $bbox 0]/$dx)}]
|
|
893
|
+
if { $x0 < $xv0 } {
|
|
894
|
+
$path.c xview scroll [expr {$x0-$xv0}] units
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
# ----------------------------------------------------------------------------
|
|
901
|
+
# Command ListBox::_update_scrollregion
|
|
902
|
+
# ----------------------------------------------------------------------------
|
|
903
|
+
proc ListBox::_update_scrollregion { path } {
|
|
904
|
+
set bd [$path.c cget -borderwidth]
|
|
905
|
+
set ht [$path.c cget -highlightthickness]
|
|
906
|
+
set bd [expr {2*($bd + $ht)}]
|
|
907
|
+
set w [expr {[winfo width $path] - $bd}]
|
|
908
|
+
set h [expr {[winfo height $path] - $bd}]
|
|
909
|
+
set xinc [$path.c cget -xscrollincrement]
|
|
910
|
+
set yinc [$path.c cget -yscrollincrement]
|
|
911
|
+
set bbox [$path.c bbox item win img]
|
|
912
|
+
if { [llength $bbox] } {
|
|
913
|
+
set xs [lindex $bbox 2]
|
|
914
|
+
set ys [lindex $bbox 3]
|
|
915
|
+
|
|
916
|
+
if { $w < $xs } {
|
|
917
|
+
set w [expr {int($xs)}]
|
|
918
|
+
if { [set r [expr {$w % $xinc}]] } {
|
|
919
|
+
set w [expr {$w+$xinc-$r}]
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
if { $h < $ys } {
|
|
923
|
+
set h [expr {int($ys)}]
|
|
924
|
+
if { [set r [expr {$h % $yinc}]] } {
|
|
925
|
+
set h [expr {$h+$yinc-$r}]
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
$path.c configure -scrollregion [list 0 0 $w $h]
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
proc ListBox::_update_select_fill { path } {
|
|
935
|
+
variable $path
|
|
936
|
+
upvar 0 $path data
|
|
937
|
+
|
|
938
|
+
set width [winfo width $path]
|
|
939
|
+
|
|
940
|
+
foreach item $data(items) {
|
|
941
|
+
set bbox [$path.c bbox n:$item]
|
|
942
|
+
set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
|
|
943
|
+
$path.c coords b:$item $bbox
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
_redraw_selection $path
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
# ----------------------------------------------------------------------------
|
|
951
|
+
# Command ListBox::_draw_item
|
|
952
|
+
# ----------------------------------------------------------------------------
|
|
953
|
+
proc ListBox::_draw_item {path item x0 x1 y bg selfill multi ww} {
|
|
954
|
+
set indent [Widget::getoption $path.$item -indent]
|
|
955
|
+
set i [$path.c create text [expr {$x1+$indent}] $y \
|
|
956
|
+
-text [Widget::getoption $path.$item -text] \
|
|
957
|
+
-fill [_getoption $path $item -foreground] \
|
|
958
|
+
-font [_getoption $path $item -font] \
|
|
959
|
+
-anchor w \
|
|
960
|
+
-tags [list item n:$item click]]
|
|
961
|
+
|
|
962
|
+
if { $selfill && !$multi } {
|
|
963
|
+
set bbox [$path.c bbox n:$item]
|
|
964
|
+
set bbox [list 0 [lindex $bbox 1] $ww [lindex $bbox 3]]
|
|
965
|
+
set tags [list box b:$item click]
|
|
966
|
+
$path.c create rect $bbox -fill $bg -width 0 -tags $tags
|
|
967
|
+
$path.c raise $i
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if { [set win [Widget::getoption $path.$item -window]] != "" } {
|
|
971
|
+
$path.c create window [expr {$x0+$indent}] $y \
|
|
972
|
+
-window $win -anchor w -tags [list win i:$item]
|
|
973
|
+
} elseif { [set img [Widget::getoption $path.$item -image]] != "" } {
|
|
974
|
+
$path.c create image [expr {$x0+$indent}] $y \
|
|
975
|
+
-image $img -anchor w -tags [list img i:$item]
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
_set_help $path $item
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
# ----------------------------------------------------------------------------
|
|
983
|
+
# Command ListBox::_redraw_items
|
|
984
|
+
# ----------------------------------------------------------------------------
|
|
985
|
+
proc ListBox::_redraw_items { path } {
|
|
986
|
+
variable $path
|
|
987
|
+
upvar 0 $path data
|
|
988
|
+
|
|
989
|
+
set cursor [$path.c cget -cursor]
|
|
990
|
+
$path.c configure -cursor watch
|
|
991
|
+
update idletasks ; # make sure watch cursor is reflected
|
|
992
|
+
set dx [Widget::getoption $path -deltax]
|
|
993
|
+
set dy [Widget::getoption $path -deltay]
|
|
994
|
+
set padx [Widget::getoption $path -padx]
|
|
995
|
+
set y0 [expr {$dy/2}]
|
|
996
|
+
set x0 4
|
|
997
|
+
set x1 [expr {$x0+$padx}]
|
|
998
|
+
set nitem 0
|
|
999
|
+
set drawn {}
|
|
1000
|
+
set data(xlist) {}
|
|
1001
|
+
if { [Widget::cget $path -multicolumn] } {
|
|
1002
|
+
set nrows $data(nrows)
|
|
1003
|
+
} else {
|
|
1004
|
+
set nrows [llength $data(items)]
|
|
1005
|
+
}
|
|
1006
|
+
foreach item $data(upd,delete) {
|
|
1007
|
+
$path.c delete i:$item n:$item s:$item b:$item
|
|
1008
|
+
}
|
|
1009
|
+
# Pass these to _draw_item so it doesn't have to request them
|
|
1010
|
+
# for each item.
|
|
1011
|
+
set bg [Widget::cget $path -background]
|
|
1012
|
+
set selfill [Widget::cget $path -selectfill]
|
|
1013
|
+
set multi [Widget::cget $path -multicolumn]
|
|
1014
|
+
set ww [winfo width $path]
|
|
1015
|
+
foreach item $data(items) {
|
|
1016
|
+
if { [info exists data(upd,create,$item)] } {
|
|
1017
|
+
_draw_item $path $item $x0 $x1 $y0 $bg $selfill $multi $ww
|
|
1018
|
+
unset data(upd,create,$item)
|
|
1019
|
+
} else {
|
|
1020
|
+
set indent [Widget::getoption $path.$item -indent]
|
|
1021
|
+
$path.c coords n:$item [expr {$x1+$indent}] $y0
|
|
1022
|
+
$path.c coords i:$item [expr {$x0+$indent}] $y0
|
|
1023
|
+
}
|
|
1024
|
+
incr y0 $dy
|
|
1025
|
+
incr nitem
|
|
1026
|
+
lappend drawn n:$item
|
|
1027
|
+
if { $nitem == $nrows } {
|
|
1028
|
+
set y0 [expr {$dy/2}]
|
|
1029
|
+
set bbox [eval [linsert $drawn 0 $path.c bbox]]
|
|
1030
|
+
set drawn {}
|
|
1031
|
+
set x0 [expr {[lindex $bbox 2]+$dx}]
|
|
1032
|
+
set x1 [expr {$x0+$padx}]
|
|
1033
|
+
set nitem 0
|
|
1034
|
+
lappend data(xlist) [lindex $bbox 2]
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if { $nitem && $nitem < $nrows } {
|
|
1038
|
+
set bbox [eval [linsert $drawn 0 $path.c bbox]]
|
|
1039
|
+
lappend data(xlist) [lindex $bbox 2]
|
|
1040
|
+
}
|
|
1041
|
+
set data(upd,delete) {}
|
|
1042
|
+
$path.c configure -cursor $cursor
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
# ----------------------------------------------------------------------------
|
|
1047
|
+
# Command ListBox::_redraw_selection
|
|
1048
|
+
# ----------------------------------------------------------------------------
|
|
1049
|
+
proc ListBox::_redraw_selection { path } {
|
|
1050
|
+
variable $path
|
|
1051
|
+
upvar 0 $path data
|
|
1052
|
+
|
|
1053
|
+
set selbg [Widget::getoption $path -selectbackground]
|
|
1054
|
+
set selfg [Widget::getoption $path -selectforeground]
|
|
1055
|
+
set selfill [Widget::getoption $path -selectfill]
|
|
1056
|
+
set multi [Widget::getoption $path -multicolumn]
|
|
1057
|
+
foreach id [$path.c find withtag sel] {
|
|
1058
|
+
set item [string range [lindex [$path.c gettags $id] 1] 2 end]
|
|
1059
|
+
$path.c itemconfigure "n:$item" \
|
|
1060
|
+
-fill [_getoption $path $item -foreground]
|
|
1061
|
+
}
|
|
1062
|
+
$path.c delete sel
|
|
1063
|
+
if {$selfill && !$multi} {
|
|
1064
|
+
# cache window width for use below
|
|
1065
|
+
set width [winfo width $path]
|
|
1066
|
+
}
|
|
1067
|
+
foreach item $data(selitems) {
|
|
1068
|
+
set bbox [$path.c bbox "n:$item"]
|
|
1069
|
+
if { [llength $bbox] } {
|
|
1070
|
+
if { $selfill && !$multi } {
|
|
1071
|
+
# With -selectfill, make box occupy full width of widget
|
|
1072
|
+
set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
|
|
1073
|
+
}
|
|
1074
|
+
set tags [list sel s:$item click]
|
|
1075
|
+
set id [$path.c create rectangle $bbox \
|
|
1076
|
+
-fill $selbg -outline $selbg -tags $tags]
|
|
1077
|
+
$path.c itemconfigure "n:$item" -fill $selfg
|
|
1078
|
+
$path.c lower $id
|
|
1079
|
+
$path.c lower b:$item
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
# ----------------------------------------------------------------------------
|
|
1086
|
+
# Command ListBox::_redraw_listbox
|
|
1087
|
+
# ----------------------------------------------------------------------------
|
|
1088
|
+
proc ListBox::_redraw_listbox { path } {
|
|
1089
|
+
variable $path
|
|
1090
|
+
upvar 0 $path data
|
|
1091
|
+
|
|
1092
|
+
if { [Widget::getoption $path -redraw] } {
|
|
1093
|
+
if { $data(upd,level) == 2 } {
|
|
1094
|
+
_redraw_items $path
|
|
1095
|
+
}
|
|
1096
|
+
_redraw_selection $path
|
|
1097
|
+
_update_scrollregion $path
|
|
1098
|
+
if {[Widget::cget $path -selectfill]} {
|
|
1099
|
+
_update_select_fill $path
|
|
1100
|
+
}
|
|
1101
|
+
set data(upd,level) 0
|
|
1102
|
+
set data(upd,afterid) ""
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
# ----------------------------------------------------------------------------
|
|
1108
|
+
# Command ListBox::_redraw_idle
|
|
1109
|
+
# ----------------------------------------------------------------------------
|
|
1110
|
+
proc ListBox::_redraw_idle { path level } {
|
|
1111
|
+
variable $path
|
|
1112
|
+
upvar 0 $path data
|
|
1113
|
+
|
|
1114
|
+
if { $data(nrows) != -1 } {
|
|
1115
|
+
# widget is realized
|
|
1116
|
+
if { [Widget::getoption $path -redraw] && $data(upd,afterid) == "" } {
|
|
1117
|
+
set data(upd,afterid) \
|
|
1118
|
+
[after idle [list ListBox::_redraw_listbox $path]]
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
if { $level > $data(upd,level) } {
|
|
1122
|
+
set data(upd,level) $level
|
|
1123
|
+
}
|
|
1124
|
+
return ""
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
# ----------------------------------------------------------------------------
|
|
1129
|
+
# Command ListBox::_resize
|
|
1130
|
+
# ----------------------------------------------------------------------------
|
|
1131
|
+
proc ListBox::_resize { path } {
|
|
1132
|
+
variable $path
|
|
1133
|
+
upvar 0 $path data
|
|
1134
|
+
|
|
1135
|
+
if { [Widget::getoption $path -multicolumn] } {
|
|
1136
|
+
set bd [expr {[$path.c cget -borderwidth]+[$path.c cget -highlightthickness]}]
|
|
1137
|
+
set h [expr {[winfo height $path] - 2*$bd}]
|
|
1138
|
+
set nrows [expr {$h/[$path.c cget -yscrollincrement]}]
|
|
1139
|
+
if { $nrows == 0 } {
|
|
1140
|
+
set nrows 1
|
|
1141
|
+
}
|
|
1142
|
+
if { $nrows != $data(nrows) } {
|
|
1143
|
+
set data(nrows) $nrows
|
|
1144
|
+
_redraw_idle $path 2
|
|
1145
|
+
} else {
|
|
1146
|
+
_update_scrollregion $path
|
|
1147
|
+
}
|
|
1148
|
+
} elseif { $data(nrows) == -1 } {
|
|
1149
|
+
# first Configure event
|
|
1150
|
+
set data(nrows) 0
|
|
1151
|
+
ListBox::_redraw_listbox $path
|
|
1152
|
+
if {[Widget::cget $path -selectfill]} {
|
|
1153
|
+
_update_select_fill $path
|
|
1154
|
+
}
|
|
1155
|
+
} else {
|
|
1156
|
+
if {[Widget::cget $path -selectfill]} {
|
|
1157
|
+
_update_select_fill $path
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
_update_scrollregion $path
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
# ----------------------------------------------------------------------------
|
|
1166
|
+
# Command ListBox::_init_drag_cmd
|
|
1167
|
+
# ----------------------------------------------------------------------------
|
|
1168
|
+
proc ListBox::_init_drag_cmd { path X Y top } {
|
|
1169
|
+
set path [winfo parent $path]
|
|
1170
|
+
set ltags [$path.c gettags current]
|
|
1171
|
+
set item [lindex $ltags 0]
|
|
1172
|
+
if { [string equal $item "item"] ||
|
|
1173
|
+
[string equal $item "img"] ||
|
|
1174
|
+
[string equal $item "win"] } {
|
|
1175
|
+
set item [string range [lindex $ltags 1] 2 end]
|
|
1176
|
+
if {[llength [set cmd [Widget::getoption $path -draginitcmd]]]} {
|
|
1177
|
+
return [uplevel \#0 $cmd [list $path $item $top]]
|
|
1178
|
+
}
|
|
1179
|
+
if { [set type [Widget::getoption $path -dragtype]] == "" } {
|
|
1180
|
+
set type "LISTBOX_ITEM"
|
|
1181
|
+
}
|
|
1182
|
+
if { [set img [Widget::getoption $path.$item -image]] != "" } {
|
|
1183
|
+
pack [label $top.l -image $img -padx 0 -pady 0]
|
|
1184
|
+
}
|
|
1185
|
+
return [list $type {copy move link} $item]
|
|
1186
|
+
}
|
|
1187
|
+
return {}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
# ----------------------------------------------------------------------------
|
|
1192
|
+
# Command ListBox::_drop_cmd
|
|
1193
|
+
# ----------------------------------------------------------------------------
|
|
1194
|
+
proc ListBox::_drop_cmd { path source X Y op type dnddata } {
|
|
1195
|
+
set path [winfo parent $path]
|
|
1196
|
+
variable $path
|
|
1197
|
+
upvar 0 $path data
|
|
1198
|
+
|
|
1199
|
+
if { [string length $data(dnd,afterid)] } {
|
|
1200
|
+
after cancel $data(dnd,afterid)
|
|
1201
|
+
set data(dnd,afterid) ""
|
|
1202
|
+
}
|
|
1203
|
+
$path.c delete drop
|
|
1204
|
+
set data(dnd,scroll) ""
|
|
1205
|
+
if { [llength $data(dnd,item)] || ![llength $data(items)] } {
|
|
1206
|
+
if {[llength [set cmd [Widget::getoption $path -dropcmd]]]} {
|
|
1207
|
+
return [uplevel \#0 $cmd [list $path $source $data(dnd,item) $op $type $dnddata]]
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return 0
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
# ----------------------------------------------------------------------------
|
|
1215
|
+
# Command ListBox::_over_cmd
|
|
1216
|
+
# ----------------------------------------------------------------------------
|
|
1217
|
+
proc ListBox::_over_cmd { path source event X Y op type dnddata } {
|
|
1218
|
+
set path [winfo parent $path]
|
|
1219
|
+
variable $path
|
|
1220
|
+
upvar 0 $path data
|
|
1221
|
+
|
|
1222
|
+
if { [string equal $event "leave"] } {
|
|
1223
|
+
# we leave the window listbox
|
|
1224
|
+
$path.c delete drop
|
|
1225
|
+
if { [string length $data(dnd,afterid)] } {
|
|
1226
|
+
after cancel $data(dnd,afterid)
|
|
1227
|
+
set data(dnd,afterid) ""
|
|
1228
|
+
}
|
|
1229
|
+
set data(dnd,scroll) ""
|
|
1230
|
+
return 0
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
if { [string equal $event "enter"] } {
|
|
1234
|
+
# we enter the window listbox - dnd data initialization
|
|
1235
|
+
set mode [Widget::getoption $path -dropovermode]
|
|
1236
|
+
set data(dnd,mode) 0
|
|
1237
|
+
foreach c {w p i} {
|
|
1238
|
+
set data(dnd,mode) [expr {($data(dnd,mode) << 1) | ([string first $c $mode] != -1)}]
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
set x [expr {$X-[winfo rootx $path]}]
|
|
1243
|
+
set y [expr {$Y-[winfo rooty $path]}]
|
|
1244
|
+
$path.c delete drop
|
|
1245
|
+
set data(dnd,item) ""
|
|
1246
|
+
|
|
1247
|
+
# test for auto-scroll unless mode is widget only
|
|
1248
|
+
if { $data(dnd,mode) != 4 && [_auto_scroll $path $x $y] != "" } {
|
|
1249
|
+
return 2
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
if { $data(dnd,mode) & 4 } {
|
|
1253
|
+
# dropovermode includes widget
|
|
1254
|
+
set target [list widget]
|
|
1255
|
+
set vmode 4
|
|
1256
|
+
} else {
|
|
1257
|
+
set target [list ""]
|
|
1258
|
+
set vmode 0
|
|
1259
|
+
}
|
|
1260
|
+
if { ($data(dnd,mode) & 2) && ![llength $data(items)] } {
|
|
1261
|
+
# dropovermode includes position and listbox is empty
|
|
1262
|
+
lappend target "" 0
|
|
1263
|
+
set vmode [expr {$vmode | 2}]
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
if { ($data(dnd,mode) & 3) && [llength $data(items)]} {
|
|
1267
|
+
# dropovermode includes item or position
|
|
1268
|
+
# we extract the box (xi,yi,xs,ys) where we can find item around x,y
|
|
1269
|
+
set len [llength $data(items)]
|
|
1270
|
+
set xc [$path.c canvasx $x]
|
|
1271
|
+
set yc [$path.c canvasy $y]
|
|
1272
|
+
set dy [$path.c cget -yscrollincrement]
|
|
1273
|
+
set line [expr {int($yc/$dy)}]
|
|
1274
|
+
set yi [expr {$line*$dy}]
|
|
1275
|
+
set ys [expr {$yi+$dy}]
|
|
1276
|
+
set xi 0
|
|
1277
|
+
set pos $line
|
|
1278
|
+
if { [Widget::getoption $path -multicolumn] } {
|
|
1279
|
+
set nrows $data(nrows)
|
|
1280
|
+
} else {
|
|
1281
|
+
set nrows $len
|
|
1282
|
+
}
|
|
1283
|
+
if { $line < $nrows } {
|
|
1284
|
+
foreach xs $data(xlist) {
|
|
1285
|
+
if { $xc <= $xs } {
|
|
1286
|
+
break
|
|
1287
|
+
}
|
|
1288
|
+
set xi $xs
|
|
1289
|
+
incr pos $nrows
|
|
1290
|
+
}
|
|
1291
|
+
if { $pos < $len } {
|
|
1292
|
+
set item [lindex $data(items) $pos]
|
|
1293
|
+
set xi [expr {[lindex [$path.c coords n:$item] 0]-[Widget::getoption $path -padx]-1}]
|
|
1294
|
+
if { $data(dnd,mode) & 1 } {
|
|
1295
|
+
# dropovermode includes item
|
|
1296
|
+
lappend target $item
|
|
1297
|
+
set vmode [expr {$vmode | 1}]
|
|
1298
|
+
} else {
|
|
1299
|
+
lappend target ""
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
if { $data(dnd,mode) & 2 } {
|
|
1303
|
+
# dropovermode includes position
|
|
1304
|
+
if { $yc >= $yi+$dy/2 } {
|
|
1305
|
+
# position is after $item
|
|
1306
|
+
incr pos
|
|
1307
|
+
set yl $ys
|
|
1308
|
+
} else {
|
|
1309
|
+
# position is before $item
|
|
1310
|
+
set yl $yi
|
|
1311
|
+
}
|
|
1312
|
+
lappend target $pos
|
|
1313
|
+
set vmode [expr {$vmode | 2}]
|
|
1314
|
+
} else {
|
|
1315
|
+
lappend target ""
|
|
1316
|
+
}
|
|
1317
|
+
} else {
|
|
1318
|
+
lappend target "" ""
|
|
1319
|
+
}
|
|
1320
|
+
} else {
|
|
1321
|
+
lappend target "" ""
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
if { ($vmode & 3) == 3 } {
|
|
1325
|
+
# result have both item and position
|
|
1326
|
+
# we compute what is the preferred method
|
|
1327
|
+
if { $yc-$yi <= 3 || $ys-$yc <= 3 } {
|
|
1328
|
+
lappend target "position"
|
|
1329
|
+
} else {
|
|
1330
|
+
lappend target "item"
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
if {$vmode && [llength [set cmd [Widget::getoption $path -dropovercmd]]]} {
|
|
1336
|
+
# user-defined dropover command
|
|
1337
|
+
set res [uplevel \#0 $cmd [list $source $target $op $type $dnddata]]
|
|
1338
|
+
set code [lindex $res 0]
|
|
1339
|
+
set vmode 0
|
|
1340
|
+
if {$code & 1} {
|
|
1341
|
+
# update vmode
|
|
1342
|
+
switch -exact -- [lindex $res 1] {
|
|
1343
|
+
item {set vmode 1}
|
|
1344
|
+
position {set vmode 2}
|
|
1345
|
+
widget {set vmode 4}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
} else {
|
|
1349
|
+
if { ($vmode & 3) == 3 } {
|
|
1350
|
+
# result have both item and position
|
|
1351
|
+
# we choose the preferred method
|
|
1352
|
+
if { [string equal [lindex $target 3] "position"] } {
|
|
1353
|
+
set vmode [expr {$vmode & ~1}]
|
|
1354
|
+
} else {
|
|
1355
|
+
set vmode [expr {$vmode & ~2}]
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
if { $data(dnd,mode) == 4 || $data(dnd,mode) == 0 } {
|
|
1360
|
+
# dropovermode is widget or empty - recall is not necessary
|
|
1361
|
+
set code 1
|
|
1362
|
+
} else {
|
|
1363
|
+
set code 3
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
# draw dnd visual following vmode
|
|
1368
|
+
if {[llength $data(items)]} {
|
|
1369
|
+
if { $vmode & 1 } {
|
|
1370
|
+
set data(dnd,item) [list "item" [lindex $target 1]]
|
|
1371
|
+
$path.c create rectangle $xi $yi $xs $ys -tags drop
|
|
1372
|
+
} elseif { $vmode & 2 } {
|
|
1373
|
+
set data(dnd,item) [concat "position" [lindex $target 2]]
|
|
1374
|
+
$path.c create line $xi $yl $xs $yl -tags drop
|
|
1375
|
+
} elseif { $vmode & 4 } {
|
|
1376
|
+
set data(dnd,item) [list "widget"]
|
|
1377
|
+
} else {
|
|
1378
|
+
set code [expr {$code & 2}]
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
if { $code & 1 } {
|
|
1383
|
+
DropSite::setcursor based_arrow_down
|
|
1384
|
+
} else {
|
|
1385
|
+
DropSite::setcursor dot
|
|
1386
|
+
}
|
|
1387
|
+
return $code
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
# ----------------------------------------------------------------------------
|
|
1392
|
+
# Command ListBox::_auto_scroll
|
|
1393
|
+
# ----------------------------------------------------------------------------
|
|
1394
|
+
proc ListBox::_auto_scroll { path x y } {
|
|
1395
|
+
variable $path
|
|
1396
|
+
upvar 0 $path data
|
|
1397
|
+
|
|
1398
|
+
set xmax [winfo width $path]
|
|
1399
|
+
set ymax [winfo height $path]
|
|
1400
|
+
set scroll {}
|
|
1401
|
+
if { $y <= 6 } {
|
|
1402
|
+
if { [lindex [$path.c yview] 0] > 0 } {
|
|
1403
|
+
set scroll [list yview -1]
|
|
1404
|
+
DropSite::setcursor sb_up_arrow
|
|
1405
|
+
}
|
|
1406
|
+
} elseif { $y >= $ymax-6 } {
|
|
1407
|
+
if { [lindex [$path.c yview] 1] < 1 } {
|
|
1408
|
+
set scroll [list yview 1]
|
|
1409
|
+
DropSite::setcursor sb_down_arrow
|
|
1410
|
+
}
|
|
1411
|
+
} elseif { $x <= 6 } {
|
|
1412
|
+
if { [lindex [$path.c xview] 0] > 0 } {
|
|
1413
|
+
set scroll [list xview -1]
|
|
1414
|
+
DropSite::setcursor sb_left_arrow
|
|
1415
|
+
}
|
|
1416
|
+
} elseif { $x >= $xmax-6 } {
|
|
1417
|
+
if { [lindex [$path.c xview] 1] < 1 } {
|
|
1418
|
+
set scroll [list xview 1]
|
|
1419
|
+
DropSite::setcursor sb_right_arrow
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
if { [string length $data(dnd,afterid)] && ![string equal $data(dnd,scroll) $scroll] } {
|
|
1424
|
+
after cancel $data(dnd,afterid)
|
|
1425
|
+
set data(dnd,afterid) ""
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
set data(dnd,scroll) $scroll
|
|
1429
|
+
if { [llength $scroll] && ![string length $data(dnd,afterid)] } {
|
|
1430
|
+
set data(dnd,afterid) [after 200 [list ListBox::_scroll $path $scroll]]
|
|
1431
|
+
}
|
|
1432
|
+
return $data(dnd,afterid)
|
|
1433
|
+
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
# -----------------------------------------------------------------------------
|
|
1437
|
+
# Command ListBox::_multiple_select
|
|
1438
|
+
# -----------------------------------------------------------------------------
|
|
1439
|
+
proc ListBox::_multiple_select { path mode x y idx } {
|
|
1440
|
+
|
|
1441
|
+
variable $path
|
|
1442
|
+
upvar 0 $path data
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
if { ![info exists data(anchor)] || ![info exists data(sel_anchor)] } {
|
|
1446
|
+
set data(anchor) $idx
|
|
1447
|
+
set data(sel_anchor) {}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
switch -exact -- $mode {
|
|
1451
|
+
n {
|
|
1452
|
+
_mouse_select $path set $idx
|
|
1453
|
+
set data(anchor) $idx
|
|
1454
|
+
set data(sel_anchor) {}
|
|
1455
|
+
}
|
|
1456
|
+
c {
|
|
1457
|
+
set l [_mouse_select $path get]
|
|
1458
|
+
if { [lsearch -exact $l $idx] >= 0 } {
|
|
1459
|
+
_mouse_select $path remove $idx
|
|
1460
|
+
} else {
|
|
1461
|
+
_mouse_select $path add $idx
|
|
1462
|
+
}
|
|
1463
|
+
set data(anchor) $idx
|
|
1464
|
+
set data(sel_anchor) {}
|
|
1465
|
+
}
|
|
1466
|
+
s {
|
|
1467
|
+
eval [list $path _mouse_select remove] $data(sel_anchor)
|
|
1468
|
+
|
|
1469
|
+
set ix [$path index $idx]
|
|
1470
|
+
set ia [$path index $data(anchor)]
|
|
1471
|
+
if { $ix > $ia } {
|
|
1472
|
+
set istart $ia
|
|
1473
|
+
set iend $ix
|
|
1474
|
+
} else {
|
|
1475
|
+
set istart $ix
|
|
1476
|
+
set iend $ia
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
for { set i $istart } { $i <= $iend } { incr i } {
|
|
1480
|
+
set l [$path selection get]
|
|
1481
|
+
set t [$path items $i]
|
|
1482
|
+
set li [lsearch -exact $l $t]
|
|
1483
|
+
if { $li < 0 } {
|
|
1484
|
+
_mouse_select $path add $t
|
|
1485
|
+
lappend data(sel_anchor) $t
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
# ----------------------------------------------------------------------------
|
|
1494
|
+
# Command ListBox::_scroll
|
|
1495
|
+
# ----------------------------------------------------------------------------
|
|
1496
|
+
proc ListBox::_scroll { path cmd dir } {
|
|
1497
|
+
variable $path
|
|
1498
|
+
upvar 0 $path data
|
|
1499
|
+
|
|
1500
|
+
if { ($dir == -1 && [lindex [$path.c $cmd] 0] > 0) ||
|
|
1501
|
+
($dir == 1 && [lindex [$path.c $cmd] 1] < 1) } {
|
|
1502
|
+
$path $cmd scroll $dir units
|
|
1503
|
+
set data(dnd,afterid) \
|
|
1504
|
+
[after 100 [list ListBox::_scroll $path $cmd $dir]]
|
|
1505
|
+
} else {
|
|
1506
|
+
set data(dnd,afterid) ""
|
|
1507
|
+
DropSite::setcursor dot
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
# ListBox::_set_help --
|
|
1512
|
+
#
|
|
1513
|
+
# Register dynamic help for an item in the listbox.
|
|
1514
|
+
#
|
|
1515
|
+
# Arguments:
|
|
1516
|
+
# path ListBox to query
|
|
1517
|
+
# item Item in the listbox
|
|
1518
|
+
# force Optional argument to force a reset of the help
|
|
1519
|
+
#
|
|
1520
|
+
# Results:
|
|
1521
|
+
# none
|
|
1522
|
+
proc ListBox::_set_help { path node } {
|
|
1523
|
+
Widget::getVariable $path help
|
|
1524
|
+
|
|
1525
|
+
set item $path.$node
|
|
1526
|
+
set opts [list -helptype -helptext -helpvar]
|
|
1527
|
+
foreach {cty ctx cv} [eval [linsert $opts 0 Widget::hasChangedX $item]] break
|
|
1528
|
+
set text [Widget::getoption $item -helptext]
|
|
1529
|
+
|
|
1530
|
+
## If we've never set help for this item before, and text is not blank,
|
|
1531
|
+
## we need to setup help. We also need to reset help if any of the
|
|
1532
|
+
## options have changed.
|
|
1533
|
+
if { (![info exists help($node)] && $text != "") || $cty || $ctx || $cv } {
|
|
1534
|
+
set help($node) 1
|
|
1535
|
+
set type [Widget::getoption $item -helptype]
|
|
1536
|
+
switch $type {
|
|
1537
|
+
balloon {
|
|
1538
|
+
DynamicHelp::register $path.c balloon n:$node $text
|
|
1539
|
+
DynamicHelp::register $path.c balloon i:$node $text
|
|
1540
|
+
DynamicHelp::register $path.c balloon b:$node $text
|
|
1541
|
+
}
|
|
1542
|
+
variable {
|
|
1543
|
+
set var [Widget::getoption $item -helpvar]
|
|
1544
|
+
DynamicHelp::register $path.c variable n:$node $var $text
|
|
1545
|
+
DynamicHelp::register $path.c variable i:$node $var $text
|
|
1546
|
+
DynamicHelp::register $path.c variable b:$node $var $text
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
# ListBox::_mouse_select --
|
|
1553
|
+
#
|
|
1554
|
+
# Handle selection commands that are done by the mouse. If the
|
|
1555
|
+
# selection command returns true, we generate a <<ListboxSelect>>
|
|
1556
|
+
# event for the listbox.
|
|
1557
|
+
#
|
|
1558
|
+
# Arguments:
|
|
1559
|
+
# Standard arguments passed to a selection command.
|
|
1560
|
+
#
|
|
1561
|
+
# Results:
|
|
1562
|
+
# none
|
|
1563
|
+
proc ListBox::_mouse_select { path cmd args } {
|
|
1564
|
+
eval [linsert $args 0 selection $path $cmd]
|
|
1565
|
+
switch -- $cmd {
|
|
1566
|
+
"add" - "clear" - "remove" - "set" {
|
|
1567
|
+
event generate $path <<ListboxSelect>>
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
proc ListBox::_get_current { path } {
|
|
1574
|
+
set t [$path.c gettags current]
|
|
1575
|
+
return [string range [lindex $t 1] 2 end]
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
# ListBox::_drag_and_drop --
|
|
1580
|
+
#
|
|
1581
|
+
# A default command to handle drag-and-drop functions local to this
|
|
1582
|
+
# listbox. With this as the default -dropcmd, the user can simply
|
|
1583
|
+
# enable drag-and-drop and be able to move items within this list
|
|
1584
|
+
# with no further code.
|
|
1585
|
+
#
|
|
1586
|
+
# Arguments:
|
|
1587
|
+
# Standard arguments passed to a dropcmd.
|
|
1588
|
+
#
|
|
1589
|
+
# Results:
|
|
1590
|
+
# none
|
|
1591
|
+
proc ListBox::_drag_and_drop { path from endItem operation type startItem } {
|
|
1592
|
+
set items [$path items]
|
|
1593
|
+
|
|
1594
|
+
## This proc only handles drag-and-drop commands within itself.
|
|
1595
|
+
## If the widget this came from is not our widget (minus the canvas),
|
|
1596
|
+
## we don't want to do anything. They need to handle this themselves.
|
|
1597
|
+
if {[winfo parent $from] != $path} { return }
|
|
1598
|
+
|
|
1599
|
+
set place [lindex $endItem 0]
|
|
1600
|
+
set i [lindex $endItem 1]
|
|
1601
|
+
|
|
1602
|
+
switch -- $place {
|
|
1603
|
+
"position" {
|
|
1604
|
+
set idx $i
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
"item" {
|
|
1608
|
+
set idx [$path index $i]
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
if {$idx > [$path index $startItem]} { incr idx -1 }
|
|
1613
|
+
|
|
1614
|
+
if {[string equal $operation "copy"]} {
|
|
1615
|
+
set options [Widget::options $path.$startItem]
|
|
1616
|
+
eval [linsert $options 0 $path insert $idx $startItem\#auto]
|
|
1617
|
+
} else {
|
|
1618
|
+
$path move $startItem $idx
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
proc ListBox::_keyboard_navigation { path dir } {
|
|
1624
|
+
variable $path
|
|
1625
|
+
upvar 0 $path data
|
|
1626
|
+
|
|
1627
|
+
set sel [$path index [lindex [$path selection get] end]]
|
|
1628
|
+
if {$dir > 0} {
|
|
1629
|
+
incr sel
|
|
1630
|
+
if {$sel >= [llength $data(items)]} { return }
|
|
1631
|
+
} else {
|
|
1632
|
+
incr sel -1
|
|
1633
|
+
if {$sel < 0} { return }
|
|
1634
|
+
}
|
|
1635
|
+
set item [lindex $data(items) $sel]
|
|
1636
|
+
$path see $item
|
|
1637
|
+
_mouse_select $path set $item
|
|
1638
|
+
}
|