Prima

 view release on metacpan or  search on metacpan

Prima/MDI.pm  view on Meta::CPAN

{
	return grep {$_-> isa('Prima::MDI')?$_:0} $_[0]-> widgets
}

sub arrange_icons
{
	my @m = $_[0]-> mdis;
	$m[0]-> arrange_icons if $m[0];
}

sub cascade
{
	my @m = $_[0]-> mdis;
	$m[0]-> cascade if $m[0];
}

sub tile
{
	my @m = $_[0]-> mdis;
	$m[0]-> tile if $m[0];
}

package Prima::MDIWindowOwner;
use vars qw(@ISA);

Prima/MDI.pm  view on Meta::CPAN

	$szx = int( $szx);
	my $i = 0;
	$_-> lock for @mdis;
	for ( @mdis) {
		$_-> origin( $i % $szx * $szMin[0], int($i / $szx) * $szMin[1]);
		$i++;
	}
	$_-> unlock for @mdis;
}

sub cascade
{
	my $self = $_[0]-> owner;
	my @mdis = grep {
		(($_-> windowState != ws::Minimized) and $_-> tileable && $_-> clipOwner) ?
			$_ :
			0
	} $_[0]-> mdis;
	return unless scalar @mdis;

	my $i = 0;

Prima/MDI.pm  view on Meta::CPAN

=head1 NAME

Prima::MDI - top-level windows emulation classes

=head1 DESCRIPTION

MDI stands for Multiple Document Interface, and is a Microsoft Windows user
interface, that consists of multiple non-toplevel windows belonging to an
application window. The module contains classes that provide similar
functionality; sub-window widgets realize a set of operations, close to those
of the real top-level windows, - iconize, maximize, cascade etc.

The basic classes required to use the MDI are C<Prima::MDIOwner> and
C<Prima::MDI>, which are, correspondingly, sub-window owner class and
sub-window class. C<Prima::MDIWindowOwner> is exactly the same as
C<Prima::MDIOwner> but is a C<Prima::Window> descendant: the both owner classes
are different only in their first ascendants. Their second ascendant is
C<Prima::MDIMethods> package, that contains all the owner class functionality.

Usage of C<Prima::MDI> class extends beyond the multi-document paradigm.
C<Prima::DockManager> module uses the class as a base of a dockable toolbar

Prima/MDI.pm  view on Meta::CPAN


Selects close button image in pressed state.

=item iconRestorePressed HANDLE

Selects restore button image in pressed state.

=item tileable BOOLEAN

Selects whether the window is allowed to participate in cascading and tiling
auto-arrangements, performed correspondingly by C<cascade> and C<tile> methods.
If 0, the window is never positioned automatically.

Default value: 1

=item titleHeight INTEGER

Selects height of the title bar in pixels. If 0, the default system
value is used.

Default value: 0

Prima/MDI.pm  view on Meta::CPAN

=back

=head2 Methods

=over

=item arrange_icons

Arranges geometrically the minimized sibling MDI windows.

=item cascade

Arranges sibling MDI windows so they form a cascade-like structure: the lowest
window is expanded to the full owner window inferior rectangle, window next to
the lowest occupies the inferior rectangle of the lowest window, etc.

Only windows with C<tileable> property set to 1 are processed.

=item client2frame X1, Y1, X2, Y2

Returns a rectangle that the window would occupy if
its client rectangle is assigned to X1, Y1, X2, Y2
rectangle.

Prima/MDI.pm  view on Meta::CPAN

Repaints window title in all children MDI windows.

=item mdis

Returns array of children MDI windows.

=item arrange_icons

Same as C<Prima::MDI::arrange_icons>.

=item cascade

Same as C<Prima::MDI::cascade>.

=item tile

Same as C<Prima::MDI::tile>.

=back

=head1 Prima::MDIOwner

A predeclared descendant class of C<Prima::Widget> and C<Prima::MDIMethods>.

examples/mdi.pl  view on Meta::CPAN

			[ '*cls' => '~Close button'    => sub { icons( @_, mbi::Close)}, ],
		]],
		[ '~Drag mode' => [
			[ '~System defined' => sub { $w-> dragMode( undef);}],
			[ '~Dynamic' => sub { $w-> dragMode( 1);}],
			[ '~Old fashioned' => sub { $w-> dragMode( 0);}],
		]],
		[ '~Windows' => [
			[ '~New' => 'Ctrl+N' => '^N' => sub{ $_[0]-> insert( 'MDI'); }],
			[ '~Arrange icons' => sub{ $_[0]-> arrange_icons;} ],
			[ '~Cascade' => sub{ $_[0]-> cascade; } ],
			[ '~Tile' => sub{ $_[0]-> tile;} ],
		]],
	],
);

$w = Prima::MDI-> create(
	owner => $wwx,
	clipOwner => 0,
	size => [200, 200],
	icon => Prima::StdBitmap::icon(sbmp::DriveCDROM),

pod/Prima/Object.pod  view on Meta::CPAN

post_message().

=item SysHandle

Sometimes Prima needs to implicitly re-create the system handle of a component.
The re-creation is not seen on the toolkit level, except for some repaints when
widgets on screen are affected, but under the hood, when it happens, Prima
creates a whole new system resource. This happens when the underlying system
either doesn't have API to change a certain property during the runtime, or
when such a re-creation happens on one of component's parent, leading to a
downward cascade of children re-creation. Also, it may happen when the user
changes some system settings resolution, so that some resources have to be changed
accordingly.

This event will be only needed when the system handle (that can be acquired by
C<get_handle> ) is used further, or in case when Prima doesn't restore some
properties bound to the system handle.

=back

=head1 AUTHOR



( run in 0.515 second using v1.01-cache-2.11-cpan-49f99fa48dc )