# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # # $Id: Balloon.tcl,v 1.7 2008/02/27 22:17:28 hobbs Exp $ # # Balloon.tcl -- # # The help widget. It provides both "balloon" type of help # message and "status bar" type of help message. You can use # this widget to indicate the function of the widgets inside # your application. # # Copyright (c) 1993-1999 Ioi Kim Lam. # Copyright (c) 2000-2001 Tix Project Group. # Copyright (c) 2004 ActiveState # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # tixWidgetClass tixBalloon { -classname TixBalloon -superclass tixShell -method { bind post unbind } -flag { -installcolormap -initwait -state -statusbar -cursor } -configspec { {-installcolormap installColormap InstallColormap false} {-initwait initWait InitWait 1000} {-state state State both} {-statusbar statusBar StatusBar ""} {-cursor cursor Cursor {}} } -default { {*background #ffff60} {*foreground black} {*borderWidth 0} {.borderWidth 1} {.background black} {*Label.anchor w} {*Label.justify left} } } # static seem to be -installcolormap -initwait -statusbar -cursor # Class Record # global tixBalloon set tixBalloon(bals) "" proc tixBalloon:InitWidgetRec {w} { upvar #0 $w data global tixBalloon tixChainMethod $w InitWidgetRec set data(isActive) 0 set data(client) "" lappend tixBalloon(bals) $w } proc tixBalloon:ConstructWidget {w} { upvar #0 $w data tixChainMethod $w ConstructWidget if {[tk windowingsystem] eq "aqua"} { ::tk::unsupported::MacWindowStyle style $w help none } else { wm overrideredirect $w 1 } catch {wm attributes $w -topmost 1} wm positionfrom $w program wm withdraw $w # Frame 1 : arrow frame $w.f1 -bd 0 set data(w:label) [label $w.f1.lab -bd 0 -relief flat \ -bitmap [tix getbitmap balarrow]] pack $data(w:label) -side left -padx 1 -pady 1 # Frame 2 : Message frame $w.f2 -bd 0 set data(w:message) [label $w.f2.message -padx 0 -pady 0 -bd 0] pack $data(w:message) -side left -expand yes -fill both -padx 10 -pady 1 # Pack all pack $w.f1 -fill both pack $w.f2 -fill both # This is an event tag used by the clients # bind TixBal$w [list tixBalloon:ClientDestroy $w %W] } proc tixBalloon:Destructor {w} { global tixBalloon set bals "" foreach b $tixBalloon(bals) { if {$w != $b} { lappend bals $b } } set tixBalloon(bals) $bals tixChainMethod $w Destructor } #---------------------------------------------------------------------- # Config: #---------------------------------------------------------------------- proc tixBalloon:config-state {w value} { upvar #0 $w data set re {^(none|balloon|status|both)$} if {![regexp -- $re $value]} { error "invalid value $value, must be none, balloon, status, or both" } } #---------------------------------------------------------------------- # "RAW" event bindings: #---------------------------------------------------------------------- bind all "+tixBalloon_XXMotion %X %Y 1" bind all "+tixBalloon_XXMotion %X %Y 2" bind all "+tixBalloon_XXMotion %X %Y 3" bind all "+tixBalloon_XXMotion %X %Y 4" bind all "+tixBalloon_XXMotion %X %Y 5" bind all "+tixBalloon_XXMotion %X %Y 0" # Should %b be 0? %b is illegal bind all "+tixBalloon_XXMotion %X %Y 0" bind all