1 #!/home/people/tkys/Eos/util/SGI/bin/bltwish
6 set file ./images/chalk.gif
7 set active ./images/rain.gif
9 image create photo calendar.texture.1 -file $file
10 image create photo calendar.texture.2 -file $active
12 option add *Tile calendar.texture.1
14 option add *HighlightThickness 0
15 option add *calendar.weekframe*Tile calendar.texture.2
16 option add *Calendar.Label.borderWidth 0
17 option add *Calendar.Label.relief sunken
18 option add *Calendar.Frame.borderWidth 2
19 option add *Calendar.Frame.relief raised
20 option add *Calendar.Label.font -*-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*
21 option add *Calendar.Label.foreground white
22 option add *button.foreground white
23 option add *background grey85
24 option add *button.activeForeground white
25 option add *button.activeBackground blue4
42 option add *tile calendar.texture.2
43 set abbrDays { Sun Mon Tue Wed Thu Fri Sat }
45 proc Calendar { weekday day month year } {
46 global monthInfo abbrDays
48 set wkdayOffset [lsearch $abbrDays $weekday]
49 if { $wkdayOffset < 0 } {
50 error "Invalid week day \"$weekday\""
52 set dayOffset [expr ($day-1)%7]
53 if { $wkdayOffset < $dayOffset } {
54 set wkdayOffset [expr $wkdayOffset+7]
56 set wkday [expr $wkdayOffset-$dayOffset-1]
57 if { [info commands .calendar] == ".calendar" } {
60 frame .calendar -class Calendar -width 3i -height 3i
62 if ![info exists monthInfo($month)] {
63 error "Invalid month \"$month\""
65 set info $monthInfo($month)
66 label .calendar.month \
67 -text "[lindex $info 0] $year" \
68 -font *-New*Century*Schoolbook-Bold-R-*-18-*
69 table .calendar .calendar.month 1,0 -cspan 7
72 frame .calendar.weekframe -relief raised -bd 2
73 table .calendar .calendar.weekframe 2,0 -columnspan 7 -fill both
74 foreach dayName $abbrDays {
75 set name [string tolower $dayName]
76 label .calendar.$name \
78 -font -*-Helvetica-Bold-R-*-*-16-*-*-*-*-*-*-*
79 table .calendar .calendar.$name 2,$cnt -pady 2 -padx 2
82 table configure .calendar c* r2 -pad 4
84 set numDays [lindex $info 1]
85 for { set cnt 1 } { $cnt <= $numDays } { incr cnt } {
86 label .calendar.day${cnt} -text $cnt
88 .calendar.day${cnt} configure -relief raised -bd 2
95 table .calendar .calendar.day${cnt} $week+3,$wkday -fill both -pady 4
97 frame .calendar.quit -bd 1 -relief sunken
98 button .calendar.quit.button -command { exit } -text {Quit} \
100 table .calendar.quit .calendar.quit.button -padx 4 -pady 4
102 .calendar.quit $week+4,5 -cspan 2 -pady 4
103 table . .calendar -fill both
104 table configure .calendar r0 -resize none
107 #table . -reqwidth [image width calendar.texture.1] -reqheight [image height calendar.texture.1]
109 set date [clock format [clock seconds]]
110 scan $date {%s %s %d %*s %*s %s} weekday month day year
112 Calendar $weekday $day $month $year
115 bind AutoFocus <Enter> {
117 catch { .calendar.quit configure -tile calendar.texture.2 }
121 bind AutoFocus <Leave> {
123 catch { .calendar.quit configure -tile calendar.texture.1 }
126 bindtags .calendar.quit.button { AutoFocus .calendar.quit.button Button all }