package require twoMdi
?1.0?
two_mdi
pathName ?options?
two_mdi
is an implementation
of the MDI widget known from Windows. An MDI is like a windowmanager in
another window: you can open an arbitrary number of slave windows, move,
resize, maximize and minimize them, and sure enough close them. There are
window menus and a root menu.
Creating a new two_mdi
gives you a master
widget which serves as a container for slave widgets. Handling of slave
windows is a bit weird with MDI. It doesn't work like a TK geometry manager,
and this the slave widgets are no direct children of the master widget.
There is a mdi command to create new slaves, which will return the path
to the frame.
MIDs are not really the UNIX (Motif?) way of handling more than one document with one instance of an application. The most obvious disadvantage is the loss of freedom (you can't place slaves independant from the master). Yet there might be reasons to use this: you might want to run the Tcl/Tk application on Windows, or the average user might be used to MDIs from their windows applications and thus accept them even on UNIX, or you just like them fore any reason.
two_mdi
widget
command takes the following commands (as the first argument):
- pathName
addSlave
?slaveoptions?- Add a slave widget. Returns path of the new slave widget (a frame widget). Destroying this widget will clean up things, but won't call the closecmd. Better use
master delete
slave
.- pathName
new
?slaveoptions?- Just an alias for
addSlave
.- pathName
slaves
- Returns a list of all slave widgets' pathnames.
- pathName
entryconfigure
slavePathName ?options?- Configures options for the slave widget slavePathName.
- pathName
entrycget
slavePathName ?option?- Returns configuration setting of
option
from slave widget slavePathName.- pathName
active
- Returns path to currently active child (or an empty string).
- pathName
tile
- Tile the slave widgets (fill all space of the master with all slaves).
- pathName
cascade
- Cascade the slave widgets (stack them with some displacement).
- pathName
show
slavePathName- Show slave widget slavePathName, i.e. raise it, maybe restore from minimized state, and set the focus.
- pathName
delete
slavePathName- Delete slave widget denoted by slavePathName.
- pathName
maximize
- Maximize all slave widgets.
- pathName
minimize
?slavePathName...?- Minimize all given slave widgets slavePathName. If no slaves are given: minimize all.
- pathName
restore
?slavePathName...?- Restore the original size of all maximized or minimized widgets from the given list of slave widgets slavePathName. If no slaves are given: restore all.
addSlave
, entryconfigure
and entrycget
commands:
-title
string- Set title of slave widget.
-closecmd
command- Invoke this command when slave widget is to be deleted. The actual command will be
command
slave , i.e. the name of the current slave will be appended. The widget will only be destroyed if this command returns TRUE (or no command is given).
two_mdi
command takes all options of the TK frame widget plus to following options:
-slavebg
color- Background color of slave window.
-slavebd
color- Border width of slave window's frame.
-font
font- Font of title of slave window.
-titlebg
color- Background color of an inactive slave's title.
-titlefg
color- Foreground color of an inactive slave's title.
-activebg
color- Background color of an active title.
-activefg
color- Foreground color of an active title.
-xscrollcommand
command- Specifies the command to be called on x-scroll. Should almost always be something like
.xscrollbar set
.-yscrollcommand
command- Specifies the command to be called on y-scroll. Should almost always be something like
.yscrollbar set
.-arrangeicons
TCL_BOOLEAN- If set to 1, then resizing the master and minimizing/restoring the slaves will lead to a recalculation of all icon positions. Defaults to 1.
-style
style- Set the style of the MDI:
unix
for a more UNIX (KDE) like look orwindows
for a look like on windows.
two_mdi
master widget may generate the following virtual event:
- <<ActiveOn>> and <<ActiveOff>>
- There is an active slave (On) oder not (Off). This event is triggered as well whenever the focus is set to another slave.
The TwoMdiSlave
slave
widgets may generate the following virtual event:
- <<Closeing>>
- when they are destroyed.
two_mdi
widget is built up with a rather complex
widget hierarchy. The master widget is a frame (class: TwoMdiMaster). Its
children are the two popup menus (root menu and window/icon menu). The slave widgets' hierarchy starts with a frame widget serving as border (class: TwoMdi). This contains another frame widget (class again TwoMdi) which provides the space (by padding) for further content. This frame contains another three frames for title (class: TwoMdiTitle), spaceing (class once more TwoMdi) and the slave container returned to the user (class TwoMdiSlave).
The title bar of the slaves is built with two labels (the window icon and the title text) and three buttons (minimize/restor, maximize/restore and close).