/usr/share/doc/nam/examples/tcl/balloon.tcl is in nam-examples 1.15-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 | #
# Copyright (C) 2000 by USC/ISI
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation, advertising
# materials, and other materials related to such distribution and use
# acknowledge that the software was developed by the University of
# Southern California, Information Sciences Institute. The name of the
# University may not be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $Header: /cvsroot/nsnam/nam-1/tcl/balloon.tcl,v 1.1 2000/02/18 18:07:31 haoboy Exp $
#
# Generic balloon help for an Animator
Class BalloonHelp
BalloonHelp instproc init { tlw } {
$self instvar balloon_
set balloon_ $tlw-bal
toplevel $balloon_ -class Balloon -borderwidth 1 -relief groove \
-background black
label $balloon_.info
pack $balloon_.info -side left -fill y
wm overrideredirect $balloon_ 1
wm withdraw $balloon_
}
BalloonHelp instproc destroy {} {
$self balloon_cancel
}
# By default show the balloon after the mouse stayed for 500ms.
BalloonHelp instproc balloon_for {win mesg {delay 500}} {
$self instvar balloon_ bhInfo_ balloon_delay_
# If we do not know about this window, do the event binding,
# otherwise just change the message and delay.
if {![info exists bhInfo_($win)]} {
set bhInfo_($win) $mesg
set balloon_delay_ $delay
bind $win <Enter> "$self balloon_pending %W"
bind $win <Leave> "$self balloon_cancel"
} else {
set bhInfo_($win) $mesg
set balloon_delay_ $delay
}
}
BalloonHelp instproc balloon_pending {win} {
$self instvar bhInfo_ balloon_ balloon_delay_
$self balloon_cancel
set bhInfo_(pending) [after $balloon_delay_ \
"$self balloon_show $win"]
}
BalloonHelp instproc balloon_cancel {} {
$self instvar bhInfo_ balloon_
if [info exists bhInfo_(pending)] {
after cancel $bhInfo_(pending)
unset bhInfo_(pending)
}
wm withdraw $balloon_
}
BalloonHelp instproc balloon_show {win} {
$self instvar bhInfo_ balloon_
set bhInfo_(active) 1
if { $bhInfo_(active) } {
$balloon_.info configure -text $bhInfo_($win)
set x [expr [winfo rootx $win]+[winfo width $win]+5]
set y [expr [winfo rooty $win]+10]
wm geometry $balloon_ +$x+$y
wm deiconify $balloon_
raise $balloon_
}
unset bhInfo_(pending)
}
|