sub
action_cb {
my
(
$self
,
$posx
,
$posy
) =
@_
;
$self
->cdActivate();
$posy
= 399 -
$self
->DY -
$posy
;
$self
->cdClear();
$self
->cdForeground(CD_RED);
$self
->cdLine(0-
$posx
, 0-
$posy
, 599-
$posx
, 399-
$posy
);
$self
->cdLine(0-
$posx
, 399-
$posy
, 599-
$posx
, 0-
$posy
);
return
IUP_DEFAULT;
}
sub
scroll_cb {
my
(
$self
,
$op
,
$posx
,
$posy
) =
@_
;
action_cb(
$self
,
$posx
,
$posy
);
return
IUP_DEFAULT;
}
sub
resize_cb {
my
(
$self
,
$w
,
$h
) =
@_
;
$self
->SetAttribute(
DX
=>
$w
,
DY
=>
$h
);
$self
->cdActivate();
return
IUP_DEFAULT;
}
my
$canvas
= IUP::Canvas->new(
RASTERSIZE
=>
"300x200"
,
SCROLLBAR
=>
"YES"
,
XMAX
=>
"599"
,
YMAX
=>
"399"
,
SCROLL_CB
=>\
&scroll_cb
,
RESIZE_CB
=>\
&resize_cb
,
ACTION
=>\
&action_cb
);
my
$dialog
= IUP::Dialog->new(
child
=>
$canvas
,
TITLE
=>
"Scrollbar Test"
);
$dialog
->ShowXY(IUP_CENTER, IUP_CENTER);
$canvas
->RASTERSIZE(
undef
);
IUP->MainLoop();