Prima
view release on metacpan or search on metacpan
Prima/MDI.pm view on Meta::CPAN
$sz[0] * ( $x + 1) / $col,
$sz[1] * ( $y + 1) / ( $row + (( $n >= $a) ? 1 : 0))
);
$n--;
}
$_-> unlock for @mdis;
}
sub xy2part
{
my ( $self, $x, $y) = @_;
my @size = $self-> size;
my $bw = $self-> { border};
my $bwx = $bw + 16;
my $bi = $self-> { borderIcons};
my $bs = $self-> { borderStyle};
my $icos = $self-> { iconsAtRight};
my $move = $self-> {windowState} != ws::Maximized;
my $size = ( $bs == bs::Sizeable) && ( $self-> {windowState} == ws::Normal);
my $dy = ( $bi & mbi::TitleBar) ? $self-> {titleY} : 0;
if ( $x < $bw) {
return q(border) unless $size;
return q(SizeSW) if $y < $bwx;
return q(SizeNW) if $y >= $size[1] - $bwx;
return q(SizeW);
} elsif ( $x >= $size[0] - $bw) {
return q(border) unless $size;
return q(SizeSE) if $y < $bwx;
return q(SizeNE) if $y >= $size[1] - $bwx;
return $size ? q(SizeE) : q(border);
} elsif (( $y < $bw) or ( $y >= $size[1] - $bw)) {
return q(border) unless $size;
return ( $y < $bw) ? q(SizeSW) : q(SizeNW) if $x < $bwx;
return ( $y < $bw) ? q(SizeSE) : q(SizeNE) if $x >= $size[0] - $bwx;
return ($y < $bw) ? q(SizeS) : q(SizeN);
} elsif ( $y < $size[1] - $bw - $dy) {
return q(client);
} elsif ( $x < $dy + $bw) {
return ( $bi & mbi::SystemMenu) ? q(menu) : ( $move ? q(caption) : q(title));
} elsif ( $x <= $size[0] - $bw - $icos * $dy) {
return $move ? q(caption) : q(title);
} elsif ( $x >= $size[0] - $bw - $dy) {
return ( $bi & mbi::Close) ? q(close) :
(( $bi & mbi::Maximize) ? (
($self-> {windowState} == ws::Maximized) ? q(restore) : q(max)
) : (
($self-> {windowState} == ws::Minimized) ? q(restore) : q(min)
));
} elsif ( $x >= $size[0] - $bw - $dy * 2) {
return (( $bi & ( mbi::Close | mbi::Maximize)) == (mbi::Close | mbi::Maximize))
? (
($self-> {windowState} == ws::Maximized) ? q(restore) : q(max)
) : (
($self-> {windowState} == ws::Minimized) ? q(restore) : q(min)
);
} else {
return ($self-> {windowState} == ws::Minimized) ? q(restore) : q(min);
}
return q(desktop);
}
sub post_action
{
my ( $self, $action) = @_;
$self-> post_message(q(cmMDI), $action);
}
sub repaint_title
{
my ( $self, $area) = @_;
my @size = $self-> size;
my $bw = $self-> {border};
my $dy = $self-> {titleY};
$area ||= '';
return unless $self-> { borderIcons} & mbi::TitleBar;
if ( $area eq 'right') {
$self-> invalidate_rect(
$size[0] - $bw - $self-> {iconsAtRight} * $dy, $size[1] - $bw,
$size[0] - $bw, $size[1] - $bw - $dy
);
} elsif ( $area eq 'left') {
$self-> invalidate_rect(
$bw, $size[1] - $bw - $dy,
$bw + $dy, $size[1] - $bw,
);
} else {
my $dx = (( $self-> {borderIcons} & mbi::SystemMenu) and ( !defined $self-> {icon})) ? $dy : 0;
$self-> invalidate_rect(
$bw + $dx, $size[1] - $bw - $dy,
$size[0] - $bw - $self-> {iconsAtRight} * $dy, $size[1] - $bw,
);
}
}
sub sizemove_cancel
{
my $self = $_[0];
my $ok;
return unless $self-> {mouseTransaction};
if ( $self-> {mouseTransaction} eq q(caption)) {
if ( $self-> {fullDrag}) {
$self-> origin( @{$self-> {trackSaveData}});
} else {
$self-> xorrect;
}
$ok = 1;
} elsif ( $self-> {mouseTransactionArea} eq q(size)) {
if ( $self-> {fullDrag}) {
$self-> rect( @{$self-> {trackSaveData}});
} else {
$self-> xorrect;
}
$ok = 1;
} elsif ( $self-> {mouseTransaction} eq q(keyMove)) {
if ( $self-> {fullDrag}) {
$self-> origin( @{$self-> {trackSaveData}});
} else {
$self-> xorrect;
Prima/MDI.pm view on Meta::CPAN
Returns array of sibling MDI windows.
=item maximize
Maximizes window. A shortcut for C<windowState(ws::Maximized)>.
=item minimize
Minimizes window. A shortcut for C<windowState(ws::Minimized)>.
=item post_action STRING
Posts an action to the windows; the action is deferred and executed in the next
message loop. This is used to avoid unnecessary state checks when the
action-executing code returns. The current implementation accepts following
string commands: C<min>, C<max>, C<restore>, C<close>.
=item repaint_title [ STRING = C<title> ]
Invalidates rectangle on the title bar, corresponding to STRING, which can be
one of the following:
left - redraw the menu button
right - redraw minimize, maximize, and close buttons
title - redraw the title
=item restore
Restores window to normal state from minimized or maximized state. A shortcut
for C<windowState(ws::Normal)>.
=item sizemove_cancel
Cancels active window moving or resizing session and returns the window to the
state before the session.
=item tile
Arranges sibling MDI windows so they form a grid-like structure, where all
windows occupy equal space, if possible.
Only windows with C<tileable> property set to 1 are processed.
=item xy2part X, Y
Maps a point in (X,Y) coordinates into a string, corresponding to a part of the
window: titlebar, button, or part of the border. The latter can be returned
only if C<borderStyle> is set to C<bs::Sizeable>. The possible return values
are:
border - window border; the window is not sizeable
client - client widget
caption - titlebar; the window is not moveable
title - titlebar; the window is movable
close - close button
min - minimize button
max - maximize button
restore - restore button
menu - menu button
desktop - the point does not belong to the window
In addition, if the window is sizeable, the following constants can be
returned, indicating part of the border:
SizeN - upper side
SizeS - lower side
SizeW - left side
SizeE - right side
SizeSW - lower left corner
SizeNW - upper left corner
SizeSE - lower right corner
SizeNE - upper right corner
=back
=head2 Events
=over
=item Activate
Triggered when the user activates a window. Activation mark is usually resides
on a window that contains keyboard focus.
The module does not provide the activation function; C<select()> call is used
instead.
=item Deactivate
Triggered when the user deactivates a window. Window is usually marked
inactive, when it contains no keyboard focus.
The module does not provide the de-activation function; C<deselect()> call is
used instead.
=item WindowState STATE
Triggered when window state is changed, either by an explicit C<windowState()>
call, or by the user. STATE is the new window state, one of three C<ws::XXX>
constants.
=back
=head1 Prima::MDIMethods
=head2 Methods
The package contains several methods for a class that is to be used as a MDI
windows owner. It is enough to add class inheritance to C<Prima::MDIMethods> to
use the functionality. This step, however, is not required for a widget to
become a MDI windows owner; the package contains helper functions only, which
mostly mirror the arrangement functions of C<Prima::MDI> class.
=over
=item mdi_activate
Repaints window title in all children MDI windows.
=item mdis
( run in 0.644 second using v1.01-cache-2.11-cpan-39bf76dae61 )