I'm quite sure that we should be able to get a faster and cleaner way to define
on/off buttons….
(state = true or: [state isString and: [(state beginsWith: '<yes>') or:
[state beginsWith: '<on>']]])
http://code.google.com/p/pharo/issues/detail?id=5633
:(
icon
"Answer the receiver's icon. Handle legacy case
of wording-based mechanism."
|state|
self getStateSelector ifNil: [^super icon].
state := (MessageSend receiver: self target selector: self
getStateSelector)
valueWithEnoughArguments: self arguments .
(state = true or: [state isString and: [(state beginsWith: '<yes>') or:
[state beginsWith: '<on>']]])
ifTrue: [^self onIcon].
(state = false or: [state isString and: [(state beginsWith: '<no>') or:
[state beginsWith: '<off>']]])
ifTrue: [^self offIcon].
^super icon
benjamin suggested that we had support for the string 'true' and 'false' in
case :)
Stef