OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [library/] [TList.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# TList.tcl --
2
#
3
#       This file defines the default bindings for Tix Tabular Listbox
4
#       widgets.
5
#
6
# Copyright (c) 1996, Expert Interface Technologies
7
#
8
# See the file "license.terms" for information on usage and redistribution
9
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
#
11
 
12
 
13
 
14
#--------------------------------------------------------------------------
15
# tkPriv elements used in this file:
16
#
17
# afterId -             Token returned by "after" for autoscanning.
18
# fakeRelease -         Cancel the ButtonRelease-1 after the user double click
19
#--------------------------------------------------------------------------
20
#
21
proc tixTListBind {} {
22
    tixBind TixTList <ButtonPress-1> {
23
        tixTList:Button-1 %W %x %y
24
    }
25
    tixBind TixTList <Shift-ButtonPress-1> {
26
        tixTList:Shift-Button-1 %W %x %y
27
    }
28
    tixBind TixTList <Control-ButtonPress-1> {
29
        tixTList:Control-Button-1 %W %x %y
30
    }
31
    tixBind TixTList <ButtonRelease-1> {
32
        tixTList:ButtonRelease-1 %W %x %y
33
    }
34
    tixBind TixTList <Double-ButtonPress-1> {
35
        tixTList:Double-1 %W  %x %y
36
    }
37
    tixBind TixTList <B1-Motion> {
38
        set tkPriv(x) %x
39
        set tkPriv(y) %y
40
        set tkPriv(X) %X
41
        set tkPriv(Y) %Y
42
 
43
        tixTList:B1-Motion %W %x %y
44
    }
45
    tixBind TixTList <Control-B1-Motion> {
46
        set tkPriv(x) %x
47
        set tkPriv(y) %y
48
        set tkPriv(X) %X
49
        set tkPriv(Y) %Y
50
 
51
        tixTList:Control-B1-Motion %W %x %y
52
    }
53
    tixBind TixTList <B1-Leave> {
54
        set tkPriv(x) %x
55
        set tkPriv(y) %y
56
        set tkPriv(X) %X
57
        set tkPriv(Y) %Y
58
 
59
        tixTList:B1-Leave %W
60
    }
61
    tixBind TixTList <B1-Enter> {
62
        tixTList:B1-Enter %W %x %y
63
    }
64
    tixBind TixTList <Control-B1-Leave> {
65
        set tkPriv(x) %x
66
        set tkPriv(y) %y
67
        set tkPriv(X) %X
68
        set tkPriv(Y) %Y
69
 
70
        tixTList:Control-B1-Leave %W
71
    }
72
    tixBind TixTList <Control-B1-Enter> {
73
        tixTList:Control-B1-Enter %W %x %y
74
    }
75
 
76
    # Keyboard bindings
77
    #
78
    tixBind TixTList <Up> {
79
        tixTList:DirKey %W up
80
    }
81
    tixBind TixTList <Down> {
82
        tixTList:DirKey %W down
83
    }
84
    tixBind TixTList <Left> {
85
        tixTList:DirKey %W left
86
    }
87
    tixBind TixTList <Right> {
88
        tixTList:DirKey %W right
89
    }
90
    tixBind TixTList <Prior> {
91
        %W yview scroll -1 pages
92
    }
93
    tixBind TixTList <Next> {
94
        %W yview scroll 1 pages
95
    }
96
    tixBind TixTList <Return> {
97
        tixTList:Return %W
98
    }
99
    tixBind TixTList <space> {
100
        tixTList:Space %W
101
    }
102
}
103
 
104
#----------------------------------------------------------------------
105
#
106
#
107
#                        Mouse bindings
108
#
109
#
110
#----------------------------------------------------------------------
111
 
112
proc tixTList:Button-1 {w x y} {
113
    if {[$w cget -state] == "disabled"} {
114
        return
115
    }
116
    if [$w cget -takefocus] {
117
        focus $w
118
    }
119
    case [tixTList:GetState $w] {
120
        {s0} {
121
            tixTList:GoState s1 $w $x $y
122
        }
123
        {b0} {
124
            tixTList:GoState b1 $w $x $y
125
        }
126
        {m0} {
127
            tixTList:GoState m1 $w $x $y
128
        }
129
        {e0} {
130
            tixTList:GoState e1 $w $x $y
131
        }
132
    }
133
}
134
 
135
proc tixTList:Shift-Button-1 {w x y} {
136
    if {[$w cget -state] == "disabled"} {
137
        return
138
    }
139
    if [$w cget -takefocus] {
140
        focus $w
141
    }
142
    case [tixTList:GetState $w] {
143
        {s0} {
144
            tixTList:GoState s1 $w $x $y
145
        }
146
        {b0} {
147
            tixTList:GoState b1 $w $x $y
148
        }
149
        {m0} {
150
            tixTList:GoState m7 $w $x $y
151
        }
152
        {e0} {
153
            tixTList:GoState e7 $w $x $y
154
        }
155
    }
156
}
157
 
158
proc tixTList:Control-Button-1 {w x y} {
159
    if {[$w cget -state] == "disabled"} {
160
        return
161
    }
162
    if [$w cget -takefocus] {
163
        focus $w
164
    }
165
    case [tixTList:GetState $w] {
166
        {s0} {
167
            tixTList:GoState s1 $w $x $y
168
        }
169
        {b0} {
170
            tixTList:GoState b1 $w $x $y
171
        }
172
        {m0} {
173
            tixTList:GoState m1 $w $x $y
174
        }
175
        {e0} {
176
            tixTList:GoState e10 $w $x $y
177
        }
178
    }
179
}
180
 
181
proc tixTList:ButtonRelease-1 {w x y} {
182
    case [tixTList:GetState $w] {
183
        {s2 s4 s5 s6} {
184
            tixTList:GoState s3 $w
185
        }
186
        {b2 b4 b5 b6} {
187
            tixTList:GoState b3 $w
188
        }
189
        {m2} {
190
            tixTList:GoState m3 $w
191
        }
192
        {m5} {
193
            tixTList:GoState m6 $w $x $y
194
        }
195
        {m9} {
196
            tixTList:GoState m0 $w
197
        }
198
        {e2} {
199
            tixTList:GoState e3 $w
200
        }
201
        {e5} {
202
            tixTList:GoState e6 $w $x $y
203
        }
204
        {e9} {
205
            tixTList:GoState e0 $w
206
        }
207
    }
208
}
209
 
210
proc tixTList:B1-Motion {w x y} {
211
    case [tixTList:GetState $w] {
212
        {s2 s4} {
213
            tixTList:GoState s4 $w $x $y
214
        }
215
        {b2 b4} {
216
            tixTList:GoState b4 $w $x $y
217
        }
218
        {m2 m5} {
219
            tixTList:GoState m4 $w $x $y
220
        }
221
        {e2 e5} {
222
            tixTList:GoState e4 $w $x $y
223
        }
224
    }
225
}
226
 
227
proc tixTList:Control-B1-Motion {w x y} {
228
    case [tixTList:GetState $w] {
229
        {s2 s4} {
230
            tixTList:GoState s4 $w $x $y
231
        }
232
        {b2 b4} {
233
            tixTList:GoState b4 $w $x $y
234
        }
235
        {m2 m5} {
236
            tixTList:GoState m4 $w $x $y
237
        }
238
    }
239
}
240
 
241
proc tixTList:Double-1 {w x y} {
242
    case [tixTList:GetState $w] {
243
        {s0} {
244
            tixTList:GoState s7 $w $x $y
245
        }
246
        {b0} {
247
            tixTList:GoState b7 $w $x $y
248
        }
249
    }
250
}
251
 
252
proc tixTList:B1-Leave {w} {
253
    case [tixTList:GetState $w] {
254
        {s2 s4} {
255
            tixTList:GoState s5 $w
256
        }
257
        {b2 b4} {
258
            tixTList:GoState b5 $w
259
        }
260
        {m2 m5} {
261
            tixTList:GoState m8 $w
262
        }
263
        {e2 e5} {
264
            tixTList:GoState e8 $w
265
        }
266
    }
267
}
268
 
269
proc tixTList:B1-Enter {w x y} {
270
    case [tixTList:GetState $w] {
271
        {s5 s6} {
272
            tixTList:GoState s4 $w $x $y
273
        }
274
        {b5 b6} {
275
            tixTList:GoState b4 $w $x $y
276
        }
277
        {m8 m9} {
278
            tixTList:GoState m4 $w $x $y
279
        }
280
        {e8 e9} {
281
            tixTList:GoState e4 $w $x $y
282
        }
283
    }
284
}
285
 
286
proc tixTList:Control-B1-Leave {w} {
287
    case [tixTList:GetState $w] {
288
        {s2 s4} {
289
            tixTList:GoState s5 $w
290
        }
291
        {b2 b4} {
292
            tixTList:GoState b5 $w
293
        }
294
        {m2 m5} {
295
            tixTList:GoState m8 $w
296
        }
297
    }
298
}
299
 
300
proc tixTList:Control-B1-Enter {w x y} {
301
    case [tixTList:GetState $w] {
302
        {s5 s6} {
303
            tixTList:GoState s4 $w $x $y
304
        }
305
        {b5 b6} {
306
            tixTList:GoState b4 $w $x $y
307
        }
308
        {m8 m9} {
309
            tixTList:GoState m4 $w $x $y
310
        }
311
    }
312
}
313
 
314
proc tixTList:AutoScan {w} {
315
    case [tixTList:GetState $w] {
316
        {s5 s6} {
317
            tixTList:GoState s6 $w
318
        }
319
        {b5 b6} {
320
            tixTList:GoState b6 $w
321
        }
322
        {m8 m9} {
323
            tixTList:GoState m9 $w
324
        }
325
        {e8 e9} {
326
            tixTList:GoState e9 $w
327
        }
328
    }
329
}
330
 
331
#----------------------------------------------------------------------
332
#
333
#
334
#                        Key bindings
335
#
336
#
337
#----------------------------------------------------------------------
338
proc tixTList:DirKey {w key} {
339
    if {[$w cget -state] == "disabled"} {
340
        return
341
    }
342
    case [tixTList:GetState $w] {
343
        {s0} {
344
            tixTList:GoState s8 $w $key
345
        }
346
        {b0} {
347
            tixTList:GoState b8 $w $key
348
        }
349
    }
350
}
351
 
352
proc tixTList:Return {w} {
353
    if {[$w cget -state] == "disabled"} {
354
        return
355
    }
356
    case [tixTList:GetState $w] {
357
        {s0} {
358
            tixTList:GoState s9 $w
359
        }
360
        {b0} {
361
            tixTList:GoState b9 $w
362
        }
363
    }
364
}
365
 
366
proc tixTList:Space {w} {
367
    if {[$w cget -state] == "disabled"} {
368
        return
369
    }
370
    case [tixTList:GetState $w] {
371
        {s0} {
372
            tixTList:GoState s10 $w
373
        }
374
        {b0} {
375
            tixTList:GoState b10 $w
376
        }
377
   }
378
}
379
 
380
#----------------------------------------------------------------------
381
#
382
#                       STATE MANIPULATION
383
#
384
#
385
#----------------------------------------------------------------------
386
proc tixTList:GetState {w} {
387
    global $w:priv:state
388
 
389
    if {![info exists $w:priv:state]} {
390
        case [$w cget -selectmode] {
391
            single {
392
                set $w:priv:state s0
393
            }
394
            browse {
395
                set $w:priv:state b0
396
            }
397
            multiple {
398
                set $w:priv:state m0
399
            }
400
            extended {
401
                set $w:priv:state e0
402
            }
403
            default {
404
                set $w:priv:state unknown
405
            }
406
        }
407
    }
408
    return [set $w:priv:state]
409
}
410
 
411
proc tixTList:SetState {w n} {
412
    global $w:priv:state
413
 
414
    set $w:priv:state $n
415
}
416
 
417
proc tixTList:GoState {n w args} {
418
 
419
#   puts "going from [tixTList:GetState $w] --> $n"
420
 
421
    tixTList:SetState $w $n
422
    eval tixTList:GoState-$n $w $args
423
}
424
 
425
#----------------------------------------------------------------------
426
#                       States
427
#----------------------------------------------------------------------
428
 
429
#----------------------------------------------------------------------
430
#       SINGLE SELECTION
431
#----------------------------------------------------------------------
432
proc tixTList:GoState-s0 {w} {
433
}
434
 
435
proc tixTList:GoState-s1 {w x y} {
436
    set ent [$w nearest $x $y]
437
    if {$ent != ""} {
438
        $w anchor set $ent
439
    }
440
    tixTList:GoState s2 $w
441
}
442
 
443
proc tixTList:GoState-s2 {w} {
444
}
445
 
446
proc tixTList:GoState-s3 {w} {
447
    set ent [$w info anchor]
448
    if {$ent != ""} {
449
        $w selection clear
450
        $w selection set $ent
451
        tixTList:CallBrowseCmd $w $ent
452
    }
453
    tixTList:GoState s0 $w
454
}
455
 
456
proc tixTList:GoState-s4 {w x y} {
457
    set ent [$w nearest $x $y]
458
    if {$ent != ""} {
459
        $w anchor set $ent
460
    }
461
}
462
 
463
proc tixTList:GoState-s5 {w} {
464
    tixTList:StartScan $w
465
}
466
 
467
proc tixTList:GoState-s6 {w} {
468
    global tkPriv
469
 
470
    tixTList:DoScan $w
471
}
472
 
473
proc tixTList:GoState-s7 {w x y} {
474
    set ent [$w nearest $x $y]
475
 
476
    if {$ent != ""} {
477
        $w selection clear
478
        $w selection set $ent
479
        tixTList:CallCommand $w $ent
480
    }
481
    tixTList:GoState s0 $w
482
}
483
 
484
proc tixTList:GoState-s8 {w key} {
485
    set anchor [$w info anchor]
486
 
487
    if {$anchor == ""} {
488
        set anchor 0
489
    } else {
490
        set anchor [$w info $key $anchor]
491
    }
492
 
493
    $w anchor set $anchor
494
    $w see $anchor
495
    tixTList:GoState s0 $w
496
}
497
 
498
proc tixTList:GoState-s9 {w} {
499
    set anchor [$w info anchor]
500
 
501
    if {$anchor == ""} {
502
        set anchor 0
503
        $w anchor set $anchor
504
        $w see $anchor
505
    }
506
 
507
    if {[$w info anchor] != ""} {
508
        # ! may not have any elements
509
        #
510
        tixTList:CallCommand $w [$w info anchor]
511
        $w selection clear
512
        $w selection set $anchor
513
    }
514
 
515
    tixTList:GoState s0 $w
516
}
517
 
518
proc tixTList:GoState-s10 {w} {
519
    set anchor [$w info anchor]
520
 
521
    if {$anchor == ""} {
522
        set anchor 0
523
        $w anchor set $anchor
524
        $w see $anchor
525
    }
526
 
527
    if {[$w info anchor] != ""} {
528
        # ! may not have any elements
529
        #
530
        tixTList:CallBrowseCmd $w [$w info anchor]
531
        $w selection clear
532
        $w selection set $anchor
533
    }
534
 
535
    tixTList:GoState s0 $w
536
}
537
 
538
#----------------------------------------------------------------------
539
#       BROWSE SELECTION
540
#----------------------------------------------------------------------
541
proc tixTList:GoState-b0 {w} {
542
}
543
 
544
proc tixTList:GoState-b1 {w x y} {
545
    set ent [$w nearest $x $y]
546
    if {$ent != ""} {
547
        $w anchor set $ent
548
        $w selection clear
549
        $w selection set $ent
550
        tixTList:CallBrowseCmd $w $ent
551
    }
552
    tixTList:GoState b2 $w
553
}
554
 
555
proc tixTList:GoState-b2 {w} {
556
}
557
 
558
proc tixTList:GoState-b3 {w} {
559
    set ent [$w info anchor]
560
    if {$ent != ""} {
561
        $w selection clear
562
        $w selection set $ent
563
        tixTList:CallBrowseCmd $w $ent
564
    }
565
    tixTList:GoState b0 $w
566
}
567
 
568
proc tixTList:GoState-b4 {w x y} {
569
    set ent [$w nearest $x $y]
570
    if {$ent != ""} {
571
        $w anchor set $ent
572
        $w selection clear
573
        $w selection set $ent
574
        tixTList:CallBrowseCmd $w $ent
575
    }
576
}
577
 
578
proc tixTList:GoState-b5 {w} {
579
    tixTList:StartScan $w
580
}
581
 
582
proc tixTList:GoState-b6 {w} {
583
    global tkPriv
584
 
585
    tixTList:DoScan $w
586
}
587
 
588
proc tixTList:GoState-b7 {w x y} {
589
    set ent [$w nearest $x $y]
590
 
591
    if {$ent != ""} {
592
        $w selection clear
593
        $w selection set $ent
594
        tixTList:CallCommand $w $ent
595
    }
596
    tixTList:GoState b0 $w
597
}
598
 
599
proc tixTList:GoState-b8 {w key} {
600
    set anchor [$w info anchor]
601
 
602
    if {$anchor == ""} {
603
        set anchor 0
604
    } else {
605
        set anchor [$w info $key $anchor]
606
    }
607
 
608
    $w anchor set $anchor
609
    $w selection clear
610
    $w selection set $anchor
611
    $w see $anchor
612
 
613
    tixTList:CallBrowseCmd $w $anchor
614
    tixTList:GoState b0 $w
615
}
616
 
617
proc tixTList:GoState-b9 {w} {
618
    set anchor [$w info anchor]
619
 
620
    if {$anchor == ""} {
621
        set anchor 0
622
        $w anchor set $anchor
623
        $w see $anchor
624
    }
625
 
626
    if {[$w info anchor] != ""} {
627
        # ! may not have any elements
628
        #
629
        tixTList:CallCommand $w [$w info anchor]
630
        $w selection clear
631
        $w selection set $anchor
632
    }
633
 
634
    tixTList:GoState b0 $w
635
}
636
 
637
proc tixTList:GoState-b10 {w} {
638
    set anchor [$w info anchor]
639
 
640
    if {$anchor == ""} {
641
        set anchor 0
642
        $w anchor set $anchor
643
        $w see $anchor
644
    }
645
 
646
    if {[$w info anchor] != ""} {
647
        # ! may not have any elements
648
        #
649
        tixTList:CallBrowseCmd $w [$w info anchor]
650
        $w selection clear
651
        $w selection set $anchor
652
    }
653
 
654
    tixTList:GoState b0 $w
655
}
656
 
657
#----------------------------------------------------------------------
658
#       MULTIPLE SELECTION
659
#----------------------------------------------------------------------
660
proc tixTList:GoState-m0 {w} {
661
}
662
 
663
proc tixTList:GoState-m1 {w x y} {
664
    set ent [$w nearest $x $y]
665
    if {$ent != ""} {
666
        $w anchor set $ent
667
        $w selection clear
668
        $w selection set $ent
669
        tixTList:CallBrowseCmd $w $ent
670
    }
671
    tixTList:GoState m2 $w
672
}
673
 
674
proc tixTList:GoState-m2 {w} {
675
}
676
 
677
proc tixTList:GoState-m3 {w} {
678
    set ent [$w info anchor]
679
    if {$ent != ""} {
680
        tixTList:CallBrowseCmd $w $ent
681
    }
682
    tixTList:GoState m0 $w
683
}
684
 
685
proc tixTList:GoState-m4 {w x y} {
686
    set from [$w info anchor]
687
    set to   [$w nearest $x $y]
688
    if {$to != ""} {
689
        $w selection clear
690
        $w selection set $from $to
691
        tixTList:CallBrowseCmd $w $to
692
    }
693
    tixTList:GoState m5 $w
694
}
695
 
696
proc tixTList:GoState-m5 {w} {
697
}
698
 
699
proc tixTList:GoState-m6 {w x y} {
700
    set ent [$w nearest $x $y]
701
    if {$ent != ""} {
702
        tixTList:CallBrowseCmd $w $ent
703
    }
704
    tixTList:GoState m0 $w
705
}
706
 
707
proc tixTList:GoState-m7 {w x y} {
708
    set from [$w info anchor]
709
    set to   [$w nearest $x $y]
710
    if {$from == ""} {
711
        set from $to
712
        $w anchor set $from
713
    }
714
    if {$to != ""} {
715
        $w selection clear
716
        $w selection set $from $to
717
        tixTList:CallBrowseCmd $w $to
718
    }
719
    tixTList:GoState m5 $w
720
}
721
 
722
 
723
proc tixTList:GoState-m8 {w} {
724
    tixTList:StartScan $w
725
}
726
 
727
proc tixTList:GoState-m9 {w} {
728
    tixTList:DoScan $w
729
}
730
 
731
proc tixTList:GoState-xm7 {w x y} {
732
    set ent [$w nearest $x $y]
733
 
734
    if {$ent != ""} {
735
        $w selection clear
736
        $w selection set $ent
737
        tixTList:CallCommand $w $ent
738
    }
739
    tixTList:GoState m0 $w
740
}
741
 
742
#----------------------------------------------------------------------
743
#       EXTENDED SELECTION
744
#----------------------------------------------------------------------
745
proc tixTList:GoState-e0 {w} {
746
}
747
 
748
proc tixTList:GoState-e1 {w x y} {
749
    set ent [$w nearest $x $y]
750
    if {$ent != ""} {
751
        $w anchor set $ent
752
        $w selection clear
753
        $w selection set $ent
754
        tixTList:CallBrowseCmd $w $ent
755
    }
756
    tixTList:GoState e2 $w
757
}
758
 
759
proc tixTList:GoState-e2 {w} {
760
}
761
 
762
proc tixTList:GoState-e3 {w} {
763
    set ent [$w info anchor]
764
    if {$ent != ""} {
765
        tixTList:CallBrowseCmd $w $ent
766
    }
767
    tixTList:GoState e0 $w
768
}
769
 
770
proc tixTList:GoState-e4 {w x y} {
771
    set from [$w info anchor]
772
    set to   [$w nearest $x $y]
773
    if {$to != ""} {
774
        $w selection clear
775
        $w selection set $from $to
776
        tixTList:CallBrowseCmd $w $to
777
    }
778
    tixTList:GoState e5 $w
779
}
780
 
781
proc tixTList:GoState-e5 {w} {
782
}
783
 
784
proc tixTList:GoState-e6 {w x y} {
785
    set ent [$w nearest $x $y]
786
    if {$ent != ""} {
787
        tixTList:CallBrowseCmd $w $ent
788
    }
789
    tixTList:GoState e0 $w
790
}
791
 
792
proc tixTList:GoState-e7 {w x y} {
793
    set from [$w info anchor]
794
    set to   [$w nearest $x $y]
795
    if {$from == ""} {
796
        set from $to
797
        $w anchor set $from
798
    }
799
    if {$to != ""} {
800
        $w selection clear
801
        $w selection set $from $to
802
        tixTList:CallBrowseCmd $w $to
803
    }
804
    tixTList:GoState e5 $w
805
}
806
 
807
 
808
proc tixTList:GoState-e8 {w} {
809
    tixTList:StartScan $w
810
}
811
 
812
proc tixTList:GoState-e9 {w} {
813
    tixTList:DoScan $w
814
}
815
 
816
proc tixTList:GoState-e10 {w x y} {
817
    set ent [$w nearest $x $y]
818
    if {$ent != ""} {
819
        if {[$w info anchor] == ""} {
820
            $w anchor set $ent
821
        }
822
        if [$w selection includes $ent] {
823
            $w selection clear $ent
824
        } else {
825
            $w selection set $ent
826
        }
827
        tixTList:CallBrowseCmd $w $ent
828
    }
829
    tixTList:GoState e2 $w
830
}
831
 
832
proc tixTList:GoState-xm7 {w x y} {
833
    set ent [$w nearest $x $y]
834
 
835
    if {$ent != ""} {
836
        $w selection clear
837
        $w selection set $ent
838
        tixTList:CallCommand $w $ent
839
    }
840
    tixTList:GoState e0 $w
841
}
842
 
843
#----------------------------------------------------------------------
844
#       HODGE PODGE
845
#----------------------------------------------------------------------
846
 
847
proc tixTList:GoState-12 {w x y} {
848
    tkCancelRepeat
849
    tixTList:GoState 5 $w $x $y
850
}
851
 
852
proc tixTList:GoState-13 {w ent oldEnt} {
853
    global tkPriv
854
    set tkPriv(tix,indicator) $ent
855
    set tkPriv(tix,oldEnt)    $oldEnt
856
    tixTList:IndicatorCmd $w <Arm> $ent
857
}
858
 
859
proc tixTList:GoState-14 {w x y} {
860
    global tkPriv
861
 
862
    if [tixTList:InsideArmedIndicator $w $x $y] {
863
        $w anchor set $tkPriv(tix,indicator)
864
        $w select clear
865
        $w select set $tkPriv(tix,indicator)
866
        tixTList:IndicatorCmd $w <Activate> $tkPriv(tix,indicator)
867
    } else {
868
        tixTList:IndicatorCmd $w <Disarm>   $tkPriv(tix,indicator)
869
    }
870
 
871
    unset tkPriv(tix,indicator)
872
    tixTList:GoState 0 $w
873
}
874
 
875
proc tixTList:GoState-16 {w ent} {
876
    if {$ent == ""} {
877
        return
878
    }
879
    if {[$w cget -selectmode] != "single"} {
880
        tixTList:Select $w $ent
881
        tixTList:Browse $w $ent
882
    }
883
}
884
 
885
proc tixTList:GoState-18 {w} {
886
    global tkPriv
887
    tkCancelRepeat
888
    tixTList:GoState 6 $w $tkPriv(x) $tkPriv(y)
889
}
890
 
891
proc tixTList:GoState-20 {w x y} {
892
    global tkPriv
893
 
894
    if {![tixTList:InsideArmedIndicator $w $x $y]} {
895
        tixTList:GoState 21 $w $x $y
896
    } else {
897
        tixTList:IndicatorCmd $w <Arm> $tkPriv(tix,indicator)
898
    }
899
}
900
 
901
proc tixTList:GoState-21 {w x y} {
902
    global tkPriv
903
 
904
    if {[tixTList:InsideArmedIndicator $w $x $y]} {
905
        tixTList:GoState 20 $w $x $y
906
    } else {
907
        tixTList:IndicatorCmd $w <Disarm> $tkPriv(tix,indicator)
908
    }
909
}
910
 
911
proc tixTList:GoState-22 {w} {
912
    global tkPriv
913
 
914
    if {$tkPriv(tix,oldEnt) != ""} {
915
        $w anchor set $tkPriv(tix,oldEnt)
916
    } else {
917
        $w anchor clear
918
    }
919
    tixTList:GoState 0 $w
920
}
921
 
922
 
923
#----------------------------------------------------------------------
924
#                       callback actions
925
#----------------------------------------------------------------------
926
proc tixTList:SetAnchor {w x y} {
927
    set ent [$w nearest $x $y]
928
    if {$ent != "" && [$w entrycget $ent -state] != "disabled"} {
929
        $w anchor set $ent
930
        $w see $ent
931
        return $ent
932
    }
933
 
934
    return ""
935
}
936
 
937
proc tixTList:Select {w ent} {
938
    $w selection clear
939
    $w select set $ent
940
}
941
 
942
proc tixTList:StartScan {w} {
943
    global tkPriv
944
    set tkPriv(afterId) [after 50 tixTList:AutoScan $w]
945
}
946
 
947
proc tixTList:DoScan {w} {
948
    global tkPriv
949
    set x $tkPriv(x)
950
    set y $tkPriv(y)
951
    set X $tkPriv(X)
952
    set Y $tkPriv(Y)
953
 
954
    set out 0
955
    if {$y >= [winfo height $w]} {
956
        $w yview scroll 1 units
957
        set out 1
958
    }
959
    if {$y < 0} {
960
        $w yview scroll -1 units
961
        set out 1
962
    }
963
    if {$x >= [winfo width $w]} {
964
        $w xview scroll 2 units
965
        set out 1
966
    }
967
    if {$x < 0} {
968
        $w xview scroll -2 units
969
        set out 1
970
    }
971
 
972
    if {$out} {
973
        set tkPriv(afterId) [after 50 tixTList:AutoScan $w]
974
    }
975
}
976
 
977
proc tixTList:CallBrowseCmd {w ent} {
978
    set browsecmd [$w cget -browsecmd]
979
    if {$browsecmd != ""} {
980
        set bind(specs) {%V}
981
        set bind(%V)    $ent
982
 
983
        tixEvalCmdBinding $w $browsecmd bind $ent
984
    }
985
}
986
 
987
proc tixTList:CallCommand {w ent} {
988
    set command [$w cget -command]
989
    if {$command != ""} {
990
        set bind(specs) {%V}
991
        set bind(%V)    $ent
992
 
993
        tixEvalCmdBinding $w $command bind $ent
994
    }
995
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.