With Spec, it is really easy to make some simple widgets:
"you have a class and a method?"
class:=Morph.
method:=class>>#openInWorld.
"want some textmorp?"
code := TextModel new.
code text:method sourceCode.
"with styling?"
code aboutToStyle:true.
"in context of the class"
code behavior:class.
"do it!"
code openWithSpec.
"more? save on accept..."
code acceptBlock:[:text |
������ class compile:text notifying:nil.
������ ].
Composing models:
class:=Morph.
method:=class>>#openInWorld.
composed:= DynamicComposableModel new.
composed instantiateModels: #(code TextModel method TextInputFieldModel).
composed code text:method sourceCode.
composed method text: method selector asString.
composed code aboutToStyle:true.
composed code behavior:class.
composed code acceptBlock:[:text |
������ class compile:text notifying:nil.
������ ].
composed method acceptBlock:[:text |
������ method:=class methodDict at:text asSymbol.
composed code text:method sourceCode.
������ ].
composed openWithSpecLayout:(
SpecLayout composed
newColumn:[:r | r
add: #method height:25;
add: #code];
yourself).
or search for DynamicComposableModel in this mailing list or
look at some other basic Spec examples in Pharo:
������ | cb |
������ cb := ClassMethodBrowser new.
������ cb openWithSpec.
������ cb classes: Smalltalk allClasses.
������ | si |
������ si := MethodBrowser new.
������ si openWithSpec.
������ si methods: Object methodDict values