/usr/share/skycat/tclutil2.1.0/ScrollText.tcl is in skycat 3.1.2+starlink1~b-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | # E.S.O. - VLT project/ ESO Archive
# "@(#) $Id: ScrollText.tcl,v 1.1.1.1 2009/03/31 14:11:52 cguirao Exp $"
#
# ScrollText.tcl - Itcl class for displaying a text window with scrollbars.
#
# who when what
# -------------- --------- ----------------------------------------
# Allan Brighton 18 Mar 98 Copied from GAIA (Peter Draper, Starlink)
# and changed namespace to util::
# Changed comment format for use with itcldoc.
itk::usual ScrollText {}
# This class defines methods and configuration options for
# creating a text widget with scrollbars. The scrolltext widget
# has scrollbars along the right and bottom.
itcl::class util::ScrollText {
# Inheritances:
inherit FrameWidget
# Constructor.
constructor {args} {
# Do initialisations.
eval itk_initialize $args
# Tk text widget.
itk_component add Text {
text $w_.text
} {
keep -width -height -exportselection -font
}
# Tk label for title.
itk_component add Label {
label $w_.label -text "$itk_option(-label)"
}
# vertical scrollbar
itk_component add Scrollright {
scrollbar $w_.scrollright \
-orient vertical \
-command "$itk_component(Text) yview"
}
$itk_component(Text) configure \
-yscrollcommand "$itk_component(Scrollright) set"
# outer frame
itk_component add Frame {
frame $w_.frame -borderwidth 0
}
set rwidth [winfo reqwidth $itk_component(Scrollright)]
# corner frame
itk_component add Corner {
frame $itk_component(Frame).corner -width $rwidth
}
# horizontal scrollbar
itk_component add Scrollbottom {
scrollbar $itk_component(Frame).scrollbottom)\
-orient horizontal \
-command "$itk_component(Text) xview"
}
$itk_component(Text) configure \
-xscrollcommand "$itk_component(Scrollbottom) set"
# Now pack everything into place.
pack $itk_component(Label) -side top -fill x
pack $itk_component(Frame) -side bottom -fill x
pack $itk_component(Corner) -side right -fill y
pack $itk_component(Scrollbottom) -side bottom -fill x
pack $itk_component(Scrollright) -side right -fill y
pack $itk_component(Text) -expand true -fill both
}
# Inserts a line of text with the given index. "index" can
# be 0 or end which inserts at the beginning and at the end.
public method insert { index args } {
eval $itk_component(Text) insert $index $args
}
# Clears a range of items from the text widget. If first is "all"
# then all lines are deleted. If only first is given then this
# clears a single line. "last" may be set as end.
public method clear { args } {
if { [lindex $args 0 ] != "all" } {
eval $itk_component(Text) delete $args
} else {
$itk_component(Text) delete 0.0 end
}
}
# Gets the item with the given indices from the text widget.
public method get { index } {
set contents ""
if { $index != "all" } {
set contents [$itk_component(Text) get $index]
} else {
set size [$itk_component(Text) size]
for { set i 0 } { $i < $size } { incr i } {
lappend contents [$itk_component(Text) get $i]
}
}
return $contents
}
# Configuration options:
# ----------------------
# Adds a label over at top of the text widget.
itk_option define -label scrolltextlabel ScrolltextLabel {} {
if { [info exists itk_component(Label)] } {
$itk_component(Label) configure -text "$itk_option(-label)"
}
}
}
|