blob: 77aadf1b929aa3b6cdf4908fde99cf8815f0dbdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# NOTE: Derived from blib\lib\Tk.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package Tk;
#line 485 "blib\lib\Tk.pm (autosplit into blib\lib\auto\Tk\focusPrev.al)"
# focusPrev --
# This procedure is invoked to move the input focus to the previous
# window before a given one. "Previous" is defined in terms of the
# window stacking order, with all the windows underneath a given
# top-level (no matter how deeply nested in the hierarchy) considered.
#
# Arguments:
# w - Name of a window: the procedure will set the focus
# to the previous window before this one in the traversal
# order.
sub focusPrev
{
my $w = shift;
my $cur = $w;
my @children;
my $i;
my $parent;
while (1)
{
# Collect information about the current window's position
# among its siblings. Also, if the window is a top-level,
# then reposition to just after the last child of the window.
if ($cur->toplevel() == $cur)
{
$parent = $cur;
@children = $cur->FocusChildren();
$i = @children;
}
else
{
$parent = $cur->parent();
@children = $parent->FocusChildren();
$i = lsearch(\@children,$cur);
}
# Go to the previous sibling, then descend to its last descendant
# (highest in stacking order. While doing this, ignore top-levels
# and their descendants. When we run out of descendants, go up
# one level to the parent.
while ($i > 0)
{
$i--;
$cur = $children[$i];
next if ($cur->toplevel() == $cur);
$parent = $cur;
@children = $parent->FocusChildren();
$i = @children;
}
$cur = $parent;
if ($cur == $w || $cur->FocusOK)
{
$cur->tabFocus;
return;
}
}
}
# end of Tk::focusPrev
1;
|