MorphExamplesAndDemos

AnimatedImageMorph
I am an ImageMorph that can hold more than one image. Each image has its own delay time.
If you have an animated gif close to the image named
(AnimatedImageMorph fromGIFFileNamed: 'animated.gif') openInWorld
fileReaderServicesForFile:suffix:
fromGIFFileNamed:
fromReader:
fromStream:
images
initialize
initialize the state of the receiver
openGIFInWindow:
serviceOpenGIFInWindow
services
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.
stepTime:
unload
wantsSteps
Return true if the receiver overrides the default Morph step method.
AtomMorph
AtomMorph represents an atom used in the simulation of
an ideal gas. It's container is typically a BouncingAtomsMorph.
Try:
BouncingAtomsMorph new openInWorld
to open the gas simulation or:
AtomMorph example
to open an instance in the current world
bounceIn:
Move this atom one step along its velocity vector and make it bounce if it goes outside the given rectangle. Return true if it is bounced.
defaultBorderWidth
answer the default border width for the receiver
defaultColor
answer the default color/fill style for the receiver
drawOn:
Note: Set 'drawAsRect' to true to make the atoms draw faster. When testing the speed of other aspects of Morphic, such as its damage handling efficiency for large numbers of atoms, it is useful to make drawing faster.
example
includeInNewMorphMenu
infected
infected:
initialize
Make a new atom with a random position and velocity.
randomPositionIn:maxVelocity:
Give this atom a random position and velocity.
velocity
velocity:
BackgroundMorph
This morph incorporates tiling and regular motion with the intent of supporting, eg, panning of endless (toroidal) backgrounds.
The idea is that embedded morphs get displayed at a moving offset relative to my position. Moreover this display is tiled according to the bounding box of the submorphs (subBounds), as much as necesary to fill the rest of my bounds.
(BackgroundMorph new addMorph: (ImageMorph new image: Form fromUser)) openInWorld
addCustomMenuItems:hand:
Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.
delta
delta:
drawOn:
The tiling is solely determined by bounds, subBounds and offset.
The extent of display is determined by bounds and the clipRect of the canvas.
fullBounds
Return the bounding box of the receiver and all its children. Recompute the layout if necessary.
fullDrawOn:
Draw the full Morphic structure on the given Canvas
initialize
initialize the state of the receiver
layoutChanged
Do nothing, since I clip my submorphs
offset
offset:
slideBy:
startRunning
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds.
stopRunning
subBounds
calculate the submorph bounds
test
BouncingAtomsMorph
This morph shows how an ideal gas simulation might work. When it gets step messages, it makes all its atom submorphs move along their velocity vectors, bouncing when they hit a wall. It also exercises the Morphic damage reporting and display architecture. Here are some things to try:
1. Resize this morph as the atoms bounce around.
2. In an inspector on this morph, evaluate "self addAtoms: 10."
3. Try setting quickRedraw to false in invalidRect:. This gives the
default damage reporting and incremental redraw. Try it for
100 atoms.
4. In the drawOn: method of AtomMorph, change drawAsRect to true.
5. Create a HeaterCoolerMorph and embed it in the simulation. Extract
it and use an inspector on it to evaluate "self velocityDelta: -5", then
re-embed it. Note the effect on atoms passing over it.
addAtoms:
Add a bunch of new atoms.
addCustomMenuItems:hand:
Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.
addMorphFront:
Called by the 'embed' meta action. We want non-atoms to go to the back.
areasRemainingToFill:
Pushed up from BorderedMorph, all cases tested for there are
supported by basic Morph.
collisionPairs
Return a list of pairs of colliding atoms, which are assumed to be
circles of known radius. This version uses the morph's positions--i.e.
the top-left of their bounds rectangles--rather than their centers.
defaultColor
answer the default color/fill style for the receiver
descriptionForPartsBin
drawOn:
Clear the damageReported flag when redrawn.
initialize
initialize the state of the receiver
intoWorld:
Make sure report damage at least once
invalidRect:from:
Try setting 'quickRedraw' to true. This invalidates the entire morph, whose bounds typically subsume all it's submorphs. (However, this code checks that assumption and passes through any damage reports for out-of-bounds submorphs. Note that atoms with super-high velocities do occaisionally shoot through the walls!) An additional optimization is to only submit only damage report per display cycle by using the damageReported flag, which is reset to false when the morph is drawn.
registerInFlapsRegistry
setAtomCount
showInfectionHistory:
Place a graph of the infection history in the world.
startInfection
step
Bounce those atoms!
stepTime
As fast as possible.
transmitInfection
unload
updateTemperature:
Record the current temperature, which is taken to be the number of atoms that have bounced in the last cycle. To avoid too much jitter in the reading, the last several readings are averaged.
ClipboardMorph
A morph that always displays the current contents of the text clipboard.
ClipboardMorph new openInWorld
defaultBorderColor
answer the default border color/fill style for the receiver
defaultBorderWidth
answer the default border width for the receiver
defaultColor
answer the default color/fill style for the receiver
descriptionForPartsBin
initialize
initialize the state of the receiver
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the interval between steps -- in this case a leisurely 1 seconds
wantsSteps
Return true if the receiver overrides the default Morph step method.
ClockMorph
A ClockMorph is oneline clock
ClockMorph new openInWorld
ClockMorph new openInHand
addCustomMenuItems:hand:
Note minor loose end here -- if the menu is persistent, then the wording will be wrong half the time
authoringPrototype
descriptionForPartsBin
initialize
initialize the state of the receiver
initializeToStandAlone
Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.
registerInFlapsRegistry
show24hr:
showSeconds:
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds.
toggleShowing24hr
toggleShowingSeconds
unload
DoubleClickExample
Illustrates the double-click capabilities of Morphic.
DoubleClickExample new openInWorld
If you have a kind of morph you wish to have respond specially to a double-click, it should:
(1) Respond "true" to #handlesMouseDown:
(2) In its mouseDown: method, send #waitForClicksOrDrag:event: to the hand.
(3) Reimplement #click: to react to single-clicked mouse-down.
(4) Reimplement #doubleClick: to make the appropriate response to a double-click.
(5) Reimplement #drag: to react to non-clicks. This message is sent continuously until the button is released. You can check the event argument to react differently on the first, intermediate, and last calls.
balloonText
Answer balloon help text or nil, if no help is available.
NB: subclasses may override such that they programatically
construct the text, for economy's sake, such as model phrases in
a Viewer
click:
Handle a single-click event. This message is only sent to clients that request it by sending #waitForClicksOrDrag:event: to the initiating hand in their mouseDown: method. This default implementation does nothing.
LC 2/14/2000 08:32 - added: EventHandler notification
defaultColor
answer the default color/fill style for the receiver
descriptionForPartsBin
doubleClick:
Handle a double-click event. This message is only sent to clients that request it by sending #waitForClicksOrDrag:event: to the initiating hand in their mouseDown: method. This default implementation does nothing.
LC 2/14/2000 08:32 - added: EventHandler notification
handlesMouseDown:
Do I want to receive mouseDown events (mouseDown:, mouseMove:, mouseUp:)?
mouseDown:
Do nothing upon mouse-down except inform the hand to watch for a double-click; wait until an ensuing click:, doubleClick:, or drag: message gets dispatched
startDrag:
We'll get a mouseDown first, some mouseMoves, and a mouseUp event last
FishEyeMorph
A FishEyeMorph is an extreme-wide-angle lens MagnifierMorph
FishEyeMorph new openInWorld
calculateTransform
chooseMagnification
chooseMagnification:
descriptionForPartsBin
extent:
Round to a number divisible by grid. Note that the superclass has its own implementation.
g:max:focus:
gridSizeFor:
returns appropriate size for specified argument
initialize
initialize the state of the receiver
initializeToStandAlone
Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.
magnifiedForm
Answer the magnified form
transformX:
transformY:
Flasher
A simple example - a circle that flashes.
Flasher new openInWorld
The "onColor" instance variable indicates the color to use when "on", A darker color is used to represent "off".
The #step method, called every 500ms. by default, alternatively makes the flasher show its "on" and its "off" color.
descriptionForPartsBin
initializeToStandAlone
Initialize the flasher.
onColor
Answer my onColor
onColor:
Change my on color to be aColor
step
Perform my standard periodic action
stepTime
Answer the desired time between steps, in milliseconds.
FrameRateMorph
A little Morph to show the speed of frame rate of the system.
FrameRateMorph new openInWorld.
FrameRateMorph new openInHand.
authoringPrototype
descriptionForPartsBin
initialize
initialize the state of the receiver
initializeToStandAlone
Initialize the receiver as a stand-alone entity
registerInFlapsRegistry
step
Compute and display (every half second or so) the current framerate
stepTime
Answer the desired time between steps in milliseconds.
unload
HeadingMorph
A HeadingMorph displays an arrow on a grid as well as its decomposition on x and y axis.
Clicking on it changes the direction of the main arrow.
HeadingMorph new openInWorld
defaultBorderWidth
answer the default border width for the receiver
defaultColor
answer the default color/fill style for the receiver
degrees
degrees:
drawArrowFrom:to:width:color:on:
drawOn:
extent:
Contrain extent to be square.
handlesMouseDown:
Do I want to receive mouseDown events (mouseDown:, mouseMove:, mouseUp:)?
initialize
initialize the state of the receiver
magnitude
magnitude:
mouseDown:
Handle a mouse down event. The default response is to let my
eventHandler, if any, handle it.
mouseMove:
Handle a mouse move event. The default response is to let my eventHandler, if any, handle it.
ImageMorphWithSpotlight
This class implements an image that appears one way or another depending upon whether it lies within a spotlight shape that moves with the cursor. As delivered, the shape is a simple circle, the spotlighted appearance is that of a ColorForm, and the non-highlighted apperarance is a derived gray-scale form.
(ImageMorphWithSpotlight new image: (Form fromUser)) openInWorld

