?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_body {{args {}}} {
_parse_fields ar $args
if [info exists ar(bgcolor)] {
set _bgcolor $ar(bgcolor)
set temp $itk_option(-textbackground)
config -textbackground $_bgcolor
set _defaulttextbackground $temp
}
if [info exists ar(text)] {
set _color $ar(text)
}
if [info exists ar(link)] {
set _link $ar(link)
}
if [info exists ar(alink)] {
set _alink $ar(alink)
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/body
#
# end body text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/body {} {
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_br
#
# line break
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_br {{args {}}} {
$_hottext insert end "\n"
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_center
#
# change justification to center
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_center {} {
_push justify $_justify
set _justify C
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/center
#
# change state back from center
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/center {} {
set _justify [_pop justify]
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_cite
#
# display citation
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_cite {} {
_entity_i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/cite
#
# change state back from citation
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/cite {} {
_entity_/i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_code
#
# display code listing
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_code {} {
_entity_pre
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/code
#
# end code listing
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/code {} {
_entity_/pre
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_dir
#
# display dir list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_dir {{args {}}} {
_entity_ul plain $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/dir
#
# end dir list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/dir {} {
_entity_/ul
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_div
#
# divide text. same as
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_div {{args {}}} {
_entity_p $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_dl
#
# begin definition list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_dl {{args {}}} {
if {$_left == 0} {
_entity_p
}
_push left $_left
_push left2 $_left2
if {$_left2 == $_left } {
incr _left2 [expr {$_indentincr+3}]
} else {
incr _left2 $_indentincr
}
incr _left $_indentincr
_push listyle $_listyle
_push licount $_licount
set _listyle none
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/dl
#
# end definition list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/dl {} {
set _left [_pop left]
set _left2 [_pop left2]
set _listyle [_pop listyle]
set _licount [_pop licount]
_set_tag
if {$_left == 0} {
_entity_p
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_dt
#
# definition term
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_dt {} {
set _left [expr {$_left2 - 3}]
_set_tag
_entity_p
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_dd
#
# definition definition
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_dd {} {
set _left $_left2
_set_tag
_entity_br
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_dfn
#
# display defining instance of a term
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_dfn {} {
_entity_i
_entity_b
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/dfn
#
# change state back from defining instance of term
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/dfn {} {
_entity_/b
_entity_/i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_em
#
# display emphasized text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_em {} {
_entity_i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/em
#
# change state back from emphasized text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/em {} {
_entity_/i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_font
#
# set font size and color
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_font {{args {}}} {
_parse_fields ar $args
_push pointsndx $_pointsndx
_push color $_color
if [info exists ar(size)] {
if {![regexp {^[+-].*} $ar(size)]} {
set _pointsndx $ar(size)
} else {
set _pointsndx [expr $_basefontsize $ar(size)]
}
if { $_pointsndx > 6 } {
set _pointsndx 6
} else {
if { $_pointsndx < 0 } {
set _pointsndx 0
}
}
}
if {[info exists ar(color)]} {
set _color $ar(color)
}
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/font
#
# close current font size
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/font {} {
set _pointsndx [_pop pointsndx]
set _color [_pop color]
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h1
#
# display header level 1.
# Accepts argument of the form ?align=[left,right,center]? ?src=?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h1 {{args {}}} {
_header 1 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h1
#
# change state back from header 1
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h1 {} {
_/header 1
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h2
#
# display header level 2
# Accepts argument of the form ?align=[left,right,center]? ?src=?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h2 {{args {}}} {
_header 2 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h2
#
# change state back from header 2
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h2 {} {
_/header 2
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h3
#
# display header level 3
# Accepts argument of the form ?align=[left,right,center]? ?src=?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h3 {{args {}}} {
_header 3 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h3
#
# change state back from header 3
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h3 {} {
_/header 3
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h4
#
# display header level 4
# Accepts argument of the form ?align=[left,right,center]? ?src=?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h4 {{args {}}} {
_header 4 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h4
#
# change state back from header 4
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h4 {} {
_/header 4
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h5
#
# display header level 5
# Accepts argument of the form ?align=[left,right,center]? ?src=?
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h5 {{args {}}} {
_header 5 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h5
#
# change state back from header 5
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h5 {} {
_/header 5
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_h6
#
# display header level 6
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_h6 {{args {}}} {
_header 6 $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/h6
#
# change state back from header 6
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/h6 {} {
_/header 6
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_hr
#
# Add a horizontal rule
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_hr {{args {}}} {
_parse_fields ar $args
if [info exists ar(size)] {
set font "-font -*-*-*-*-*-*-$ar(size)-*-*-*-*-*-*-*"
} else {
set font "-font -*-*-*-*-*-*-2-*-*-*-*-*-*-*"
}
if [info exists ar(width)] {
}
if [info exists ar(noshade)] {
set relief "-relief flat"
set background "-background black"
} else {
set relief "-relief sunken"
set background ""
}
# if [info exists ar(align)] {
# $_hottext tag config hr$_counter -justify $ar(align)
# set justify -justify $ar(align)
# } else {
# set justify ""
# }
eval $_hottext tag config hr[incr _counter] $relief $background $font \
-borderwidth 2
_entity_p
$_hottext insert end " \n" hr$_counter
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_i
#
# display italicized text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_i {} {
incr _textslant
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/i
#
# change state back from italicized text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/i {} {
incr _textslant -1
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_img
#
# display an image. takes argument of the form img=
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_img {{args {}}} {
_parse_fields ar $args
set alttext ""
#
# If proper argument exists
#
if [info exists ar(src)] {
set imgframe $_hottext.img[incr _counter]
#
# if this is an anchor
#
if $_anchorcount {
# create link colored border
frame $imgframe -borderwidth 2 -background $_link
bind $imgframe \
[list $imgframe configure -background $_alink]
bind $imgframe \
[list $imgframe configure -background $_link]
} else {
# create plain frame
frame $imgframe -borderwidth 0 -background $_color
}
#
# try to load image
#
if {[string index $ar(src) 0] == "/" || [string index $ar(src) 0] == "~"} {
set file $ar(src)
} else {
set file $_cwd/$ar(src)
}
if [catch {set img [::image create photo -file $file]} err] {
if {[info exists ar(width)] && [info exists ar(height)] } {
# suggestions exist, so make frame appropriate size and add a border
$imgframe configure -width $ar(width) -height $ar(height) -borderwidth 2
pack propagate $imgframe false
}
#
# If alt text is specified, display that
#
if [info exists ar(alt)] {
# add a border
$imgframe configure -borderwidth 2
set win $imgframe.text
label $win -text "$ar(alt)" -background $_bgcolor \
-foreground $_color
} else {
#
# use 'unknown image'
set win $imgframe.image#auto
#
# make label containing image
#
label $win -image $_unknownimg -borderwidth 0 -background $_bgcolor
}
pack $win -fill both -expand true
} else { ;# no error loading image
lappend _images $img
set win $imgframe.$img
#
# make label containing image
#
label $win -image $img -borderwidth 0
}
pack $win
#
# set alignment
#
set align bottom
if [info exists ar(align)] {
switch $ar(align) {
middle {
set align center
}
right {
set align center
}
default {
set align [string tolower $ar(align)]
}
}
}
#
# create window in text to display image
#
$_hottext window create end -window \
$imgframe -align $align
#
# set tag for window
#
$_hottext tag add $_tag $imgframe
if $_anchorcount {
set href [_peek href]
set href_tag href[incr _counter]
set tags [list $_tag $href_tag]
if { $itk_option(-linkcommand)!= {} } {
bind $win <1> [list uplevel #0 $itk_option(-linkcommand) $href]
}
}
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_kbd
#
# Display keyboard input
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_kbd {} {
incr _textweight
_entity_tt
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/kbd
#
# change state back from displaying keyboard input
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/kbd {} {
_entity_/tt
incr _textweight -1
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_li
#
# begin new list entry
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_li {{args {}}} {
_parse_fields ar $args
if [info exists ar(value)] {
set _licount $ar(value)
}
_entity_br
switch -exact $_listyle {
bullet {
set old_font $_font
set _font symbol
_set_tag
$_hottext insert end "\xb7" $_tag
set _font $old_font
_set_tag
}
none {
}
picture {
_entity_img src="$_lipic" width=4 height=4 align=middle
}
A {
_entity_b
$_hottext insert end [format "%c) " [expr {$_licount + 0x40}]] $_tag
_entity_/b
incr _licount
}
a {
_entity_b
$_hottext insert end [format "%c) " [expr {$_licount + 0x60}]] $_tag
_entity_/b
incr _licount
}
I {
_entity_b
$_hottext insert end "[::iwidgets::roman $_licount]) " $_tag
_entity_/b
incr _licount
}
i {
_entity_b
$_hottext insert end "[::iwidgets::roman $_licount lower])] " $_tag
_entity_/b
incr _licount
}
default {
_entity_b
$_hottext insert end "$_licount) " $_tag
_entity_/b
incr _licount
}
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_listing
#
# diplay code listing
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_listing {} {
_entity_pre
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/listing
#
# end code listing
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/listing {} {
_entity_/pre
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_menu
#
# diplay menu list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_menu {{args {}}} {
_entity_ul plain $args
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/menu
#
# end menu list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/menu {} {
_entity_/ul
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_ol
#
# begin ordered list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_ol {{args {}}} {
_parse_fields ar $args
if $_left {
_entity_br
} else {
_entity_p
}
if {![info exists ar(type)]} {
set ar(type) 1
}
_push licount $_licount
if [info exists ar(start)] {
set _licount $ar(start)
} else {
set _licount 1
}
_push left $_left
_push left2 $_left2
if {$_left2 == $_left } {
incr _left2 [expr {$_indentincr+3}]
} else {
incr _left2 $_indentincr
}
incr _left $_indentincr
_push listyle $_listyle
set _listyle $ar(type)
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/ol
#
# end ordered list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/ol {} {
set _left [_pop left]
set _left2 [_pop left2]
set _listyle [_pop listyle]
set _licount [_pop licount]
_set_tag
_entity_p
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_p
#
# paragraph break
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_p {{args {}}} {
_parse_fields ar $args
if [info exists ar(align)] {
_set_align $ar(align)
} else {
set _justify L
}
_set_tag
if [info exists ar(id)] {
set _anchor($ar(id)) [$itk_component(text) index end]
}
set x [$_hottext get end-3c]
set y [$_hottext get end-2c]
if {$x == "" && $y == ""} return
if {$y == ""} {
$_hottext insert end "\n\n"
return
}
if {$x == "\n" && $y == "\n"} return
if {$y == "\n"} {
$_hottext insert end "\n"
return
}
$_hottext insert end "\n\n"
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_pre
#
# display preformatted text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_pre {{args {}}} {
_entity_tt
_entity_br
incr _pre
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/pre
#
# change state back from preformatted text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/pre {} {
_entity_/tt
set _pre 0
_entity_p
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_samp
#
# display sample text.
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_samp {} {
_entity_kbd
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/samp
#
# switch back to non-sample text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/samp {} {
_entity_/kbd
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_small
#
# Change current font to a smaller size
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_small {} {
_push pointsndx $_pointsndx
if {[incr _pointsndx -2] < 0} {
set _pointsndx 0
}
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/small
#
# change current font back from smaller size
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/small {} {
set _pointsndx [_pop pointsndx]
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_sub
#
# display subscript
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_sub {} {
_push offset $_offset
incr _offset -2
_entity_small
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/sub
#
# switch back to non-subscript
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/sub {} {
set _offset [_pop offset]
_entity_/small
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_sup
#
# display superscript
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_sup {} {
_push offset $_offset
incr _offset 4
_entity_small
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/sup
#
# switch back to non-superscript
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/sup {} {
set _offset [_pop offset]
_entity_/small
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_strong
#
# display strong text. (i.e. make font bold)
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_strong {} {
incr _textweight
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/strong
#
# switch back to non-strong text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/strong {} {
incr _textweight -1
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_table
#
# display a table.
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_table {{args {}}} {
_parse_fields ar $args
_entity_p
set _intable 1
_push row -1
_push column 0
_push hottext $_hottext
_push justify $_justify
_push justify L
# push color information for master of table, then push info for table
_push color $_color
_push bgcolor $_bgcolor
_push link $_link
_push alink $_alink
if [info exists ar(bgcolor)] {
set _bgcolor $ar(bgcolor)
}
if [info exists ar(text)] {
set _color $ar(text)
}
if [info exists ar(link)] {
set _link $ar(link)
}
if [info exists ar(alink)] {
set _alink $ar(alink)
}
_push color $_color
_push bgcolor $_bgcolor
_push link $_link
_push alink $_alink
# push fake first row to avoid using optional /tr tag
# (This needs to set a real color - not the empty string
# becaule later code will try to use those values.)
_push color $_color
_push bgcolor $_bgcolor
_push link {}
_push alink {}
if {[info exists ar(align)]} {
_set_align $ar(align)
_set_tag
_append_text " "
}
set _justify L
if [info exists ar(id)] {
set _anchor($ar(id)) [$itk_component(text) index end]
}
if [info exists ar(cellpadding)] {
_push cellpadding $ar(cellpadding)
} else {
_push cellpadding 0
}
if [info exists ar(cellspacing)] {
_push cellspacing $ar(cellspacing)
} else {
_push cellspacing 0
}
if {[info exists ar(border)]} {
_push tableborder 1
set relief raised
if {$ar(border)==""} {
set ar(border) 2
}
} else {
_push tableborder 0
set relief flat
set ar(border) 2
}
_push table [set table $_hottext.table[incr _counter]]
iwidgets::labeledwidget $table -foreground $_color -background $_bgcolor -labelpos n
if {[info exists ar(title)]} {
$table configure -labeltext $ar(title)
}
#
# create window in text to display table
#
$_hottext window create end -window $table
set table [$table childsite]
set _anchor($table) [$_hottext index "end - 1 line"]
$table configure -borderwidth $ar(border) -relief $relief
if {[info exists ar(width)]} {
_push tablewidth $ar(width)
} else {
_push tablewidth 0
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/table
#
# end table
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/table {} {
if {$_intable} {
_pop tableborder
set table [[_pop table] childsite]
_pop row
_pop column
_pop cellspacing
_pop cellpadding
# pop last row's defaults
_pop color
_pop bgcolor
_pop link
_pop alink
# pop table defaults
_pop color
_pop bgcolor
_pop link
_pop alink
# restore table master defaults
set _color [_pop color]
set _bgcolor [_pop bgcolor]
set _link [_pop link]
set _alink [_pop alink]
foreach x [grid slaves $table] {
set text [$x get 1.0 end]
set tl [split $text \n]
set max 0
foreach l $tl {
set len [string length $l]
if {$len > $max} {
set max $len
}
}
if {$max > [$x cget -width]} {
$x configure -width $max
}
if {[$x cget -height] == 1} {
$x configure -height [lindex [split [$x index "end - 1 chars"] "."] 0]
}
}
$_hottext configure -state disabled
set _hottext [_pop hottext]
$_hottext configure -state normal
if {[set tablewidth [_pop tablewidth]]!="0"} {
if {[string index $tablewidth \
[expr {[string length $tablewidth] -1}]] == "%"} {
set multiplier [expr {[string trimright $tablewidth "%"] / 100.0}]
set idletask [after idle [itcl::code "$this _fixtablewidth $_hottext $table $multiplier"]]
} else {
$table configure -width $tablewidth
grid propagate $table 0
}
}
_pop justify
set _justify [_pop justify]
_entity_br
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_td
#
# start table data cell
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_td {{args {}}} {
if $_intable {
_parse_fields ar $args
set table [[_peek table] childsite]
if {![info exists ar(colspan)]} {
set ar(colspan) 1
}
if {![info exists ar(rowspan)]} {
set ar(rowspan) 1
}
if {![info exists ar(width)]} {
set ar(width) 10
}
if {![info exists ar(height)]} {
set ar(height) 0
}
if [info exists ar(bgcolor)] {
set _bgcolor $ar(bgcolor)
} else {
set _bgcolor [_peek bgcolor]
}
if [info exists ar(text)] {
set _color $ar(text)
} else {
set _color [_peek color]
}
if [info exists ar(link)] {
set _link $ar(link)
} else {
set _link [_peek link]
}
if [info exists ar(alink)] {
set _alink $ar(alink)
} else {
set _alink [_peek alink]
}
$_hottext configure -state disabled
set cellpadding [_peek cellpadding]
set cellspacing [_peek cellspacing]
set _hottext $table.cell[incr _counter]
text $_hottext -relief flat -width $ar(width) -height $ar(height) \
-highlightthickness 0 -wrap word -cursor $itk_option(-cursor) \
-wrap word -cursor $itk_option(-cursor) \
-padx $cellpadding -pady $cellpadding
if {$_color != ""} {
$_hottext config -foreground $_color
}
if {$_bgcolor != ""} {
$_hottext config -background $_bgcolor
}
if [info exists ar(nowrap)] {
$_hottext configure -wrap none
}
if [_peek tableborder] {
$_hottext configure -relief sunken
}
set row [_peek row]
if {$row < 0} {
set row 0
}
set column [_pop column]
if {$column < 0} {
set column 0
}
while {[grid slaves $table -row $row -column $column] != ""} {
incr column
}
grid $_hottext -sticky nsew -row $row -column $column \
-columnspan $ar(colspan) -rowspan $ar(rowspan) \
-padx $cellspacing -pady $cellspacing
grid columnconfigure $table $column -weight 1
_push column [expr {$column + $ar(colspan)}]
if [info exists ar(align)] {
_set_align $ar(align)
} else {
set _justify [_peek justify]
}
_set_tag
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/td
#
# end table data cell
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/td {} {
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_th
#
# start table header
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_th {{args {}}} {
if $_intable {
_parse_fields ar $args
if [info exists ar(align)] {
_entity_td $args
} else {
_entity_td align=center $args
}
_entity_b
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/th
#
# end table data cell
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/th {} {
_entity_/td
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_title
#
# begin title of document
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_title {} {
set _intitle 1
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/title
#
# end title
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/title {} {
set _intitle 0
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_tr
#
# start table row
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_tr {{args {}}} {
if $_intable {
_parse_fields ar $args
_pop justify
if [info exists ar(align)] {
_set_align $ar(align)
_push justify $_justify
} else {
_push justify L
}
# pop last row's colors
_pop color
_pop bgcolor
_pop link
_pop alink
if [info exists ar(bgcolor)] {
set _bgcolor $ar(bgcolor)
} else {
set _bgcolor [_peek bgcolor]
}
if [info exists ar(text)] {
set _color $ar(text)
} else {
set _color [_peek color]
}
if [info exists ar(link)] {
set _link $ar(link)
} else {
set _link [_peek link]
}
if [info exists ar(alink)] {
set _alink $ar(alink)
} else {
set _alink [_peek alink]
}
# push this row's defaults
_push color $_color
_push bgcolor $_bgcolor
_push link $_link
_push alink $_alink
$_hottext configure -state disabled
_push row [expr {[_pop row] + 1}]
_pop column
_push column 0
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/tr
#
# end table row
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/tr {} {
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_tt
#
# Show typewriter text, using the font given by -fixedfont
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_tt {} {
_push font $_font
set _font $itk_option(-fixedfont)
set _verbatim 1
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/tt
#
# Change back to non-typewriter mode to display text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/tt {} {
set _font [_pop font]
set _verbatim 0
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_u
#
# display underlined text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_u {} {
incr _underline
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/u
#
# change back from underlined text
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/u {} {
incr _underline -1
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_ul
#
# begin unordered list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_ul {{args {}}} {
_parse_fields ar $args
if $_left {
_entity_br
} else {
_entity_p
}
if [info exists ar(id)] {
set _anchor($ar(id)) [$itk_component(text) index end]
}
_push left $_left
_push left2 $_left2
if {$_left2 == $_left } {
incr _left2 [expr {$_indentincr+3}]
} else {
incr _left2 $_indentincr
}
incr _left $_indentincr
_push listyle $_listyle
_push licount $_licount
if [info exists ar(plain)] {
set _listyle none
} {
set _listyle bullet
}
if [info exists ar(dingbat)] {
set ar(src) $ar(dingbat)
}
_push lipic $_lipic
if [info exists ar(src)] {
set _listyle picture
set _lipic $ar(src)
}
_set_tag
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/ul
#
# end unordered list
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/ul {} {
set _left [_pop left]
set _left2 [_pop left2]
set _listyle [_pop listyle]
set _licount [_pop licount]
set _lipic [_pop lipic]
_set_tag
_entity_p
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_var
#
# Display variable
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_var {} {
_entity_i
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _entity_/var
#
# change state back from variable display
# ------------------------------------------------------------------
itcl::body iwidgets::Scrolledhtml::_entity_/var {} {
_entity_/i
}