Added assert and Scheduler, and started adding proper test frameworks
[tcl-tlc.git] / scripts / myentry.itk
blobda6e2675e1277f9dbce24347b343365b76aad992
1 #option add *Myentry.borderWidth        2               widgetDefault
2 #option add *Myentry.relief             sunken  widgetDefault
4 itk::usual Myentry {
5         keep -background -textbackground -cursor
7 class tlc::Myentry {
8         inherit tlc::Border
9         
10         constructor {args} {}
12         itk_option define -state state State "normal"
13         itk_option define -disabledbackground disabledBackground DisabledBackground $::tlc::config(disabledbackground)
14         itk_option define -enabledbackground enabledBackground EnabledBackground $::tlc::config(enabledbackground)
16         public {
17                 method bbox {args} {uplevel $w.entry bbox $args}
18                 method delete {args} {uplevel $w.entry delete $args}
19                 method get {args} {uplevel $w.entry get $args}
20                 method icursor {args} {uplevel $w.entry icursor $args}
21                 method index {args} {uplevel $w.entry index $args}
22                 method insert {args} {uplevel $w.entry insert $args}
23                 method scan {args} {uplevel $w.entry scan $args}
24                 method selection {args} {uplevel $w.entry selection $args}
25                 method validate {args} {uplevel $w.entry validate $args}
26                 method xview {args} {uplevel $w.entry xview $args}
27         }
31 configbody tlc::Myentry::state {
32         switch -- $itk_option(-state) {
33                 "disabled" {
34                         set tbg         $itk_option(-disabledbackground)
35                 }
36                 
37                 default -
38                 "normal" {
39                         set tbg         $itk_option(-enabledbackground)
40                 }
41         }
42         
43         configure -textbackground $tbg
47 body tlc::Myentry::constructor {args} {
48         itk_component add entry {
49                 entry $w.entry -borderwidth 0 -relief flat
50         } {
51                 ignore -borderwidth
52                 rename -background -textbackground textBackground Background
53                 keep \
54                                 -cursor -exportselection \
55                                 -font -foreground -highlightbackground -highlightcolor \
56                                 -highlightthickness -insertbackground -insertborderwidth \
57                                 -insertofftime -insertontime -insertwidth -invalidcommand \
58                                 -justify -selectbackground -selectborderwidth \
59                                 -selectforeground -show -state -takefocus -textvariable \
60                                 -validate -validatecommand -width -xscrollcommand \
61                                 -relief
62         }
63         itk_component add expander {
64                 frame $w.expander -relief flat -borderwidth 0
65         }
66                 
67         table $w \
68                         $w.entry        1,1 -fill both \
69                         $w.expander     1,2 -fill y
70         table configure $w c2 -resize none
71         eval itk_initialize $args