The implementation will space-efficient if supplied with a ColorForm, because the gray-scale derived form will share the same bitmap.
In general, any two images can be used -- one could be blurred, the other sharp -- and the masking form can be any shape.
At some point this class should be merged somehow with ScreeningMorph.
-- Note from Stephane Ducasse - August 2009: Does not seem to work with ColorForm
backgroundImage:spotImage:spotShape:
See class comment.
drawOn:
Draw the border after the image.
example1
image:
The spotlight will reveal the original form supplied
while the background form will be derived grayscale.
spotChanged
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.
InfoStringMorph
A generalization of the clock morph
Try
InfoStringMorph new openInWorld
or
(InfoStringMorph on: [SmalltalkImage current vmParameterAt: 9])
stepTime: 50;
openInWorld
block
block:
initialize
initialize the state of the receiver
on:
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.
stepTime:
JoystickMorph
A widget that simulates a joystick. Mosly used in etoy sopenInWorld:

JoystickMorph new openInHand explore

Explore the morph and you will see that you can get the direction, strength and
addCustomMenuItems:hand:
Add custom items to the menu
amount
angle
autoCenterString
Answer a string characterizing whether or not I have auto-center on
button1
button2
chooseJoystickNumber
Allow the user to select a joystick number
descriptionForPartsBin
handlesMouseDown:
Do I want to receive mouseDown events (mouseDown:, mouseMove:, mouseUp:)?
includeInNewMorphMenu
initialize
initialize the state of the receiver
initializeToStandAlone
Circumvent SketchMorph's implementation here
isLikelyRecipientForMouseOverHalos
The automatic mouseover halos interere with the proper functioning of the joystick's knob
joystickNumberString
Answer a string characterizing the joystick number
lastRealJoystickIndex
Answer the last remembered real joystick index. Initialize it to 1 if need be
leftRight
mouseMove:
Make handle track the cursor within my bounds.
mouseUp:
Handle a mouse up event. The default response is to let my eventHandler, if any, handle it.
moveHandleToCenter
realJoystickInUse
Answer whether a real joystick is in use
realJoystickString
Answer a string characterizing whether or not I am currenty tracking a real joystick
registerInFlapsRegistry
setXRange
setYRange
step
Track the real joystick whose index is realJoystickIndex.
stepTime
Provide for as-fast-as-possible stepping in the case of a real joystick
stopTrackingJoystick
toggleAutoCenter
toggleRealJoystick
Toggle whether or not one is using a real joystick
trackRealJoystick
unload
upDown
MagnifierMorph
MagnifierMorph instances are magnifying lenses that magnify the morphs below them (if grabbed or if trackPointer is false) or the area around the mouse pointer.
MagnifierMorph newShowingPointer openInWorld
MagnifierMorph new openInWorld

