Prima::MDI - top-level windows emulation classes |
Prima::MDI - top-level windows emulation classes
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 Prima::MDIOwner
and Prima::MDI
,
which are, correspondingly, sub-window owner class and sub-window class. Prima::MDIWindowOwner
is exactly the same as Prima::MDIOwner
but is a Prima::Window
descendant: the both owner classes
are different only in their first ascendants. Their second ascendant is Prima::MDIMethods
package, that contains all the owner class functionality.
Usage of Prima::MDI
class extends beyond the multi-document paradigm.
Prima::DockManager
module uses the class as a base of a dockable toolbar window class
( see the Prima::DockManager manpage.
use Prima::MDI;
my $owner = Prima::MDIWindowOwner-> create(); my $mdi = $owner-> insert( 'Prima::MDI'); $mdi-> client-> insert( 'Prima::Button' => centered => 1 );
Implements MDI window functionality. A subwindow widget consists of a titlebar, titlebar buttons, and a client widget. The latter must be used as an insertion target for all children widgets.
A subwindow can be moved and resized, both by mouse and keyboard. These functions, along with maximize, minimize, and restore commands are accessible via the toolbar-anchored popup menu. The default set of commands is as follows:
Close window - Ctrl+F4 Restore window - Ctrl+F5 or a double click on the titlebar Maximize window - Ctrl+F10 or a double click on the titlebar Go to next MDI window - Ctrl+Tab Go to previous MDI window - Ctrl+Shift+Tab Invoke popup menu - Ctrl+Space
The class mimics API of Prima::Window
class, and in some extent
the Prima::Window manpage and this page share the same information.
mbi::XXX
constants, which are supreset
of bi::XXX
constants ( see borderIcons in the Prima::Window manpage ) and are interchangeable.
mbi::SystemMenu - system menu button with icon is shown mbi::Minimize - minimize button mbi::Maximize - maximize ( and eventual restore ) mbi::TitleBar - window title mbi::Close - close button mbi::All - all of the above
Default value: mbi::All
bs::XXX
constants, selecting the window border style.
The constants are:
bs::None - no border bs::Single - thin border bs::Dialog - thick border bs::Sizeable - thick border with interactive resize capabilities
bs::Sizeable
is an unique mode. If selected, the user
can resize the window interactively. The other border styles
disallow resizing and affect the border width and design only.
Default value: bs::Sizeable
clientClass
and clientProfile
properties instead.
When setting new client object, note that is has to be named MDIClient
and the window is automatically destroyed after the client is destroyed.
=item clientClass STRING
Assigns client widget class.
Create-only property.
Default value: Prima::Widget
Create-only property.
undef
, the system-dependant
dragging style is used. ( See get_system_value in the Prima::Application manpage ).
The dragging session can be aborted by
hitting Esc key or calling sizemove_cancel
method.
Default value: undef
.
Default value: 0
cascade
and tile
methods. If 0, the window is never positioned
automatically.
Default value: 1
Default value: 0
ws::XXX
constants:
ws::Normal ws::Minimized ws::Maximized
The property can be changed
either by explicit set-mode call or by the user. In either case,
a WindowState
notification is triggered.
The property has three convenience wrappers: maximize()
,
minimize()
and restore()
.
Default value: ws::Normal
See also: WindowState
Only windows with tileable
property set to 1 are processed.
windowState(ws::Maximized)
.
windowState(ws::Minimized)
.
min
, max
, restore
, close
.
title
]left - redraw the menu button right - redraw minimize, maximize, and close buttons title - redraw the title
windowState(ws::Normal)
.
Only windows with tileable
property set to 1 are processed.
borderStyle
is set to 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
The module does not provide the activation function;
select()
call is used instead.
The module does not provide the de-activation
function; deselect()
call is used instead.
windowState()
call, or by the user.
STATE is the new window state, one of three ws::XXX
constants.
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 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 Prima::MDI
class.
Prima::MDI::arrange_icons
.
Prima::MDI::cascade
.
Prima::MDI::tile
.
A predeclared descendant class of Prima::Widget
and Prima::MDIMethods
.
A pre-declared descendant class of Prima::Window
and Prima::MDIMethods
.
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, the Prima::Widget manpage, the Prima::Window manpage, the Prima::DockManager manpage, examples/mdi.pl
Prima::MDI - top-level windows emulation classes |