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 deleteslave.- pathName
new?slaveoptions?- Just an alias for
addSlave.- pathName
slaves- Returns a list of all slave widgets' pathnames.
- pathName
entryconfigureslavePathName ?options?- Configures options for the slave widget slavePathName.
- pathName
entrycgetslavePathName ?option?- Returns configuration setting of
optionfrom 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
showslavePathName- Show slave widget slavePathName, i.e. raise it, maybe restore from minimized state, and set the focus.
- pathName
deleteslavePathName- 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:
-titlestring- Set title of slave widget.
-closecmdcommand- Invoke this command when slave widget is to be deleted. The actual command will be
commandslave , 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:
-slavebgcolor- Background color of slave window.
-slavebdcolor- Border width of slave window's frame.
-fontfont- Font of title of slave window.
-titlebgcolor- Background color of an inactive slave's title.
-titlefgcolor- Foreground color of an inactive slave's title.
-activebgcolor- Background color of an active title.
-activefgcolor- Foreground color of an active title.
-xscrollcommandcommand- Specifies the command to be called on x-scroll. Should almost always be something like
.xscrollbar set.-yscrollcommandcommand- Specifies the command to be called on y-scroll. Should almost always be something like
.yscrollbar set.-arrangeiconsTCL_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.
-stylestyle- Set the style of the MDI:
unixfor a more UNIX (KDE) like look orwindowsfor 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).