SystemWindow>>initialize

Stephan B. Wessels stephan.wessels at sdrc.com
Thu Dec 2 20:15:59 UTC 1999


It looks like it's pretty common for folks to extend or enhance the initialize method
in SystemWindow.  I wonder if we could benefit from some better factoring of the code
in there so that extensions could be easier to swap out?

For instance,

add a method which answers the stripes (probably have to do something to #extent
method too, I think) and then move the code there.

add a method which answers the label and move that code.

add a method to add the collapse button and move that code there.  Just like the
close box and menu control methods do now.

we could even add a method to add special features and leave that stubbed out by
default.

Just some ideas,

 - Steve

> > >         stripes := Array with: (RectangleMorph newBounds: bounds)  "see
> > > extent:"
> > >                                 with: (RectangleMorph newBounds: bounds).
> > >         self addMorph: (stripes first borderWidth: 1).
> > >         self addMorph: (stripes second borderWidth: 2).
> > >         self addMorph: (label := StringMorph new contents: labelString;
> > >                         font: (TextStyle default fontAt: 2) emphasis: 1).
> > >         self setLabelWidgetAllowance.
> > >         self addCloseBox.
> > >         self addMenuControl.
> > >         self addMorph: (collapseBox := SimpleButtonMorph new borderWidth: 0;
> > >                         label: 'O' font: aFont; color: Color transparent;
> > >                         actionSelector: #collapseOrExpand; target: self;
> > > extent: 16 at 16).
> > >         self addMorph: (growBox _ SimpleButtonMorph new borderWidth: 0;
> > >                         label: '^' font: aFont; color: Color transparent;
> > >                         actionSelector: #growOrShrink; target: self;
> > > extent: 16 at 16).





More information about the Squeak-dev mailing list