12345678910111213141516171819202122232425262728293031323334 |
- Smalltalk createPackage: 'Silk'!
- Domite subclass: #Silk
- instanceVariableNames: ''
- package: 'Silk'!
- !Silk commentStamp!
- I am adding convenience APIs to my subclass, `Domite`.
- ##Rendering
- - `aSilk << anObject` uses double-dispatch via `renderOnSilk:`. This allows creating widgets (no formal superclass, anything with `renderOnSilk:` is a widget), as well as incorporating blocks: `aSilk << aBlock` runs the block, passing aSilk as a parameter.!
- !Silk methodsFor: 'writing'!
- nextPut: anObject
- "Double-dispatches anObject via renderOnSilk: message.
- If a message returns nil, this fallbacks to superclass.
- Otherwise, it is assumed renderOnSilk: did its job."
- (anObject renderOnSilk: self)
- ifNil: [ super nextPut: anObject ]
- ! !
- !BlockClosure methodsFor: '*Silk'!
- renderOnSilk: aSilk
- self value: aSilk
- ! !
- !Object methodsFor: '*Silk'!
- renderOnSilk: aSilk
- ^ nil
- ! !
|