[ANN] Bricks pre-alpha (morphic enhancement effort - Layouts)
tblanchard at mac.com
tblanchard at mac.com
Wed Apr 30 07:27:23 UTC 2003
Download Location:
http://minnow.cc.gatech.edu/squeak/uploads/3186/BrickAlpha.sar
This is an early start at a set of UI building blocks I call Bricks. I
wasn''t going to share it so soon but I keep seeing questions about
layout floating around and I think this could help some people out.
Brick grew out of the ProtoMorph class I posted awhile ago. It
dynamically steals code from Morph. It hasn''t stolen any new code in
awhile so I''m calling it sort of stable. Bricks can coexist with
Morphs in a Morphic world, but you can''t embed Morphs in Bricks.
I started out to simply improve the usability of layout control. If
nothing else but this code (and its control brick) gets adopted I will
be very pleased.
To try it out, open the halo menu on the white brick embedded in the
red lego and select "Layout Options...". You''ll see a struts and
springs control that looks remarkably like the one in IB on Mac OS X.
Clicking on a strut changes it to a spring or vice versa. The little X
closes the control. Play with the settings and then resize the red
lego brick using the halo. What could be simpler?
The other key change is that I have pulled nearly all of the drawing
code out of Morph and split it up into a layered scheme of Painters. A
kind of Painter is assigned to a layer. You can add and remove
Painters from a brick to change its appearance. Basic painters so far
are a BackgroundPainter (which draws the colors or the Lego
background), a BorderPainter, CornerPainter (does corner rounding), a
hilight painter (puts a translucent gray wash over the component),
ShadowPainter, and some others.
A brick can still do its own painting along with the Painters. For
instance, StringBrick does the string drawing, but you can give it
borders and backgrounds by adding painters to it. A brick has been
assigned a painter layer and if the brick adds itself to the painter
list, its drawOn: method will be called at the appropriate time.
There is a DragWrapperBrick that acts as a container for things being
dragged. A subclass DragPainterBrick is for dragging painters around.
The two pallettes at the top left of the screen are filled with
DragPainterWrappers containing BorderPainters or CornerPainters. More
work on creating nifty Painter configuration bricks needs to happen for
setting up gradients and such in BackgroundPainters.
Try dragging and dropping new borders or corner rounders on the red or
white bricks to see this work. The drag/drop hilighting is done by
adding and removing painters on the bricks on mouseEnter/Leave.
Why didn''t I just put this in Morph? After many many many hung
systems and wrecked images I decided it was just too dangerous to try
to operate on Morph. So I cloned the essentials and work on that. If
someone wants to integrate this code back into Morph - please do.
I''ve found that I can generally copy most morphs and change their
superclass to brick to get something usable right away.
Feedback/bug reports are appreciated.
-Todd Blanchard
More information about the Squeak-dev
mailing list
|