The StatusPane class is a Subpane that always appears at the lower
portion of the TopPane.
StatusPane (along with ToolPane and MDI) can be installed by filing in
"mdi.st" in the extras\mdi subdirectory. In Smalltalk Express, these classes have already been installed.
StatusPane has two major functions:
1. Display information reflecting the states of the application.
2. Show hints when the user highlights a menuitem or clicks on a
button of a ToolPane.
StatusPane uses a helper class called StatusBox. StatusPane handles
a collection of StatusBox objects. A StatusBox object appears as a small
box with a 3D effect.
StatusPane can be leftJustified or rightJustifed, fixedSize or resizable.
The default style is leftJustified and resizable.
An application may also assign preview help for menu items through the
StatusPane. The help text for each menu item and menu title is given by
the menu owner by responding to the statusPaneHelp: message. The
parameter of the statusPaneHelp: method may be one of following:
1. If the preview help is for a menu item, the parameter is the selector
of the highlighted menu item represented as a string.
2. If the preview help is for a menu, the parameter is the title of the
highlighted menu represented as a string.
Each application (ViewManager subclass) typically
- defines a dictionary, the key being the menu selectors, and the value
being the text of the hints.
- reimplements the statusPaneHelp method as in the following:
ViewManagerApplication>>statusPaneHelp:aKey
"Private - Answer the hint text to the StatusPane"
^HelpDictionary at:aKey ifAbsent:[^super statusPaneHelp:aKey].
The StatusPane has a default framingBlock, and therefore you do not need to
specify it. The application usually sets the height. The default height is the
height of the caption bar.
StatusPane Programming Interface
===========================
contents
"Answer the receiver's contents, i.e., a collection of statusBox objects."
contents: aStatusBoxCollection
"Set the receiver's contents."
fixedSize
"Set the StatusPane style. The StatusPane boxes will be fixed size."
height
"Answer the receiver's height."
height:anInteger
"Set the receiver's height."
inset
"Answer the receiver's inset.
The height of a StatusBox is the height
of the statusPane minus two times the inset."
inset: anInteger
"Set the receiver's inset.
The height of a StatusBox is the height
of the statusPane minus two times the inset."
isStatusPane
"Answer true if receiver is an instance of class
StatusPane, else answer false."
leftJustified
"Set the StatusPane style. The StatusPane boxes will be
leftJustified."
resizable
"Set the StatusPane style. The left-most status box in a
rightJustified statusPane will be resizable. The right-most status
box in a left Justified statusPane will be resizable."
rightJustified
"Set the StatusPane style. The StatusPane boxes will be
rightJustified."
statusBoxAt: statusBoxSymbol
"Answer the first statusBox with the name statusBoxSymbol."
StatusBox Programming Interface
===========================
contents
"Answer the receiver's contents."
contents: anObject
"Set the receiver's contents and update the statusPane."
name
"Answer the statusBox name. A StatusBox's name is established by
sending the 'name:' message to the statusBox."
name: aSymbol
"Set the statusBox name to aSymbol
which can be a Symbol or a String."
show: aBoolean
"Show the receiver's contents if aBoolean is true, else
hide the receiver's contents."
space
"Answer the receiver's offset in pixel units. An offset specifies
the distance between a box and the previous one."
space: anInteger
"Set the receiver's offset to anInteger pixel units. An offset
specifies the distance between a box and the previous one."
width
"Answer the receiver's width in pixel units."
width: anInteger
"Set the receiver's width. anInteger is in pixel units."
Example:
Look at the MDIDemo class in the extras\mdi\mdidemo subdirectory.
MDIDemo>>open
......
self
addSubpane:(
StatusPane new
owner: self;
fixedSize;
leftJustified;
height: 45;
inset: 6;
when: #doubleClicked perform: #statusPaneDoubleClicked:;
when: #getContents perform: #statusPane:).
........
MDIDemo>>statusPane: aStatusPane
"Private - Set the status pane contents."
| statusBoxes |
statusBoxes := OrderedCollection new
add: ( StatusBox new
space: aStatusPane font width;
width: Display width // 3;
name: #status);
add: ( StatusBox new
space: aStatusPane font width * 2;
width: Display width // 3;
name: #mdidemo);
yourself.
aStatusPane contents: statusBoxes.
MDIDemo>>childActivate:aPane
"Private - Update the status pane. Shows
the label of the active MDI document."
|mdiActive|
(mdiActive := self frame mdiGetActive) notNil ifTrue:[
(self statusPane statusBoxAt: #status) contents: mdiActive label].
[top] [index]