This document describes how to use the ToolPane classes for Smalltalk/V Windows.
ToolPane (along with StatusPane and MDI) can be installed by filing in "mdi.st" in the extras\mdi subdirectory. This has already been done in Smalltalk Express.
For an example, look at the MDIDemo class, in the extras\mdi\mdidemo subdirectory
Programming Interface
A ToolPane window uses a helper class called Tool. To make a ToolPane
look and behave the way you want, you will send the contents: message to it.
The parameter of the contents: method is a collection of Tool objects.
The responsibilities of the Tool class are:
1. Displaying the Bitmap associated with the Tool. The user must provide a bitmap for each Tool. This bitmap must include the up state and the down state for the tool. One part of the bitmap is used for the up state, and the other part for the down state. The default size of a tool is 25 X 22 pixels. There is a reference bitmap in the extras\mdi subdirectory called ref.bmp. You can start your custom bitmap with it.
The .bmp files are always DIB file. The indices 4, 8 and 9 in the color table of the bitmap are set to the buttonText color, buttonShadow color and buttonFace color, respectively.
2. Performing a selector associated with the Tool. The user must also provide a selector and an owner for each tool. The message will be sent whenever a tool is clicked on.
The ToolPane has a default framingBlock, and therefore you do not need to specify it. The application can change the height. The default height is the height of the caption bar.
contents "Answer the receiver's contents, i.e. a collection of Tool objects."
contents:aToolCollection "Set the receiver's contents. aToolCollection is a collection of Tool objects."
height "Answer the receiver's height."
height:anInteger "Set the receiver's height."
isToolPane "Answer true if receiver is an instance of class ToolPane, else answer false."
toolAt: toolSymbol "Answer the first tool with the name toolSymbol."
fromFile:aFileName "Create a new tool. aFileName is a .BMP file name."
fromModule:aFileName id:aString "Create a new tool. aFileName is a DLL file name. aString is a BITMAP name in this DLL."
fromBitmap: aBitmap "Create a new tool from aBitmap object."
extent "Answer the receiver's extent."
extent:aPoint "Set the receiver's extent."
name "Answer the tool name. Tool's name is established by sending the 'name:' message to the tool."
name: aSymbol "Set the tool name to aSymbol which can be a Symbol or a String."
owner "Answer the receiver's owner."
owner:anOwner "Set the receiver's owner."
selector "Answer the receiver's selector."
selector:aSymbol "Set the receiver's selector. It can be either aSymbol or a message."
space "Answer the receiver's offset in pixel units."
space:anInteger "Set the receiver's offset to anInteger pixel units. An offset specifies the distance between a tool and the previous one."
Look at the MDIDemo class in the extras\mdi\mdidemo subdirectory. MDIDemo creates a ToolPane with a comboBox.
MDIDemo>>open .......
self addSubpane:(toolPane := (ToolPane new owner: self; height: 45; when: #doubleClicked perform: #toolPaneDoubleClicked:; when: #getContents perform:#toolPane:)). toolPane addSubpane:( ComboBox new font: (Font face:'Helv' size:0 @ 8 fixedWidth:false); dropDownList; when: #select perform: #selectColor:; when: #getContents perform: #comboBox:; framingBlock:[:box | 2 @ 8 extent: 100 @ 200]). ......
MDIDemo>>toolPane: aPane ......
aTool:=Tool fromBitmap: bmp. aTool selector:#doc2;owner:self;extent: 38 @ 38;space: 11. aToolCollection add:aTool.
aPane contents: aToolCollection.