Instance variables:
magnification <Number> The magnification to use. If non-integer, smooths the magnified form.
trackPointer <Boolean> If set, magnifies the area around the Hand. If not, magnfies the area underneath the magnifier center.
showPointer <Boolean> If set, display a small reversed rectangle in the center of the lens. Also enables the display of Morphs in the Hand itself.
srcExtent <Rectangle> The extent of the source rectangle.

Class variables:
RecursionLock <MagnifierMorph|nil> Used to avoid infinite recursion when getting the source patch to display.
addCustomMenuItems:hand:
Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.
borderWidth:
Grow outwards preserving innerBounds
chooseMagnification
chooseMagnification:
defaultBorderWidth
answer the default border width for the receiver
defaultColor
answer the default color/fill style for the receiver
defaultExtent
descriptionForPartsBin
drawOn:
extent:
Round to multiples of magnification
handlesMouseDown:
Do I want to receive mouseDown events (mouseDown:, mouseMove:, mouseUp:)?
hasTranslucentColor
I may show what's behind me, so tell the hand to don't cache
initialize
initialize the state of the receiver
magnification:
magnifiedForm
Answer the magnified form
mouseDown:
Handle a mouse down event. The default response is to let my
eventHandler, if any, handle it.
newShowingPointer
showPointer
showPointer:
If aBoolean is true, display the current pointer position as a small square in the center of the lens.
showingPointerString
sourcePoint
If we are being dragged use our center, otherwise use pointer position
sourceRect
sourceRectFrom:
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.
toggleShowingPointer
toggleTrackingPointer
trackingPointerString
MovingEyeMorph
A MovingEyeMorph is a morph representing an eye whose iris is following the mouse cursor.
defaultColor
answer the default color/fill style for the receiver
descriptionForPartsBin
extent:
initialize
initialize the state of the receiver
irisPos:
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
stepTime
Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.
StarMorph
I am a very flexible star..
Grab me from the supplies flap or from the graphic objects.
Add my handles and you can move and resize me.
The up and down arrows increase or reduce the number of my sides.
The right and left arrows cycle thru different amounts of pointiness.
Use the arrows right and left of my center or get stars with a specific amount of pointyness. The left side goes from fat to thin and then cycles around again. The right goes from thin to fat. Hold down the shift key if you wish to stop the cycling at the extremes.
Use the arrows up and down to change the number of sides if you would like a different number of points.
To add or remove just one side hold the shift key down as you use the arrows or use the menu items for that purpose.
If you add or remove just one point I will have an odd number of sides. When that happens I can only look like a regular polygon. The right and left arrows will have no effect. Add or remove just one more side and you can shift drag the outer handle or use the arrows to restore my pointiness.
That was too complicated. It is gone. You can get regular polygon shapes by adjusting my pointiness. For example the extreme of a five pointed star is a dodecahedron (10 sided regular polygon) and one step less extreme is a pentagon (5 sided regular polygon).
At some time you will probably shift drag the outer handle thru the center handle.
While I looked round as you shrunk me, I will look very much like an asterisk as you pull me away. What happens is that inside bend shrunk on the way down because it can never be larger than the outer point (or it wouldn't be the innerbend would it).
But on the way out it is perfectly happy to remain small. So I look like an asterisk.
To fatten me up (if you haven't already figured this out by fooling around) hold the shift down an move the outer handle towards the center (but not quite all the way) then let the shift up and move the outer handle away. A couple of cycles like this and I'll be looking fat and jolly again. Or you can now just use the right arrow to make me fatter.
This is also the reason I don't let the inside bend get larger than the outer point.
If I did the same process that fattened me when I was an asterisk would also grow an asterisk so large squeak would complain about not having enough memory.
Historical note:
The former star had two bugs that are fixed here.
The outer handle now no longer jumps from one point to another.
The other bug prevented some higher order stars from looking right.
Which is why the former star didn't allow you to change the number of points.
addChangeSidesMenuItems:hand:
Menu items to change number of sides.
addCustomMenuItems:hand:
Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.
addHandles
Put moving handles at the vertices. Put adding handles at
edge midpoints.
Moving over adjacent vertex and dropping will delete a
vertex.
addStarHandles
Outer handle must not be blocked so it comes first.
The editing routine expects to find the center handle second.
The side and shape changing handles follow these.
addTwinkleMenuItems:hand:
Menu items to change the sharpness of the star.
changeVertices:event:fromHandle:
defaultBorderColor
answer the default border color/fill style for the receiver
defaultBorderWidth
answer the default border width for the receiver
defaultCenter
answer the default center for the receiver
defaultColor
answer the default color/fill style for the receiver
defaultFirstVertex
answer the default first outer point for the receiver.
This with the center determines the angle and size of the outer radius.
defaultSides
answer the default number of sides for the receiver
defaultStarRatio
answer the default ratio of outer radius to inner radius for the receiver
descriptionForPartsBin
dragVertex:event:fromHandle:
initialize
initialize the state of the receiver
initializeToStandAlone
Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.
insureCompatability
The old stars had the point on the second not the first vertex. So we need to check for this special case.
lessVertices
Reduce the number of points by one until we are a diamond. If odd reduce the number of sides by two until we become a triangle. See class comment.
makeVertices:
Assuming vertices has at least one point, make a new star
or regular polygon (for odd sided polygons).
The center of the polygon and the first vertex remain in
place. The inner distances for stars remain the same also if
possible.
makeVertices:starRatio:
Assuming vertices has at least one point, make a new star
or regular polygon (for odd sided polygons).
The center of the polygon and the first vertex remain in
place. The inner distances for stars remain the same also if
possible.
makeVertices:starRatio:withCenter:withPoint:
Make a new star or regular polygon (for odd sided polygons).
This makes star vertices from scratch without any feedback from existing vertices.
moreVertices
nextSkip
Set starRatio to next skip wrapping if needed.
nextTwinkle
nextTwinkleSkip
Set starRatio to next skip wrapping if needed.
oneLessVertex
oneMoreVertex
placeHandles
Add the handles to my submorphs.
prevSkip
Set starRatio to next skip wrapping if necessary
prevTwinkle
prevTwinkleSkip
Set starRatio to next skip wrapping if necessary
registerInFlapsRegistry
skipRatios
Return an array of ratios of the inner radius to the outer radius.
Ratios are in ascending order from 0.0 to 1.0.
starRatio
Return the ratio of the inner radius to the outer radius.
starRatio:
Set the star s.t. the ratio of the inner radius to the outer radius is r.
If r is > 1 use the reciprocal to keep the outer radius first.
unload
updateFormFromUser
Does nothing here. Overridden in subclasses e.g. Kaleidoscope.
updateHandles
withCenterOuterHandles
Add to our handles the center positioning and outer resizing
handles. Outer handle must not be blocked so it comes first.
The editing routine expects to find the center handle second.
The side and shape changing handles follow these.
withUpDownLeftRightHandlesAround:center:
Add to our handles the side and shape changing handles.
StarWithABallMorph
This is a example of how to use a morph. It consists of only two
methods, initialize and step.
DoIt:
StarWithABall new openInWorld.
initialize
initialize the state of the receiver
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
StickyPadMorph
A custom item for the Squeakland Supplies bin, as defined by Kim Rose and BJ Con.A parts bin will deliver up translucent, borderless Rectangles in a sequence of 6 colors. It offers some complication to the parts-bin protocols in two ways::
* The multi-colored icon seen in the parts bin is not a thumbnail of any actual instance, all of which are monochrome
* New instances need to be given default names that are not the same as the name seen in the parts bin.
StickyPadMorph minimics the stickyPad
StickyPadMorph new openInWorld
canHaveFillStyles
Return true if the receiver can have general fill styles; not just
colors. This method is for gradually converting old morphs.
descriptionForPartsBin
initialize
Initialize the receiver to stand alone. Use the next color in the standard sequence.
registerInFlapsRegistry
WatchMorph
This class is a representation of a watch.
The labels' font is changeble. Labels' font size increase or decrease when resizing me.
WatchMorph new openInWorld
(WatchMorph fontName: 'ComicPlain' bgColor: Color transparent centerColor: Color transparent) openInWorld " transparent "
(WatchMorph fontName: 'ComicBold' bgColor: Color white centerColor: Color black) openInWorld
Structure:
fontName String -- the labels' font name
cColor Color -- center color
handsColor Color
romanNumerals Boolean
antialias Boolean
addCustomMenuItems:hand:
Add morph-specific items to the given menu which was invoked by the given hand.
antiAliasString
antialias:
centerColor:
Set the center color as indicated; map nil into transparent
changeCenterColor
Let the user change the color of the center of the watch
changeFont
changeHandsColor
Let the user change the color of the hands of the watch.
createLabels
defaultColor
answer the default color/fill style for the receiver
descriptionForPartsBin
drawOn:
Draw the watch on the given canvas
extent:
fontName:
fontName:bgColor:centerColor:
handsColor:
initialize
initialize the state of the receiver
radius:hourAngle:
unitRadius goes from 0.0 at the center to 1.0 on the circumference.
hourAngle runs from 0.0 clockwise around to 12.0 with wrapping.
romanNumeralString
Answer a string governing the roman-numerals checkbox
step
Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.
toggleAntialias
toggleRoman