1 # vim: foldmarker=<<<,>>>
3 #option add *Label_link.linkColour blue widgetDefault
4 #option add *Label_link.linkActive red widgetDefault
6 class tlc::Label_link {
11 itk_option define -linkcolour linkColour LinkColour "blue"
12 itk_option define -linkactive linkActive LinkActive "red"
13 itk_option define -linkdisabled linkDisabled LinkDisabled $::tlc::config(disabledbackground)
14 itk_option define -linkfont linkFont LinkFont [lreplace $::tlc::config(normalfont) 2 2 {underline italic bold}]
18 variable uri_reg "tlc::uri"
19 variable state "normal" update_fg
29 method update_fg {args}
34 configbody tlc::Label_link::linkfont { #<<<1
35 $w.link configure -font $itk_option(-linkfont)
39 body tlc::Label_link::constructor {args} { #<<<1
40 Signal #auto active -name "$this active"
42 itk_component add label {
48 rename -background -linkbackground linkBackground LinkBackground
50 bind $w.link <Button-1> [code $this invoke]
51 bind $w.link <Enter> [code $this enter]
52 bind $w.link <Leave> [code $this leave]
54 eval itk_initialize $args
56 $active attach_output [code $this update_fg]
63 body tlc::Label_link::invoke {} { #<<<1
64 if {$state != "disabled"} {
65 $uri_reg dispatch $target
70 body tlc::Label_link::enter {} { #<<<1
75 body tlc::Label_link::leave {} { #<<<1
80 body tlc::Label_link::update_fg {args} { #<<<1
81 if {$state == "disabled"} {
82 $w.link configure -foreground $itk_option(-linkdisabled)
84 if {[$active state]} {
85 $w.link configure -foreground $itk_option(-linkactive)
87 $w.link configure -foreground $itk_option(-linkcolour)