Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from ../blib/lib/Tk/Scrollbar.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Tk::Scrollbar; | |
5 | ||
6 | #line 171 "../blib/lib/Tk/Scrollbar.pm (autosplit into ../blib/lib/auto/Tk/Scrollbar/Select.al)" | |
7 | # tkScrollSelect -- | |
8 | # This procedure is invoked when button 1 is pressed over the scrollbar. | |
9 | # It invokes one of several scrolling actions depending on where in | |
10 | # the scrollbar the button was pressed. | |
11 | # | |
12 | # Arguments: | |
13 | # w - The scrollbar widget. | |
14 | # element - The element of the scrollbar that was selected, such | |
15 | # as "arrow1" or "trough2". Shouldn't be "slider". | |
16 | # repeat - Whether and how to auto-repeat the action: "noRepeat" | |
17 | # means don't auto-repeat, "initial" means this is the | |
18 | # first action in an auto-repeat sequence, and "again" | |
19 | # means this is the second repetition or later. | |
20 | ||
21 | sub Select | |
22 | { | |
23 | my $w = shift; | |
24 | my $element = shift; | |
25 | my $repeat = shift; | |
26 | return unless defined ($element); | |
27 | if ($element eq 'arrow1') | |
28 | { | |
29 | $w->ScrlByUnits('hv',-1); | |
30 | } | |
31 | elsif ($element eq 'trough1') | |
32 | { | |
33 | $w->ScrlByPages('hv',-1); | |
34 | } | |
35 | elsif ($element eq 'trough2') | |
36 | { | |
37 | $w->ScrlByPages('hv', 1); | |
38 | } | |
39 | elsif ($element eq 'arrow2') | |
40 | { | |
41 | $w->ScrlByUnits('hv', 1); | |
42 | } | |
43 | else | |
44 | { | |
45 | return; | |
46 | } | |
47 | ||
48 | if ($repeat eq 'again') | |
49 | { | |
50 | $w->RepeatId($w->after($w->cget('-repeatinterval'),['Select',$w,$element,'again'])); | |
51 | } | |
52 | elsif ($repeat eq 'initial') | |
53 | { | |
54 | $w->RepeatId($w->after($w->cget('-repeatdelay'),['Select',$w,$element,'again'])); | |
55 | } | |
56 | } | |
57 | ||
58 | # end of Tk::Scrollbar::Select | |
59 | 1; |