$VERSION
=
'4.004'
;
Construct Tk::Widget
'Panedwindow'
;
sub
Tk_cmd { \
&Tk::panedwindow
}
Tk::Methods(
'add'
,
'forget'
,
'identify'
,
'proxy'
,
'sash'
,
'panes'
);
'proxy'
=> [
qw/coord forget place/
],
'sash'
=> [
qw/coord mark place/
],
);
sub
ClassInit {
my
(
$class
,
$mw
) =
@_
;
$class
->SUPER::ClassInit(
$mw
);
$mw
->
bind
(
$class
,
'<Button-1>'
=> [
'MarkSash'
=> Ev(
'x'
), Ev(
'y'
), 1]);
$mw
->
bind
(
$class
,
'<Button-2>'
=> [
'MarkSash'
=> Ev(
'x'
), Ev(
'y'
), 0]);
$mw
->
bind
(
$class
,
'<B1-Motion>'
=> [
'DragSash'
=> Ev(
'x'
), Ev(
'y'
), 1]);
$mw
->
bind
(
$class
,
'<B2-Motion>'
=> [
'DragSash'
=> Ev(
'x'
), Ev(
'y'
), 0]);
$mw
->
bind
(
$class
,
'<ButtonRelease-1>'
=> [
'ReleaseSash'
=> 1]);
$mw
->
bind
(
$class
,
'<ButtonRelease-2>'
=> [
'ReleaseSash'
=> 0]);
$mw
->
bind
(
$class
,
'<Motion>'
=> [
'Motion'
=> Ev(
'x'
), Ev(
'y'
)]);
$mw
->
bind
(
$class
,
'<Leave>'
=> [
'Leave'
]);
return
$class
;
}
sub
MarkSash {
my
(
$w
,
$x
,
$y
,
$proxy
) =
@_
;
my
@what
=
$w
->identify(
$x
,
$y
);
if
(
@what
== 2 ) {
my
(
$index
,
$which
) =
@what
[0 .. 1];
if
(not
$Tk::strictMotif
or
$which
eq
'handle'
) {
$w
->sashMark(
$index
,
$x
,
$y
)
if
not
$proxy
;
$w
->{_sash} =
$index
;
my
(
$sx
,
$sy
) =
$w
->sashCoord(
$index
);
$w
->{_dx} =
$sx
-
$x
;
$w
->{_dy} =
$sy
-
$y
;
}
}
}
sub
DragSash {
my
(
$w
,
$x
,
$y
,
$proxy
) =
@_
;
if
(
exists
$w
->{_sash} ) {
if
(
$proxy
) {
$w
->proxyPlace(
$x
+
$w
->{_dx},
$y
+
$w
->{_dy});
}
else
{
$w
->sashPlace(
$w
->{_sash},
$x
+
$w
->{_dx},
$y
+
$w
->{_dy});
}
}
}
sub
ReleaseSash {
my
(
$w
,
$proxy
) =
@_
;
if
(
exists
$w
->{_sash} ) {
if
(
$proxy
) {
my
(
$x
,
$y
) =
$w
->proxyCoord;
$w
->sashPlace(
$w
->{_sash},
$x
,
$y
);
$w
->proxyForget;
}
delete
$w
->{
'_sash'
,
'_dx'
,
'_dy'
};
}
}
sub
Motion {
my
(
$w
,
$x
,
$y
) =
@_
;
my
@id
=
$w
->identify(
$x
,
$y
);
if
( (
@id
== 2) and
(not
$Tk::strictMotif
or
$id
[1] eq
'handle'
) ) {
if
( not
exists
$w
->{_panecursor} ) {
$w
->{_panecursor} =
$w
->cget(-cursor);
if
( not
defined
$w
->cget(-sashcursor) ) {
if
(
$w
->cget(-orient) eq
'horizontal'
) {
$w
->configure(
-cursor
=>
'sb_h_double_arrow'
);
}
else
{
$w
->configure(
-cursor
=>
'sb_v_double_arrow'
);
}
}
else
{
$w
->configure(
-cursor
=>
$w
->cget(-sashcursor));
}
if
(
exists
$w
->{_pwAfterId} ) {
$w
->afterCancel(
$w
->{_pwAfterId});
}
$w
->{_pwAfterId} =
$w
->
after
(
150
=> [
'Cursor'
=>
$w
]);
}
return
}
if
(
exists
$w
->{_panecursor} ) {
$w
->configure(
-cursor
=>
$w
->{_panecursor});
delete
$w
->{_panecursor};
}
}
sub
Cursor {
my
(
$w
) =
@_
;
if
(
exists
$w
->{_panecursor} ) {
if
(
$w
->containing(
$w
->pointerx,
$w
->pointery) ==
$w
) {
$w
->{_pwAfterId} =
$w
->
after
(
150
=> [
'Cursor'
=>
$w
]);
}
else
{
$w
->configure(
-cursor
=>
$w
->{_panecursor});
delete
$w
->{_panecursor};
if
(
exists
$w
->{_pwAfterId} ) {
$w
->afterCancel(
$w
->{_pwAfterId});
delete
$w
->{_pwAfterId};
}
}
}
}
sub
Leave {
my
(
$w
) =
@_
;
if
(
exists
$w
->{_panecursor} ) {
$w
->configure(
-cursor
=>
$w
->{_panecursor});
delete
$w
->{_panecursor};
}
}
1;