Tk-MK
view release on metacpan or search on metacpan
lib/Tk/PopUpSelectBox.pm view on Meta::CPAN
$_[0]->{'m_Cursor'} = $_[0]->cget ('-cursor');
$_[0]->configure ('-cursor' => ($^O =~ /^(MSWin32|DOS)$/ ? 'size_nw_se' : 'bottom_right_corner'));
}
#---------------------------------------------
sub Leave
{
$_[0]->configure ('-cursor' => $_[0]->{'m_Cursor'} || 'arrow');
}
#---------------------------------------------
sub Press
{
$_[1]->{'-deltax'} = $_[1]->pointerx();
$_[1]->{'-deltay'} = $_[1]->pointery();
}
#---------------------------------------------
sub Resize
{
my @geometry = split (/[+x]/, $_[1]->toplevel()->geometry());
# Take care that we stay in the visible area
my $x = $_[1]->pointerx();
if ($x < 0) {
$geometry [0] = $_[1]->{'-deltax'};
}
else {
$geometry [0] += ($x - $_[1]->{'-deltax'});
$_[1]->{'-deltax'} = $x;
}
my $y = $_[1]->pointery();
if ($y < 0) {
$geometry [1] = $_[1]->{'-deltay'};
}
else {
$geometry [1] += ($y - $_[1]->{'-deltay'});
$_[1]->{'-deltay'} = $y;
}
# Force absolute min-sizes of the steered window
$geometry [0] = MINSIZE_X() if $geometry [0] < MINSIZE_X();
$geometry [1] = MINSIZE_Y() if $geometry [1] < MINSIZE_Y();
# Set the new geometry
$_[1]->toplevel()->geometry($geometry [0] . 'x' . $geometry [1]);
}
1;
########################################################################
# For changing some aspects here we clone the TK-Tree Widget
########################################################################
package Tk::PopUpSelectBox::SelectTree;
use vars qw($VERSION);
$VERSION = '0.01';
use Tk qw(Ev);
use Tk::Derived;
use Tk::HList;
use base qw(Tk::Derived Tk::HList);
#---------------------------------------------
Tk::Widget->Construct ('SelectTree');
my $minus_data = <<'minus_data_EOP';
/* XPM */
static char *xpm[] = {
"13 13 2 1",
". c none",
"X c black",
".............",
".............",
".............",
"XXXXXXXXXXXXX",
".XX.......XX.",
"..XX.....XX..",
"...XX...XX...",
"....XX.XX....",
".....XXX.....",
"......X......",
".............",
".............",
".............",
};
minus_data_EOP
my $minus_arm_data = <<'minus_arm_data_EOP';
/* XPM */
static char *xpm[] = {
"13 13 3 1",
". c none",
"X c black",
"a c red",
".............",
".............",
".............",
"XXXXXXXXXXXXX",
".XXXXXXXXXXX.",
"..XXXXXXXXX..",
"...XXXXXXX...",
"....XXXXX....",
".....XXX.....",
"......X......",
".............",
".............",
".............",
};
minus_arm_data_EOP
my $plus_data = <<'plus_data_EOP';
/* XPM */
static char *xpm[] = {
"13 13 2 1",
". c none",
"X c black",
"...X.........",
"...XX........",
"...XXX.......",
"...X.XX......",
"...X..XX.....",
( run in 0.578 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )