1 # vim: foldmarker=<<<,>>>
3 option add *Dateentry.labelBorderwidth 2 widgetDefault
4 option add *Dateentry.labelRelief sunken widgetDefault
5 option add *Dateentry.labelWidth 14 widgetDefault
6 option add *Dateentry.anchor nw widgetDefault
7 option add *Dateentry.buttonBorderwidth 1 widgetDefault
8 option add *Dateentry.resultFormat "%d/%m/%Y" widgetDefault
10 class tlc::Dateentry {
11 inherit tlc::Mywidget tlc::Handlers tlc::Textvariable
15 itk_option define -command command Command {}
16 itk_option define -state state State "normal"
17 itk_option define -textbackground textBackground TextBackground white
20 method rerender_dom_ref {}
25 method textvariable_changed {newvalue}
31 method request_lookup {}
32 method newselection {newdate}
37 configbody tlc::Dateentry::textbackground { #<<<1
38 if {$itk_option(-state) != "disabled"} {
39 $w.label configure -background $itk_option(-textbackground)
44 configbody tlc::Dateentry::state { #<<<1
45 log debug "$w -state reconfigured: ($itk_option(-state))"
47 $w.label configure -background \
48 [expr {$itk_option(-state) == "disabled" ? \
49 $::tlc::config(disabledbackground) : $::tlc::config(textbackground)}]
50 $w.label configure -foreground \
51 [expr {$itk_option(-state) == "disabled" ? \
52 $::tlc::config(disabledforeground) : $::tlc::config(enabledforeground)}]
56 body tlc::Dateentry::constructor {args} { #<<<1
58 itk_component add label {
59 label $w.label -textvariable [scope date] -takefocus 1
62 rename -borderwidth -labelborderwidth labelBorderwidth LabelBorderwidth
63 rename -relief -labelrelief labelRelief LabelRelief
64 rename -background -textbackground textBackground TextBackground
65 rename -width -labelwidth labelWidth LabelWidth
66 rename -highlightthickness -labelhighlightthickness labelHighlightThickness LabelHighlightThickness
67 rename -highlightbackground -labelhighlightbackground labelHighlightBackground LabelHighlightBackground
71 bind $w.label <Button-1> [code $this request_lookup]
73 itk_component add button {
74 Datelookup $w.datelookup -newselection [code $this newselection]
78 rename -borderwidth -buttonborderwidth buttonBorderwidth ButtonBorderwidth
79 rename -highlightbackground -buttonhighlightbackground buttonHighlightBackground ButtonHighLightBackground
80 keep -resultformat -special_cb
81 keep -validfrom -validto -state
86 eval itk_initialize $args
89 $w.label 1,1 -fill x \
90 $w.datelookup 1,2 -anchor e -pady {0 1}
91 table configure $w r1 c2 -resize none
95 body tlc::Dateentry::request_lookup {} { #<<<1
97 if {$itk_option(-state) != "disabled"} {
100 $w.datelookup popdown
105 body tlc::Dateentry::newselection {newdate} { #<<<1
108 set_textvariable $date
109 if {$itk_option(-command) != ""} {
110 uplevel #0 $itk_option(-command) [list $newdate]
112 invoke_handlers onselect [list $newdate]
116 body tlc::Dateentry::rerender_dom_ref {} { #<<<1
117 return [[[$w.datelookup component popup] component calendar] rerender_dom_ref]
121 body tlc::Dateentry::textvariable_changed {newvalue} { #<<<1
127 body tlc::Dateentry::get_date {} { #<<<1