Prima::MDI - top-level window emulation
MDI stands for Multiple Document Interface and is a Microsoft Windows user interface that consists of multiple non-top-level windows belonging to an application window. The module contains classes that provide similar functionality; sub-window widgets realize a set of operations similar 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 the same as Prima::MDIOwner but is a Prima::Window descendant: both owner classes are different only in the class they are derived from. Their second ascendant is the Prima::MDIMethods package that contains all the owner class functionality.
Prima::MDIOwner
Prima::MDI
Prima::MDIWindowOwner
Prima::Window
Prima::MDIMethods
Usage of the Prima::MDI class extends beyond the multi-document paradigm. The Prima::DockManager module uses the class as a base of the dockable toolbar window class (see Prima::DockManager.
Prima::DockManager
use Prima qw(Application MDI Buttons); my $owner = Prima::MDIWindowOwner-> new; my $mdi = $owner-> insert( 'Prima::MDI'); $mdi-> client-> insert( 'Prima::Button' => centered => 1 ); run Prima;
Implements MDI window functionality. A subwindow widget consists of a title bar, title bar 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 popup menu anchored to the window toolbar. The default set of commands is as follows
Close window - Ctrl+F4 Restore window - Ctrl+F5 or double-click on the title bar Maximize window - Ctrl+F10 or double-click on the title bar Go to the next MDI window - Ctrl+Tab Go to the previous MDI window - Ctrl+Shift+Tab Invoke popup menu - Ctrl+Space
The class mimics the API of the Prima::Window class, and to some extent, Prima::Window and this page share the same information.
Manages window decorations, which are buttons on the title bar and the title bar itself. Can be 0 or a combination of the following mbi::XXX constants that are a superset of the bi::XXX constants ( see "borderIcons" in Prima::Window ) and are interchangeable.
mbi::XXX
bi::XXX
mbi::SystemMenu - system menu button with an icon is shown mbi::Minimize - minimize button mbi::Maximize - maximize and restore buttons mbi::TitleBar - window title mbi::Close - close button mbi::All - all of the above
Default value: mbi::All
mbi::All
One of the bs::XXX constants that define the window border style:
bs::XXX
bs::None - no border bs::Single - thin border bs::Dialog - thick border bs::Sizeable - thick border with interactive resize capabilities
The bs::Sizeable is a 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.
bs::Sizeable
Default value: bs::Sizeable
Selects the client widget at run time. When changing the client, the old client's children are not reparented to the new client. The property cannot be used to set the client during the MDI window creation; use the clientClass and clientProfile properties instead.
clientClass
clientProfile
When setting a new client object, note that it has to be named MDIClient, and that the window will be automatically destroyed after the client is destroyed.
MDIClient
Assigns the client widget class.
Create-only property.
Default value: Prima::Widget
Prima::Widget
Assigns a hash of properties passed to the client during the creation.
A three-state variable that manages the visual feedback style when the user moves or resizes a window. If 1, the window is moved or resized simultaneously with the user's mouse or keyboard actions. If 0, a marquee rectangle is drawn, which is moved or resized as the user sends the commands; the window is only positioned and/or resized after the dragging session is successfully finished. If undef, the system-dependant dragging style is used. ( See "get_system_value" in Prima::Application ).
undef
The dragging session can be aborted by hitting the Esc key or calling the sizemove_cancel method.
sizemove_cancel
Default value: undef.
Selects a custom image to be drawn in the left corner of the toolbar. If 0, the default image ( menu button icon ) is drawn.
Default value: 0
Selects the minimized button image in the normal state.
Selects the maximized button image in the normal state.
Selects the close button image in the normal state.
Selects the restore button image in the normal state.
Selects the minimize button image in the pressed state.
Selects the maximize button image in the pressed state.
Selects the close button image in the pressed state.
Selects the restore button image in the pressed state.
Selects whether the window is allowed to participate in cascading and tiling auto-arrangements, performed correspondingly by the cascade and tile methods. If 0, the window position is not affected by these methods.
cascade
tile
Default value: 1
Selects the height of the title bar in pixels. If 0, the default system value is used.
A three-state property that manages the state of a window. STATE can be one of three ws::XXX constants:
ws::XXX
ws::Normal ws::Minimized ws::Maximized
The property can be changed either by an explicit set-mode call or by the user. In either case, a WindowState notification is triggered.
WindowState
The property has three convenience wrappers: maximize(), minimize(), and restore().
maximize()
minimize()
restore()
The ws::Fullscreen constant is not supported, and there's no corresponding fullscreen() method.
ws::Fullscreen
fullscreen()
Default value: ws::Normal
ws::Normal
See also: WindowState
Arranges geometrically the minimized sibling MDI windows.
Arranges sibling MDI windows so they form a cascade-like structure: the lowest window is expanded to the full owner window inferior rectangle, the next window occupies the inferior rectangle of the first window, etc.
Only windows with the tileable property set to 1 are arranged.
tileable
Returns a rectangle that the window would occupy if its client rectangle is assigned to the X1, Y1, X2, Y2 rectangle.
Returns a rectangle that the window client would occupy if the window rectangle is assigned to the X1, Y1, X2, Y2 rectangle.
Returns a rectangle in the window coordinate system that the client would occupy if the window extensions are WIDTH and HEIGHT. If WIDTH and HEIGHT are undefined, the current window size is used.
Initiates window moving session, navigated by the keyboard.
Initiates window resizing session, navigated by the keyboard.
Returns an array of sibling MDI windows.
Maximizes the window. A shortcut for windowState(ws::Maximized).
windowState(ws::Maximized)
Minimizes the window. A shortcut for windowState(ws::Minimized).
windowState(ws::Minimized)
Posts an action to the window; 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 the following string commands: min, max, restore, close.
min
max
restore
close
title
Invalidates the part of the title bar corresponding to the STRING, which can be one of the following:
left - redraws the menu button right - redraws minimize, maximize, and close buttons title - redraws the title
Restores the window to the normal state from the minimized or maximized state. A shortcut for windowState(ws::Normal).
windowState(ws::Normal)
Cancels active moving or resizing session and returns the window to the previous state
Arranges sibling MDI windows so they form a grid-like structure where all windows occupy equal space, if possible.
Only windows with the tileable property set to 1 are processed.
Maps a point in the (X,Y) coordinates into a string corresponding to the part of the window: title bar, button, or a part of the border. The latter can be returned only if borderStyle is set to bs::Sizeable. The possible return values are:
borderStyle
border - window border; the window is not sizeable client - client widget caption - title bar; the window is not movable title - title bar; 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 the 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
Triggered when the user activates the window. The activation mark usually resides on the window that has the keyboard focus.
The module does not provide a dedicated activation function; the select() call can be used for this.
select()
Triggered when the user deactivates the window. A window is usually marked inactive when it contains no keyboard focus.
The module does not provide a dedicated de-activation function; the deselect() call can be used instead.
deselect()
Triggered when the window state is changed, either by an explicit windowState() call or by the user. STATE is the new window state, one of three ws::XXX constants.
windowState()
The package contains methods for MDI window owners. Add Prima::MDIMethods as a base to your class to inherit this functionality if neither Prima::MDIOwner nor Prima::MDIWindowOwner suit your needs.
Repaints window titles in all children MDI windows.
Returns an array of children MDI windows.
The same as Prima::MDI::arrange_icons.
Prima::MDI::arrange_icons
The same as Prima::MDI::cascade.
Prima::MDI::cascade
The same as Prima::MDI::tile.
Prima::MDI::tile
A predeclared descendant class derived from Prima::Widget and Prima::MDIMethods.
A pre-declared descendant class derived from Prima::Window and Prima::MDIMethods.
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, Prima::Widget, Prima::Window, Prima::DockManager, examples/mdi.pl
To install Prima, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima
CPAN shell
perl -MCPAN -e shell install Prima
For more information on module installation, please visit the detailed CPAN module installation guide.